se-design 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.prettierrc +8 -0
  2. package/.storybook/main.ts +25 -0
  3. package/.storybook/preview-head.html +6 -0
  4. package/.storybook/preview.ts +14 -0
  5. package/.vscode/settings.json +3 -0
  6. package/README.md +30 -0
  7. package/index.html +13 -0
  8. package/package.json +61 -0
  9. package/postcss.config.cjs +10 -0
  10. package/public/icons/back.svg +4 -0
  11. package/public/icons/close.svg +4 -0
  12. package/public/icons/down.svg +3 -0
  13. package/public/icons/pages.svg +4 -0
  14. package/public/icons/tick.svg +3 -0
  15. package/public/vite.svg +1 -0
  16. package/pull_request_template.md +31 -0
  17. package/src/App.css +42 -0
  18. package/src/App.tsx +35 -0
  19. package/src/assets/react.svg +1 -0
  20. package/src/components/Button/Button.stories.ts +98 -0
  21. package/src/components/Button/index.tsx +69 -0
  22. package/src/components/Icon/Icon.stories.ts +21 -0
  23. package/src/components/Icon/Icon.tsx +24 -0
  24. package/src/components/Icon/Icon.types.ts +4 -0
  25. package/src/components/MenuItem/MenuItem.stories.tsx +30 -0
  26. package/src/components/MenuItem/index.tsx +20 -0
  27. package/src/components/MenuList/MenuList.stories.tsx +20 -0
  28. package/src/components/MenuList/index.tsx +16 -0
  29. package/src/components/Modal/Modal.stories.ts +43 -0
  30. package/src/components/Modal/Modal.tsx +39 -0
  31. package/src/components/SplitButton/SplitButton.stories.ts +22 -0
  32. package/src/components/SplitButton/SplitButton.tsx +59 -0
  33. package/src/components/Tag/Tag.stories.tsx +20 -0
  34. package/src/components/Tag/Tag.tsx +13 -0
  35. package/src/components/Toggle/Toggle.stories.tsx +34 -0
  36. package/src/components/Toggle/Toggle.tsx +40 -0
  37. package/src/components/Toggle/Toggle.types.ts +14 -0
  38. package/src/components/Tooltip/Tooltip.stories.tsx +58 -0
  39. package/src/components/Tooltip/Tooltip.tsx +95 -0
  40. package/src/components/index.ts +9 -0
  41. package/src/index.css +23 -0
  42. package/src/index.ts +3 -0
  43. package/src/main.tsx +10 -0
  44. package/src/stories/Colors.mdx +24 -0
  45. package/src/stories/Configure.mdx +364 -0
  46. package/src/stories/Iconography.mdx +27 -0
  47. package/src/stories/assets/accessibility.png +0 -0
  48. package/src/stories/assets/accessibility.svg +5 -0
  49. package/src/stories/assets/addon-library.png +0 -0
  50. package/src/stories/assets/assets.png +0 -0
  51. package/src/stories/assets/avif-test-image.avif +0 -0
  52. package/src/stories/assets/context.png +0 -0
  53. package/src/stories/assets/discord.svg +15 -0
  54. package/src/stories/assets/docs.png +0 -0
  55. package/src/stories/assets/figma-plugin.png +0 -0
  56. package/src/stories/assets/github.svg +3 -0
  57. package/src/stories/assets/share.png +0 -0
  58. package/src/stories/assets/styling.png +0 -0
  59. package/src/stories/assets/testing.png +0 -0
  60. package/src/stories/assets/theming.png +0 -0
  61. package/src/stories/assets/tutorials.svg +12 -0
  62. package/src/stories/assets/youtube.svg +4 -0
  63. package/src/utils/colors.js +47 -0
  64. package/src/utils/common.types.ts +3 -0
  65. package/src/utils/iconNames.ts +6 -0
  66. package/src/vite-env.d.ts +1 -0
  67. package/tailwind.config.js +67 -0
  68. package/tsconfig.json +30 -0
  69. package/tsconfig.node.json +11 -0
  70. package/vite.config.ts +28 -0
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "printWidth": 120,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "singleQuote": true,
6
+ "arrowParens": "always",
7
+ "trailingComma": "none"
8
+ }
@@ -0,0 +1,25 @@
1
+ import type { StorybookConfig } from '@storybook/react-vite';
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5
+
6
+ addons: [
7
+ '@storybook/addon-links',
8
+ '@storybook/addon-essentials',
9
+ '@storybook/addon-onboarding',
10
+ '@storybook/addon-interactions',
11
+ '@chromatic-com/storybook'
12
+ ],
13
+
14
+ framework: {
15
+ name: '@storybook/react-vite',
16
+ options: {}
17
+ },
18
+
19
+ docs: {},
20
+
21
+ typescript: {
22
+ reactDocgen: 'react-docgen-typescript'
23
+ }
24
+ };
25
+ export default config;
@@ -0,0 +1,6 @@
1
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
2
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
3
+ <link
4
+ href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
5
+ rel="stylesheet"
6
+ />
@@ -0,0 +1,14 @@
1
+ import type { Preview } from '@storybook/react';
2
+ import '../src/index.css';
3
+ const preview: Preview = {
4
+ parameters: {
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/i
9
+ }
10
+ }
11
+ }
12
+ };
13
+
14
+ export default preview;
@@ -0,0 +1,3 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib"
3
+ }
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13
+
14
+ - Configure the top-level `parserOptions` property like this:
15
+
16
+ ```js
17
+ export default {
18
+ // other rules...
19
+ parserOptions: {
20
+ ecmaVersion: "latest",
21
+ sourceType: "module",
22
+ project: ["./tsconfig.json", "./tsconfig.node.json"],
23
+ tsconfigRootDir: __dirname,
24
+ },
25
+ };
26
+ ```
27
+
28
+ - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
29
+ - Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
30
+ - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + React + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "se-design",
3
+ "version": "0.0.7",
4
+ "type": "module",
5
+ "main": "dist/se-design.js",
6
+ "module": "dist/se-design.js",
7
+ "types": "dist/se-design.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/se-design.es.js",
11
+ "require": "./dist/se-design.umd.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "dev": "vite",
16
+ "build": "tsc && vite build",
17
+ "release": "standard-version && git push --follow-tags && npm publish",
18
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
19
+ "preview": "vite preview",
20
+ "storybook": "storybook dev -p 6006",
21
+ "start": "storybook dev -p 6006",
22
+ "build-storybook": "storybook build"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^18.2.0",
26
+ "react-dom": "^18.2.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "devDependencies": {
32
+ "@chromatic-com/storybook": "^1.6.1",
33
+ "@storybook/addon-essentials": "^8.2.7",
34
+ "@storybook/addon-interactions": "^8.2.7",
35
+ "@storybook/addon-links": "^8.2.7",
36
+ "@storybook/addon-onboarding": "^8.2.7",
37
+ "@storybook/blocks": "^8.2.7",
38
+ "@storybook/react": "^8.2.7",
39
+ "@storybook/react-vite": "^8.2.7",
40
+ "@storybook/test": "^8.2.7",
41
+ "@types/react": "^18.2.43",
42
+ "@types/react-dom": "^18.2.17",
43
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
44
+ "@typescript-eslint/parser": "^6.14.0",
45
+ "@vitejs/plugin-react": "^4.2.1",
46
+ "autoprefixer": "^10.4.17",
47
+ "eslint": "^8.55.0",
48
+ "eslint-plugin-react-hooks": "^4.6.0",
49
+ "eslint-plugin-react-refresh": "^0.4.5",
50
+ "eslint-plugin-storybook": "^0.8.0",
51
+ "postcss": "^8.4.33",
52
+ "postcss-import": "^16.1.0",
53
+ "react-svg": "^16.1.33",
54
+ "standard-version": "^9.5.0",
55
+ "storybook": "^8.2.7",
56
+ "tailwindcss": "^3.4.1",
57
+ "typescript": "^5.2.2",
58
+ "vite": "^5.0.8",
59
+ "vite-plugin-dts": "^3.9.1"
60
+ }
61
+ }
@@ -0,0 +1,10 @@
1
+ const config = {
2
+ plugins: [
3
+ require("tailwindcss/nesting"),
4
+ require("tailwindcss"),
5
+ require("autoprefixer"),
6
+ require("postcss-import"),
7
+ ],
8
+ };
9
+
10
+ module.exports = config;
@@ -0,0 +1,4 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.2727 10.0535H2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M6.49198 14.5454L2 10.0535L6.49198 5.56149" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
+ <path d="M14.5455 5.45454L5.45456 14.5455" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M5.45456 5.45454L14.5455 14.5455" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
+ <path d="M6.66669 9.33275L10 12.6661L13.3334 9.33275" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16" fill="none">
2
+ <path d="M3 0.732748C2.11635 0.732748 1.4 1.44909 1.4 2.33275V13.6661C1.4 14.5497 2.11635 15.2661 3 15.2661H11C11.8837 15.2661 12.6 14.5497 12.6 13.6661V5.54084C12.6 5.35519 12.5263 5.17714 12.395 5.04586C12.395 5.04586 12.395 5.04586 12.395 5.04586L10.3409 2.99182L8.28689 0.937775C8.15561 0.806498 7.97756 0.732748 7.79191 0.732748H3Z" stroke="currentColor" stroke-width="1.2"/>
3
+ <path d="M7.83273 1.33275V4.49942C7.83273 5.0517 8.28045 5.49942 8.83273 5.49942H11.9994" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M15.4447 6.36364L8.30181 13.6364L5.05505 10.3306" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,31 @@
1
+ ## Change description
2
+
3
+ > Description here
4
+
5
+ ## Type of change
6
+ - [ ] Bug fix (fixes an issue)
7
+ - [ ] New feature (adds functionality)
8
+
9
+ ## Related issues
10
+
11
+ > Fix [#1]()
12
+
13
+ ## Checklists
14
+
15
+ ### Development
16
+
17
+ - [ ] Lint rules pass locally
18
+ - [ ] Application changes have been tested thoroughly
19
+ - [ ] Automated tests covering modified code pass
20
+
21
+ ### Security
22
+
23
+ - [ ] Security impact of change has been considered
24
+ - [ ] Code follows company security practices and guidelines
25
+
26
+ ### Code review
27
+
28
+ - [ ] Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached as necessary
29
+ - [ ] "Ready for review" label attached and reviewers assigned
30
+ - [ ] Changes have been reviewed by at least one other contributor
31
+ - [ ] Pull request linked to task tracker where applicable
package/src/App.css ADDED
@@ -0,0 +1,42 @@
1
+ #root {
2
+ max-width: 1280px;
3
+ margin: 0 auto;
4
+ padding: 2rem;
5
+ text-align: center;
6
+ }
7
+
8
+ .logo {
9
+ height: 6em;
10
+ padding: 1.5em;
11
+ will-change: filter;
12
+ transition: filter 300ms;
13
+ }
14
+ .logo:hover {
15
+ filter: drop-shadow(0 0 2em #646cffaa);
16
+ }
17
+ .logo.react:hover {
18
+ filter: drop-shadow(0 0 2em #61dafbaa);
19
+ }
20
+
21
+ @keyframes logo-spin {
22
+ from {
23
+ transform: rotate(0deg);
24
+ }
25
+ to {
26
+ transform: rotate(360deg);
27
+ }
28
+ }
29
+
30
+ @media (prefers-reduced-motion: no-preference) {
31
+ a:nth-of-type(2) .logo {
32
+ animation: logo-spin infinite 20s linear;
33
+ }
34
+ }
35
+
36
+ .card {
37
+ padding: 2em;
38
+ }
39
+
40
+ .read-the-docs {
41
+ color: #888;
42
+ }
package/src/App.tsx ADDED
@@ -0,0 +1,35 @@
1
+ import { useState } from 'react'
2
+ import reactLogo from './assets/react.svg'
3
+ import viteLogo from '/vite.svg'
4
+ import './App.css'
5
+
6
+ function App() {
7
+ const [count, setCount] = useState(0)
8
+
9
+ return (
10
+ <>
11
+ <div>
12
+ <a href="https://vitejs.dev" target="_blank">
13
+ <img src={viteLogo} className="logo" alt="Vite logo" />
14
+ </a>
15
+ <a href="https://react.dev" target="_blank">
16
+ <img src={reactLogo} className="logo react" alt="React logo" />
17
+ </a>
18
+ </div>
19
+ <h1>Vite + React</h1>
20
+ <div className="card">
21
+ <button onClick={() => setCount((count) => count + 1)}>
22
+ count is {count}
23
+ </button>
24
+ <p>
25
+ Edit <code>src/App.tsx</code> and save to test HMR
26
+ </p>
27
+ </div>
28
+ <p className="read-the-docs">
29
+ Click on the Vite and React logos to learn more
30
+ </p>
31
+ </>
32
+ )
33
+ }
34
+
35
+ export default App
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,98 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
3
+
4
+ import { Button } from '.';
5
+
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
+ const meta = {
8
+ title: 'Components/Button',
9
+ component: Button,
10
+ args: { onClick: fn() },
11
+ parameters: {
12
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
13
+ layout: 'centered'
14
+ },
15
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
16
+ tags: ['autodocs']
17
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
18
+ } satisfies Meta<typeof Button>;
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
24
+ export const Primary: Story = {
25
+ args: {
26
+ type: 'primary',
27
+ label: 'Button'
28
+ }
29
+ };
30
+
31
+ export const Secondary: Story = {
32
+ args: {
33
+ type: 'secondary',
34
+ label: 'Button'
35
+ }
36
+ };
37
+
38
+ export const Purchase: Story = {
39
+ args: {
40
+ type: 'purchase',
41
+ label: 'Button'
42
+ }
43
+ };
44
+
45
+ export const PurchaseSecondary: Story = {
46
+ args: {
47
+ type: 'purchase-secondary',
48
+ label: 'Button'
49
+ }
50
+ };
51
+
52
+ export const Negative: Story = {
53
+ args: {
54
+ type: 'negative',
55
+ label: 'Button'
56
+ }
57
+ };
58
+
59
+ export const NegativeSecondary: Story = {
60
+ args: {
61
+ type: 'negative-secondary',
62
+ label: 'Button'
63
+ }
64
+ };
65
+
66
+ export const Disabled: Story = {
67
+ args: {
68
+ type: 'primary',
69
+ label: 'Button',
70
+ disabled: true
71
+ }
72
+ };
73
+
74
+ export const PrimaryWithLeftIcon: Story = {
75
+ args: {
76
+ type: 'primary',
77
+ label: 'Button',
78
+ icon: 'back',
79
+ iconPosition: 'left'
80
+ }
81
+ };
82
+
83
+ export const PrimaryWithRightIcon: Story = {
84
+ args: {
85
+ type: 'primary',
86
+ label: 'Button',
87
+ icon: 'down',
88
+ iconPosition: 'right'
89
+ }
90
+ };
91
+
92
+ export const PrimarySmall: Story = {
93
+ args: {
94
+ type: 'primary',
95
+ label: 'Button',
96
+ size: 'sm'
97
+ }
98
+ };
@@ -0,0 +1,69 @@
1
+ import { FC } from 'react';
2
+ import { Map } from '../../utils/common.types';
3
+ import { Icon } from '../Icon/Icon';
4
+
5
+ interface ButtonProps {
6
+ /**
7
+ * Type of the button
8
+ */
9
+ type?: 'primary' | 'secondary' | 'negative' | 'negative-secondary' | 'purchase' | 'purchase-secondary';
10
+ /**
11
+ * Size of the button
12
+ */
13
+ size?: 'sm' | 'md';
14
+ /**
15
+ * Button contents
16
+ */
17
+ label: string;
18
+ /**
19
+ * Icon name
20
+ */
21
+ icon?: string;
22
+ /**
23
+ * Icon position
24
+ */
25
+ iconPosition?: 'left' | 'right';
26
+ /**
27
+ * Disabled state
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * Optional click handler
32
+ */
33
+ onClick?: () => void;
34
+ }
35
+
36
+ const focusClass = 'focus-visible:outline outline-2 outline-offset-2';
37
+ const disabledClass = 'bg-gray-300 border-gray-300 text-white pointer-events-none cursor-not-allowed';
38
+ const classNames: Map = {
39
+ primary: `bg-blue-500 text-white hover:bg-blue-600 border border-blue-500 hover:border-blue-600 outline-blue-500 ${focusClass}`,
40
+ secondary: `bg-blue-50 text-blue-500 hover:bg-blue-100 border border-blue-500 hover:border-blue-600 outline-blue-500 ${focusClass}`,
41
+ purchase: `bg-purchase-300 text-white hover:bg-purchase-400 border border-purchase-300 hover:border-purchase-400 outline-purchase-300 ${focusClass}`,
42
+ 'purchase-secondary': `bg-purchase-100 text-purchase-300 hover:bg-purchase-200 border border-purchase-300 hover:border-purchase-400 outline-purchase-300 ${focusClass}`,
43
+ negative: `bg-red-400 text-white hover:bg-red-700 border border-red-400 hover:border-red-700 outline-red-400 ${focusClass}`,
44
+ 'negative-secondary': `bg-red-100 text-red-400 hover:bg-red-200 border border-red-400 hover:border-red-700 outline-red-400 ${focusClass}`,
45
+ sm: 'px-3 py-1',
46
+ md: 'px-4 py-2'
47
+ };
48
+
49
+ export const Button: FC<ButtonProps> = ({
50
+ type = 'primary',
51
+ size = 'md',
52
+ label = '',
53
+ icon = '',
54
+ iconPosition = 'left',
55
+ disabled = false,
56
+ ...props
57
+ }) => {
58
+ return (
59
+ <button
60
+ type="button"
61
+ className={`rounded font-medium flex gap-1 items-center ${classNames[size]} ${disabled ? disabledClass : classNames[type]}`}
62
+ {...props}
63
+ >
64
+ {icon && iconPosition === 'left' && <Icon name={icon} className="" />}
65
+ {label}
66
+ {icon && iconPosition === 'right' && <Icon name={icon} className="" />}
67
+ </button>
68
+ );
69
+ };
@@ -0,0 +1,21 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Icon } from './Icon';
4
+
5
+ const meta = {
6
+ title: 'Components/Icon',
7
+ component: Icon,
8
+ parameters: {
9
+ layout: 'centered'
10
+ },
11
+ tags: ['autodocs']
12
+ } as Meta<typeof Icon>;
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Pages: Story = {
18
+ args: {
19
+ name: 'pages'
20
+ }
21
+ };
@@ -0,0 +1,24 @@
1
+ import { ReactSVG } from 'react-svg';
2
+ import { Map } from '../../utils/common.types';
3
+ import { IconProps } from './Icon.types';
4
+ import { iconNames } from 'src/utils/iconNames';
5
+ import { FC } from 'react';
6
+
7
+ const ICON_MAP: Map = iconNames.reduce((acc: Map, name: string) => {
8
+ acc[name] = `icons/${name}.svg`;
9
+ return acc;
10
+ }, {});
11
+
12
+ export const Icon: FC<IconProps> = (props) => {
13
+ const { name = '', className = '' } = props;
14
+ const src = ICON_MAP[name];
15
+
16
+ if (!src) {
17
+ return null;
18
+ }
19
+ return (
20
+ <div className={`svg-wrapper ${className}`}>
21
+ <ReactSVG src={src} wrapper="span" />
22
+ </div>
23
+ );
24
+ };
@@ -0,0 +1,4 @@
1
+ export type IconProps = {
2
+ name: string;
3
+ className?: string;
4
+ }
@@ -0,0 +1,30 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { MenuItem } from '.';
3
+ import { fn } from '@storybook/test';
4
+
5
+ const meta = {
6
+ title: 'Components/MenuItem',
7
+ component: MenuItem,
8
+ args: {
9
+ onClick: fn()
10
+ },
11
+ parameters: {
12
+ layout: 'centered'
13
+ },
14
+ tags: ['autodocs']
15
+ } satisfies Meta<typeof MenuItem>;
16
+
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ label: 'Email'
23
+ }
24
+ };
25
+ export const WithTag: Story = {
26
+ args: {
27
+ label: 'Shedule Reminder Event',
28
+ tag: 'NEW'
29
+ }
30
+ };
@@ -0,0 +1,20 @@
1
+ import { FC } from 'react';
2
+ import { Tag } from 'src/components/Tag/Tag';
3
+
4
+ export type MenuItemProps = {
5
+ label: string;
6
+ tag?: string;
7
+ onClick?: () => void;
8
+ };
9
+
10
+ export const MenuItem: FC<MenuItemProps> = ({ label, tag, onClick = () => {} }) => {
11
+ return (
12
+ <div
13
+ className="flex items-center justify-between px-4 py-3 text-gray-900 hover:bg-blue-100 cursor-pointer first:rounded-t last:rounded-b gap-2"
14
+ onClick={onClick}
15
+ >
16
+ <div>{label}</div>
17
+ {tag && <Tag label={tag} />}
18
+ </div>
19
+ );
20
+ };
@@ -0,0 +1,20 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { MenuList } from '.';
3
+
4
+ const meta = {
5
+ title: 'Components/Menu List',
6
+ component: MenuList,
7
+ parameters: {
8
+ layout: 'centered'
9
+ },
10
+ tags: ['autodocs']
11
+ } satisfies Meta<typeof MenuList>;
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const Default: Story = {
17
+ args: {
18
+ items: [{ label: 'Email' }, { label: 'Rename' }, { label: 'Shedule Reminder Event', tag: 'NEW' }]
19
+ }
20
+ };
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ import { MenuItem, MenuItemProps } from 'src/components/MenuItem';
3
+
4
+ export type MenuListProps = {
5
+ items: MenuItemProps[];
6
+ };
7
+
8
+ export const MenuList: FC<MenuListProps> = ({ items }) => {
9
+ return (
10
+ <div className="border border-gray-200 rounded shadow-md">
11
+ {items.map((item) => (
12
+ <MenuItem {...item} />
13
+ ))}
14
+ </div>
15
+ );
16
+ };