UNPKG

ds-smart-ui

Version:

Smart UI v1.0.5 — A production-ready React component library by PT Praisindo Teknologi. Covers inputs, navigation, data display, feedback, and layout with a unified design system, semantic Typography tokens, and full Storybook documentation.

76 lines (75 loc) 1.71 kB
import { default as React } from 'react'; import { ThemeConfig, ThemeContextValue } from './types'; /** * Theme Context */ declare const ThemeContext: React.Context<ThemeContextValue | undefined>; /** * ThemeProvider Props */ export interface ThemeProviderProps { /** Children components */ children: React.ReactNode; /** Custom theme configuration - akan di-merge dengan default theme */ theme?: ThemeConfig; /** Jika true, akan langsung apply theme saat mount */ applyOnMount?: boolean; } /** * ThemeProvider Component * * Component ini menyediakan context untuk theming dan otomatis apply CSS variables * * @example * ```tsx * import { ThemeProvider } from 'ds-smart-ui'; * * // Brand A dengan primary color merah * const brandATheme = { * colors: { * primary: { * 500: '#ff0000', // red * // atau gunakan full palette * } * } * }; * * function App() { * return ( * <ThemeProvider theme={brandATheme}> * <YourApp /> * </ThemeProvider> * ); * } * ``` */ export declare const ThemeProvider: React.FC<ThemeProviderProps>; /** * Hook untuk menggunakan theme context * * @example * ```tsx * import { useTheme } from 'ds-smart-ui'; * * function MyComponent() { * const { theme, setTheme } = useTheme(); * * const changeToBrandB = () => { * setTheme({ * colors: { * primary: { * 500: '#00ff00' // green * } * } * }); * }; * * return <button onClick={changeToBrandB}>Change Theme</button>; * } * ``` */ export declare const useTheme: () => ThemeContextValue; /** * Export ThemeContext for advanced use cases */ export { ThemeContext };