w-design-system 0.0.35 → 0.0.36
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/dist/components/Sidebar/SidebarGroup/styles.js +1 -1
- package/dist/components/Sidebar/SidebarItem/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarItem/styles.js +3 -1
- package/dist/components/Sidebar/SidebarItem/styles.js.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/index.d.ts +2 -1
- package/dist/components/Sidebar/SidebarLogo/index.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/index.js +2 -2
- package/dist/components/Sidebar/SidebarLogo/index.js.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/styles.d.ts +1 -0
- package/dist/components/Sidebar/SidebarLogo/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/styles.js +3 -2
- package/dist/components/Sidebar/SidebarLogo/styles.js.map +1 -1
- package/dist/components/Sidebar/index.d.ts +2 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +4 -3
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/components/Sidebar/stories.d.ts.map +1 -1
- package/dist/components/Sidebar/stories.js +62 -4
- package/dist/components/Sidebar/stories.js.map +1 -1
- package/dist/components/Sidebar/styles.d.ts +1 -0
- package/dist/components/Sidebar/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/styles.js +1 -2
- package/dist/components/Sidebar/styles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Sidebar/SidebarGroup/styles.ts +1 -1
- package/src/components/Sidebar/SidebarItem/styles.ts +3 -1
- package/src/components/Sidebar/SidebarLogo/index.tsx +3 -2
- package/src/components/Sidebar/SidebarLogo/styles.ts +4 -2
- package/src/components/Sidebar/index.tsx +5 -3
- package/src/components/Sidebar/stories.tsx +88 -30
- package/src/components/Sidebar/styles.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarItem/styles.ts"],"names":[],"mappings":"AAEA,UAAU,yBAAyB;IACjC,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarItem/styles.ts"],"names":[],"mappings":"AAEA,UAAU,yBAAyB;IACjC,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,SAAS,8PA2CrB,CAAA;AAED,eAAO,MAAM,MAAM,6NAiBlB,CAAA"}
|
|
@@ -10,9 +10,11 @@ export const Container = styled.div `
|
|
|
10
10
|
color: ${({ disabled }) => (disabled ? 'rgba(255,255,255,0.4)' : '#fff')};
|
|
11
11
|
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
|
12
12
|
border-radius: ${({ isInsideGroup }) => !isInsideGroup && '4px'};
|
|
13
|
+
|
|
13
14
|
&:hover {
|
|
14
|
-
background-color:
|
|
15
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
15
16
|
}
|
|
17
|
+
|
|
16
18
|
&:not(:last-child) {
|
|
17
19
|
border-bottom: ${({ isInsideGroup }) => isInsideGroup && '1px solid rgba(255, 255, 255, 0.1)'};
|
|
18
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarItem/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAStC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CA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CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBjE,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiB/B,CAAA"}
|
|
@@ -4,7 +4,8 @@ export interface SidebarLogoProps {
|
|
|
4
4
|
logoOpacity?: number;
|
|
5
5
|
setSidebarOpen: (value: boolean) => void;
|
|
6
6
|
logoUrl: string;
|
|
7
|
+
baseColor?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const SidebarLogo: ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl }: SidebarLogoProps) => React.JSX.Element;
|
|
9
|
+
declare const SidebarLogo: ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl, baseColor }: SidebarLogoProps) => React.JSX.Element;
|
|
9
10
|
export default SidebarLogo;
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,OAAO,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,WAAW,qEAAsE,gBAAgB,sBAStG,CAAA;AACD,eAAe,WAAW,CAAA"}
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { chevronLeftSVG, chevronRightSVG } from '../../../assets/icon';
|
|
3
3
|
import { IconWrapper } from '../../IconWrapper';
|
|
4
4
|
import { SidebarLogoContainer } from './styles';
|
|
5
|
-
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl }) => {
|
|
6
|
-
return (React.createElement(SidebarLogoContainer, { logoUrl: logoUrl, logoOpacity: logoOpacity, sidebarOpen: sidebarOpen },
|
|
5
|
+
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl, baseColor }) => {
|
|
6
|
+
return (React.createElement(SidebarLogoContainer, { logoUrl: logoUrl, logoOpacity: logoOpacity, sidebarOpen: sidebarOpen, baseColor: baseColor },
|
|
7
7
|
React.createElement("button", { type: "button", onClick: () => setSidebarOpen(!sidebarOpen), className: "close", "aria-label": "Fechar menu" },
|
|
8
8
|
React.createElement(IconWrapper, { src: sidebarOpen ? chevronRightSVG : chevronLeftSVG, color: "#fff", width: "12px", height: "12px" })),
|
|
9
9
|
React.createElement("div", { className: "logo" })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAU/C,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAoB,EAAE,EAAE;IACzG,OAAO,CACL,oBAAC,oBAAoB,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS;QAC9G,gCAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,EAAE,SAAS,EAAC,OAAO,gBAAY,aAAa;YAC3G,oBAAC,WAAW,IAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,EAAE,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,GAAG,CACrG;QACT,6BAAK,SAAS,EAAC,MAAM,GAAG,CACH,CACxB,CAAA;AACH,CAAC,CAAA;AACD,eAAe,WAAW,CAAA"}
|
|
@@ -2,6 +2,7 @@ interface SidebarLogoContainerProps {
|
|
|
2
2
|
logoOpacity?: number;
|
|
3
3
|
sidebarOpen: boolean;
|
|
4
4
|
logoUrl: string;
|
|
5
|
+
baseColor?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare const SidebarLogoContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SidebarLogoContainerProps>> & string;
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/styles.ts"],"names":[],"mappings":"AAGA,UAAU,yBAAyB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,oBAAoB,8PA4ChC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { theme } from '../../Themes';
|
|
2
3
|
export const SidebarLogoContainer = styled.div `
|
|
3
4
|
position: relative;
|
|
4
5
|
|
|
@@ -11,7 +12,7 @@ export const SidebarLogoContainer = styled.div `
|
|
|
11
12
|
height: 40px;
|
|
12
13
|
|
|
13
14
|
background: url(${({ logoUrl }) => logoUrl});
|
|
14
|
-
background-size: ${({ sidebarOpen
|
|
15
|
+
background-size: ${({ sidebarOpen }) => (sidebarOpen ? `202px 40px` : '141px 28px')};
|
|
15
16
|
background-repeat: no-repeat;
|
|
16
17
|
background-position: -8px 0px;
|
|
17
18
|
|
|
@@ -30,7 +31,7 @@ export const SidebarLogoContainer = styled.div `
|
|
|
30
31
|
height: var(--height);
|
|
31
32
|
width: var(--width);
|
|
32
33
|
|
|
33
|
-
background:
|
|
34
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
34
35
|
color: #fff;
|
|
35
36
|
|
|
36
37
|
border-radius: 0 var(--width) var(--width) 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/SidebarLogo/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AASpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAA2B;;;;;;;;;;;sBAWnD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;uBACvB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;;;;eAIxE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC;;;;;;;;;;;;;;;kBAelC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM;;;;;;;;;;;;;CAapE,CAAA"}
|
|
@@ -32,6 +32,7 @@ export interface SidebarProps {
|
|
|
32
32
|
groups: Record<string, SidebarGroupData>;
|
|
33
33
|
logoUrl: string;
|
|
34
34
|
logoOpacity?: number;
|
|
35
|
+
baseColor?: string;
|
|
35
36
|
}
|
|
36
|
-
export declare const Sidebar: ({ logoUrl, layout, currentItemId, currentGroupId, setLink, items, logoOpacity, groups, }: SidebarProps) => React.JSX.Element;
|
|
37
|
+
export declare const Sidebar: ({ logoUrl, layout, currentItemId, currentGroupId, setLink, items, logoOpacity, groups, baseColor, }: SidebarProps) => React.JSX.Element;
|
|
37
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CA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IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,CAAC,yBAAyB,GAAG,0BAA0B,GAAG,2BAA2B,CAAC,EAAE,CAAA;IAChG,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,OAAO,wGAUjB,YAAY,sBAqEd,CAAA"}
|
|
@@ -4,7 +4,7 @@ import SidebarItem from './SidebarItem';
|
|
|
4
4
|
import SidebarLogo from './SidebarLogo';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { SidebarContainer, SidebarScrollContainer, SidebarScrollWrapperContainer, SidebarSpacer } from './styles';
|
|
7
|
-
export const Sidebar = ({ logoUrl, layout, currentItemId, currentGroupId, setLink, items, logoOpacity, groups, }) => {
|
|
7
|
+
export const Sidebar = ({ logoUrl, layout, currentItemId, currentGroupId, setLink, items, logoOpacity, groups, baseColor, }) => {
|
|
8
8
|
const [sidebarOpen, setSidebarOpen] = useState(true);
|
|
9
9
|
const sidebarItemClickHandler = (itemId) => {
|
|
10
10
|
const item = items[itemId];
|
|
@@ -12,8 +12,9 @@ export const Sidebar = ({ logoUrl, layout, currentItemId, currentGroupId, setLin
|
|
|
12
12
|
if (link)
|
|
13
13
|
setLink(link);
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
console.log(baseColor);
|
|
16
|
+
return (React.createElement(SidebarContainer, { sidebarOpen: sidebarOpen, baseColor: baseColor },
|
|
17
|
+
React.createElement(SidebarLogo, { logoUrl: logoUrl, sidebarOpen: sidebarOpen, setSidebarOpen: setSidebarOpen, logoOpacity: logoOpacity, baseColor: baseColor }),
|
|
17
18
|
React.createElement(SidebarScrollWrapperContainer, null,
|
|
18
19
|
React.createElement(SidebarScrollContainer, null, layout
|
|
19
20
|
.map((item, index) => (Object.assign({ id: index, disabled: undefined }, item)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Sidebar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,WAAW,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Sidebar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,WAAW,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K,CAAC,EAAE,CAAC,0CAAE,UAAU,MAAK,KAAK,CAAA,EAAA,CAAC;yBAC7C,GAAG,CAAC,EAAE,CAAC,EAAE;;wBAAC,OAAA,CACT,oBAAC,WAAW,IACV,GAAG,EAAE,EAAE,EACP,KAAK,EAAE,MAAA,KAAK,CAAC,EAAE,CAAC,0CAAE,SAAS,EAC3B,QAAQ,EAAE,MAAA,KAAK,CAAC,EAAE,CAAC,0CAAE,QAAQ,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAC1C,aAAa,EAAE,aAAa,KAAK,EAAE,EACnC,WAAW,EAAE,WAAW,EACxB,aAAa,SACb,CACH,CAAA;qBAAA,CAAC,CACS,CAChB,CAAA;gBACH,CAAC;gBACD,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CACmB,CACK,CACf,CACpB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAIjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAIjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CA8DC,CAAA;AAEhC,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AAErC,eAAO,MAAM,UAAU,EAAE,KAkCxB,CAAA"}
|
|
@@ -6,11 +6,69 @@ const meta = {
|
|
|
6
6
|
title: 'Components/Sidebar',
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
component: Sidebar,
|
|
9
|
+
argTypes: {
|
|
10
|
+
layout: {
|
|
11
|
+
control: 'object',
|
|
12
|
+
description: 'Array of sidebar layout',
|
|
13
|
+
},
|
|
14
|
+
currentItemId: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Current item id',
|
|
17
|
+
},
|
|
18
|
+
currentGroupId: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Current group id',
|
|
21
|
+
},
|
|
22
|
+
setLink: {
|
|
23
|
+
action: 'setLink',
|
|
24
|
+
description: 'Function to set link',
|
|
25
|
+
},
|
|
26
|
+
items: {
|
|
27
|
+
control: 'object',
|
|
28
|
+
description: 'Items data',
|
|
29
|
+
},
|
|
30
|
+
groups: {
|
|
31
|
+
control: 'object',
|
|
32
|
+
description: 'Groups data',
|
|
33
|
+
},
|
|
34
|
+
logoUrl: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Logo url',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
args: {
|
|
40
|
+
layout: [
|
|
41
|
+
{
|
|
42
|
+
type: 'item',
|
|
43
|
+
id: 'DASHBOARD',
|
|
44
|
+
},
|
|
45
|
+
{ type: 'group', id: 'group1' },
|
|
46
|
+
],
|
|
47
|
+
currentItemId: 'DASHBOARD',
|
|
48
|
+
currentGroupId: 'DASHBOARD',
|
|
49
|
+
items: {
|
|
50
|
+
DASHBOARD: {
|
|
51
|
+
menuTitle: 'Dashboard',
|
|
52
|
+
icon: dashboardSVG,
|
|
53
|
+
link: '/dashboard',
|
|
54
|
+
disabled: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
groups: {
|
|
58
|
+
group1: {
|
|
59
|
+
name: 'Group 1',
|
|
60
|
+
icon: dashboardSVG,
|
|
61
|
+
itemIds: ['DASHBOARD'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
logoUrl: '',
|
|
65
|
+
baseColor: '',
|
|
66
|
+
},
|
|
9
67
|
};
|
|
10
68
|
export default meta;
|
|
11
69
|
export const Playground = {
|
|
12
|
-
render:
|
|
13
|
-
return (React.createElement(Sidebar, { layout: [
|
|
70
|
+
render: args => {
|
|
71
|
+
return (React.createElement(Sidebar, Object.assign({}, args, { layout: [
|
|
14
72
|
{
|
|
15
73
|
type: 'item',
|
|
16
74
|
id: 'DASHBOARD',
|
|
@@ -21,7 +79,7 @@ export const Playground = {
|
|
|
21
79
|
menuTitle: 'Dashboard',
|
|
22
80
|
icon: dashboardSVG,
|
|
23
81
|
link: '/dashboard',
|
|
24
|
-
disabled:
|
|
82
|
+
disabled: false,
|
|
25
83
|
},
|
|
26
84
|
}, currentItemId: '', currentGroupId: '', setLink: action('setLink'), groups: {
|
|
27
85
|
group1: {
|
|
@@ -29,7 +87,7 @@ export const Playground = {
|
|
|
29
87
|
icon: dashboardSVG,
|
|
30
88
|
itemIds: ['DASHBOARD'],
|
|
31
89
|
},
|
|
32
|
-
}, logoUrl: '' }));
|
|
90
|
+
}, logoUrl: '' })));
|
|
33
91
|
},
|
|
34
92
|
};
|
|
35
93
|
//# sourceMappingURL=stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../src/components/Sidebar/stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,IAAI,GAAyB;IACjC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../src/components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ACN,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,CAAC,WAAW,CAAC;aACvB;SACF;QACD,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;KACd;CAC6B,CAAA;AAEhC,eAAe,IAAI,CAAA;AAInB,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,MAAM,EAAE,IAAI,CAAC,EAAE;QACb,OAAO,CACL,oBAAC,OAAO,oBACF,IAAI,IACR,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,MAAM;oBACZ,EAAE,EAAE,WAAW;iBAChB;gBACD,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE;aAChC,EACD,KAAK,EAAE;gBACL,SAAS,EAAE;oBACT,SAAS,EAAE,WAAW;oBACtB,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,KAAK;iBAChB;aACF,EACD,aAAa,EAAE,EAAE,EACjB,cAAc,EAAE,EAAE,EAClB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,EAC1B,MAAM,EAAE;gBACN,MAAM,EAAE;oBACN,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,YAAY;oBAClB,OAAO,EAAE,CAAC,WAAW,CAAC;iBACvB;aACF,EACD,OAAO,EAAE,EAAE,IACX,CACH,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface SidebarContainerProps {
|
|
2
2
|
sidebarOpen: boolean;
|
|
3
|
+
baseColor?: string;
|
|
3
4
|
}
|
|
4
5
|
export declare const SidebarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SidebarContainerProps>> & string;
|
|
5
6
|
export declare const SidebarScrollContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,WAAW,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,0PA2B5B,CAAA;AAED,eAAO,MAAM,sBAAsB,6NAMlC,CAAA;AAED,eAAO,MAAM,6BAA6B,6NA8BzC,CAAA;AAED,eAAO,MAAM,aAAa,6NAEzB,CAAA"}
|
|
@@ -7,13 +7,12 @@ export const SidebarContainer = styled.div `
|
|
|
7
7
|
position: relative;
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
color: white;
|
|
10
|
-
background: ${theme.colors.cyan50};
|
|
11
10
|
height: 100vh;
|
|
12
11
|
height: 100dvh;
|
|
13
12
|
padding: 16px 16px 0 16px;
|
|
14
13
|
width: min-content;
|
|
15
14
|
border-radius: ${({ sidebarOpen }) => sidebarOpen && '0 60px 0px 0;'};
|
|
16
|
-
|
|
15
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
17
16
|
/* Mantenha o estilo do container ao passar o mouse */
|
|
18
17
|
&:hover {
|
|
19
18
|
&::-webkit-scrollbar {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAOjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;;;;;;;;mBAW9C,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,IAAI,eAAe;gBACtD,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM;;;;;;;;;;;;;;;CAelE,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM/C,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BtD,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEtC,CAAA"}
|
package/package.json
CHANGED
|
@@ -18,9 +18,11 @@ export const Container = styled.div<SidebarItemContainerProps>`
|
|
|
18
18
|
color: ${({ disabled }) => (disabled ? 'rgba(255,255,255,0.4)' : '#fff')};
|
|
19
19
|
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
|
20
20
|
border-radius: ${({ isInsideGroup }) => !isInsideGroup && '4px'};
|
|
21
|
+
|
|
21
22
|
&:hover {
|
|
22
|
-
background-color:
|
|
23
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
&:not(:last-child) {
|
|
25
27
|
border-bottom: ${({ isInsideGroup }) => isInsideGroup && '1px solid rgba(255, 255, 255, 0.1)'};
|
|
26
28
|
}
|
|
@@ -8,11 +8,12 @@ export interface SidebarLogoProps {
|
|
|
8
8
|
logoOpacity?: number
|
|
9
9
|
setSidebarOpen: (value: boolean) => void
|
|
10
10
|
logoUrl: string
|
|
11
|
+
baseColor?: string
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl }: SidebarLogoProps) => {
|
|
14
|
+
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl, baseColor }: SidebarLogoProps) => {
|
|
14
15
|
return (
|
|
15
|
-
<SidebarLogoContainer logoUrl={logoUrl} logoOpacity={logoOpacity} sidebarOpen={sidebarOpen}>
|
|
16
|
+
<SidebarLogoContainer logoUrl={logoUrl} logoOpacity={logoOpacity} sidebarOpen={sidebarOpen} baseColor={baseColor}>
|
|
16
17
|
<button type="button" onClick={() => setSidebarOpen(!sidebarOpen)} className="close" aria-label="Fechar menu">
|
|
17
18
|
<IconWrapper src={sidebarOpen ? chevronRightSVG : chevronLeftSVG} color="#fff" width="12px" height="12px" />
|
|
18
19
|
</button>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import styled from 'styled-components'
|
|
2
|
+
import { theme } from '../../Themes'
|
|
2
3
|
|
|
3
4
|
interface SidebarLogoContainerProps {
|
|
4
5
|
logoOpacity?: number
|
|
5
6
|
sidebarOpen: boolean
|
|
6
7
|
logoUrl: string
|
|
8
|
+
baseColor?: string
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
@@ -18,7 +20,7 @@ export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
|
18
20
|
height: 40px;
|
|
19
21
|
|
|
20
22
|
background: url(${({ logoUrl }) => logoUrl});
|
|
21
|
-
background-size: ${({ sidebarOpen
|
|
23
|
+
background-size: ${({ sidebarOpen }) => (sidebarOpen ? `202px 40px` : '141px 28px')};
|
|
22
24
|
background-repeat: no-repeat;
|
|
23
25
|
background-position: -8px 0px;
|
|
24
26
|
|
|
@@ -37,7 +39,7 @@ export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
|
37
39
|
height: var(--height);
|
|
38
40
|
width: var(--width);
|
|
39
41
|
|
|
40
|
-
background:
|
|
42
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
41
43
|
color: #fff;
|
|
42
44
|
|
|
43
45
|
border-radius: 0 var(--width) var(--width) 0;
|
|
@@ -44,6 +44,7 @@ export interface SidebarProps {
|
|
|
44
44
|
groups: Record<string, SidebarGroupData>
|
|
45
45
|
logoUrl: string
|
|
46
46
|
logoOpacity?: number
|
|
47
|
+
baseColor?: string
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export const Sidebar = ({
|
|
@@ -55,22 +56,23 @@ export const Sidebar = ({
|
|
|
55
56
|
items,
|
|
56
57
|
logoOpacity,
|
|
57
58
|
groups,
|
|
59
|
+
baseColor,
|
|
58
60
|
}: SidebarProps) => {
|
|
59
61
|
const [sidebarOpen, setSidebarOpen] = useState(true)
|
|
60
|
-
|
|
61
62
|
const sidebarItemClickHandler = (itemId: string) => {
|
|
62
63
|
const item = items[itemId]
|
|
63
64
|
const link = item?.link
|
|
64
65
|
if (link) setLink(link)
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
console.log(baseColor)
|
|
67
68
|
return (
|
|
68
|
-
<SidebarContainer sidebarOpen={sidebarOpen}>
|
|
69
|
+
<SidebarContainer sidebarOpen={sidebarOpen} baseColor={baseColor}>
|
|
69
70
|
<SidebarLogo
|
|
70
71
|
logoUrl={logoUrl}
|
|
71
72
|
sidebarOpen={sidebarOpen}
|
|
72
73
|
setSidebarOpen={setSidebarOpen}
|
|
73
74
|
logoOpacity={logoOpacity}
|
|
75
|
+
baseColor={baseColor}
|
|
74
76
|
/>
|
|
75
77
|
<SidebarScrollWrapperContainer>
|
|
76
78
|
<SidebarScrollContainer>
|
|
@@ -7,8 +7,65 @@ import { dashboardSVG } from '../../assets/icon'
|
|
|
7
7
|
const meta: Meta<typeof Sidebar> = {
|
|
8
8
|
title: 'Components/Sidebar',
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
-
|
|
11
10
|
component: Sidebar,
|
|
11
|
+
argTypes: {
|
|
12
|
+
layout: {
|
|
13
|
+
control: 'object',
|
|
14
|
+
description: 'Array of sidebar layout',
|
|
15
|
+
},
|
|
16
|
+
currentItemId: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Current item id',
|
|
19
|
+
},
|
|
20
|
+
currentGroupId: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Current group id',
|
|
23
|
+
},
|
|
24
|
+
setLink: {
|
|
25
|
+
action: 'setLink',
|
|
26
|
+
description: 'Function to set link',
|
|
27
|
+
},
|
|
28
|
+
items: {
|
|
29
|
+
control: 'object',
|
|
30
|
+
description: 'Items data',
|
|
31
|
+
},
|
|
32
|
+
groups: {
|
|
33
|
+
control: 'object',
|
|
34
|
+
description: 'Groups data',
|
|
35
|
+
},
|
|
36
|
+
logoUrl: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'Logo url',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
args: {
|
|
42
|
+
layout: [
|
|
43
|
+
{
|
|
44
|
+
type: 'item',
|
|
45
|
+
id: 'DASHBOARD',
|
|
46
|
+
},
|
|
47
|
+
{ type: 'group', id: 'group1' },
|
|
48
|
+
],
|
|
49
|
+
currentItemId: 'DASHBOARD',
|
|
50
|
+
currentGroupId: 'DASHBOARD',
|
|
51
|
+
items: {
|
|
52
|
+
DASHBOARD: {
|
|
53
|
+
menuTitle: 'Dashboard',
|
|
54
|
+
icon: dashboardSVG,
|
|
55
|
+
link: '/dashboard',
|
|
56
|
+
disabled: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
groups: {
|
|
60
|
+
group1: {
|
|
61
|
+
name: 'Group 1',
|
|
62
|
+
icon: dashboardSVG,
|
|
63
|
+
itemIds: ['DASHBOARD'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
logoUrl: '',
|
|
67
|
+
baseColor: '',
|
|
68
|
+
},
|
|
12
69
|
} satisfies Meta<typeof Sidebar>
|
|
13
70
|
|
|
14
71
|
export default meta
|
|
@@ -16,36 +73,37 @@ export default meta
|
|
|
16
73
|
type Story = StoryObj<typeof Sidebar>
|
|
17
74
|
|
|
18
75
|
export const Playground: Story = {
|
|
19
|
-
render:
|
|
76
|
+
render: args => {
|
|
20
77
|
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
<Sidebar
|
|
79
|
+
{...args}
|
|
80
|
+
layout={[
|
|
81
|
+
{
|
|
82
|
+
type: 'item',
|
|
83
|
+
id: 'DASHBOARD',
|
|
84
|
+
},
|
|
85
|
+
{ type: 'group', id: 'group1' },
|
|
86
|
+
]}
|
|
87
|
+
items={{
|
|
88
|
+
DASHBOARD: {
|
|
89
|
+
menuTitle: 'Dashboard',
|
|
90
|
+
icon: dashboardSVG,
|
|
91
|
+
link: '/dashboard',
|
|
92
|
+
disabled: false,
|
|
93
|
+
},
|
|
94
|
+
}}
|
|
95
|
+
currentItemId={''}
|
|
96
|
+
currentGroupId={''}
|
|
97
|
+
setLink={action('setLink')}
|
|
98
|
+
groups={{
|
|
99
|
+
group1: {
|
|
100
|
+
name: 'Group 1',
|
|
101
|
+
icon: dashboardSVG,
|
|
102
|
+
itemIds: ['DASHBOARD'],
|
|
103
|
+
},
|
|
104
|
+
}}
|
|
105
|
+
logoUrl={''}
|
|
106
|
+
/>
|
|
49
107
|
)
|
|
50
108
|
},
|
|
51
109
|
}
|
|
@@ -3,6 +3,7 @@ import { theme } from '../Themes'
|
|
|
3
3
|
|
|
4
4
|
interface SidebarContainerProps {
|
|
5
5
|
sidebarOpen: boolean
|
|
6
|
+
baseColor?: string
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export const SidebarContainer = styled.div<SidebarContainerProps>`
|
|
@@ -12,13 +13,12 @@ export const SidebarContainer = styled.div<SidebarContainerProps>`
|
|
|
12
13
|
position: relative;
|
|
13
14
|
box-sizing: border-box;
|
|
14
15
|
color: white;
|
|
15
|
-
background: ${theme.colors.cyan50};
|
|
16
16
|
height: 100vh;
|
|
17
17
|
height: 100dvh;
|
|
18
18
|
padding: 16px 16px 0 16px;
|
|
19
19
|
width: min-content;
|
|
20
20
|
border-radius: ${({ sidebarOpen }) => sidebarOpen && '0 60px 0px 0;'};
|
|
21
|
-
|
|
21
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
22
22
|
/* Mantenha o estilo do container ao passar o mouse */
|
|
23
23
|
&:hover {
|
|
24
24
|
&::-webkit-scrollbar {
|