diff --git a/.changeset/tidy-drinks-doubt.md b/.changeset/tidy-drinks-doubt.md
new file mode 100644
index 0000000..05ac4f3
--- /dev/null
+++ b/.changeset/tidy-drinks-doubt.md
@@ -0,0 +1,5 @@
+---
+'@groovy-box/ui': minor
+---
+
+storybook directory change, modal component, textfield and button component revamp
diff --git a/.github/workflows/button-tests.yaml b/.github/workflows/button-tests.yaml
deleted file mode 100644
index 306f33d..0000000
--- a/.github/workflows/button-tests.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Button-Tests
-
-on:
- push:
- branches: [button]
- pull_request:
- branches: [button]
-
-jobs:
- test_button:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Install Dependencies
- run: npm install
-
- - name: Run Button Component Tests
- run: npm run test __test__/Button.test.js
-
- id: test_button_output
- continue-on-error: true
-
- - name: Set Test Result
- if: always()
- run: echo "::set-output name=button_tests_result::${{ job.status }}"
-
- - name: Final Message
- if: success()
- run: echo "Button component tests passed! 🎉"
-
- - name: Final Message on Failure
- if: failure()
- run: echo "Button component tests failed! ❌"
diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml
index 7ea9144..ddd5957 100644
--- a/.github/workflows/code_coverage.yml
+++ b/.github/workflows/code_coverage.yml
@@ -1,40 +1,40 @@
-name: Running Code Coverage
-
-on:
- push:
- branches:
- - dev
- pull_request:
- branches:
- - dev
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- node-version: [20.x]
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- with:
- fetch-depth: 2
-
- - name: Set up Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
- with:
- node-version: ${{ matrix.node-version }}
-
- - name: Install dependencies
- run: npm install
-
- - name: Run tests
- run: npm run ui:coverage
-
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v4
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- directory: apps/ui/coverage
+# name: Running Code Coverage
+
+# on:
+# push:
+# branches:
+# - dev
+# pull_request:
+# branches:
+# - dev
+
+# jobs:
+# build:
+# runs-on: ubuntu-latest
+
+# strategy:
+# matrix:
+# node-version: [20.x]
+
+# steps:
+# - name: Checkout repository
+# uses: actions/checkout@v2
+# with:
+# fetch-depth: 2
+
+# - name: Set up Node.js ${{ matrix.node-version }}
+# uses: actions/setup-node@v3
+# with:
+# node-version: ${{ matrix.node-version }}
+
+# - name: Install dependencies
+# run: npm install
+
+# - name: Run tests
+# run: npm run ui:coverage
+
+# - name: Upload coverage to Codecov
+# uses: codecov/codecov-action@v4
+# with:
+# token: ${{ secrets.CODECOV_TOKEN }}
+# directory: apps/ui/coverage
diff --git a/.github/workflows/textfield-test.yaml b/.github/workflows/textfield-test.yaml
deleted file mode 100644
index 30ccf1e..0000000
--- a/.github/workflows/textfield-test.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Textfield-Tests
-
-on:
- push:
- branches: [textfield]
- pull_request:
- branches: [textfield]
-
-jobs:
- test_button:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Install Dependencies
- run: npm install
-
- - name: Run Button Component Tests
- run: npm run test __test__/Textfield.test.js
-
- id: test_textField_output
- continue-on-error: true
-
- - name: Set Test Result
- if: always()
- run: echo "::set-output name=textField_tests_result::${{ job.status }}"
-
- - name: Final Message
- if: success()
- run: echo "TextField component tests passed! 🎉"
-
- - name: Final Message on Failure
- if: failure()
- run: echo "Textfield component tests failed! ❌"
diff --git a/apps/ui/.eslintrc.cjs b/apps/ui/.eslintrc.cjs
index 6716988..d542efb 100644
--- a/apps/ui/.eslintrc.cjs
+++ b/apps/ui/.eslintrc.cjs
@@ -14,6 +14,7 @@ module.exports = {
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-children-prop': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
},
parserOptions: {
project: true,
diff --git a/apps/ui/.storybook/main.ts b/apps/ui/.storybook/main.ts
index 2e7bd1d..55a16aa 100644
--- a/apps/ui/.storybook/main.ts
+++ b/apps/ui/.storybook/main.ts
@@ -4,55 +4,55 @@ import { defineConfig } from 'vite';
const tsconfigPaths = require('vite-tsconfig-paths').default;
module.exports = {
- stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'],
+ stories: ['../lib/**/*.stories.@(ts|tsx|js|jsx)'],
- viteFinal: async (config) => {
- return mergeConfig(config, {
- plugins: [tsconfigPaths()],
- });
- },
-
- viteConfig: defineConfig({
- resolve: {
- alias: {
- '@': '/src',
- '@utils': '/utils',
- },
+ viteFinal: async (config) => {
+ return mergeConfig(config, {
+ plugins: [tsconfigPaths()],
+ });
},
- }),
- addons: [
- '@storybook/addon-links',
- '@storybook/addon-essentials',
- '@storybook/addon-controls',
- '@storybook/addon-themes',
- 'storybook-css-modules',
- {
- name: '@storybook/addon-postcss',
- options: {
- postcssLoaderOptions: {
- implementation: require('postcss'),
+ viteConfig: defineConfig({
+ resolve: {
+ alias: {
+ '@': '/src',
+ '@utils': '/utils',
+ },
},
- },
- },
- ],
+ }),
- // https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
- typescript: {
- check: true, // type-check stories during Storybook build
- },
+ addons: [
+ '@storybook/addon-links',
+ '@storybook/addon-essentials',
+ '@storybook/addon-controls',
+ '@storybook/addon-themes',
+ 'storybook-css-modules',
+ {
+ name: '@storybook/addon-postcss',
+ options: {
+ postcssLoaderOptions: {
+ implementation: require('postcss'),
+ },
+ },
+ },
+ ],
- framework: {
- name: '@storybook/react-vite',
- // options: {
- // legacyRootApi: true,
- // builder: {
- // viteConfigPath: './vite.config.ts',
- // },
- // },
- },
+ // https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
+ typescript: {
+ check: true, // type-check stories during Storybook build
+ },
- docs: {
- autodocs: true,
- },
+ framework: {
+ name: '@storybook/react-vite',
+ // options: {
+ // legacyRootApi: true,
+ // builder: {
+ // viteConfigPath: './vite.config.ts',
+ // },
+ // },
+ },
+
+ docs: {
+ autodocs: true,
+ },
};
diff --git a/apps/ui/.storybook/preview.tsx b/apps/ui/.storybook/preview.tsx
index 82e2219..3a12059 100644
--- a/apps/ui/.storybook/preview.tsx
+++ b/apps/ui/.storybook/preview.tsx
@@ -1,69 +1,69 @@
// https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters
import '../lib/tailwind.css';
import '../lib/color-scheme.css';
-import { withGlobalStyles } from './decorator';
+import '@groovy-box/tokens/src/fonts.css';
const customViewports = {
- xs: {
- name: 'XS',
- styles: {
- width: '350px',
- height: '963px',
+ xs: {
+ name: 'XS',
+ styles: {
+ width: '350px',
+ height: '963px',
+ },
},
- },
- sm: {
- name: 'SM',
- styles: {
- width: '600px',
- height: '801px',
+ sm: {
+ name: 'SM',
+ styles: {
+ width: '600px',
+ height: '801px',
+ },
},
- },
- md: {
- name: 'MD',
- styles: {
- width: '900px',
- height: '801px',
+ md: {
+ name: 'MD',
+ styles: {
+ width: '900px',
+ height: '801px',
+ },
},
- },
- lg: {
- name: 'LG',
- styles: {
- width: '1200px',
- height: '801px',
+ lg: {
+ name: 'LG',
+ styles: {
+ width: '1200px',
+ height: '801px',
+ },
},
- },
- xl: {
- name: 'XL',
- styles: {
- width: '1536px',
- height: '801px',
+ xl: {
+ name: 'XL',
+ styles: {
+ width: '1536px',
+ height: '801px',
+ },
},
- },
};
export const parameters = {
- // https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args
- actions: { argTypesRegex: '^on.*' },
- controls: {
- matchers: {
- color: /(background|color)$/i,
- date: /Date$/,
+ // https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args
+ actions: { argTypesRegex: '^on.*' },
+ controls: {
+ matchers: {
+ color: /(background|color)$/i,
+ date: /Date$/,
+ },
+ },
+ visualViewport: {
+ customViewports,
},
- },
- visualViewport: {
- customViewports,
- },
};
export const globalTypes = {
- scheme: {
- name: 'Scheme',
- description: 'Select light or dark',
- defaultValue: 'light',
- toolbar: {
- icon: 'mirror',
- items: ['light', 'dark'],
- dynamicTitle: true,
+ scheme: {
+ name: 'Scheme',
+ description: 'Select light or dark',
+ defaultValue: 'light',
+ toolbar: {
+ icon: 'mirror',
+ items: ['light', 'dark'],
+ dynamicTitle: true,
+ },
},
- },
};
diff --git a/apps/ui/.storybook/theme.ts b/apps/ui/.storybook/theme.ts
index c68890d..a867536 100644
--- a/apps/ui/.storybook/theme.ts
+++ b/apps/ui/.storybook/theme.ts
@@ -1,28 +1,28 @@
import { create } from '@storybook/theming/create';
export default create({
- base: 'light',
- brandTitle: 'Groovy-Box',
- brandUrl: 'https://ui.soumyasagar.in/',
- brandImage:
- 'https://raw.githubusercontent.com/EnigmaVSSUT/Enigma-UI-Kit/main/assets/logo.png',
- brandTarget: '_self',
- //fonts
- fontBase: '"Inter", sans-serif',
- fontCode: 'monospace',
+ base: 'light',
+ brandTitle: 'Groovy-Box',
+ brandUrl: 'https://ui.soumyasagar.in/',
+ brandImage:
+ 'https://raw.githubusercontent.com/EnigmaVSSUT/Enigma-UI-Kit/main/assets/logo.png',
+ brandTarget: '_self',
+ //fonts
+ fontBase: '"Inter", sans-serif',
+ fontCode: 'monospace',
- //UI
- appBg: '#E9EFE7',
+ //UI
+ appBg: '#E9EFE7',
- // Text colors
- textColor: '#454A44',
- textInverseColor: '#10162F',
+ // Text colors
+ textColor: '#454A44',
+ textInverseColor: '#10162F',
- // Toolbar default and active colors
- barTextColor: '#9E9E9E',
- barBg: '#ffffff',
+ // Toolbar default and active colors
+ barTextColor: '#9E9E9E',
+ barBg: '#ffffff',
- // Form colors
- inputBg: '#ffffff',
- inputTextColor: '#10162F',
+ // Form colors
+ inputBg: '#ffffff',
+ inputTextColor: '#10162F',
});
diff --git a/apps/ui/__test__/Button.spec.js b/apps/ui/__test__/Button.spec.js
deleted file mode 100644
index 0d15fcd..0000000
--- a/apps/ui/__test__/Button.spec.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react';
-import { render, screen } from '@testing-library/react';
-import { Button } from '../lib/components/Button/index';
-import { Variants, Sizes } from '../stories/Button.stories';
-import '@testing-library/jest-dom';
-
-const argsColor = {
- variant: 'default',
- size: 'md',
-};
-
-const args = {
- variant: 'default',
- size: 'md',
-};
-
-describe('Button Component', () => {
- test('renders without crashing', () => {
- render();
- });
-
- test('renders Variants', () => {
- render(Variants(args));
- const outlinedButton = screen.getByText('Default');
- const filledButton = screen.getByText('destructive');
-
- expect(outlinedButton).toBeInTheDocument();
- expect(filledButton).toBeInTheDocument();
- });
-
- test('renders Sizes', () => {
- render(Sizes(args));
- const smallButton = screen.getByText('Small');
- const mediumButton = screen.getByText('Medium');
- const largeButton = screen.getByText('Large');
-
- expect(smallButton).toBeInTheDocument();
- expect(mediumButton).toBeInTheDocument();
- expect(largeButton).toBeInTheDocument();
- });
-});
diff --git a/apps/ui/__test__/Textfield.spec.js b/apps/ui/__test__/Textfield.spec.js
deleted file mode 100644
index be0deb3..0000000
--- a/apps/ui/__test__/Textfield.spec.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import React from 'react';
-import { render, fireEvent, screen } from '@testing-library/react';
-import { TextField } from '../lib/components/Textfield';
-import '@testing-library/jest-dom';
-
-const textFieldArgs = {
- label: 'Label',
- placeholder: 'Placeholder',
- startIcon: Start Icon,
- endIcon: End Icon,
-};
-
-describe('TextField Component', () => {
- test('renders disabled TextField', () => {
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- expect(inputElement).toBeDisabled();
- });
-
- test('renders label and placeholder', () => {
- render();
- const labelElement = screen.getByText('Label');
- const inputElement = screen.getByPlaceholderText('Placeholder');
- const startIcon = screen.getByText('Start Icon');
- const endIcon = screen.getByText('End Icon');
-
- expect(labelElement).toBeInTheDocument();
- expect(inputElement).toBeInTheDocument();
- expect(startIcon).toBeInTheDocument();
- expect(endIcon).toBeInTheDocument();
- });
-
- test('handles onChange event', () => {
- const onChangeMock = jest.fn();
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- fireEvent.change(inputElement, { target: { value: 'test value' } });
-
- expect(onChangeMock).toHaveBeenCalledTimes(1);
- expect(inputElement.value).toBe('test value');
- });
-
- test('renders read-only TextField', () => {
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- expect(inputElement).toHaveAttribute('readonly');
- });
-
- test('renders required TextField', () => {
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- expect(inputElement).toBeRequired();
- });
-
- test('handles onKeyPress event', () => {
- const onKeyPressMock = jest.fn();
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- fireEvent.keyPress(inputElement, {
- key: 'Enter',
- code: 'Enter',
- charCode: 13,
- });
-
- expect(onKeyPressMock).toHaveBeenCalledTimes(1);
- });
-
- test('handles onKeyUp event', () => {
- const onKeyUpMock = jest.fn();
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- fireEvent.keyUp(inputElement, { key: 'A', code: 'KeyA' });
-
- expect(onKeyUpMock).toHaveBeenCalledTimes(1);
- });
-
- test('handles onKeyDown event', () => {
- const onKeyDownMock = jest.fn();
- render();
- const inputElement = screen.getByPlaceholderText('Placeholder');
-
- fireEvent.keyDown(inputElement, { key: 'ArrowDown', code: 'ArrowDown' });
-
- expect(onKeyDownMock).toHaveBeenCalledTimes(1);
- });
-});
diff --git a/apps/ui/__test__/Typography.spec.js b/apps/ui/__test__/Typography.spec.js
deleted file mode 100644
index 78bb071..0000000
--- a/apps/ui/__test__/Typography.spec.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react';
-import { render, screen } from '@testing-library/react';
-import { Text, TextProps } from '../lib/components/Typography';
-import '@testing-library/jest-dom';
-import 'jest-styled-components';
-
-describe('Typography Component', () => {
- test('renders without crashing', () => {
- render(Hey there peeps!);
- });
-
- test('renders with props', () => {
- const props = {
- variant: 'heading-1',
- color: '#0f0f0f',
- align: 'center',
- };
-
- render(Hey there peeps!);
- const textElement = screen.getByText('Hey there peeps!');
-
- expect(textElement).toBeInTheDocument();
- });
- test('applies custom text alignment when align prop is provided', () => {
- render(Left Aligned Text);
-
- const textElement = screen.getByText('Left Aligned Text');
- const computedStyle = window.getComputedStyle(textElement);
-
- expect(computedStyle.textAlign).toBe('left');
- });
-
- test('applies custom color when color prop is provided', () => {
- render(Colored Text);
-
- const textElement = screen.getByText('Colored Text');
- const computedStyle = window.getComputedStyle(textElement);
-
- expect(computedStyle.color).toBe('rgb(0, 0, 255)');
- });
-});
diff --git a/apps/ui/stories/Accordion.stories.tsx b/apps/ui/lib/components/Accordion/Accordion.stories.tsx
similarity index 81%
rename from apps/ui/stories/Accordion.stories.tsx
rename to apps/ui/lib/components/Accordion/Accordion.stories.tsx
index a667ddd..bdf9591 100644
--- a/apps/ui/stories/Accordion.stories.tsx
+++ b/apps/ui/lib/components/Accordion/Accordion.stories.tsx
@@ -1,14 +1,11 @@
-import React from 'react';
-import { Meta, Story } from '@storybook/react';
-import { withGlobalStyles } from '../.storybook/decorator';
+import { withGlobalStyles } from '../../../.storybook/decorator';
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
-} from '../lib';
-import exp from 'constants';
+} from '../..';
const Test = () => (
@@ -29,24 +26,24 @@ const Test = () => (
);
-const withTailwind = ()=>{
+const withTailwind = () => {
return (
-
+
Accordion 1
Content 1
);
-}
+};
export default {
title: 'components/Accordion',
component: Test,
decorators: [withGlobalStyles],
-} as Meta;
+};
export const Default = () => ;
export const WithTailwind = () => withTailwind();
diff --git a/apps/ui/stories/Avatar.stories.tsx b/apps/ui/lib/components/Avatar/Avatar.stories.tsx
similarity index 94%
rename from apps/ui/stories/Avatar.stories.tsx
rename to apps/ui/lib/components/Avatar/Avatar.stories.tsx
index aab125b..e779dfa 100644
--- a/apps/ui/stories/Avatar.stories.tsx
+++ b/apps/ui/lib/components/Avatar/Avatar.stories.tsx
@@ -1,6 +1,5 @@
-import React from 'react';
-import { Meta, Story } from '@storybook/react';
-import { Avatar, AvatarImage, AvatarContent, AvatarFallback } from '../lib';
+import { Story } from '@storybook/react';
+import { Avatar, AvatarImage, AvatarContent, AvatarFallback } from './Avatar';
import { Search, File } from 'lucide-react';
export default {
@@ -10,7 +9,7 @@ export default {
argTypes: {
className: { control: 'text' },
},
-} as Meta;
+};
const Template: Story = (args) => (
@@ -54,13 +53,13 @@ export const WithContentIcon: Story = (args) => (
);
-export const WithFallback: Story = (args) => (
+export const WithFallback: Story = () => (
AB
);
-export const allSizes: Story = (args) => (
+export const allSizes: Story = () => (
diff --git a/apps/ui/stories/Button.stories.tsx b/apps/ui/lib/components/Button/Button.stories.tsx
similarity index 75%
rename from apps/ui/stories/Button.stories.tsx
rename to apps/ui/lib/components/Button/Button.stories.tsx
index 9c42ea5..0681225 100644
--- a/apps/ui/stories/Button.stories.tsx
+++ b/apps/ui/lib/components/Button/Button.stories.tsx
@@ -1,13 +1,11 @@
-import React from 'react';
-import { Meta } from '@storybook/react';
-import { Button } from '../lib';
-import { withGlobalStyles } from '../.storybook/decorator';
+import { Button } from './index';
+import { withGlobalStyles } from '../../../.storybook/decorator';
export default {
title: 'Components/Button',
component: Button,
decorators: [withGlobalStyles],
-} as Meta;
+};
export const Variants = () => (
(
);
export const tailwindButton = () => {
- return
;
-};
-
-export const tailwindButtonWithOverridingVariant = () => {
return (
-