glassine-paper 1.0.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 +21 -0
- package/README.md +85 -0
- package/lib/AppBar.d.ts +81 -0
- package/lib/AppBar.d.ts.map +1 -0
- package/lib/AppBar.js +85 -0
- package/lib/AppBar.js.map +1 -0
- package/lib/Button.d.ts +89 -0
- package/lib/Button.d.ts.map +1 -0
- package/lib/Button.js +83 -0
- package/lib/Button.js.map +1 -0
- package/lib/Menu.d.ts +59 -0
- package/lib/Menu.d.ts.map +1 -0
- package/lib/Menu.js +49 -0
- package/lib/Menu.js.map +1 -0
- package/lib/NavDrawer.d.ts +63 -0
- package/lib/NavDrawer.d.ts.map +1 -0
- package/lib/NavDrawer.js +55 -0
- package/lib/NavDrawer.js.map +1 -0
- package/lib/Slider.d.ts +70 -0
- package/lib/Slider.d.ts.map +1 -0
- package/lib/Slider.js +104 -0
- package/lib/Slider.js.map +1 -0
- package/lib/Tabs.d.ts +50 -0
- package/lib/Tabs.d.ts.map +1 -0
- package/lib/Tabs.js +42 -0
- package/lib/Tabs.js.map +1 -0
- package/lib/TextField.d.ts +68 -0
- package/lib/TextField.d.ts.map +1 -0
- package/lib/TextField.js +52 -0
- package/lib/TextField.js.map +1 -0
- package/lib/Toolbar.d.ts +62 -0
- package/lib/Toolbar.d.ts.map +1 -0
- package/lib/Toolbar.js +54 -0
- package/lib/Toolbar.js.map +1 -0
- package/lib/glassine-paper.min.css +1 -0
- package/lib/glassine-paper.min.css.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michinobu Maeda
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Glassine Paper
|
|
2
|
+
|
|
3
|
+
CSS and some React components for Material Design 3
|
|
4
|
+
|
|
5
|
+
- [API Documentation](docs/api.md)
|
|
6
|
+
- [Sample](https://pages.michinobu.jp/glassine-paper/sample)
|
|
7
|
+
- [Theme color generator](https://pages.michinobu.jp/glassine-paper/theme)
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
@import url('https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900,900i');
|
|
13
|
+
@import './glassine-paper-variables.css';
|
|
14
|
+
@import './theme.css';
|
|
15
|
+
@import './glassine-paper.min.css';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`glassine-paper-variables.css` with default values
|
|
19
|
+
|
|
20
|
+
```css
|
|
21
|
+
:root {
|
|
22
|
+
--color-scheme: light dark;
|
|
23
|
+
|
|
24
|
+
--root-font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
25
|
+
--root-font-size: 16px;
|
|
26
|
+
--root-font-weight: 400;
|
|
27
|
+
|
|
28
|
+
--app-bar-z-index: 4;
|
|
29
|
+
--nav-bar-z-index: 6;
|
|
30
|
+
--nav-bar-height: calc(64px + env(safe-area-inset-bottom));
|
|
31
|
+
--nav-rail-z-index: 8;
|
|
32
|
+
--nav-rail-width: 240px;
|
|
33
|
+
--nav-drawer-z-index: 10;
|
|
34
|
+
--nav-drawer-width: 360px;
|
|
35
|
+
|
|
36
|
+
--menu-width: 256px;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
Install from GitHub repository:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install github:MichinobuMaeda/glassine-paper
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Import CSS
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
import 'glassine-paper/css';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```css
|
|
55
|
+
@import 'glassine-paper/css';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Import React Components
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
// Import all components
|
|
62
|
+
import { Button, Slider, TextField } from 'glassine-paper';
|
|
63
|
+
|
|
64
|
+
// Or import individual components
|
|
65
|
+
import { Button } from 'glassine-paper/Button';
|
|
66
|
+
import { Slider } from 'glassine-paper/Slider';
|
|
67
|
+
import { TextField } from 'glassine-paper/TextField';
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/MichinobuMaeda/glassine-paper.git
|
|
74
|
+
cd glassine-paper
|
|
75
|
+
npm install
|
|
76
|
+
|
|
77
|
+
# Build all
|
|
78
|
+
npm run build
|
|
79
|
+
|
|
80
|
+
# Watch and compile SCSS changes
|
|
81
|
+
npm run watch
|
|
82
|
+
|
|
83
|
+
# Start development server (theme generator UI)
|
|
84
|
+
npm start
|
|
85
|
+
```
|
package/lib/AppBar.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { type ReactNode, type CSSProperties } from 'react';
|
|
2
|
+
export interface AppBarItemProps {
|
|
3
|
+
key?: string | number;
|
|
4
|
+
id?: string;
|
|
5
|
+
type?: 'button' | 'appLogo' | 'title' | 'spacer';
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
title?: string;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
href?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AppBarProps {
|
|
16
|
+
id?: string;
|
|
17
|
+
items: Iterable<AppBarItemProps>;
|
|
18
|
+
sticky?: boolean;
|
|
19
|
+
scrolled?: boolean;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Material Design 3 App bar component
|
|
24
|
+
*
|
|
25
|
+
* @param props AppBarProps
|
|
26
|
+
* @param props.id Element id
|
|
27
|
+
* @param props.items Array of AppBarItem configurations
|
|
28
|
+
* @param props.items[].key Unique key for the item
|
|
29
|
+
* @param props.items[].id Element id for the item
|
|
30
|
+
* @param props.items[].type Item type: 'button', 'appLogo', 'title', or 'spacer'
|
|
31
|
+
* @param props.items[].icon Icon element (svg or img)
|
|
32
|
+
* @param props.items[].title Title text
|
|
33
|
+
* @param props.items[].subtitle Subtitle text
|
|
34
|
+
* @param props.items[].active Active state
|
|
35
|
+
* @param props.items[].hidden Hidden state
|
|
36
|
+
* @param props.items[].disabled Disabled state
|
|
37
|
+
* @param props.items[].onClick Click handler
|
|
38
|
+
* @param props.items[].href Link URL (renders as anchor tag)
|
|
39
|
+
* @param props.sticky Whether the app bar sticks to the top
|
|
40
|
+
* @param props.scrolled Whether the content is scrolled (affects styling)
|
|
41
|
+
* @param props.style Custom inline styles
|
|
42
|
+
* @returns JSX.Element
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* import useDetectScroll, { Axis } from '@smakss/react-scroll-direction';
|
|
46
|
+
*
|
|
47
|
+
* const [scrolled, setScrolled] = useState(false);
|
|
48
|
+
* const { scrollPosition } = useDetectScroll({ axis: Axis.X });
|
|
49
|
+
*
|
|
50
|
+
* useEffect(() => {
|
|
51
|
+
* setScrolled(scrollPosition.top > 0);
|
|
52
|
+
* }, [scrollPosition]);
|
|
53
|
+
*
|
|
54
|
+
* <AppBar
|
|
55
|
+
* sticky
|
|
56
|
+
* scrolled={scrolled}
|
|
57
|
+
* items={[
|
|
58
|
+
* {
|
|
59
|
+
* icon: <svg>...</svg>,
|
|
60
|
+
* onClick: () => {...},
|
|
61
|
+
* },
|
|
62
|
+
* {
|
|
63
|
+
* type: "appLogo",
|
|
64
|
+
* icon: <img src="./favicon.svg" alt="Glassine Paper" />,
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* type: "title",
|
|
68
|
+
* title: "App name",
|
|
69
|
+
* subtitle: "Description",
|
|
70
|
+
* },
|
|
71
|
+
* { type: "spacer" },
|
|
72
|
+
* {
|
|
73
|
+
* icon: <svg>...</svg>,
|
|
74
|
+
* onClick: () => {...},
|
|
75
|
+
* },
|
|
76
|
+
* ]}
|
|
77
|
+
* />
|
|
78
|
+
*/
|
|
79
|
+
export declare const AppBar: React.FC<AppBarProps>;
|
|
80
|
+
export default AppBar;
|
|
81
|
+
//# sourceMappingURL=AppBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.d.ts","sourceRoot":"","sources":["../src/components/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACjD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAiDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmBxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/AppBar.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, {} from 'react';
|
|
3
|
+
const AppBarItem = ({ id, type = 'button', title, subtitle, icon, active = false, hidden = false, onClick, href, }) => {
|
|
4
|
+
const classes = [active ? 'active' : ''].join(' ');
|
|
5
|
+
if (hidden) {
|
|
6
|
+
return _jsx(_Fragment, {});
|
|
7
|
+
}
|
|
8
|
+
switch (title ? 'title' : type) {
|
|
9
|
+
case 'button':
|
|
10
|
+
return href ? (_jsx("a", { id: id, className: classes, href: href, children: icon })) : (_jsx("button", { id: id, className: classes, onClick: onClick, children: icon }));
|
|
11
|
+
case 'appLogo':
|
|
12
|
+
return icon;
|
|
13
|
+
case 'title':
|
|
14
|
+
return (_jsxs("div", { id: id, className: "title-area", children: [_jsx("div", { id: `${id}-title`, className: "title", children: title }), subtitle && (_jsx("div", { id: `${id}-subtitle`, className: "subtitle", children: subtitle }))] }));
|
|
15
|
+
case 'spacer':
|
|
16
|
+
return _jsx("div", { style: { flexGrow: 1 } });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Material Design 3 App bar component
|
|
21
|
+
*
|
|
22
|
+
* @param props AppBarProps
|
|
23
|
+
* @param props.id Element id
|
|
24
|
+
* @param props.items Array of AppBarItem configurations
|
|
25
|
+
* @param props.items[].key Unique key for the item
|
|
26
|
+
* @param props.items[].id Element id for the item
|
|
27
|
+
* @param props.items[].type Item type: 'button', 'appLogo', 'title', or 'spacer'
|
|
28
|
+
* @param props.items[].icon Icon element (svg or img)
|
|
29
|
+
* @param props.items[].title Title text
|
|
30
|
+
* @param props.items[].subtitle Subtitle text
|
|
31
|
+
* @param props.items[].active Active state
|
|
32
|
+
* @param props.items[].hidden Hidden state
|
|
33
|
+
* @param props.items[].disabled Disabled state
|
|
34
|
+
* @param props.items[].onClick Click handler
|
|
35
|
+
* @param props.items[].href Link URL (renders as anchor tag)
|
|
36
|
+
* @param props.sticky Whether the app bar sticks to the top
|
|
37
|
+
* @param props.scrolled Whether the content is scrolled (affects styling)
|
|
38
|
+
* @param props.style Custom inline styles
|
|
39
|
+
* @returns JSX.Element
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* import useDetectScroll, { Axis } from '@smakss/react-scroll-direction';
|
|
43
|
+
*
|
|
44
|
+
* const [scrolled, setScrolled] = useState(false);
|
|
45
|
+
* const { scrollPosition } = useDetectScroll({ axis: Axis.X });
|
|
46
|
+
*
|
|
47
|
+
* useEffect(() => {
|
|
48
|
+
* setScrolled(scrollPosition.top > 0);
|
|
49
|
+
* }, [scrollPosition]);
|
|
50
|
+
*
|
|
51
|
+
* <AppBar
|
|
52
|
+
* sticky
|
|
53
|
+
* scrolled={scrolled}
|
|
54
|
+
* items={[
|
|
55
|
+
* {
|
|
56
|
+
* icon: <svg>...</svg>,
|
|
57
|
+
* onClick: () => {...},
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* type: "appLogo",
|
|
61
|
+
* icon: <img src="./favicon.svg" alt="Glassine Paper" />,
|
|
62
|
+
* },
|
|
63
|
+
* {
|
|
64
|
+
* type: "title",
|
|
65
|
+
* title: "App name",
|
|
66
|
+
* subtitle: "Description",
|
|
67
|
+
* },
|
|
68
|
+
* { type: "spacer" },
|
|
69
|
+
* {
|
|
70
|
+
* icon: <svg>...</svg>,
|
|
71
|
+
* onClick: () => {...},
|
|
72
|
+
* },
|
|
73
|
+
* ]}
|
|
74
|
+
* />
|
|
75
|
+
*/
|
|
76
|
+
export const AppBar = ({ id, items, sticky = false, scrolled = false, style = {}, }) => {
|
|
77
|
+
const classes = [
|
|
78
|
+
'app-bar',
|
|
79
|
+
sticky ? 'sticky' : '',
|
|
80
|
+
scrolled ? 'on-scroll' : '',
|
|
81
|
+
].join(' ');
|
|
82
|
+
return (_jsx("div", { id: id, className: classes, style: style, children: Array.from(items).map((item, index) => (_jsx(AppBarItem, { ...item }, item.key || index))) }));
|
|
83
|
+
};
|
|
84
|
+
export default AppBar;
|
|
85
|
+
//# sourceMappingURL=AppBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../src/components/AppBar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAsC,MAAM,OAAO,CAAC;AAwBlE,MAAM,UAAU,GAA8B,CAAC,EAC7C,EAAE,EACF,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACd,OAAO,EACP,IAAI,GACL,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,mBAAK,CAAC;IACf,CAAC;IACD,QAAQ,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/B,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,YAAG,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACtC,IAAI,GACH,CACL,CAAC,CAAC,CAAC,CACF,iBAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,YACjD,IAAI,GACE,CACV,CAAC;QACJ,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,CACL,eAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,YAAY,aACjC,cAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,OAAO,YACtC,KAAK,GACF,EACL,QAAQ,IAAI,CACX,cAAK,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAC,UAAU,YAC5C,QAAQ,GACL,CACP,IACG,CACP,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAQ,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAC5C,EAAE,EACF,KAAK,EACL,MAAM,GAAG,KAAK,EACd,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,EAAE,GACX,EAAE,EAAE;IACH,MAAM,OAAO,GAAG;QACd,SAAS;QACT,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QACtB,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;KAC5B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,OAAO,CACL,cAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,YAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACtC,KAAC,UAAU,OAA6B,IAAI,IAA3B,IAAI,CAAC,GAAG,IAAI,KAAK,CAAc,CACjD,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/Button.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { type ReactNode, type CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Button component props
|
|
4
|
+
*/
|
|
5
|
+
export interface ButtonProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
variant?: 'filled' | 'tonal' | 'danger' | 'error' | 'outlined' | 'elevated' | 'text';
|
|
9
|
+
size?: 'xs' | 'sm' | 'md';
|
|
10
|
+
radius?: 'default' | 'square';
|
|
11
|
+
label?: string;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
width?: 'narrow' | 'default' | 'wide';
|
|
14
|
+
type?: 'button' | 'submit' | 'reset' | 'toggle' | 'select';
|
|
15
|
+
href?: string;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLInputElement>) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Material Design 3 Button component
|
|
24
|
+
*
|
|
25
|
+
* @param props ButtonProps
|
|
26
|
+
* @param props.id Input id attribute
|
|
27
|
+
* @param props.name Input name attribute
|
|
28
|
+
* @param props.variant Button variant: 'filled', 'tonal', 'danger', 'error', 'outlined', 'elevated', or 'text'
|
|
29
|
+
* @param props.size Button size: 'xs', 'sm', or 'md'
|
|
30
|
+
* @param props.radius Button radius: 'default' or 'square'
|
|
31
|
+
* @param props.label Label text
|
|
32
|
+
* @param props.icon Leading icon element
|
|
33
|
+
* @param props.width Icon button width: 'narrow', 'default', or 'wide'
|
|
34
|
+
* @param props.type Button type: 'button', 'submit', 'reset', 'toggle', or 'select'
|
|
35
|
+
* @param props.href Link URL (renders as anchor tag)
|
|
36
|
+
* @param props.checked Checked state (for toggle/select types)
|
|
37
|
+
* @param props.disabled Disabled state
|
|
38
|
+
* @param props.onClick Click handler
|
|
39
|
+
* @param props.className Additional CSS class names
|
|
40
|
+
* @param props.style Custom inline styles
|
|
41
|
+
* @returns JSX.Element
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Regular button
|
|
45
|
+
* <Button variant="filled" size="sm">
|
|
46
|
+
* Click me
|
|
47
|
+
* </Button>
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Button with leading icon and text
|
|
51
|
+
* <Button
|
|
52
|
+
* variant="tonal"
|
|
53
|
+
* size="md"
|
|
54
|
+
* radius="square"
|
|
55
|
+
* icon={<svg>...</svg>}
|
|
56
|
+
* label="Label"
|
|
57
|
+
* />
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Icon button
|
|
61
|
+
* <Button
|
|
62
|
+
* variant="outlined"
|
|
63
|
+
* icon
|
|
64
|
+
* width="wide"
|
|
65
|
+
* icon={<svg>...</svg>}
|
|
66
|
+
* />
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Link button
|
|
70
|
+
* <Button
|
|
71
|
+
* variant="elevated"
|
|
72
|
+
* href="https://example.com"
|
|
73
|
+
* label="Go to Example"
|
|
74
|
+
* />
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Toggle button (checkbox)
|
|
78
|
+
* <Button
|
|
79
|
+
* variant="filled"
|
|
80
|
+
* type="toggle"
|
|
81
|
+
* checked={isToggled}
|
|
82
|
+
* icon={<svg>...</svg>}
|
|
83
|
+
* label="Toggle"
|
|
84
|
+
* />
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
88
|
+
export default Button;
|
|
89
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EACJ,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,UAAU,GACV,UAAU,GACV,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwExC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/Button.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, {} from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Material Design 3 Button component
|
|
5
|
+
*
|
|
6
|
+
* @param props ButtonProps
|
|
7
|
+
* @param props.id Input id attribute
|
|
8
|
+
* @param props.name Input name attribute
|
|
9
|
+
* @param props.variant Button variant: 'filled', 'tonal', 'danger', 'error', 'outlined', 'elevated', or 'text'
|
|
10
|
+
* @param props.size Button size: 'xs', 'sm', or 'md'
|
|
11
|
+
* @param props.radius Button radius: 'default' or 'square'
|
|
12
|
+
* @param props.label Label text
|
|
13
|
+
* @param props.icon Leading icon element
|
|
14
|
+
* @param props.width Icon button width: 'narrow', 'default', or 'wide'
|
|
15
|
+
* @param props.type Button type: 'button', 'submit', 'reset', 'toggle', or 'select'
|
|
16
|
+
* @param props.href Link URL (renders as anchor tag)
|
|
17
|
+
* @param props.checked Checked state (for toggle/select types)
|
|
18
|
+
* @param props.disabled Disabled state
|
|
19
|
+
* @param props.onClick Click handler
|
|
20
|
+
* @param props.className Additional CSS class names
|
|
21
|
+
* @param props.style Custom inline styles
|
|
22
|
+
* @returns JSX.Element
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Regular button
|
|
26
|
+
* <Button variant="filled" size="sm">
|
|
27
|
+
* Click me
|
|
28
|
+
* </Button>
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Button with leading icon and text
|
|
32
|
+
* <Button
|
|
33
|
+
* variant="tonal"
|
|
34
|
+
* size="md"
|
|
35
|
+
* radius="square"
|
|
36
|
+
* icon={<svg>...</svg>}
|
|
37
|
+
* label="Label"
|
|
38
|
+
* />
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Icon button
|
|
42
|
+
* <Button
|
|
43
|
+
* variant="outlined"
|
|
44
|
+
* icon
|
|
45
|
+
* width="wide"
|
|
46
|
+
* icon={<svg>...</svg>}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Link button
|
|
51
|
+
* <Button
|
|
52
|
+
* variant="elevated"
|
|
53
|
+
* href="https://example.com"
|
|
54
|
+
* label="Go to Example"
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Toggle button (checkbox)
|
|
59
|
+
* <Button
|
|
60
|
+
* variant="filled"
|
|
61
|
+
* type="toggle"
|
|
62
|
+
* checked={isToggled}
|
|
63
|
+
* icon={<svg>...</svg>}
|
|
64
|
+
* label="Toggle"
|
|
65
|
+
* />
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export const Button = ({ id, name, variant = 'filled', size = 'md', label, icon, width = 'default', radius = 'default', type = 'button', href, checked = false, disabled = false, onClick, className = '', style = {}, }) => {
|
|
69
|
+
const classes = [
|
|
70
|
+
'button',
|
|
71
|
+
label ? '' : 'icon',
|
|
72
|
+
variant,
|
|
73
|
+
size,
|
|
74
|
+
icon && width !== 'default' ? width : '',
|
|
75
|
+
icon && radius !== 'default' ? radius : '',
|
|
76
|
+
className,
|
|
77
|
+
]
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.join(' ');
|
|
80
|
+
return type === 'toggle' ? (_jsxs("label", { id: `${id}-label`, className: classes, style: style, children: [_jsx("input", { id: id, name: name, type: "checkbox", checked: checked, onClick: (event) => (onClick ? onClick(event) : undefined) }), icon, label] })) : type === 'select' ? (_jsxs("label", { id: `${id}-label`, className: classes, style: style, children: [_jsx("input", { id: id, name: name, type: "radio", checked: checked, onClick: (event) => (onClick ? onClick(event) : undefined) }), icon, label] })) : href ? (_jsxs("a", { id: id, href: href, className: classes, style: style, children: [icon, label] })) : (_jsxs("button", { id: id, name: name, type: type, className: classes, disabled: disabled, onClick: onClick, style: style, children: [icon, label] }));
|
|
81
|
+
};
|
|
82
|
+
export default Button;
|
|
83
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAsC,MAAM,OAAO,CAAC;AA8BlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAC5C,EAAE,EACF,IAAI,EACJ,OAAO,GAAG,QAAQ,EAClB,IAAI,GAAG,IAAI,EACX,KAAK,EACL,IAAI,EACJ,KAAK,GAAG,SAAS,EACjB,MAAM,GAAG,SAAS,EAClB,IAAI,GAAG,QAAQ,EACf,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,GACX,EAAE,EAAE;IACH,MAAM,OAAO,GAAG;QACd,QAAQ;QACR,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;QACnB,OAAO;QACP,IAAI;QACJ,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACxC,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC1C,SAAS;KACV;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACzB,iBAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,aACxD,gBACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAC1D,EACD,IAAI,EACJ,KAAK,IACA,CACT,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACtB,iBAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,aACxD,gBACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAC1D,EACD,IAAI,EACJ,KAAK,IACA,CACT,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,aAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,aACpD,IAAI,EACJ,KAAK,IACJ,CACL,CAAC,CAAC,CAAC,CACF,kBACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,aAEX,IAAI,EACJ,KAAK,IACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/Menu.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { type ReactNode, type CSSProperties } from 'react';
|
|
2
|
+
export interface MenuItemProps {
|
|
3
|
+
key?: string | number;
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
leadingIcon?: ReactNode;
|
|
7
|
+
trailingIcon?: ReactNode;
|
|
8
|
+
divider?: boolean;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
href?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MenuProps {
|
|
15
|
+
id?: string;
|
|
16
|
+
items: Iterable<MenuItemProps>;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Material Design 3 Menu component
|
|
21
|
+
*
|
|
22
|
+
* @param props MenuProps
|
|
23
|
+
* @param props.id Element id
|
|
24
|
+
* @param props.items Array of MenuItem configurations
|
|
25
|
+
* @param props.items[].key Unique key for the item
|
|
26
|
+
* @param props.items[].id Element id for the item
|
|
27
|
+
* @param props.items[].label Label text
|
|
28
|
+
* @param props.items[].leadingIcon Leading icon element
|
|
29
|
+
* @param props.items[].trailingIcon Trailing icon element
|
|
30
|
+
* @param props.items[].divider Show as divider (renders hr element)
|
|
31
|
+
* @param props.items[].active Active state
|
|
32
|
+
* @param props.items[].disabled Disabled state
|
|
33
|
+
* @param props.items[].onClick Click handler
|
|
34
|
+
* @param props.items[].href Link URL (renders as anchor tag)
|
|
35
|
+
* @param props.style Custom inline styles
|
|
36
|
+
* @returns JSX.Element
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Menu
|
|
40
|
+
* id="example-menu"
|
|
41
|
+
* items={[
|
|
42
|
+
* {
|
|
43
|
+
* leadingIcon: {<svg>...</svg>},
|
|
44
|
+
* label: "Item 1",
|
|
45
|
+
* trailingIcon: {<svg>...</svg>},
|
|
46
|
+
* active: true,
|
|
47
|
+
* onClick: () => {},
|
|
48
|
+
* },
|
|
49
|
+
* { divider: true },
|
|
50
|
+
* {
|
|
51
|
+
* label: "Item 2",
|
|
52
|
+
* href: "...",
|
|
53
|
+
* },
|
|
54
|
+
* ]}
|
|
55
|
+
* />
|
|
56
|
+
*/
|
|
57
|
+
export declare const Menu: React.FC<MenuProps>;
|
|
58
|
+
export default Menu;
|
|
59
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/components/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAkCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAQpC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/lib/Menu.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, {} from 'react';
|
|
3
|
+
const MenuItem = ({ key, id, label, leadingIcon, trailingIcon, divider = false, active = false, disabled = false, onClick, href, }) => {
|
|
4
|
+
const classes = [active ? 'active' : '', disabled ? 'disabled' : ''].join(' ');
|
|
5
|
+
return divider ? (_jsx("hr", {})) : href ? (_jsxs("a", { id: id, className: classes, href: href, children: [leadingIcon, label, trailingIcon] }, key)) : (_jsxs("button", { id: id, className: classes, onClick: onClick, children: [leadingIcon, label, trailingIcon] }, key));
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Material Design 3 Menu component
|
|
9
|
+
*
|
|
10
|
+
* @param props MenuProps
|
|
11
|
+
* @param props.id Element id
|
|
12
|
+
* @param props.items Array of MenuItem configurations
|
|
13
|
+
* @param props.items[].key Unique key for the item
|
|
14
|
+
* @param props.items[].id Element id for the item
|
|
15
|
+
* @param props.items[].label Label text
|
|
16
|
+
* @param props.items[].leadingIcon Leading icon element
|
|
17
|
+
* @param props.items[].trailingIcon Trailing icon element
|
|
18
|
+
* @param props.items[].divider Show as divider (renders hr element)
|
|
19
|
+
* @param props.items[].active Active state
|
|
20
|
+
* @param props.items[].disabled Disabled state
|
|
21
|
+
* @param props.items[].onClick Click handler
|
|
22
|
+
* @param props.items[].href Link URL (renders as anchor tag)
|
|
23
|
+
* @param props.style Custom inline styles
|
|
24
|
+
* @returns JSX.Element
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <Menu
|
|
28
|
+
* id="example-menu"
|
|
29
|
+
* items={[
|
|
30
|
+
* {
|
|
31
|
+
* leadingIcon: {<svg>...</svg>},
|
|
32
|
+
* label: "Item 1",
|
|
33
|
+
* trailingIcon: {<svg>...</svg>},
|
|
34
|
+
* active: true,
|
|
35
|
+
* onClick: () => {},
|
|
36
|
+
* },
|
|
37
|
+
* { divider: true },
|
|
38
|
+
* {
|
|
39
|
+
* label: "Item 2",
|
|
40
|
+
* href: "...",
|
|
41
|
+
* },
|
|
42
|
+
* ]}
|
|
43
|
+
* />
|
|
44
|
+
*/
|
|
45
|
+
export const Menu = ({ id, items = [], style }) => {
|
|
46
|
+
return (_jsx("div", { id: id, className: "menu", style: style, children: Array.from(items).map((item, index) => (_jsx(MenuItem, { ...item }, item.key || index))) }));
|
|
47
|
+
};
|
|
48
|
+
export default Menu;
|
|
49
|
+
//# sourceMappingURL=Menu.js.map
|
package/lib/Menu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../src/components/Menu.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAsC,MAAM,OAAO,CAAC;AAqBlE,MAAM,QAAQ,GAA4B,CAAC,EACzC,GAAG,EACH,EAAE,EACF,KAAK,EACL,WAAW,EACX,YAAY,EACZ,OAAO,GAAG,KAAK,EACf,MAAM,GAAG,KAAK,EACd,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,IAAI,GACL,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CACvE,GAAG,CACJ,CAAC;IACF,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,cAAM,CACP,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,aAAa,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,aAChD,WAAW,EACX,KAAK,EACL,YAAY,KAHP,GAAG,CAIP,CACL,CAAC,CAAC,CAAC,CACF,kBAAkB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,aAC3D,WAAW,EACX,KAAK,EACL,YAAY,KAHF,GAAG,CAIP,CACV,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EAAE,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,OAAO,CACL,cAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,YACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACtC,KAAC,QAAQ,OAA6B,IAAI,IAA3B,IAAI,CAAC,GAAG,IAAI,KAAK,CAAc,CAC/C,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { type ReactNode, type CSSProperties } from 'react';
|
|
2
|
+
export interface NavDrawerItemProps {
|
|
3
|
+
key?: string | number;
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
leadingIcon?: ReactNode;
|
|
7
|
+
trailingIcon?: ReactNode;
|
|
8
|
+
divider?: boolean;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
href?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface NavDrawerProps {
|
|
16
|
+
id?: string;
|
|
17
|
+
items: Iterable<NavDrawerItemProps>;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Material Design 3 NavDrawer component
|
|
23
|
+
*
|
|
24
|
+
* @param props NavDrawerProps
|
|
25
|
+
* @param props.id Element id
|
|
26
|
+
* @param props.items Array of NavDrawerItem configurations
|
|
27
|
+
* @param props.items[].key Unique key for the item
|
|
28
|
+
* @param props.items[].id Element id for the item
|
|
29
|
+
* @param props.items[].label Label text
|
|
30
|
+
* @param props.items[].leadingIcon Leading icon element
|
|
31
|
+
* @param props.items[].trailingIcon Trailing icon element
|
|
32
|
+
* @param props.items[].divider Show as divider (renders hr element)
|
|
33
|
+
* @param props.items[].active Active state
|
|
34
|
+
* @param props.items[].hidden Hidden state
|
|
35
|
+
* @param props.items[].disabled Disabled state
|
|
36
|
+
* @param props.items[].onClick Click handler
|
|
37
|
+
* @param props.items[].href Link URL (renders as anchor tag)
|
|
38
|
+
* @param props.className Additional CSS class names
|
|
39
|
+
* @param props.style Custom inline styles
|
|
40
|
+
* @returns JSX.Element
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <NavDrawer
|
|
44
|
+
* id="example-nav-drawer"
|
|
45
|
+
* items={[
|
|
46
|
+
* {
|
|
47
|
+
* leadingIcon: {<svg>...</svg>},
|
|
48
|
+
* label: "Item 1",
|
|
49
|
+
* trailingIcon: {<svg>...</svg>},
|
|
50
|
+
* active: true,
|
|
51
|
+
* onClick: () => {},
|
|
52
|
+
* },
|
|
53
|
+
* { divider: true },
|
|
54
|
+
* {
|
|
55
|
+
* label: "Item 2",
|
|
56
|
+
* href: "...",
|
|
57
|
+
* },
|
|
58
|
+
* ]}
|
|
59
|
+
* />
|
|
60
|
+
*/
|
|
61
|
+
export declare const NavDrawer: React.FC<NavDrawerProps>;
|
|
62
|
+
export default NavDrawer;
|
|
63
|
+
//# sourceMappingURL=NavDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavDrawer.d.ts","sourceRoot":"","sources":["../src/components/NavDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAa9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|