urfu-ui-kit-react 0.0.0 → 0.0.2
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.
- package/README.md +21 -84
- package/dist/style.css +1 -0
- package/dist/urfu-ui-kit-react.js +3049 -0
- package/dist/vite.svg +1 -0
- package/package.json +51 -33
- package/Modal.jsx +0 -24
- package/Select.jsx +0 -57
- package/Tabs.jsx +0 -39
- package/src/styles/Tabs.less +0 -24
package/dist/vite.svg
ADDED
|
@@ -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>
|
package/package.json
CHANGED
|
@@ -1,33 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "urfu-ui-kit-react",
|
|
3
|
-
"description": "UrFU UI-Kit for React Web",
|
|
4
|
-
"license": "UNLICENSED",
|
|
5
|
-
"private": false,
|
|
6
|
-
"version": "0.0.
|
|
7
|
-
"type": "module",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "urfu-ui-kit-react",
|
|
3
|
+
"description": "UrFU UI-Kit for React Web",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"private": false,
|
|
6
|
+
"version": "0.0.2",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/urfu-ui-kit-react",
|
|
9
|
+
"types": "dist/urfu-ui-kit-react",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "vite",
|
|
12
|
+
"build": "tsc && vite build",
|
|
13
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
14
|
+
"preview": "vite preview",
|
|
15
|
+
"sb": "storybook dev -p 6006",
|
|
16
|
+
"build-storybook": "storybook build"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"less": "^4.2.0",
|
|
20
|
+
"react": "^18.2.0",
|
|
21
|
+
"react-dom": "^18.2.0",
|
|
22
|
+
"urfu-ui-kit-vanilla": "^1.1.2"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@chromatic-com/storybook": "^1.2.26",
|
|
26
|
+
"@storybook/addon-essentials": "^8.0.5",
|
|
27
|
+
"@storybook/addon-interactions": "^8.0.5",
|
|
28
|
+
"@storybook/addon-links": "^8.0.5",
|
|
29
|
+
"@storybook/addon-onboarding": "^8.0.5",
|
|
30
|
+
"@storybook/blocks": "^8.0.5",
|
|
31
|
+
"@storybook/react": "^8.0.5",
|
|
32
|
+
"@storybook/react-vite": "^8.0.5",
|
|
33
|
+
"@storybook/test": "^8.0.5",
|
|
34
|
+
"@types/node": "^20.12.7",
|
|
35
|
+
"@types/react": "^18.2.75",
|
|
36
|
+
"@types/react-dom": "^18.2.22",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
38
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
39
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
40
|
+
"eslint": "^8.57.0",
|
|
41
|
+
"eslint-plugin-react": "^7.34.1",
|
|
42
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
43
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
44
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
45
|
+
"prop-types": "^15.8.1",
|
|
46
|
+
"storybook": "^8.0.5",
|
|
47
|
+
"typescript": "^5.2.2",
|
|
48
|
+
"vite": "^5.2.0"
|
|
49
|
+
},
|
|
50
|
+
"files": ["dist"]
|
|
51
|
+
}
|
package/Modal.jsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import 'urfu-ui-kit-vanilla/src/main.css';
|
|
3
|
-
|
|
4
|
-
export default function Modal({ active, setActive, children, nameClass }) {
|
|
5
|
-
return (
|
|
6
|
-
<div className={active ? `u-modal u-modal-active ${nameClass}` : "u-modal"}
|
|
7
|
-
onClick={() => setActive(false)}>
|
|
8
|
-
|
|
9
|
-
<div className="u-modal__container">
|
|
10
|
-
|
|
11
|
-
<div className="u-modal__body" onClick={(e) => { e.stopPropagation() }}>
|
|
12
|
-
|
|
13
|
-
{children}
|
|
14
|
-
|
|
15
|
-
<div className="u-modal__exit">
|
|
16
|
-
|
|
17
|
-
<button className="u-button-cross" onClick={() => setActive(false)}></button>
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
}
|
package/Select.jsx
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
-
import 'urfu-ui-kit-vanilla/src/main.css';
|
|
3
|
-
|
|
4
|
-
export default function Selectbox({ optionsArr, placeholder = "Не выбрано" }) {
|
|
5
|
-
|
|
6
|
-
const [open, setOpen] = useState(false);
|
|
7
|
-
const [value, setValue] = useState("");
|
|
8
|
-
const [isValue, setIsValue] = useState(false);
|
|
9
|
-
|
|
10
|
-
const options = optionsArr.map((text, index) => {
|
|
11
|
-
return <div className="u-selectbox-option" key={index} onClick={() => { setValue(`${text}`); setIsValue(true); }}>{text}</div>;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
document.addEventListener('click', handleClick)
|
|
16
|
-
return () => document.removeEventListener('click', handleClick)
|
|
17
|
-
}, [])
|
|
18
|
-
|
|
19
|
-
const handleClick = (e) => {
|
|
20
|
-
if (!e.target.closest('.u-selectbox')) {
|
|
21
|
-
setOpen(false);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<div className="u-selectbox">
|
|
28
|
-
<div className={open ? "u-selectbox-select u-selectbox-select-open" : "u-selectbox-select"}
|
|
29
|
-
|
|
30
|
-
onClick={() => {
|
|
31
|
-
setOpen(!open);
|
|
32
|
-
}}>
|
|
33
|
-
|
|
34
|
-
{isValue ? <></> : <span>{placeholder}</span>}
|
|
35
|
-
|
|
36
|
-
<span className="u-selectbox-select-title">{value}</span>
|
|
37
|
-
|
|
38
|
-
{isValue
|
|
39
|
-
? <i className="u-selectbox-select-icon-cross"
|
|
40
|
-
onClick={(e) => { setValue(""); setIsValue(false); e.stopPropagation(); }}></i>
|
|
41
|
-
: <></>}
|
|
42
|
-
|
|
43
|
-
<i className="u-selectbox-select-icon-arrow"></i>
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div className="u-selectbox-options"
|
|
48
|
-
onClick={() => {
|
|
49
|
-
setOpen(false);
|
|
50
|
-
}}>
|
|
51
|
-
{options}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
</>
|
|
56
|
-
)
|
|
57
|
-
}
|
package/Tabs.jsx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Link } from "react-router-dom";
|
|
3
|
-
import "./src/styles/Tabs.less";
|
|
4
|
-
import 'urfu-ui-kit-vanilla/src/main.css';
|
|
5
|
-
|
|
6
|
-
export default function Tabs({ children, route, activeTab, setActiveTab }) {
|
|
7
|
-
|
|
8
|
-
const handleClick = (newActiveTab) => {
|
|
9
|
-
setActiveTab(newActiveTab);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className="u-react-tabs">
|
|
14
|
-
|
|
15
|
-
{children.map((tab) => {
|
|
16
|
-
|
|
17
|
-
const label = tab.props.label;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div key={label}>
|
|
21
|
-
|
|
22
|
-
<Link
|
|
23
|
-
to={`${route}/${label}`}
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
<button className={label === activeTab ? "u-tab-line u-tab-active" : "u-tab-line"}
|
|
27
|
-
onClick={() => handleClick(label)}>
|
|
28
|
-
{tab.props.title}
|
|
29
|
-
</button>
|
|
30
|
-
|
|
31
|
-
</Link>
|
|
32
|
-
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
})}
|
|
36
|
-
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
package/src/styles/Tabs.less
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @import "../../style/const";
|
|
2
|
-
|
|
3
|
-
.u-react-tabs {
|
|
4
|
-
display: flex;
|
|
5
|
-
margin: 16px 0 32px 0;
|
|
6
|
-
|
|
7
|
-
a {
|
|
8
|
-
text-decoration: none;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// @media screen and (max-width: 1012px) {
|
|
13
|
-
|
|
14
|
-
// /*для больших планшетов*/
|
|
15
|
-
// .tabs {
|
|
16
|
-
// margin: 24px 0 24px;
|
|
17
|
-
// }
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
// @media screen and (max-width: 404px) {
|
|
21
|
-
// .tabs {
|
|
22
|
-
// margin: 24px 0 14px;
|
|
23
|
-
// }
|
|
24
|
-
// }
|