5007e0f4eb
Все font cascade bugs из последних MR были вызваны @nstart/ui pollution
(Tektur inheritance от Card parent'ов, Onest font в Button, font-primary
class overrides). Решили обрезать раньше plan'а.
What changed:
New primitives (8 файлов в src/ui/components/):
- panel.tsx — container с border/surface
- field.tsx — FieldLabel/Hint/Error typography helpers
- text-input.tsx — Input + label/hint/error composite
- table.tsx — Table/TableHeader/Body/Row/HeaderCell/Cell/Empty
- date-picker.tsx — native <input type=date> wrapper с label/hint/error
- multi-select.tsx — Radix Popover + inline checkboxes
- single-select.tsx — native <select> с label/hint/error chrome
- language-switch.tsx — segmented control в Tektur uppercase
Compatibility shims (existing components extended):
- checkbox.tsx — + label/description/error/onChange (nstart-compat
synthetic event), wrap в <label> когда есть chrome
- modal.tsx — + panelClassName / bodyClassName props
- form-actions.tsx — + align prop (start/end/between)
- tabs-simple.tsx — TabItem.count alias for .trailing (nstart-compat)
- table TableHead — alias TableHeaderCell с align prop
Barrel rewrite (src/ui/index.ts):
- Удалён 'export * from @nstart/ui'
- Explicit exports для всех 45+ нужных символов
- SelectOption / MultiSelectOption / LanguageOption теперь {id, label}
с optional 'value' alias — nstart-compat без массового codemod call-sites
styles.css cleanup:
- Removed @import @nstart/ui/styles/{fonts,theme}.css
- Removed @source nstart/dist directive (Tailwind v4 scan)
- Removed --text-sm: 13px override (был костыль для @nstart/ui dist)
- Legacy color tokens (--color-carbon/ultramarain/orbit/regolith/asteroid)
sсодержали fallback mappings — оставлены, но callsites больше не используют
Codemod: 9 файлов конвертированы legacy colors → handoff tokens
carbon → ink, ultramarain → accent, orbit → warn, regolith → line, asteroid → mute
main.tsx:
- NStartUiProvider → TooltipProvider (Radix)
- DatePickerProvider убран (наш DatePicker native, no provider needed)
routes/dictionaries.$name.tsx:
- Removed useRef-based <input>.indeterminate hack
- Radix Checkbox принимает checked='indeterminate' declaratively
package.json: -@nstart/ui (was 0.1.3)
Bundle impact:
before: vendor-nstart-ui chunk = 1228 KB
after: no nstart chunk, всё в vendor-misc (+~70 KB Radix wrappers)
net savings: ~1.15 MB minified, ~440 KB gzip
Tests: 116 pass (1 fixed: tab role from 'button' → 'tab', Radix semantically correct).
TS strict: clean.
Browser-verified (preview): 7 utilities computed correctly, nstart bundle absent.
173 lines
4.9 KiB
TypeScript
173 lines
4.9 KiB
TypeScript
/**
|
|
* @/ui — single source of truth для UI primitives.
|
|
*
|
|
* <p>Stage 3.9: @nstart/ui удалён. Все экспорты резолвят к локальным
|
|
* shadcn primitives в `./components/`. Имена сохранены в nstart-compat форме
|
|
* чтобы существующий код работал без массового рефактора imports.
|
|
*
|
|
* <p>Группы:
|
|
* <ol>
|
|
* <li><b>Handoff typography utility</b> — Cap, ScopeDot/Badge/Strip.</li>
|
|
* <li><b>Atomic</b> — Button, Badge, Alert, IconButton, Input, Label,
|
|
* Separator, Skeleton, Switch.</li>
|
|
* <li><b>Form fields</b> — TextInput, TextArea, Checkbox, FieldLabel/Hint/
|
|
* Error, FormActions, DatePicker, MultiSelect, SearchInput.</li>
|
|
* <li><b>Layout</b> — Card*, Panel, PageHeader, EmptyState, LoadingBlock,
|
|
* Tabs (legacy items-API + Radix root primitives).</li>
|
|
* <li><b>Overlays</b> — Modal (Dialog adapter), Drawer (Sheet adapter), Sheet*,
|
|
* Dialog*, Popover*, DropdownMenu*, Tooltip*.</li>
|
|
* <li><b>Switches</b> — LanguageSwitch.</li>
|
|
* <li><b>Toast</b> — Toaster, toast (sonner).</li>
|
|
* </ol>
|
|
*/
|
|
|
|
// === Atomic ===
|
|
export { Button, buttonVariants, type ButtonProps } from './components/button'
|
|
export { Badge, type BadgeProps } from './components/badge'
|
|
export { Alert, type AlertProps } from './components/alert'
|
|
export { IconButton, type IconButtonProps } from './components/icon-button'
|
|
export { Input, type InputProps } from './components/input'
|
|
export { Label } from './components/label'
|
|
export { Separator } from './components/separator'
|
|
export { Skeleton } from './components/skeleton'
|
|
export { Switch } from './components/switch'
|
|
|
|
// === Handoff design primitives ===
|
|
export { Cap, type CapProps } from './components/cap'
|
|
export {
|
|
ScopeDot,
|
|
ScopeBadge,
|
|
ScopeStrip,
|
|
type DataScope as ScopeKind,
|
|
} from './components/scope'
|
|
|
|
// === Form fields ===
|
|
export { TextInput, type TextInputProps } from './components/text-input'
|
|
export { TextArea, type TextAreaProps } from './components/textarea'
|
|
export { Checkbox } from './components/checkbox'
|
|
export {
|
|
FieldLabel,
|
|
FieldHint,
|
|
FieldError,
|
|
type FieldLabelProps,
|
|
} from './components/field'
|
|
export { FormActions, type FormActionsProps } from './components/form-actions'
|
|
export { DatePicker, type DatePickerProps } from './components/date-picker'
|
|
export {
|
|
MultiSelect,
|
|
type MultiSelectOption,
|
|
type MultiSelectProps,
|
|
} from './components/multi-select'
|
|
export {
|
|
SingleSelect,
|
|
type SelectOption,
|
|
type SingleSelectProps,
|
|
} from './components/single-select'
|
|
export { SearchInput, type SearchInputProps } from './components/search-input'
|
|
|
|
// === Layout ===
|
|
export {
|
|
Card,
|
|
CardHeader,
|
|
CardTitle,
|
|
CardDescription,
|
|
CardContent,
|
|
CardFooter,
|
|
} from './components/card'
|
|
export { Panel, type PanelProps } from './components/panel'
|
|
export { PageHeader, type PageHeaderProps } from './components/page-header'
|
|
export { EmptyState, type EmptyStateProps } from './components/empty-state'
|
|
export { LoadingBlock, type LoadingBlockProps } from './components/loading-block'
|
|
|
|
// === Tables ===
|
|
export {
|
|
Table,
|
|
TableHeader,
|
|
TableBody,
|
|
TableFooter,
|
|
TableRow,
|
|
TableHead,
|
|
TableHeaderCell,
|
|
TableCell,
|
|
TableCaption,
|
|
TableEmpty,
|
|
type TableHeaderCellProps,
|
|
type TableEmptyProps,
|
|
} from './components/table'
|
|
|
|
// === Tabs (legacy items[] API + Radix primitives для нового кода) ===
|
|
export { TabsSimple as Tabs, type TabItem, type TabsSimpleProps } from './components/tabs-simple'
|
|
export {
|
|
Tabs as TabsRoot,
|
|
TabsList,
|
|
TabsTrigger,
|
|
TabsContent,
|
|
} from './components/tabs'
|
|
|
|
// === Overlays ===
|
|
export { Modal, type ModalProps } from './components/modal'
|
|
export { Drawer, type DrawerProps } from './components/drawer'
|
|
export {
|
|
Dialog,
|
|
DialogTrigger,
|
|
DialogPortal,
|
|
DialogClose,
|
|
DialogOverlay,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogFooter,
|
|
DialogTitle,
|
|
DialogDescription,
|
|
type DialogContentProps,
|
|
} from './components/dialog'
|
|
export {
|
|
Sheet,
|
|
SheetTrigger,
|
|
SheetClose,
|
|
SheetPortal,
|
|
SheetContent,
|
|
SheetHeader,
|
|
SheetFooter,
|
|
SheetTitle,
|
|
SheetDescription,
|
|
type SheetContentProps,
|
|
} from './components/sheet'
|
|
export {
|
|
Popover,
|
|
PopoverTrigger,
|
|
PopoverAnchor,
|
|
PopoverContent,
|
|
} from './components/popover'
|
|
export {
|
|
Tooltip,
|
|
TooltipProvider,
|
|
TooltipTrigger,
|
|
TooltipContent,
|
|
} from './components/tooltip'
|
|
export {
|
|
DropdownMenu,
|
|
DropdownMenuTrigger,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuCheckboxItem,
|
|
DropdownMenuRadioItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuGroup,
|
|
DropdownMenuPortal,
|
|
DropdownMenuSub,
|
|
DropdownMenuSubTrigger,
|
|
DropdownMenuSubContent,
|
|
DropdownMenuRadioGroup,
|
|
} from './components/dropdown-menu'
|
|
|
|
// === Switches ===
|
|
export {
|
|
LanguageSwitch,
|
|
type LanguageOption,
|
|
type LanguageSwitchProps,
|
|
} from './components/language-switch'
|
|
|
|
// === Toast (sonner) ===
|
|
export { Toaster, toast } from './components/toaster'
|