norma-library 0.6.86 → 0.6.87
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/.storybook/main.ts +7 -0
- package/dist/esm/components/Box/interfaces.d.ts +1 -0
- package/dist/esm/components/Breadcrumb/index.d.ts +2 -2
- package/dist/esm/components/Breadcrumb/index.js +13 -9
- package/dist/esm/components/Breadcrumb/index.js.map +1 -1
- package/dist/esm/components/Breadcrumb/interface.d.ts +11 -6
- package/dist/esm/components/Breadcrumb/styles.d.ts +3 -3
- package/dist/esm/components/Breadcrumb/styles.js +3 -3
- package/dist/esm/components/Breadcrumb/styles.js.map +1 -1
- package/dist/esm/components/Typography/Text/interfaces.d.ts +1 -0
- package/dist/esm/components/Typography/Title/interfaces.d.ts +1 -0
- package/dist/esm/hooks/useClickOutside.d.ts +1 -1
- package/dist/esm/hooks/useClickOutside.js.map +1 -1
- package/package.json +24 -24
- package/src/components/Box/interfaces.ts +2 -0
- package/src/components/Breadcrumb/index.tsx +16 -11
- package/src/components/Breadcrumb/interface.ts +12 -6
- package/src/components/Breadcrumb/styles.tsx +10 -11
- package/src/components/Typography/Text/interfaces.ts +3 -1
- package/src/components/Typography/Title/interfaces.ts +2 -0
- package/src/hooks/useClickOutside.tsx +1 -1
- package/src/stories/Accordion.stories.tsx +19 -19
- package/src/stories/Avatar.stories.tsx +32 -28
- package/src/stories/Badge.stories.tsx +17 -15
- package/src/stories/Box.stories.tsx +16 -12
- package/src/stories/Breadcrumb.stories.tsx +62 -18
- package/src/stories/Button.stories.tsx +24 -16
- package/src/stories/Card.stories.tsx +21 -13
- package/src/stories/ChatMessage.stories.tsx +10 -9
- package/src/stories/ChatMessageBalloon.stories.tsx +83 -66
- package/src/stories/CheckBox.stories.tsx +23 -23
- package/src/stories/DateInput.stories.tsx +15 -16
- package/src/stories/DatePicker.stories.tsx +17 -12
- package/src/stories/DropDown.stories.tsx +16 -16
- package/src/stories/IconButton.stories.tsx +45 -21
- package/src/stories/Modal.stories.tsx +49 -49
- package/src/stories/ModalStatus.stories.tsx +34 -18
- package/src/stories/MultiSelectInput.stories.tsx +30 -28
- package/src/stories/NormaChatMessageBalloon.stories.tsx +119 -82
- package/src/stories/Paper.stories.tsx +14 -14
- package/src/stories/ProductCard.stories.tsx +76 -52
- package/src/stories/ProgressBar.stories.tsx +27 -19
- package/src/stories/RadioGroup.stories.tsx +28 -21
- package/src/stories/RangerSlider.stories.tsx +43 -35
- package/src/stories/Select.stories.tsx +61 -33
- package/src/stories/SelectInput.stories.tsx +27 -25
- package/src/stories/ServiceCard.stories.tsx +36 -27
- package/src/stories/Table.stories.tsx +211 -276
- package/src/stories/Tabs.stories.tsx +17 -17
- package/src/stories/Tag.stories.tsx +22 -14
- package/src/stories/Text.stories.tsx +9 -9
- package/src/stories/TextField.stories.tsx +116 -35
- package/src/stories/TextInput.stories.tsx +14 -15
- package/src/stories/TimeLine.stories.tsx +22 -20
- package/src/stories/TimePicker.stories.tsx +54 -30
- package/src/stories/Title.stories.tsx +9 -9
- package/src/stories/UncontrolledTable.stories.tsx +196 -66
- package/src/stories/UncontrolledTabs.stories.tsx +28 -23
- /package/src/stories/{Colors.stories.mdx → Colors.mdx} +0 -0
package/.storybook/main.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { StorybookConfig } from '@storybook/react-vite';
|
|
|
2
2
|
|
|
3
3
|
const config: StorybookConfig = {
|
|
4
4
|
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
5
|
+
|
|
5
6
|
addons: [
|
|
6
7
|
'@storybook/addon-links',
|
|
7
8
|
'@storybook/addon-essentials',
|
|
@@ -9,12 +10,18 @@ const config: StorybookConfig = {
|
|
|
9
10
|
'@storybook/addon-interactions',
|
|
10
11
|
'@storybook/addon-mdx-gfm'
|
|
11
12
|
],
|
|
13
|
+
|
|
12
14
|
framework: {
|
|
13
15
|
name: '@storybook/react-vite',
|
|
14
16
|
options: {},
|
|
15
17
|
},
|
|
18
|
+
|
|
16
19
|
docs: {
|
|
17
20
|
autodocs: 'tag',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
typescript: {
|
|
24
|
+
reactDocgen: 'react-docgen-typescript'
|
|
18
25
|
}
|
|
19
26
|
};
|
|
20
27
|
export default config;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import * as S from "./styles";
|
|
3
|
+
import { Icons } from '../Icons';
|
|
4
|
+
import { Home } from '@mui/icons-material';
|
|
3
5
|
var Breadcrumb = function (_a) {
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
return
|
|
6
|
+
var items = _a.items, onHomeClick = _a.onHomeClick, onPathClick = _a.onPathClick;
|
|
7
|
+
var listItems = useMemo(function () {
|
|
8
|
+
return items.map(function (item, index, self) {
|
|
7
9
|
var showIcon = self.length > index + 1;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var isFixedIcon = items[0] === item;
|
|
11
|
+
return (React.createElement("div", { className: 'content', key: index, onClick: function (event) { return items[0] === item ? onHomeClick(event) : onPathClick(item, event); } },
|
|
12
|
+
isFixedIcon && React.createElement(Icons, { icon: Home }),
|
|
13
|
+
!isFixedIcon && item.icon && React.createElement(Icons, { icon: item.icon, color: 'inherit' }),
|
|
14
|
+
React.createElement(S.Item, null, item.label),
|
|
15
|
+
showIcon && React.createElement(S.Divisor, null, "/")));
|
|
12
16
|
});
|
|
13
|
-
}, [
|
|
17
|
+
}, [items]);
|
|
14
18
|
return (React.createElement(S.Container, null,
|
|
15
|
-
React.createElement(S.
|
|
19
|
+
React.createElement(S.ListItems, null, listItems)));
|
|
16
20
|
};
|
|
17
21
|
export default Breadcrumb;
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,IAAM,UAAU,GAA8B,UAAC,EAAmC;QAAjC,KAAK,WAAA,EAAE,WAAW,iBAAA,EAAE,WAAW,iBAAA;IAC9E,IAAM,SAAS,GAAG,OAAO,CAAC;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,UAAC,IAAU,EAAE,KAAa,EAAE,IAAY;YACvD,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAA;YACxC,IAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;YACrC,OAAO,CACL,6BAAK,SAAS,EAAC,SAAS,EAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,EAAjE,CAAiE;gBACvH,WAAW,IAAI,oBAAC,KAAK,IAAC,IAAI,EAAE,IAAI,GAAI;gBACpC,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,IAAI,oBAAC,KAAK,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC,SAAS,GAAG;gBACxE,oBAAC,CAAC,CAAC,IAAI,QAAE,IAAI,CAAC,KAAK,CAAU;gBAC5B,QAAQ,IAAI,oBAAC,CAAC,CAAC,OAAO,YAAc,CACjC,CACP,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,CACL,oBAAC,CAAC,CAAC,SAAS;QACV,oBAAC,CAAC,CAAC,SAAS,QACT,SAAS,CACE,CACF,CACf,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IconType } from "../../types";
|
|
2
|
+
import { SvgIconComponent } from "@mui/icons-material";
|
|
3
|
+
export interface Item {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
icon?: SvgIconComponent | IconType;
|
|
4
8
|
}
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
export interface BreadCrumbProps {
|
|
10
|
+
onPathClick: Function;
|
|
11
|
+
onHomeClick: Function;
|
|
12
|
+
items: Item[];
|
|
8
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const ListItems: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const Item: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
4
|
+
export declare const Divisor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: 0 0 16px 0;\n"], ["\n margin: 0 0 16px 0;\n"])));
|
|
4
|
-
export var
|
|
5
|
-
export var
|
|
6
|
-
export var
|
|
4
|
+
export var ListItems = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: 8px;\n .content {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n"], ["\n display: flex;\n gap: 8px;\n .content {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n"])));
|
|
5
|
+
export var Item = styled.p(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: #666;\n font-size: 14px;\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n"], ["\n color: #666;\n font-size: 14px;\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n"])));
|
|
6
|
+
export var Divisor = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n color: #666;\n content: '/';\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n color: #666;\n content: '/';\n"])));
|
|
7
7
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
8
8
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,8FAAA,2BAElC,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,8FAAA,2BAElC,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,sLAAA,mHAQlC,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,IAAI,GAAG,MAAM,CAAC,CAAC,kLAAA,+GAO3B,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,GAAG,8KAAA,2GAMhC,IAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const useClickOutside: (ref: React.RefObject<HTMLElement>, callback: () => void) => void;
|
|
1
|
+
declare const useClickOutside: (ref: React.RefObject<HTMLElement | null>, callback: () => void) => void;
|
|
2
2
|
export default useClickOutside;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClickOutside.js","sourceRoot":"","sources":["../../../src/hooks/useClickOutside.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,IAAM,eAAe,GAAG,UAAC,
|
|
1
|
+
{"version":3,"file":"useClickOutside.js","sourceRoot":"","sources":["../../../src/hooks/useClickOutside.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,IAAM,eAAe,GAAG,UAAC,GAAwC,EAAE,QAAoB;IACrF,IAAM,kBAAkB,GAAG,UAAC,KAAiB;QAC3C,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE,CAAC;YAC/D,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,SAAS,CAAC;QACR,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.87",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
|
|
6
6
|
"scripts": {
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"@emotion/core": "^11.0.0",
|
|
35
35
|
"@emotion/styled-base": "^11.0.0",
|
|
36
36
|
"@mdx-js/loader": "^2.3.0",
|
|
37
|
-
"@storybook/addon-essentials": "^
|
|
38
|
-
"@storybook/addon-interactions": "^
|
|
39
|
-
"@storybook/addon-links": "^
|
|
40
|
-
"@storybook/addon-onboarding": "^
|
|
37
|
+
"@storybook/addon-essentials": "^8.5.6",
|
|
38
|
+
"@storybook/addon-interactions": "^8.5.6",
|
|
39
|
+
"@storybook/addon-links": "^8.5.6",
|
|
40
|
+
"@storybook/addon-onboarding": "^8.5.6",
|
|
41
41
|
"@storybook/addon-styling": "^1.3.7",
|
|
42
|
-
"@storybook/blocks": "^
|
|
43
|
-
"@storybook/react": "^
|
|
44
|
-
"@storybook/react-vite": "^
|
|
45
|
-
"@storybook/react-webpack5": "^
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@types/react": "^
|
|
48
|
-
"@types/react-datepicker": "^
|
|
49
|
-
"@types/react-dom": "^
|
|
42
|
+
"@storybook/blocks": "^8.5.6",
|
|
43
|
+
"@storybook/react": "^8.5.6",
|
|
44
|
+
"@storybook/react-vite": "^8.5.6",
|
|
45
|
+
"@storybook/react-webpack5": "^8.5.6",
|
|
46
|
+
"@storybook/test": "^8.5.6",
|
|
47
|
+
"@types/react": "^19.0.0",
|
|
48
|
+
"@types/react-datepicker": "^7.0.0",
|
|
49
|
+
"@types/react-dom": "^19.0.0",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
51
51
|
"@typescript-eslint/parser": "^6.0.0",
|
|
52
52
|
"@vitejs/plugin-react": "^4.0.3",
|
|
@@ -60,17 +60,17 @@
|
|
|
60
60
|
"eslint": "^8.45.0",
|
|
61
61
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
62
62
|
"eslint-plugin-react-refresh": "^0.4.3",
|
|
63
|
-
"eslint-plugin-storybook": "^0.
|
|
63
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
64
64
|
"git-cz": "^4.9.0",
|
|
65
65
|
"lint-staged": "^14.0.1",
|
|
66
66
|
"path": "^0.12.7",
|
|
67
67
|
"postcss": "^8.4.29",
|
|
68
68
|
"postcss-prettify": "^0.3.4",
|
|
69
|
-
"react": "^
|
|
70
|
-
"react-dom": "^
|
|
69
|
+
"react": "^19.0.0",
|
|
70
|
+
"react-dom": "^19.0.0",
|
|
71
71
|
"rimraf": "^5.0.5",
|
|
72
|
-
"storybook": "^
|
|
73
|
-
"storybook-dark-mode": "^
|
|
72
|
+
"storybook": "^8.5.6",
|
|
73
|
+
"storybook-dark-mode": "^4.0.2",
|
|
74
74
|
"style-loader": "^3.3.3",
|
|
75
75
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
76
76
|
"typescript": "^5.0.2",
|
|
@@ -92,24 +92,24 @@
|
|
|
92
92
|
"@dnd-kit/core": "^6.3.1",
|
|
93
93
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
94
94
|
"@dnd-kit/sortable": "^10.0.0",
|
|
95
|
-
"@emotion/react": "^11.
|
|
95
|
+
"@emotion/react": "^11.14.0",
|
|
96
96
|
"@emotion/styled": "^11.11.0",
|
|
97
97
|
"@mui/icons-material": "^5.14.9",
|
|
98
98
|
"@mui/lab": "^5.0.0-alpha.152",
|
|
99
99
|
"@mui/material": "^5.16.7",
|
|
100
|
-
"@mui/x-date-pickers": "^
|
|
101
|
-
"@storybook/addon-mdx-gfm": "^
|
|
100
|
+
"@mui/x-date-pickers": "^7.26.0",
|
|
101
|
+
"@storybook/addon-mdx-gfm": "^8.5.6",
|
|
102
102
|
"@tanstack/react-table": "^8.10.7",
|
|
103
103
|
"dayjs": "^1.11.9",
|
|
104
104
|
"react-datepicker": "^7.5.0",
|
|
105
|
-
"react-i18next": "^
|
|
105
|
+
"react-i18next": "^15.4.0",
|
|
106
106
|
"react-select": "^5.8.0",
|
|
107
107
|
"styled-components": "^6.1.0",
|
|
108
108
|
"tslib": "^2.6.2"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
112
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
111
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
112
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
113
113
|
},
|
|
114
114
|
"browserslist": {
|
|
115
115
|
"production": [
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import * as S from "./styles"
|
|
3
|
-
import {
|
|
3
|
+
import { BreadCrumbProps, Item } from './interface';
|
|
4
|
+
import { Icons } from '../Icons';
|
|
5
|
+
import { Home } from '@mui/icons-material';
|
|
4
6
|
|
|
5
|
-
const Breadcrumb:React.FC<
|
|
6
|
-
const
|
|
7
|
-
return
|
|
7
|
+
const Breadcrumb: React.FC<BreadCrumbProps> = ({ items, onHomeClick, onPathClick }) => {
|
|
8
|
+
const listItems = useMemo(() => {
|
|
9
|
+
return items.map((item: Item, index: number, self: Item[]) => {
|
|
8
10
|
const showIcon = self.length > index + 1
|
|
11
|
+
const isFixedIcon = items[0] === item
|
|
9
12
|
return (
|
|
10
|
-
<div className='content' key={index}>
|
|
11
|
-
<
|
|
12
|
-
{
|
|
13
|
+
<div className='content' key={index} onClick={(event) => items[0] === item ? onHomeClick(event) : onPathClick(item, event)}>
|
|
14
|
+
{isFixedIcon && <Icons icon={Home} />}
|
|
15
|
+
{!isFixedIcon && item.icon && <Icons icon={item.icon} color='inherit' />}
|
|
16
|
+
<S.Item>{item.label}</S.Item>
|
|
17
|
+
{showIcon && <S.Divisor>/</S.Divisor>}
|
|
13
18
|
</div>
|
|
14
19
|
)
|
|
15
20
|
})
|
|
16
|
-
}, [
|
|
21
|
+
}, [items])
|
|
17
22
|
|
|
18
23
|
return (
|
|
19
24
|
<S.Container>
|
|
20
|
-
<S.
|
|
21
|
-
{
|
|
22
|
-
</S.
|
|
25
|
+
<S.ListItems>
|
|
26
|
+
{listItems}
|
|
27
|
+
</S.ListItems>
|
|
23
28
|
</S.Container>
|
|
24
29
|
)
|
|
25
30
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IconType } from "../../types";
|
|
2
|
+
import { SvgIconComponent } from "@mui/icons-material";
|
|
3
|
+
|
|
4
|
+
export interface Item {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
icon?: SvgIconComponent | IconType;
|
|
4
9
|
}
|
|
5
10
|
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
export interface BreadCrumbProps {
|
|
12
|
+
onPathClick: Function;
|
|
13
|
+
onHomeClick: Function;
|
|
14
|
+
items: Item[];
|
|
9
15
|
}
|
|
@@ -4,30 +4,29 @@ export const Container = styled.div`
|
|
|
4
4
|
margin: 0 0 16px 0;
|
|
5
5
|
`
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const ListItems = styled.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
gap: 8px;
|
|
10
10
|
.content {
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: 8px;
|
|
13
|
+
align-items: center;
|
|
13
14
|
}
|
|
14
15
|
`
|
|
15
16
|
|
|
16
|
-
export const
|
|
17
|
+
export const Item = styled.p`
|
|
17
18
|
color: #666;
|
|
18
19
|
font-size: 14px;
|
|
19
20
|
cursor: pointer;
|
|
21
|
+
&:hover {
|
|
22
|
+
text-decoration: underline;
|
|
23
|
+
}
|
|
20
24
|
`
|
|
21
25
|
|
|
22
|
-
export const
|
|
26
|
+
export const Divisor = styled.div`
|
|
23
27
|
display: flex;
|
|
24
28
|
align-items: center;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
display: inline-block;
|
|
29
|
-
padding: 2px;
|
|
30
|
-
transform: rotate(-45deg);
|
|
31
|
-
-webkit-transform: rotate(-45deg);
|
|
32
|
-
}
|
|
29
|
+
justify-content: center;
|
|
30
|
+
color: #666;
|
|
31
|
+
content: '/';
|
|
33
32
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
const useClickOutside = (ref: React.RefObject<HTMLElement>, callback: () => void) => {
|
|
3
|
+
const useClickOutside = (ref: React.RefObject<HTMLElement | null>, callback: () => void) => {
|
|
4
4
|
const handleClickOutside = (event: MouseEvent) => {
|
|
5
5
|
if (ref.current && !ref.current.contains(event.target as Node)) {
|
|
6
6
|
callback();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
import { Accordion } from '../components'
|
|
5
|
-
import { DataAccordion } from '../types'
|
|
6
|
-
import { Typography } from '@mui/material'
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
+
import { Accordion } from '../components'
|
|
5
|
+
import { DataAccordion } from '../types'
|
|
6
|
+
import { Typography } from '@mui/material'
|
|
7
7
|
|
|
8
8
|
const data: DataAccordion[] = [
|
|
9
9
|
{
|
|
@@ -11,8 +11,8 @@ const data: DataAccordion[] = [
|
|
|
11
11
|
id: 'panel-1',
|
|
12
12
|
children: (
|
|
13
13
|
<Typography>
|
|
14
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit
|
|
15
|
-
lobortis eget.
|
|
14
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit
|
|
15
|
+
amet blandit leo lobortis eget.
|
|
16
16
|
</Typography>
|
|
17
17
|
),
|
|
18
18
|
},
|
|
@@ -21,12 +21,12 @@ const data: DataAccordion[] = [
|
|
|
21
21
|
id: 'panel-2',
|
|
22
22
|
children: (
|
|
23
23
|
<Typography>
|
|
24
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit
|
|
25
|
-
lobortis eget.
|
|
24
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit
|
|
25
|
+
amet blandit leo lobortis eget.
|
|
26
26
|
</Typography>
|
|
27
27
|
),
|
|
28
28
|
},
|
|
29
|
-
]
|
|
29
|
+
]
|
|
30
30
|
|
|
31
31
|
const meta = {
|
|
32
32
|
title: 'Display/Accordion',
|
|
@@ -38,28 +38,28 @@ const meta = {
|
|
|
38
38
|
argTypes: {
|
|
39
39
|
data: data,
|
|
40
40
|
},
|
|
41
|
-
} satisfies Meta<typeof Accordion
|
|
41
|
+
} satisfies Meta<typeof Accordion>
|
|
42
42
|
|
|
43
|
-
export default meta
|
|
43
|
+
export default meta
|
|
44
44
|
|
|
45
|
-
type Story = StoryObj<typeof meta
|
|
45
|
+
type Story = StoryObj<typeof meta>
|
|
46
46
|
|
|
47
47
|
export const AccordionBasic = () => {
|
|
48
48
|
return (
|
|
49
49
|
<div style={{ width: '480px', marginBottom: 30 }}>
|
|
50
50
|
<Accordion data={data} />
|
|
51
51
|
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
AccordionBasic.storyName = 'Accordion Basic'
|
|
55
|
+
AccordionBasic.storyName = 'Accordion Basic'
|
|
56
56
|
|
|
57
57
|
export const AccordionExpanded = () => {
|
|
58
58
|
return (
|
|
59
59
|
<div style={{ width: '480px', marginBottom: 30 }}>
|
|
60
60
|
<Accordion data={data} defaultExpanded="panel-1" />
|
|
61
61
|
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
-
AccordionExpanded.storyName = 'Accordion Expanded'
|
|
65
|
+
AccordionExpanded.storyName = 'Accordion Expanded'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import type { Meta } from '@storybook/react'
|
|
4
|
-
import { Avatar, Icons } from '../components'
|
|
5
|
-
import { AvatarGroup, Stack } from '@mui/material'
|
|
6
|
-
import { green, pink } from '@mui/material/colors'
|
|
3
|
+
import type { Meta } from '@storybook/react'
|
|
4
|
+
import { Avatar, Icons } from '../components'
|
|
5
|
+
import { AvatarGroup, Stack } from '@mui/material'
|
|
6
|
+
import { green, pink } from '@mui/material/colors'
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
9
|
title: 'Display/Avatar',
|
|
@@ -13,28 +13,28 @@ const meta = {
|
|
|
13
13
|
},
|
|
14
14
|
tags: ['autodocs'],
|
|
15
15
|
argTypes: {},
|
|
16
|
-
} satisfies Meta<typeof Avatar
|
|
16
|
+
} satisfies Meta<typeof Avatar>
|
|
17
17
|
|
|
18
|
-
export default meta
|
|
18
|
+
export default meta
|
|
19
19
|
|
|
20
20
|
function stringToColor(string: string) {
|
|
21
|
-
let hash = 0
|
|
22
|
-
let i
|
|
21
|
+
let hash = 0
|
|
22
|
+
let i
|
|
23
23
|
|
|
24
24
|
/* eslint-disable no-bitwise */
|
|
25
25
|
for (i = 0; i < string.length; i += 1) {
|
|
26
|
-
hash = string.charCodeAt(i) + ((hash << 5) - hash)
|
|
26
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
let color = '#'
|
|
29
|
+
let color = '#'
|
|
30
30
|
|
|
31
31
|
for (i = 0; i < 3; i += 1) {
|
|
32
|
-
const value = (hash >> (i * 8)) & 0xff
|
|
33
|
-
color += `00${value.toString(16)}`.slice(-2)
|
|
32
|
+
const value = (hash >> (i * 8)) & 0xff
|
|
33
|
+
color += `00${value.toString(16)}`.slice(-2)
|
|
34
34
|
}
|
|
35
35
|
/* eslint-enable no-bitwise */
|
|
36
36
|
|
|
37
|
-
return color
|
|
37
|
+
return color
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function stringAvatar(name: string) {
|
|
@@ -43,7 +43,7 @@ function stringAvatar(name: string) {
|
|
|
43
43
|
bgcolor: stringToColor(name),
|
|
44
44
|
},
|
|
45
45
|
children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`,
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export const AvatarBasic = () => {
|
|
@@ -51,8 +51,8 @@ export const AvatarBasic = () => {
|
|
|
51
51
|
<>
|
|
52
52
|
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
53
53
|
</>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
56
|
|
|
57
57
|
export const AvatarVariants = () => {
|
|
58
58
|
return (
|
|
@@ -61,8 +61,8 @@ export const AvatarVariants = () => {
|
|
|
61
61
|
<Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
|
|
62
62
|
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
63
63
|
</Stack>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
66
|
|
|
67
67
|
export const AvatarLetters = () => {
|
|
68
68
|
return (
|
|
@@ -73,20 +73,24 @@ export const AvatarLetters = () => {
|
|
|
73
73
|
<Avatar {...stringAvatar('Tim Neutkens')} />
|
|
74
74
|
</Stack>
|
|
75
75
|
</>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
78
|
|
|
79
79
|
export const AvatarSizes = () => {
|
|
80
80
|
return (
|
|
81
81
|
<>
|
|
82
82
|
<Stack direction="row" spacing={2}>
|
|
83
|
-
<Avatar
|
|
83
|
+
<Avatar
|
|
84
|
+
src="https://mui.com/static/images/avatar/1.jpg"
|
|
85
|
+
variant="square"
|
|
86
|
+
sx={{ width: 24, height: 24 }}
|
|
87
|
+
/>
|
|
84
88
|
<Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
|
|
85
89
|
<Avatar src="https://mui.com/static/images/avatar/3.jpg" sx={{ width: 56, height: 56 }} />
|
|
86
90
|
</Stack>
|
|
87
91
|
</>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
90
94
|
|
|
91
95
|
export const AvatarWidthIcons = () => {
|
|
92
96
|
return (
|
|
@@ -103,8 +107,8 @@ export const AvatarWidthIcons = () => {
|
|
|
103
107
|
</Avatar>
|
|
104
108
|
</Stack>
|
|
105
109
|
</>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
110
|
+
)
|
|
111
|
+
}
|
|
108
112
|
|
|
109
113
|
export const AvatarGrouped = () => {
|
|
110
114
|
return (
|
|
@@ -119,5 +123,5 @@ export const AvatarGrouped = () => {
|
|
|
119
123
|
</AvatarGroup>
|
|
120
124
|
</Stack>
|
|
121
125
|
</>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
126
|
+
)
|
|
127
|
+
}
|