@oef/components
v1.1.0
Published
CityCatalyst UI components including typography and buttons packaged from app/src/components/package
Keywords
Readme
@oef/components
A TypeScript package containing text/typography components and module components from CityCatalyst. This package provides consistent UI components built on top of Chakra UI.
Installation
npm install @oef/componentsPeer Dependencies
This package requires the following peer dependencies:
npm install react react-dom @chakra-ui/react @emotion/react i18nextUsage
import {
BlueSubtitle,
BodyLarge,
DisplayMedium,
HeadlineSmall,
TitleLarge,
GHGIDashboard,
HIAPDashboard,
CCRADashboard
} from '@oef/components';
function MyComponent() {
return (
<div>
<DisplayMedium>Main Heading</DisplayMedium>
<HeadlineSmall>Section Title</HeadlineSmall>
<BodyLarge>This is some body text content.</BodyLarge>
<BlueSubtitle t={t} text="subtitle.key" />
{/* Module Components */}
<GHGIDashboard />
<HIAPDashboard />
<CCRADashboard />
</div>
);
}Available Components
Display Components
DisplaySmall- Small display textDisplayMedium- Medium display textDisplayLarge- Large display text
Headline Components
HeadlineSmall- Small headlineHeadlineMedium- Medium headlineHeadlineLarge- Large headline
Title Components
TitleSmall- Small titleTitleMedium- Medium titleTitleLarge- Large title
Body Text Components
BodySmall- Small body textBodyMedium- Medium body textBodyLarge- Large body textBodyXLarge- Extra large body text
Label Components
LabelMedium- Medium labelLabelLarge- Large label
Button Text Components
ButtonSmall- Small button textButtonMedium- Medium button text
Special Components
BlueSubtitle- Blue colored subtitle with i18n supportOverline- Overline text component
Module Components
GHGIDashboardHIAPDashboardCCRADashboard
Development
This package references the original components in the main CityCatalyst app, so you can continue editing them in their original location at app/src/components/Texts/ and app/src/components/Modules/. Changes will be automatically reflected when the package is rebuilt.
Building the Package
npm run buildCleaning Build Artifacts
npm run cleanLicense
LGPL
Using the package locally (without publishing)
Option A: npm pack (recommended)
Create a tarball from the package and install it in the consumer:
# From the package folder
cd CityCatalyst/app/src/components
npm run build
npm pack # → produces something like oef-components-1.0.4.tgz
# In the consuming app
cd ../../../demo-oef-components
npm install ../CityCatalyst/app/src/components/@oef/components-*.tgzThis mimics a real npm install (no nested node_modules in the package), and is closest to what you'll publish.
Option B: file: path
cd demo-oef-components
npm pkg set dependencies.@oef/components="file:../CityCatalyst/app/src/components"
npm installPublishing to npm
- Log in with an account belonging to the oef organization.
npm login- Ensure a clean build and bump version:
cd CityCatalyst/app/src/components
npm ci
npm run clean && npm run build
npm version minor # or minor/major- Publish (requires npm account with access):
npm publish --access publicNotes:
- This package ships compiled JS and type declarations from
dist/. - Verify
nameandversioninpackage.jsonbefore publishing.
Next.js + Chakra setup (in consumer)
Wrap your app with Chakra’s provider and pass a theme value:
// app/providers.tsx
"use client";
import { ReactNode } from 'react';
import { ChakraProvider, createSystem, defaultConfig } from '@chakra-ui/react';
const appTheme = createSystem(defaultConfig, {});
export function Providers({ children }: { children: ReactNode }) {
return <ChakraProvider value={appTheme}>{children}</ChakraProvider>;
}