math-main-components 0.0.1

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 (42) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/dist/cjs/types/components/Accordeon/Accordeon.types.d.ts +4 -0
  4. package/dist/cjs/types/components/Accordeon/index.d.ts +3 -0
  5. package/dist/cjs/types/components/Dialog/Dialog.types.d.ts +6 -0
  6. package/dist/cjs/types/components/Dialog/index.d.ts +3 -0
  7. package/dist/cjs/types/components/Gap/Gap.types.d.ts +3 -0
  8. package/dist/cjs/types/components/Gap/index.d.ts +3 -0
  9. package/dist/cjs/types/components/SvgIcon/SvgIcon.types.d.ts +8 -0
  10. package/dist/cjs/types/components/SvgIcon/index.d.ts +4 -0
  11. package/dist/cjs/types/components/index.d.ts +1 -0
  12. package/dist/cjs/types/index.d.ts +1 -0
  13. package/dist/esm/index.js +2 -0
  14. package/dist/esm/index.js.map +1 -0
  15. package/dist/esm/types/components/Accordeon/Accordeon.types.d.ts +4 -0
  16. package/dist/esm/types/components/Accordeon/index.d.ts +3 -0
  17. package/dist/esm/types/components/Dialog/Dialog.types.d.ts +6 -0
  18. package/dist/esm/types/components/Dialog/index.d.ts +3 -0
  19. package/dist/esm/types/components/Gap/Gap.types.d.ts +3 -0
  20. package/dist/esm/types/components/Gap/index.d.ts +3 -0
  21. package/dist/esm/types/components/SvgIcon/SvgIcon.types.d.ts +8 -0
  22. package/dist/esm/types/components/SvgIcon/index.d.ts +4 -0
  23. package/dist/esm/types/components/index.d.ts +1 -0
  24. package/dist/esm/types/index.d.ts +1 -0
  25. package/dist/types.d.ts +2 -0
  26. package/package.json +36 -0
  27. package/rollup.config.js +39 -0
  28. package/src/components/Accordeon/Accordeon.types.ts +4 -0
  29. package/src/components/Accordeon/index.tsx +24 -0
  30. package/src/components/Accordeon/styles.module.scss +66 -0
  31. package/src/components/Dialog/Dialog.types.ts +5 -0
  32. package/src/components/Dialog/index.tsx +26 -0
  33. package/src/components/Dialog/styles.module.scss +32 -0
  34. package/src/components/Gap/Gap.types.ts +3 -0
  35. package/src/components/Gap/index.tsx +9 -0
  36. package/src/components/SvgIcon/SvgIcon.types.ts +9 -0
  37. package/src/components/SvgIcon/index.tsx +16 -0
  38. package/src/components/index.ts +1 -0
  39. package/src/index.ts +1 -0
  40. package/src/types/typings.d.ts +4 -0
  41. package/tsconfig.json +27 -0
  42. package/yarn-error.log +2108 -0
