diff --git a/packages/modal/src/index.ts b/packages/modal/src/index.ts index d738463..d547419 100644 --- a/packages/modal/src/index.ts +++ b/packages/modal/src/index.ts @@ -1 +1 @@ -export * from './lib/Modal'; +export * from './lib/modal'; diff --git a/packages/modal/src/stories/modal.stories.tsx b/packages/modal/src/stories/modal.stories.tsx index e62288a..fea7c9c 100644 --- a/packages/modal/src/stories/modal.stories.tsx +++ b/packages/modal/src/stories/modal.stories.tsx @@ -1,5 +1,5 @@ import { Meta } from '@storybook/react'; -import Modal from '../lib/Modal'; +import Modal from '../lib/modal'; import { Button } from "@bootwind/button" import { ModalTrigger } from '../lib/ModalTrigger'; import { ModalContent } from '../lib/ModalContent'; @@ -20,26 +20,26 @@ export const Basic = () => { return ( <> -
- - - - - setIsOpen(true)} onModalClose={() => setIsOpen(false)}> - - Sign In - - -

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

-
- - - -
-
-
+
+ + + + + setIsOpen(true)} onModalClose={() => setIsOpen(false)}> + + Sign In + + +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe mollitia a, molestiae soluta cupiditate consequuntur ullam voluptates, commodi magnam unde amet similique quae! Nostrum ducimus veniam sed labore praesentium molestias.

+
+ + + +
+
+
) } \ No newline at end of file diff --git a/packages/slider/.babelrc b/packages/slider/.babelrc new file mode 100644 index 0000000..1ea870e --- /dev/null +++ b/packages/slider/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nx/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/packages/slider/.eslintrc.json b/packages/slider/.eslintrc.json new file mode 100644 index 0000000..a39ac5d --- /dev/null +++ b/packages/slider/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/packages/slider/README.md b/packages/slider/README.md new file mode 100644 index 0000000..e4c103b --- /dev/null +++ b/packages/slider/README.md @@ -0,0 +1,7 @@ +# slider + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test slider` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/packages/slider/package.json b/packages/slider/package.json new file mode 100644 index 0000000..b7e1c93 --- /dev/null +++ b/packages/slider/package.json @@ -0,0 +1,12 @@ +{ + "name": "slider", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/packages/slider/project.json b/packages/slider/project.json new file mode 100644 index 0000000..8a7614f --- /dev/null +++ b/packages/slider/project.json @@ -0,0 +1,32 @@ +{ + "name": "slider", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/slider/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/slider/**/*.{ts,tsx,js,jsx}"] + } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/packages/slider" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + } + } +} diff --git a/packages/slider/src/index.ts b/packages/slider/src/index.ts new file mode 100644 index 0000000..df10870 --- /dev/null +++ b/packages/slider/src/index.ts @@ -0,0 +1 @@ +export * from './lib/slider'; diff --git a/packages/slider/src/lib/slider.tsx b/packages/slider/src/lib/slider.tsx new file mode 100644 index 0000000..38054ea --- /dev/null +++ b/packages/slider/src/lib/slider.tsx @@ -0,0 +1,42 @@ +import React, { ReactNode, useState } from "react"; + +export interface SliderProps { + min?: number; + max?: number; + leftContent?: ReactNode; + rightContent?: ReactNode; +} + +const Slider: React.FC = ({ min = 1, max = 5, leftContent, rightContent }) => { + const [value, setValue] = useState((min + max) / 2); + + const handleSliderChange = (event: React.ChangeEvent) => { + setValue(parseInt(event.target.value, 10)); + }; + + return ( +
+ {leftContent && ( + + )} + + {rightContent && ( + + )} +
+ ); +}; + +export default Slider; diff --git a/packages/slider/src/stories/slider.stories.tsx b/packages/slider/src/stories/slider.stories.tsx new file mode 100644 index 0000000..98890ac --- /dev/null +++ b/packages/slider/src/stories/slider.stories.tsx @@ -0,0 +1,32 @@ +import React from 'react'; + +import Slider from '../lib/slider'; + +export default { + title: 'Components/Slider', + component: Slider, +}; + +export const Basic = () => { + return ; +} + +export const WithIcons = () => { + return ( + 🔊} + rightContent={🔉} + /> + ); +}; + +export const CustomRange = () => { + return ( + 1} + rightContent={75} + /> + ); +}; \ No newline at end of file diff --git a/packages/slider/tsconfig.json b/packages/slider/tsconfig.json new file mode 100644 index 0000000..6734c59 --- /dev/null +++ b/packages/slider/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "types": ["vite/client"] + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "extends": "../../tsconfig.base.json" +} diff --git a/packages/slider/tsconfig.lib.json b/packages/slider/tsconfig.lib.json new file mode 100644 index 0000000..8d6bbf7 --- /dev/null +++ b/packages/slider/tsconfig.lib.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "vite/client" + ] + }, + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] +} diff --git a/packages/slider/vite.config.ts b/packages/slider/vite.config.ts new file mode 100644 index 0000000..51dce95 --- /dev/null +++ b/packages/slider/vite.config.ts @@ -0,0 +1,43 @@ +/// +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import dts from 'vite-plugin-dts'; +import * as path from 'path'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; + +export default defineConfig({ + cacheDir: '../../node_modules/.vite/slider', + + plugins: [ + react(), + nxViteTsPaths(), + dts({ + entryRoot: 'src', + tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'), + skipDiagnostics: true, + }), + ], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'slider', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/tsconfig.base.json b/tsconfig.base.json index cace9c6..35efbee 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -23,6 +23,7 @@ "@bootwind/toast": ["./packages/toast/src/index.ts"], "@bootwind/typography": ["packages/typography/src/index.ts"], "@bootwind/ui": ["./packages/ui/src/index.ts"], + "slider": ["packages/slider/src/index.ts"], "table": ["packages/table/src/index.ts"], "tooltip": ["packages/tooltip/src/index.ts"] }