@cra-risk-management/ui
v1.0.2
Published
Standardized UI Component Library for CRA Risk Management Monorepo applications (`critical-points` and `geovisor-ambiental`).
Readme
@cra-risk-management/ui
Standardized UI Component Library for CRA Risk Management Monorepo applications (critical-points and geovisor-ambiental).
Installation
Install the library via npm (or your preferred package manager):
npm install @cra-risk-management/uiPeer Dependencies
The library requires Mantine v9 (@mantine/core and @mantine/hooks >= ^9.0.0) and React v19. Make sure you have the required peer dependencies installed in your project:
npm install @mantine/core @mantine/hooks @emotion/react @emotion/styled @mui/icons-material react-geolocated leaflet react-leaflet zustandStyling Setup
Import the global styles in your application entry file (e.g., App.tsx or main.tsx):
import "@mantine/core/styles.css";
import "@cra-risk-management/ui/dist/ui.css"; // Optional custom library stylesWrap your root application with CraThemeProvider:
import { CraThemeProvider } from "@cra-risk-management/ui";
function App() {
return (
<CraThemeProvider>
<YourAppContent />
</CraThemeProvider>
);
}Components Summary
1. Structure & Layout
CraThemeProvider: Sets up custom Mantine theme configurations (colors, fonts).NavBar: Navigation header bar with branding slots.ColorSchemeToggler: Light/Dark theme switch button.PanelButtons&PanelButton&InfoButton: Floating control actions stacked at the bottom of the map.
2. Standardized Cards (CraCard)
Standardized responsive container blocks.
CraCard: Parent card wrapper.CraCardHeader: Title/Subtitle block.CraCardImage: Rounded top cover image.CraCardBody: Main paragraph/content block with line clamping support.CraCardChip: Category pills.CraCardFooter: Footer actions container.CraCardInfoRow: Grid-aligned key-value display rows.
3. Responsive Overlays (CraPanel)
Harmonized panel overlays with responsive widths/heights (desktop/mobile defaults).
CraPanel: Backdrop dialog. Takessize("sm","md","xl").CraPanelHeader: Title block with built-in close action.CraPanelBody: Scrollable body content.CraPanelFooter: Footer button layout.
4. Interactive Maps
Leaflet containers synced to store state.
CraMap: Standard Leaflet map pane.MapControls: Float-overlay control buttons (Zoom, Home, Geolocation, Basemap).CraLocationInputMap: Controlled point and polygon coordinate capture map.
5. Lists & Feeds (CraDataCardList)
Generic scrolled list containers for feeds.
CraDataCardList: Handles scroll boxes and empty states.CraDataCardEntry: Feeds list cards with a square1:1cover image.
6. Layer Selectors (CraLayerSelector)
Option selection panel lists styled as interactive cards.
CraLayerSelector: Wrapper box.CraLayerSelectorOption: Option cards with radio selects, colored initials avatars, and labels.
