@maelstrom-futurism/sidebar 0.7.4-beta.0
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/LICENSE.md +21 -0
- package/dist/Heading.d.ts +10 -0
- package/dist/Heading.d.ts.map +1 -0
- package/dist/Heading.js +25 -0
- package/dist/Heading.js.map +1 -0
- package/dist/Item.d.ts +3 -0
- package/dist/Item.d.ts.map +1 -0
- package/dist/Item.js +8 -0
- package/dist/Item.js.map +1 -0
- package/dist/Sidebar.d.ts +23 -0
- package/dist/Sidebar.d.ts.map +1 -0
- package/dist/Sidebar.js +59 -0
- package/dist/Sidebar.js.map +1 -0
- package/dist/SidebarContext.d.ts +8 -0
- package/dist/SidebarContext.d.ts.map +1 -0
- package/dist/SidebarContext.js +3 -0
- package/dist/SidebarContext.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 OSMstudios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../src/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAQ9C,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,OAAO;gBAAe,YAAY,GAAG,SAAS;;CAiCnD,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
package/dist/Heading.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { css } from "@emotion/react";
|
|
4
|
+
import { Button } from "@maelstrom-futurism/button";
|
|
5
|
+
import { useTheme } from "@maelstrom-futurism/core";
|
|
6
|
+
import { Icon } from "@maelstrom-futurism/icons";
|
|
7
|
+
import { SidebarContext } from "./SidebarContext";
|
|
8
|
+
const Heading = ({ title }) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const sidebarContext = useContext(SidebarContext);
|
|
11
|
+
const headingStyle = css `
|
|
12
|
+
padding: 0.5rem 1rem;
|
|
13
|
+
${sidebarContext.isOpen ? `border-bottom: inset 2px ${theme.color('borderMuted')}` : "border-bottom: none"};
|
|
14
|
+
|
|
15
|
+
${sidebarContext.isOpen && `h2 {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}`}
|
|
20
|
+
`;
|
|
21
|
+
return (_jsx("div", { css: headingStyle, children: _jsxs("h2", { children: [sidebarContext.isOpen && (_jsx("div", { children: title })), sidebarContext.isClosable && (_jsx(Button, { variant: "ghost", onClick: () => sidebarContext.setIsOpen(!sidebarContext.isOpen), children: sidebarContext.isOpen ? (_jsx(Icon, { icon: "AngleLeft" })) : (_jsx(Icon, { icon: "MenuBurger" })) }))] }) }));
|
|
22
|
+
};
|
|
23
|
+
Heading.displayName = "Heading";
|
|
24
|
+
export default Heading;
|
|
25
|
+
//# sourceMappingURL=Heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../src/Heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,MAAM,OAAO,GAAG,CAAC,EAAE,KAAK,EAAgB,EAAa,EAAE;IACnD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,GAAG,CAAA;;UAElB,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB;;UAExG,cAAc,CAAC,MAAM,IAAI;;;;UAIzB;KACL,CAAC;IAEF,OAAO,CACH,cAAK,GAAG,EAAE,YAAY,YAClB,yBACK,cAAc,CAAC,MAAM,IAAI,CAAC,wBAAM,KAAK,GAAO,CAAC,EAE7C,cAAc,CAAC,UAAU,IAAI,CAC1B,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,YAClF,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CACrB,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,GAAE,CAC3B,CAAC,CAAC,CAAC,CACA,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAE,CAC5B,GACI,CACZ,IAEA,GACH,CACT,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAEhC,eAAe,OAAO,CAAC"}
|
package/dist/Item.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../src/Item.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,SAAS;CAEzB"}
|
package/dist/Item.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/react";
|
|
3
|
+
const menuItemContainer = css `
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
`;
|
|
7
|
+
const Item = ({}) => _jsx("div", { css: menuItemContainer });
|
|
8
|
+
//# sourceMappingURL=Item.js.map
|
package/dist/Item.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../src/Item.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;CAG5B,CAAC;AAMF,MAAM,IAAI,GAAG,CAAC,EAAa,EAAa,EAAE,CAAC,cAAK,GAAG,EAAE,iBAAiB,GAAI,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styling ideas: https://freefrontend.com/css-sidebar-menus/
|
|
3
|
+
*
|
|
4
|
+
* https://cloudscape.design/get-started/integration/global-styles/ <- i like this
|
|
5
|
+
*
|
|
6
|
+
* Sidebar > Item > Item (A sidebar has items and those items have items)
|
|
7
|
+
*/
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
interface SidebarProps {
|
|
10
|
+
name?: string;
|
|
11
|
+
isClosable?: boolean;
|
|
12
|
+
isOpen?: boolean;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Sidebar: {
|
|
16
|
+
({ isClosable, isOpen, children }: SidebarProps): ReactNode;
|
|
17
|
+
Heading: {
|
|
18
|
+
({ title }: import("./Heading").HeadingProps): ReactNode;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default Sidebar;
|
|
23
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../src/Sidebar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAO5C,UAAU,YAAY;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,OAAO;uCAIV,YAAY,GAAG,SAAS;;;;;CAoD1B,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
package/dist/Sidebar.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Styling ideas: https://freefrontend.com/css-sidebar-menus/
|
|
4
|
+
*
|
|
5
|
+
* https://cloudscape.design/get-started/integration/global-styles/ <- i like this
|
|
6
|
+
*
|
|
7
|
+
* Sidebar > Item > Item (A sidebar has items and those items have items)
|
|
8
|
+
*/
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { useTheme } from '@maelstrom-futurism/core';
|
|
12
|
+
import Heading from './Heading';
|
|
13
|
+
import { SidebarContext } from './SidebarContext';
|
|
14
|
+
const Sidebar = ({ isClosable = false, isOpen = true, children }) => {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const [isOpenState, setIsOpenState] = useState(isOpen);
|
|
17
|
+
const openStyle = css `
|
|
18
|
+
overflow-x: hidden;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
min-width: 300px;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
|
|
23
|
+
border-right: solid 1px ${theme.color('borderMuted')};
|
|
24
|
+
`;
|
|
25
|
+
const closedStyle = css `
|
|
26
|
+
width: 65px;
|
|
27
|
+
height: 44px;
|
|
28
|
+
|
|
29
|
+
ul, hr, a {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const sidebarContainer = css `
|
|
34
|
+
position: sticky;
|
|
35
|
+
|
|
36
|
+
ul {
|
|
37
|
+
list-style: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
hr {
|
|
41
|
+
border: 0;
|
|
42
|
+
border-top: solid 1px ${theme.color('borderMuted')};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
a {
|
|
46
|
+
color: ${theme.color('textColor')};
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
a:hover {
|
|
51
|
+
color: ${theme.color('linkColor')};
|
|
52
|
+
text-decoration: underline;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
return (_jsx("aside", { css: [sidebarContainer, isOpenState ? openStyle : closedStyle], children: _jsx(SidebarContext.Provider, { value: { isOpen: isOpenState, setIsOpen: setIsOpenState, isClosable }, children: children }) }));
|
|
56
|
+
};
|
|
57
|
+
Sidebar.Heading = Heading;
|
|
58
|
+
export default Sidebar;
|
|
59
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../src/Sidebar.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlD,MAAM,OAAO,GAAG,CAAC,EACb,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,IAAI,EACb,QAAQ,EACG,EAAa,EAAE;IAC1B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEvD,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;kCAMS,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC;KACvD,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;KAOtB,CAAC;IAEF,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;oCASI,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC;;;;qBAIzC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;;;;;qBAKxB,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;;;KAGxC,CAAC;IAEF,OAAO,CACH,gBAAO,GAAG,EAAE,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,YACjE,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,YACzF,QAAQ,GACa,GACtB,CACX,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAE1B,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarContext.d.ts","sourceRoot":"","sources":["../src/SidebarContext.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,cAAc,yCAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarContext.js","sourceRoot":"","sources":["../src/SidebarContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,EAAoB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maelstrom-futurism/sidebar",
|
|
3
|
+
"version": "0.7.4-beta.0",
|
|
4
|
+
"description": "A flexible sidebar component for navigation",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"typings": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"test": "vitest run --coverage",
|
|
21
|
+
"test:dev": "vitest",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"author": "Dawson Goodell <dawsong@osmstudios.com>",
|
|
25
|
+
"homepage": "https://osmstudios.com",
|
|
26
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/DawsonG/maelstrom-futurism.git",
|
|
30
|
+
"directory": "packages/sidebar"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@maelstrom-futurism/button": "^0.7.4-beta.0",
|
|
34
|
+
"@maelstrom-futurism/core": "^0.7.4-beta.0",
|
|
35
|
+
"@maelstrom-futurism/icons": "^0.7.4-alpha.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependences": {
|
|
38
|
+
"react": ">= 18.0.0",
|
|
39
|
+
"react-dom": ">= 18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "e1ece2ae9ed8f855378d20e7a87636b3bd15a556"
|
|
42
|
+
}
|