-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tooling-ui): add configs necessary for the package (#953)
* feat(ui): kickoff * feat(ui): update package name * feat(ui): update headers * refactor: move folders around and add aliases * fix: cleanup exports field in package.json * fix: update alias import to use "@" * fix: manypkg check * feat: add configs necessary for the package * fix: update styles import * fix(tooling-ui): linter * refactor!: rename folder * refactor: rename missing strings * fix!: revert and update lockfile * refactor: update tsconfig and use a different file for package compilation * manypkg fix * fix: formatting * feat: add enums alias to tsconfig --------- Co-authored-by: evavirseda <[email protected]> Co-authored-by: cpl121 <[email protected]> Co-authored-by: cpl121 <[email protected]> Co-authored-by: Bran <[email protected]> Co-authored-by: Marc Espin <[email protected]>
- Loading branch information
1 parent
87f0581
commit f0ee6d3
Showing
21 changed files
with
498 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import '../styles/index.css'; | ||
|
||
export * from './Button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './screenSize.enum'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export enum ScreenSize { | ||
Sm = 'sm', | ||
Md = 'md', | ||
Lg = 'lg', | ||
Xl = 'xl', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './tailwind'; | ||
export * from './components'; | ||
export * from './enums'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Config } from 'tailwindcss'; | ||
|
||
export const BASE_CONFIG: Partial<Config> = { | ||
content: ['./src/**/*.{html,js,jsx,ts,tsx}'], | ||
plugins: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { ScreenSize } from '../enums'; | ||
|
||
export const pxToRem = (px: number, base: number = 16) => `${px / base}rem`; | ||
|
||
export function getTailwindScreens( | ||
breakpoints: Partial<Record<ScreenSize, number>>, | ||
): Record<string, string> { | ||
const screens: Record<string, string> = Object.entries(breakpoints).reduce( | ||
(acc, [key, value]) => { | ||
acc[key] = `${value}px`; | ||
return acc; | ||
}, | ||
{} as Record<string, string>, | ||
); | ||
|
||
return screens; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export { default as uiKitResponsivePreset } from './responsive.preset'; | ||
export { default as uiKitStaticPreset } from './static.preset'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { Config } from 'tailwindcss'; | ||
import type { ScreenBreakpoints } from './types'; | ||
import { ScreenSize } from '../enums'; | ||
import { getTailwindScreens, pxToRem } from './helpers'; | ||
import { BASE_CONFIG } from './base.preset'; | ||
import merge from 'lodash.merge'; | ||
|
||
const BREAKPOINTS: ScreenBreakpoints = { | ||
[ScreenSize.Sm]: 768, | ||
[ScreenSize.Md]: 1024, | ||
[ScreenSize.Lg]: 1400, | ||
[ScreenSize.Xl]: 1920, | ||
}; | ||
|
||
const screens = getTailwindScreens(BREAKPOINTS); | ||
|
||
const responsivePreset: Partial<Config> = merge({}, BASE_CONFIG, { | ||
theme: { | ||
screens, | ||
container: { | ||
center: true, | ||
screens, | ||
padding: { | ||
DEFAULT: pxToRem(24), | ||
md: pxToRem(48), | ||
lg: pxToRem(120), | ||
xl: pxToRem(240), | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export default responsivePreset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { Config } from 'tailwindcss'; | ||
import type { ScreenBreakpoints } from './types'; | ||
import { getTailwindScreens } from './helpers'; | ||
import { BASE_CONFIG } from './base.preset'; | ||
import merge from 'lodash.merge'; | ||
|
||
const BREAKPOINTS: Partial<ScreenBreakpoints> & { default: number } = { | ||
default: 0, | ||
}; | ||
|
||
const screens = getTailwindScreens(BREAKPOINTS); | ||
|
||
const staticPreset: Partial<Config> = merge({}, BASE_CONFIG, { | ||
theme: { | ||
screens, | ||
}, | ||
corePlugins: { | ||
container: false, | ||
}, | ||
} satisfies Partial<Config>); | ||
|
||
export default staticPreset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { ScreenSize } from '../enums'; | ||
|
||
export type ScreenBreakpoints = Record<ScreenSize, number>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import preset from '@iota/core/tailwind.config'; | ||
import { type Config } from 'tailwindcss'; | ||
import preset from './src/lib/tailwind/responsive.preset'; | ||
|
||
export default { | ||
presets: [preset], | ||
} satisfies Partial<Config>; | ||
export default preset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"module": "esnext", | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"noEmit": true, | ||
"isolatedModules": true, | ||
"sourceMap": true, | ||
"jsx": "react-jsx", | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"@/components": ["./src/lib/components"], | ||
"@/components/*": ["./src/lib/components/*"], | ||
"@/enums": ["./src/lib/enums"], | ||
"@/enums/*": ["./src/lib/enums/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"module": "esnext", | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"noEmit": true, | ||
"isolatedModules": true, | ||
"sourceMap": true, | ||
"jsx": "react-jsx", | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"@/components": ["./src/lib/components"], | ||
"@/components/*": ["./src/lib/components/*"] | ||
} | ||
}, | ||
"extends": "./tsconfig.base.json", | ||
"include": ["src"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"include": ["src/lib"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,40 @@ | ||
import { defineConfig } from 'vite'; | ||
import { resolve } from 'path'; | ||
import react from '@vitejs/plugin-react-swc'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
import dts from 'vite-plugin-dts'; | ||
import tailwindcss from 'tailwindcss'; | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: resolve(__dirname, './src/lib/index.ts'), | ||
name: '@iota/apps-ui-kit', | ||
fileName: (format) => `index.${format}.js`, | ||
}, | ||
rollupOptions: { | ||
external: ['react', 'react-dom', 'tailwindcss'], | ||
output: { | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
tailwindcss: 'tailwindcss', | ||
}, | ||
}, | ||
}, | ||
sourcemap: true, | ||
emptyOutDir: true, | ||
}, | ||
plugins: [ | ||
tsconfigPaths({ | ||
root: __dirname, | ||
}), | ||
react(), | ||
dts({ rollupTypes: true }), | ||
], | ||
css: { | ||
postcss: { | ||
plugins: [tailwindcss], | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.