@@ -0,0 +1,2 @@
1
+ "use strict";require("react");
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface AccordeonProps {
2
+ title?: string;
3
+ children?: any;
4
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { AccordeonProps } from './Accordeon.types';
3
+ export default function Accordeon({ title, children }: AccordeonProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface DialogProps {
3
+ active?: boolean;
4
+ onClose?: (event: React.MouseEventHandler<HTMLDivElement>) => void;
5
+ children: any;
6
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { DialogProps } from "./Dialog.types";
3
+ export default function Dialog({ active, onClose, children }: DialogProps): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ export interface GapProps {
2
+ size?: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { GapProps } from "./Gap.types";
3
+ export default function Gap({ size }: GapProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { MouseEventHandler } from "react";
2
+ export interface SvgIconProps {
3
+ iconName?: string;
4
+ size?: string;
5
+ fill?: string;
6
+ className?: string;
7
+ onClick?: MouseEventHandler<HTMLSpanElement>;
8
+ }
@@ -0,0 +1,4 @@
1
+ import "external-svg-loader";
2
+ import React from 'react';
3
+ import { SvgIconProps } from "./SvgIcon.types";
4
+ export default function SvgIcon({ iconName, size, className, onClick }: SvgIconProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Gap';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,2 @@
1
+ import"react";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface AccordeonProps {
2
+ title?: string;
3
+ children?: any;
4
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { AccordeonProps } from './Accordeon.types';
3
+ export default function Accordeon({ title, children }: AccordeonProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface DialogProps {
3
+ active?: boolean;
4
+ onClose?: (event: React.MouseEventHandler<HTMLDivElement>) => void;
5
+ children: any;
6
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { DialogProps } from "./Dialog.types";
3
+ export default function Dialog({ active, onClose, children }: DialogProps): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ export interface GapProps {
2
+ size?: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { GapProps } from "./Gap.types";
3
+ export default function Gap({ size }: GapProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { MouseEventHandler } from "react";
2
+ export interface SvgIconProps {
3
+ iconName?: string;
4
+ size?: string;
5
+ fill?: string;
6
+ className?: string;
7
+ onClick?: MouseEventHandler<HTMLSpanElement>;
8
+ }
@@ -0,0 +1,4 @@
1
+ import "external-svg-loader";
2
+ import React from 'react';
3
+ import { SvgIconProps } from "./SvgIcon.types";
4
+ export default function SvgIcon({ iconName, size, className, onClick }: SvgIconProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Gap';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "math-main-components",
3
+ "version": "0.0.1",
4
+ "author": "Emilian Scheel",
5
+ "license": "MIT",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build": "rollup -c --bundleConfigAsCjs"
11
+ },
12
+ "dependencies": {
13
+ "@rollup/plugin-commonjs": "^25.0.4",
14
+ "@rollup/plugin-node-resolve": "^15.2.1",
15
+ "@rollup/plugin-typescript": "^11.1.3",
16
+ "rollup-plugin-dts": "^6.0.2",
17
+ "rollup-plugin-peer-deps-external": "^2.2.4",
18
+ "rollup-plugin-terser": "^7.0.2",
19
+ "tslib": "^2.6.2"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node-sass": "^4.11.4",
23
+ "@types/react": "^18.2.22",
24
+ "css-loader": "^6.8.1",
25
+ "css-modules-typescript-loader": "^4.0.1",
26
+ "node-sass": "^9.0.0",
27
+ "rollup": "^3.29.2",
28
+ "sass": "^1.67.0",
29
+ "sass-loader": "^13.3.2",
30
+ "typescript": "^5.2.2"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "^18.2.0",
34
+ "react-dom": "^18.2.0"
35
+ }
36
+ }
@@ -0,0 +1,39 @@
1
+ import commonjs from "@rollup/plugin-commonjs";
2
+ import resolve from "@rollup/plugin-node-resolve";
3
+ import typescript from "@rollup/plugin-typescript";
4
+ import dts from "rollup-plugin-dts";
5
+ import peerDepsExternal from "rollup-plugin-peer-deps-external";
6
+ import { terser } from "rollup-plugin-terser";
7
+
8
+ const packageJson = require("./package.json");
9
+
10
+ export default [
11
+ {
12
+ input: "src/index.ts",
13
+ output: [
14
+ {
15
+ file: packageJson.main,
16
+ format: "cjs",
17
+ sourcemap: true,
18
+ },
19
+ {
20
+ file: packageJson.module,
21
+ format: "esm",
22
+ sourcemap: true,
23
+ },
24
+ ],
25
+ plugins: [
26
+ peerDepsExternal(),
27
+ resolve(),
28
+ commonjs(),
29
+ typescript({ tsconfig: "./tsconfig.json" }),
30
+ terser(),
31
+ ],
32
+ external: ["react", "react-dom", "styled-components"],
33
+ },
34
+ {
35
+ input: "src/index.ts",
36
+ output: [{ file: "dist/types.d.ts", format: "es" }],
37
+ plugins: [dts.default()],
38
+ },
39
+ ];
@@ -0,0 +1,4 @@
1
+ export interface AccordeonProps {
2
+ title?: string,
3
+ children?: any
4
+ }
@@ -0,0 +1,24 @@
1
+ import React, { useState } from 'react'
2
+ import SvgIcon from '../SvgIcon'
3
+ import { AccordeonProps } from './Accordeon.types'
4
+ import styles from './styles.module.scss'
5
+
6
+ export default function Accordeon({
7
+ title,
8
+ children
9
+ }: AccordeonProps) {
10
+
11
+ const [isActive, setActive] = useState(false)
12
+
13
+ return (
14
+ <div className={[styles.container, isActive ? styles.active : styles.not_active].join(" ")}>
15
+ <div className={styles.head} onClick={() => setActive(!isActive)}>
16
+ <SvgIcon iconName="expand_more" />
17
+ <h3>{title}</h3>
18
+ </div>
19
+ <div className={styles.content}>
20
+ {children}
21
+ </div>
22
+ </div>
23
+ )
24
+ }
@@ -0,0 +1,66 @@
1
+ .container {
2
+ margin-top: 40px;
3
+ background: white;
4
+ border-radius: 30px;
5
+ transition: 0.2s ease-in-out;
6
+
7
+ .head {
8
+ display: flex;
9
+ flex-direction: row;
10
+ align-items: center;
11
+ padding: 16px 20px;
12
+ color: grey;
13
+ background: #F1F1F1;
14
+ border-radius: 30px;
15
+ cursor: pointer;
16
+ user-select: none;
17
+ -webkit-user-select: none;
18
+ transition: 0.2s ease-in-out;
19
+
20
+ gap: 10px;
21
+
22
+ span {
23
+ transition: 0.2s ease-in-out;
24
+ }
25
+
26
+ h3 {
27
+ margin: 0;
28
+ font-weight: 400;
29
+ font-size: 16px;
30
+ user-select: none;
31
+ -webkit-user-select: none;
32
+ }
33
+
34
+ &:hover {
35
+ background: #e2e2e2;
36
+ }
37
+ }
38
+
39
+ &.active {
40
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px,
41
+ rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
42
+ }
43
+
44
+ &.active .head span {
45
+ rotate: 180deg;
46
+ }
47
+
48
+ .content {
49
+ transition: all 0.3s ease-in-out;
50
+ line-height: 1.5;
51
+ }
52
+
53
+ &.not_active .content {
54
+ height: 0;
55
+ max-height: 0;
56
+ overflow: hidden;
57
+ opacity: 0;
58
+ }
59
+
60
+ &.active .content {
61
+ max-height: auto;
62
+ overflow: visible;
63
+ opacity: 1;
64
+ padding: 10px 0px;
65
+ }
66
+ }
@@ -0,0 +1,5 @@
1
+ export interface DialogProps {
2
+ active?: boolean
3
+ onClose?: (event: React.MouseEventHandler<HTMLDivElement>) => void
4
+ children: any
5
+ }
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { DialogProps } from "./Dialog.types";
3
+ import styles from './styles.module.scss';
4
+
5
+
6
+
7
+ export default function Dialog({
8
+ active = false,
9
+ onClose = (event: any) => { },
10
+ children = null
11
+ }: DialogProps) {
12
+
13
+ function onClick(event: any) {
14
+ if (event.target.id == 'dialog-backdrop') {
15
+ onClose(event)
16
+ }
17
+ }
18
+
19
+ return (
20
+ <div id="dialog-backdrop" className={`${styles.container} ${active ? styles.active : styles.disabled}`} onClick={onClick}>
21
+ <div className={styles.dialog_window}>
22
+ {children}
23
+ </div>
24
+ </div>
25
+ )
26
+ }
@@ -0,0 +1,32 @@
1
+ .container {
2
+ position: fixed;
3
+ height: 100vh;
4
+ width: 100vw;
5
+ background: rgba(255, 255, 255, 0.659);
6
+ backdrop-filter: blur(10px) brightness(70%);
7
+ left: 0;
8
+ top: 0;
9
+ z-index: 10000;
10
+ display: flex;
11
+ flex-direction: row;
12
+ align-items: center;
13
+ justify-content: center;
14
+ cursor: pointer;
15
+
16
+ &.active {
17
+ opacity: 1;
18
+ }
19
+
20
+ &.disabled {
21
+ pointer-events: none;
22
+ opacity: 0;
23
+ }
24
+
25
+ .dialog_window {
26
+ background: white;
27
+ border-radius: 20px;
28
+ padding: 20px;
29
+ box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
30
+ cursor: auto;
31
+ }
32
+ }
@@ -0,0 +1,3 @@
1
+ export interface GapProps {
2
+ size?: string;
3
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { GapProps } from "./Gap.types";
3
+
4
+
5
+ export default function Gap({ size }: GapProps) {
6
+ return (
7
+ <div style={{ height: size }}></div>
8
+ )
9
+ }
@@ -0,0 +1,9 @@
1
+ import { MouseEventHandler } from "react"
2
+
3
+ export interface SvgIconProps {
4
+ iconName?: string
5
+ size?: string
6
+ fill?: string
7
+ className?: string
8
+ onClick?: MouseEventHandler<HTMLSpanElement>
9
+ }
@@ -0,0 +1,16 @@
1
+ import "external-svg-loader";
2
+ import React from 'react';
3
+ import { SvgIconProps } from "./SvgIcon.types";
4
+
5
+
6
+ export default function SvgIcon({
7
+ iconName,
8
+ size = "24px",
9
+ className = "",
10
+ onClick
11
+ }: SvgIconProps) {
12
+ return (
13
+ <span onClick={onClick} className={`material-symbols-outlined ${className}`} style={{ fontSize: size }
14
+ }> {iconName}</span >
15
+ )
16
+ }
@@ -0,0 +1 @@
1
+ export * from './Gap';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,4 @@
1
+ declare module "*.module.scss" {
2
+ const content: Record<string, string>;
3
+ export default content;
4
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "strict": true,
5
+ "skipLibCheck": true,
6
+ "jsx": "react",
7
+ "module": "ESNext",
8
+ "declaration": true,
9
+ "declarationDir": "types",
10
+ "sourceMap": true,
11
+ "outDir": "dist",
12
+ "moduleResolution": "node",
13
+ "emitDeclarationOnly": false,
14
+ "allowSyntheticDefaultImports": true,
15
+ "forceConsistentCasingInFileNames": true
16
+ },
17
+ "include": [
18
+ "src/types/typings.d.ts",
19
+ "src/**/*"
20
+ ],
21
+ "exclude": [
22
+ "dist",
23
+ "node_modules",
24
+ "src/**/*.test.tsx",
25
+ "src/**/*.stories.tsx"
26
+ ]
27
+ }