diff --git a/package.json b/package.json index 9e1a842..14f5962 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@near-pagoda/ui", - "version": "2.1.2", + "version": "3.0.0", "description": "A React component library that implements the official NEAR design system.", "license": "MIT", "repository": { @@ -37,23 +37,23 @@ "files": [ "dist" ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "./dist/index.cjs.js", + "module": "./dist/index.esm.js", + "types": "./dist/index.d.ts", "exports": { ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.esm.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.cjs.js" - } + "types": "./dist/index.d.ts", + "import": "./dist/index.esm.js", + "require": "./dist/index.cjs.js" }, - "./*.css": { - "import": "./dist/*.css", - "require": "./dist/*.css" + "./utils": { + "types": "./dist/utils/index.d.ts", + "import": "./dist/utils/index.esm.js", + "require": "./dist/utils/index.cjs.js" + }, + "./styles.css": { + "import": "./dist/styles.css", + "require": "./dist/styles.css" } }, "peerDependencies": { diff --git a/rollup.config.mjs b/rollup.config.mjs index d253817..d63d751 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -12,56 +12,76 @@ import { visualizer } from 'rollup-plugin-visualizer'; import concat from './rollup-plugin-concat.mjs'; /** @type {import('rollup').RollupOptions} */ -const options = { - input: ['./src/index.ts'], - output: [ - { - file: './dist/index.esm.js', - format: 'esm', - sourcemap: false, - inlineDynamicImports: true, - }, - { - file: './dist/index.cjs.js', - format: 'cjs', - sourcemap: false, - inlineDynamicImports: true, - }, - ], - plugins: [ - json(), - scss({ - fileName: 'globals.css', - exclude: ['/**/*.module.scss'], - failOnError: true, - verbose: true, - outputStyle: 'compressed', - }), - peerDepsExternal(), - resolve({ browser: true }), - commonjs(), - typescript(), - terser(), - postcss({ - extract: 'modules.css', - modules: true, - syntax: 'postcss-scss', - minimize: true, - plugins: [ - postcssPresetEnv({ - stage: 3, - features: { - 'nesting-rules': true, - }, - }), - ], - }), - concat({ - files: ['./dist/globals.css', './dist/modules.css'], - outputFile: './dist/styles.css', - }), - visualizer(), - ], -}; +const options = [ + { + input: './src/index.ts', + output: [ + { + file: './dist/index.esm.js', + format: 'esm', + sourcemap: false, + inlineDynamicImports: true, + }, + { + file: './dist/index.cjs.js', + format: 'cjs', + sourcemap: false, + inlineDynamicImports: true, + }, + ], + plugins: [ + json(), + scss({ + fileName: 'globals.css', + exclude: ['/**/*.module.scss'], + failOnError: true, + verbose: true, + outputStyle: 'compressed', + }), + peerDepsExternal(), + resolve({ browser: true }), + commonjs(), + typescript(), + terser(), + postcss({ + extract: 'modules.css', + modules: true, + syntax: 'postcss-scss', + minimize: true, + plugins: [ + postcssPresetEnv({ + stage: 3, + features: { + 'nesting-rules': true, + }, + }), + ], + }), + concat({ + files: ['./dist/globals.css', './dist/modules.css'], + outputFile: './dist/styles.css', + }), + visualizer(), + ], + }, + { + input: './src/utils/index.ts', + output: [ + { + file: './dist/utils/index.esm.js', + format: 'esm', + sourcemap: false, + inlineDynamicImports: true, + }, + { + file: './dist/utils/index.cjs.js', + format: 'cjs', + sourcemap: false, + inlineDynamicImports: true, + }, + ], + plugins: [peerDepsExternal(), resolve({ browser: true }), commonjs(), typescript(), terser()], + }, +]; export default options; diff --git a/src/index.ts b/src/index.ts index 5d00f9e..405fd38 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,16 +49,6 @@ export { useTheme } from 'next-themes'; export * from './components/CookiePrompt/hooks'; export * from './hooks/debounce'; -// Utils - -export * from './utils/clipboard'; -export * from './utils/error'; -export * from './utils/input-handlers'; -export * from './utils/merge-refs'; -export * from './utils/number'; -export * from './utils/theme'; -export * from './utils/unreachable'; - // Contexts export { PagodaUiProvider } from './context/PagodaUi'; diff --git a/src/utils/clipboard.ts b/src/utils/clipboard.ts index 28a51b8..761cb82 100644 --- a/src/utils/clipboard.ts +++ b/src/utils/clipboard.ts @@ -1,4 +1,4 @@ -import { openToast } from '../components/Toast'; +import { openToast } from '../components/Toast/api'; export async function copyTextToClipboard(content: string, description?: string) { try { @@ -6,7 +6,7 @@ export async function copyTextToClipboard(content: string, description?: string) openToast({ type: 'success', - title: 'Copied', + title: 'Copied To Clipboard', description, }); } catch (error) { diff --git a/src/utils/error.ts b/src/utils/error.ts index 9b916e7..777f5a8 100644 --- a/src/utils/error.ts +++ b/src/utils/error.ts @@ -1,4 +1,4 @@ -import { openToast } from '../components/Toast'; +import { openToast } from '../components/Toast/api'; export function handleClientError({ error, title, description }: { error: any; title?: string; description?: string }) { console.error(error); diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..248d418 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,7 @@ +export * from './clipboard'; +export * from './error'; +export * from './input-handlers'; +export * from './merge-refs'; +export * from './number'; +export * from './theme'; +export * from './unreachable';