@ogs-gmbh/guthrie-mui-bindings 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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/components.d.ts +10 -0
- package/components.mjs +246 -0
- package/icons.d.ts +47 -0
- package/icons.mjs +43 -0
- package/package.json +46 -0
- package/public-api.d.ts +49 -0
- package/public-api.mjs +58 -0
- package/types.d.ts +10 -0
- package/types.mjs +0 -0
- package/utils.d.ts +2 -0
- package/utils.mjs +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-03-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* initial release [skip ci]
|
|
9
|
+
|
|
10
|
+
### Miscellaneous Chores
|
|
11
|
+
|
|
12
|
+
* initial release [skip ci] ([0411edc](https://github.com/OGS-GmbH/guthrie-mui-bindings/commit/0411edc75bc0a78eb71ad9a8807496f6ebe300c8))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 — present OGS Gesellschaft für Datenverarbeitung und Systemberatung mbH
|
|
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,142 @@
|
|
|
1
|
+
> *We're OGS, check out our work on [github.com/ogs-gmbh](https://github.com/ogs-gmbh)*
|
|
2
|
+
|
|
3
|
+
# Guthrie MUI Bindings
|
|
4
|
+
*UI integration layer that connects the dynamic JSON-driven rendering capabilities of Guthrie with the component ecosystem of Material UI (MUI).*
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
<a href="./LICENSE" target="_blank"><img src="https://img.shields.io/github/license/OGS-GmbH/guthrie-mui-bindings?color=0f434e&logo=hackthebox&logoColor=000000&labelColor=ffffff" /></a>
|
|
9
|
+
<a href="https://github.com/OGS-GmbH/guthrie-mui-bindings/actions/workflows/main-deploy.yml" target="_blank"><img src="https://img.shields.io/github/actions/workflow/status/OGS-GmbH/guthrie-mui-bindings/main-deploy.yml?color=0f434e&logo=rocket&logoColor=000000&labelColor=ffffff" /></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@ogs-gmbh/guthrie-mui-bindings" target="_blank"><img src="https://img.shields.io/npm/v/%40ogs-gmbh%2Fguthrie-mui-bindings?color=0f434e&logo=npm&logoColor=000000&labelColor=ffffff" /></a>
|
|
11
|
+
|
|
12
|
+
- **Predefined MUI Component Bindings**\
|
|
13
|
+
Offers a curated set of bindings that map Guthrie JSON schemas directly to Material UI components, enabling ready-to-use UI elements without manual wiring.
|
|
14
|
+
|
|
15
|
+
- **Icon Integration**\
|
|
16
|
+
Provides built-in support for MUI icons within JSON definitions, allowing icons to be rendered declaratively alongside components.
|
|
17
|
+
|
|
18
|
+
- **Type-Safe Bindings**\
|
|
19
|
+
Ensures that all JSON-to-component mappings conform to expected TypeScript types, reducing runtime errors and enforcing consistency.
|
|
20
|
+
|
|
21
|
+
- **Extensibility**\
|
|
22
|
+
Allows developers to add or override bindings for custom components, supporting domain-specific UI requirements while maintaining a uniform architecture.
|
|
23
|
+
|
|
24
|
+
## Getting Started
|
|
25
|
+
|
|
26
|
+
> [!IMPORTANT]
|
|
27
|
+
> We're offering an extensive API-Reference covered with in-depth usage examples of this project.
|
|
28
|
+
|
|
29
|
+
To get a starting point, simply refer to our documentation at [ogs-gmbh.github.io/guthrie-mui-bindings](https://ogs-gmbh.github.io/guthrie-mui-bindings).
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
|
|
33
|
+
- Node.js version 18 or higher
|
|
34
|
+
- A package manager: e.g. npm, pnpm, ...
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
|
|
38
|
+
Using npm:
|
|
39
|
+
```sh
|
|
40
|
+
$ npm install -D @ogs-gmbh/guthrie-mui-bindings
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>Using a different package managers?</summary>
|
|
45
|
+
<br/>
|
|
46
|
+
|
|
47
|
+
Using yarn:
|
|
48
|
+
```sh
|
|
49
|
+
$ pnpm add -D @ogs-gmbh/guthrie-mui-bindings
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Using pnpm:
|
|
53
|
+
```sh
|
|
54
|
+
$ pnpm add -D @ogs-gmbh/guthrie-mui-bindings
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Using bun:
|
|
58
|
+
```sh
|
|
59
|
+
$ bun add -D @ogs-gmbh/guthrie-mui-bindings
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
### Usage
|
|
65
|
+
|
|
66
|
+
Here's a simple example using [`getGuthrieMuiBindings`](https://ogs-gmbh.github.io/guthrie-mui-bindings/reference/Bindings/getGuthrieMuiBindings). You can get a deeper understanding by looking at the [reference](https://ogs-gmbh.github.io/guthrie-mui-bindings/reference).
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { Guthrie, withElements, withOperators, withFns } from "@ogs-gmbh/guthrie";
|
|
70
|
+
import { getGuthrieMuiBindings } from "@ogs-gmbh/guthrie-mui-bindings";
|
|
71
|
+
|
|
72
|
+
function MyPage () {
|
|
73
|
+
return (
|
|
74
|
+
<Guthrie
|
|
75
|
+
elements={
|
|
76
|
+
withElements({
|
|
77
|
+
elements: getGuthrieMuiBindings()
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
operators={
|
|
81
|
+
withOperators({
|
|
82
|
+
options: {
|
|
83
|
+
universal: true
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
fns={
|
|
88
|
+
withFns({
|
|
89
|
+
options: {
|
|
90
|
+
native: true
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
page={page}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
The MIT License (MIT) - Please have a look at the [LICENSE file](./LICENSE) for more details.
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
Contributions are always welcome and greatly appreciated. Whether you want to report a bug, suggest a new feature, or improve the documentation, your input helps make the project better for everyone.
|
|
106
|
+
|
|
107
|
+
Feel free to submit a pull request, issue or feature request.
|
|
108
|
+
|
|
109
|
+
### Issues and Feature Requests
|
|
110
|
+
Reporting an issue or creating a feature request is made by creating a new issue on this repository.
|
|
111
|
+
|
|
112
|
+
You can create a [new issue or feature request here](../../issues/new/choose).
|
|
113
|
+
|
|
114
|
+
### Pull Requests
|
|
115
|
+
GitHub offers a solid guideline for contributing to open source projects through pull requests, covering key practices. These best practices provide a reliable starting point for making effective contributions.
|
|
116
|
+
|
|
117
|
+
You can find the [guidelines here](https://docs.github.com/get-started/exploring-projects-on-github/contributing-to-a-project).
|
|
118
|
+
|
|
119
|
+
### Code Of Conduct
|
|
120
|
+
We are committed to keeping a welcoming, inclusive, and respectful community for everyone. To help us achieve this, we kindly ask that you adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
121
|
+
|
|
122
|
+
## Disclaimer
|
|
123
|
+
|
|
124
|
+
All trademarks and registered trademarks mentioned are property of their respective owners and are used for identification purposes only. Use of these names does not imply endorsement or affiliation.
|
|
125
|
+
|
|
126
|
+
This project is a trademark of OGS Gesellschaft für Datenverarbeitung und Systemberatung mbH. The License does not grant rights to use the trademark without permission.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
<a href="https://www.ogs.de/en/">
|
|
131
|
+
<picture>
|
|
132
|
+
<source
|
|
133
|
+
srcset="https://raw.githubusercontent.com/OGS-GmbH/.github/refs/tags/v1.0.0/docs/assets/logo/light.svg"
|
|
134
|
+
media="(prefers-color-scheme: dark)"
|
|
135
|
+
/>
|
|
136
|
+
<img height="64" alt="OGS Logo" src="https://raw.githubusercontent.com/OGS-GmbH/.github/refs/tags/v1.0.0/docs/assets/logo/dark.svg"
|
|
137
|
+
</picture>
|
|
138
|
+
</a>
|
|
139
|
+
|
|
140
|
+
Gesellschaft für Datenverarbeitung und Systemberatung mbH
|
|
141
|
+
|
|
142
|
+
[Imprint](https://www.ogs.de/en/imprint/) | [Contact](https://www.ogs.de/en/contact/) | [Careers](https://www.ogs.de/en/about-ogs/#Careers)
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Elements } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* `Object` containing all MUI components that are supported by the bindings. The keys are the kebab-case version of the component names, and the values are the corresponding MUI components.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @author Simon Kovtyk
|
|
7
|
+
* @category Bindings
|
|
8
|
+
*/
|
|
9
|
+
declare const muiComponentBindings: Elements;
|
|
10
|
+
export { muiComponentBindings };
|
package/components.mjs
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// src/components.ts
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import IconButton from "@mui/material/IconButton";
|
|
4
|
+
import Autocomplete from "@mui/material/Autocomplete";
|
|
5
|
+
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
6
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
7
|
+
import Fab from "@mui/material/Fab";
|
|
8
|
+
import Radio from "@mui/material/Radio";
|
|
9
|
+
import RadioGroup from "@mui/material/RadioGroup";
|
|
10
|
+
import Rating from "@mui/material/Rating";
|
|
11
|
+
import NativeSelect from "@mui/material/NativeSelect";
|
|
12
|
+
import Select from "@mui/material/Select";
|
|
13
|
+
import Slider from "@mui/material/Slider";
|
|
14
|
+
import Switch from "@mui/material/Switch";
|
|
15
|
+
import FilledInput from "@mui/material/FilledInput";
|
|
16
|
+
import Input from "@mui/material/Input";
|
|
17
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
18
|
+
import InputBase from "@mui/material/InputBase";
|
|
19
|
+
import InputLabel from "@mui/material/InputLabel";
|
|
20
|
+
import OutlinedInput from "@mui/material/OutlinedInput";
|
|
21
|
+
import TextField from "@mui/material/TextField";
|
|
22
|
+
import List from "@mui/material/List";
|
|
23
|
+
import ListItem from "@mui/material/ListItem";
|
|
24
|
+
import ToggleButton from "@mui/material/ToggleButton";
|
|
25
|
+
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
26
|
+
import Avatar from "@mui/material/Avatar";
|
|
27
|
+
import AvatarGroup from "@mui/material/AvatarGroup";
|
|
28
|
+
import Badge from "@mui/material/Badge";
|
|
29
|
+
import Chip from "@mui/material/Chip";
|
|
30
|
+
import Divider from "@mui/material/Divider";
|
|
31
|
+
import Icon from "@mui/material/Icon";
|
|
32
|
+
import SvgIcon from "@mui/material/SvgIcon";
|
|
33
|
+
import Collapse from "@mui/material/Collapse";
|
|
34
|
+
import ListItemAvatar from "@mui/material/ListItemAvatar";
|
|
35
|
+
import ListItemButton from "@mui/material/ListItemButton";
|
|
36
|
+
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
37
|
+
import ListItemText from "@mui/material/ListItemText";
|
|
38
|
+
import ListSubheader from "@mui/material/ListSubheader";
|
|
39
|
+
import Table from "@mui/material/Table";
|
|
40
|
+
import TableBody from "@mui/material/TableBody";
|
|
41
|
+
import TableCell from "@mui/material/TableCell";
|
|
42
|
+
import TableContainer from "@mui/material/TableContainer";
|
|
43
|
+
import TableFooter from "@mui/material/TableFooter";
|
|
44
|
+
import TableHead from "@mui/material/TableHead";
|
|
45
|
+
import TablePagination from "@mui/material/TablePagination";
|
|
46
|
+
import TableRow from "@mui/material/TableRow";
|
|
47
|
+
import TableSortLabel from "@mui/material/TableSortLabel";
|
|
48
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
49
|
+
import Typography from "@mui/material/Typography";
|
|
50
|
+
import Alert from "@mui/material/Alert";
|
|
51
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
52
|
+
import Backdrop from "@mui/material/Backdrop";
|
|
53
|
+
import Dialog from "@mui/material/Dialog";
|
|
54
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
55
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
56
|
+
import DialogContentText from "@mui/material/DialogContentText";
|
|
57
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
58
|
+
import Slide from "@mui/material/Slide";
|
|
59
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
60
|
+
import LinearProgress from "@mui/material/LinearProgress";
|
|
61
|
+
import Skeleton from "@mui/material/Skeleton";
|
|
62
|
+
import Snackbar from "@mui/material/Snackbar";
|
|
63
|
+
import SnackbarContent from "@mui/material/SnackbarContent";
|
|
64
|
+
import Accordion from "@mui/material/Accordion";
|
|
65
|
+
import AccordionActions from "@mui/material/AccordionActions";
|
|
66
|
+
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
67
|
+
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
68
|
+
import AppBar from "@mui/material/AppBar";
|
|
69
|
+
import Menu from "@mui/material/Menu";
|
|
70
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
71
|
+
import Card from "@mui/material/Card";
|
|
72
|
+
import CardActionArea from "@mui/material/CardActionArea";
|
|
73
|
+
import CardActions from "@mui/material/CardActions";
|
|
74
|
+
import CardContent from "@mui/material/CardContent";
|
|
75
|
+
import CardHeader from "@mui/material/CardHeader";
|
|
76
|
+
import CardMedia from "@mui/material/CardMedia";
|
|
77
|
+
import Paper from "@mui/material/Paper";
|
|
78
|
+
import BottomNavigation from "@mui/material/BottomNavigation";
|
|
79
|
+
import BottomNavigationAction from "@mui/material/BottomNavigationAction";
|
|
80
|
+
import Breadcrumbs from "@mui/material/Breadcrumbs";
|
|
81
|
+
import Link from "@mui/material/Link";
|
|
82
|
+
import Drawer from "@mui/material/Drawer";
|
|
83
|
+
import SwipeableDrawer from "@mui/material/SwipeableDrawer";
|
|
84
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
85
|
+
import MenuList from "@mui/material/MenuList";
|
|
86
|
+
import Popover from "@mui/material/Popover";
|
|
87
|
+
import Popper from "@mui/material/Popper";
|
|
88
|
+
import Pagination from "@mui/material/Pagination";
|
|
89
|
+
import PaginationItem from "@mui/material/PaginationItem";
|
|
90
|
+
import TablePaginationActions from "@mui/material/TablePaginationActions";
|
|
91
|
+
import SpeedDial from "@mui/material/SpeedDial";
|
|
92
|
+
import SpeedDialAction from "@mui/material/SpeedDialAction";
|
|
93
|
+
import SpeedDialIcon from "@mui/material/SpeedDialIcon";
|
|
94
|
+
import MobileStepper from "@mui/material/MobileStepper";
|
|
95
|
+
import Step from "@mui/material/Step";
|
|
96
|
+
import StepButton from "@mui/material/StepButton";
|
|
97
|
+
import StepConnector from "@mui/material/StepConnector";
|
|
98
|
+
import StepContent from "@mui/material/StepContent";
|
|
99
|
+
import StepIcon from "@mui/material/StepIcon";
|
|
100
|
+
import StepLabel from "@mui/material/StepLabel";
|
|
101
|
+
import Stepper from "@mui/material/Stepper";
|
|
102
|
+
import Tab from "@mui/material/Tab";
|
|
103
|
+
import TabScrollButton from "@mui/material/TabScrollButton";
|
|
104
|
+
import Tabs from "@mui/material/Tabs";
|
|
105
|
+
import Box from "@mui/material/Box";
|
|
106
|
+
import Container from "@mui/material/Container";
|
|
107
|
+
import PigmentContainer from "@mui/material/PigmentContainer";
|
|
108
|
+
import Grid from "@mui/material/Grid";
|
|
109
|
+
import PigmentGrid from "@mui/material/PigmentGrid";
|
|
110
|
+
import Stack from "@mui/material/Stack";
|
|
111
|
+
import PigmentStack from "@mui/material/PigmentStack";
|
|
112
|
+
import ImageList from "@mui/material/ImageList";
|
|
113
|
+
import ImageListItem from "@mui/material/ImageListItem";
|
|
114
|
+
import ImageListItemBar from "@mui/material/ImageListItemBar";
|
|
115
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
116
|
+
import Modal from "@mui/material/Modal";
|
|
117
|
+
import Grow from "@mui/material/Grow";
|
|
118
|
+
import Portal from "@mui/material/Portal";
|
|
119
|
+
import TextareaAutosize from "@mui/material/TextareaAutosize";
|
|
120
|
+
import Fade from "@mui/material/Fade";
|
|
121
|
+
import Zoom from "@mui/material/Zoom";
|
|
122
|
+
var muiComponentBindings = {
|
|
123
|
+
"autocomplete": Autocomplete,
|
|
124
|
+
"button": Button,
|
|
125
|
+
"icon-button": IconButton,
|
|
126
|
+
"button-group": ButtonGroup,
|
|
127
|
+
"checkbox": Checkbox,
|
|
128
|
+
"fab": Fab,
|
|
129
|
+
"radio": Radio,
|
|
130
|
+
"radio-group": RadioGroup,
|
|
131
|
+
"rating": Rating,
|
|
132
|
+
"native-select": NativeSelect,
|
|
133
|
+
"select": Select,
|
|
134
|
+
"slider": Slider,
|
|
135
|
+
"switch": Switch,
|
|
136
|
+
"filled-input": FilledInput,
|
|
137
|
+
"input": Input,
|
|
138
|
+
"input-adornment": InputAdornment,
|
|
139
|
+
"input-base": InputBase,
|
|
140
|
+
"input-label": InputLabel,
|
|
141
|
+
"outlined-input": OutlinedInput,
|
|
142
|
+
"text-field": TextField,
|
|
143
|
+
"list": List,
|
|
144
|
+
"list-item": ListItem,
|
|
145
|
+
"toggle-button": ToggleButton,
|
|
146
|
+
"toggle-button-gggroup": ToggleButtonGroup,
|
|
147
|
+
"avatar": Avatar,
|
|
148
|
+
"avatar-group": AvatarGroup,
|
|
149
|
+
"badge": Badge,
|
|
150
|
+
"chip": Chip,
|
|
151
|
+
"divider": Divider,
|
|
152
|
+
"icon": Icon,
|
|
153
|
+
"svg-icon": SvgIcon,
|
|
154
|
+
"collapse": Collapse,
|
|
155
|
+
"list-item-avater": ListItemAvatar,
|
|
156
|
+
"list-item-button": ListItemButton,
|
|
157
|
+
"list-item-icon": ListItemIcon,
|
|
158
|
+
"list-item-text": ListItemText,
|
|
159
|
+
"list-subheader": ListSubheader,
|
|
160
|
+
"table": Table,
|
|
161
|
+
"table-body": TableBody,
|
|
162
|
+
"table-cell": TableCell,
|
|
163
|
+
"table-container": TableContainer,
|
|
164
|
+
"table-footer": TableFooter,
|
|
165
|
+
"table-head": TableHead,
|
|
166
|
+
"table-pagination": TablePagination,
|
|
167
|
+
"table-row": TableRow,
|
|
168
|
+
"table-sort-label": TableSortLabel,
|
|
169
|
+
"tooltip": Tooltip,
|
|
170
|
+
"typography": Typography,
|
|
171
|
+
"alert": Alert,
|
|
172
|
+
"alert-title": AlertTitle,
|
|
173
|
+
"backdrop": Backdrop,
|
|
174
|
+
"dialog": Dialog,
|
|
175
|
+
"dialog-actions": DialogActions,
|
|
176
|
+
"dialog-content": DialogContent,
|
|
177
|
+
"dialog-content-text": DialogContentText,
|
|
178
|
+
"dialog-title": DialogTitle,
|
|
179
|
+
"slide": Slide,
|
|
180
|
+
"circular-progress": CircularProgress,
|
|
181
|
+
"linear-progress": LinearProgress,
|
|
182
|
+
"skeleton": Skeleton,
|
|
183
|
+
"snackbar": Snackbar,
|
|
184
|
+
"snackbar-content": SnackbarContent,
|
|
185
|
+
"accordion": Accordion,
|
|
186
|
+
"accordion-actions": AccordionActions,
|
|
187
|
+
"accordion-details": AccordionDetails,
|
|
188
|
+
"accordion-summary": AccordionSummary,
|
|
189
|
+
"app-bar": AppBar,
|
|
190
|
+
"menu": Menu,
|
|
191
|
+
"toolbar": Toolbar,
|
|
192
|
+
"card": Card,
|
|
193
|
+
"card-action-area": CardActionArea,
|
|
194
|
+
"card-actions": CardActions,
|
|
195
|
+
"card-content": CardContent,
|
|
196
|
+
"card-header": CardHeader,
|
|
197
|
+
"card-media": CardMedia,
|
|
198
|
+
"paper": Paper,
|
|
199
|
+
"bottom-navigation": BottomNavigation,
|
|
200
|
+
"bottom-navigation-action": BottomNavigationAction,
|
|
201
|
+
"breadcrumbs": Breadcrumbs,
|
|
202
|
+
"link": Link,
|
|
203
|
+
"drawer": Drawer,
|
|
204
|
+
"swipeable-drawer": SwipeableDrawer,
|
|
205
|
+
"menu-item": MenuItem,
|
|
206
|
+
"menu-list": MenuList,
|
|
207
|
+
"popover": Popover,
|
|
208
|
+
"popper": Popper,
|
|
209
|
+
"pagination": Pagination,
|
|
210
|
+
"pagination-item": PaginationItem,
|
|
211
|
+
"table-pagination-actions": TablePaginationActions,
|
|
212
|
+
"speed-dial": SpeedDial,
|
|
213
|
+
"speed-dial-action": SpeedDialAction,
|
|
214
|
+
"speed-dial-icon": SpeedDialIcon,
|
|
215
|
+
"mobile-stepper": MobileStepper,
|
|
216
|
+
"step": Step,
|
|
217
|
+
"step-button": StepButton,
|
|
218
|
+
"step-connector": StepConnector,
|
|
219
|
+
"step-content": StepContent,
|
|
220
|
+
"step-icon": StepIcon,
|
|
221
|
+
"step-label": StepLabel,
|
|
222
|
+
"stepper": Stepper,
|
|
223
|
+
"tab": Tab,
|
|
224
|
+
"tab-scroll-button": TabScrollButton,
|
|
225
|
+
"tabs": Tabs,
|
|
226
|
+
"box": Box,
|
|
227
|
+
"container": Container,
|
|
228
|
+
"pigment-containe": PigmentContainer,
|
|
229
|
+
"grid": Grid,
|
|
230
|
+
"pigment-grid": PigmentGrid,
|
|
231
|
+
"stack": Stack,
|
|
232
|
+
"pigment-stack": PigmentStack,
|
|
233
|
+
"image-list": ImageList,
|
|
234
|
+
"image-list-item": ImageListItem,
|
|
235
|
+
"image-list-item-bar": ImageListItemBar,
|
|
236
|
+
"click-away-listener": ClickAwayListener,
|
|
237
|
+
"modal": Modal,
|
|
238
|
+
"grow": Grow,
|
|
239
|
+
"portal": Portal,
|
|
240
|
+
"textarea-autosize": TextareaAutosize,
|
|
241
|
+
"fade": Fade,
|
|
242
|
+
"zoom": Zoom
|
|
243
|
+
};
|
|
244
|
+
export {
|
|
245
|
+
muiComponentBindings
|
|
246
|
+
};
|
package/icons.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Elements } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* `Function` to get all MUI icons bindings with a filled style.
|
|
4
|
+
* @returns An `Object` containing all MUI icons bindings with a filled style. The keys are the kebab-case version of the icon names, and the values are the corresponding MUI icons.
|
|
5
|
+
*
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @author Simon Kovtyk
|
|
8
|
+
* @category Bindings
|
|
9
|
+
*/
|
|
10
|
+
declare function getMuiFilledIconBindings(): Elements;
|
|
11
|
+
/**
|
|
12
|
+
* `Function` to get all MUI icons bindings with a outlined style.
|
|
13
|
+
* @returns An `Object` containing all MUI icons bindings with a outlined style. The keys are the kebab-case version of the icon names, and the values are the corresponding MUI icons.
|
|
14
|
+
*
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
* @author Simon Kovtyk
|
|
17
|
+
* @category Bindings
|
|
18
|
+
*/
|
|
19
|
+
declare function getMuiOutlinedIconBindings(): Elements;
|
|
20
|
+
/**
|
|
21
|
+
* `Function` to get all MUI icons bindings with a rounded style.
|
|
22
|
+
* @returns An `Object` containing all MUI icons bindings with a rounded style. The keys are the kebab-case version of the icon names, and the values are the corresponding MUI icons.
|
|
23
|
+
*
|
|
24
|
+
* @since 1.0.0
|
|
25
|
+
* @author Simon Kovtyk
|
|
26
|
+
* @category Bindings
|
|
27
|
+
*/
|
|
28
|
+
declare function getMuiRoundedIconBindings(): Elements;
|
|
29
|
+
/**
|
|
30
|
+
* `Function` to get all MUI icons bindings with a two-tone style.
|
|
31
|
+
* @returns An `Object` containing all MUI icons bindings with a two-tone style. The keys are the kebab-case version of the icon names, and the values are the corresponding MUI icons.
|
|
32
|
+
*
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
* @author Simon Kovtyk
|
|
35
|
+
* @category Bindings
|
|
36
|
+
*/
|
|
37
|
+
declare function getMuiTwoToneIconsBindings(): Elements;
|
|
38
|
+
/**
|
|
39
|
+
* `Function` to get all MUI icons bindings with a sharpstyle.
|
|
40
|
+
* @returns An `Object` containing all MUI icons bindings with a sharp style. The keys are the kebab-case version of the icon names, and the values are the corresponding MUI icons.
|
|
41
|
+
*
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
* @author Simon Kovtyk
|
|
44
|
+
* @category Bindings
|
|
45
|
+
*/
|
|
46
|
+
declare function getMuiSharpIconBindings(): Elements;
|
|
47
|
+
export { getMuiFilledIconBindings, getMuiOutlinedIconBindings, getMuiRoundedIconBindings, getMuiTwoToneIconsBindings, getMuiSharpIconBindings };
|
package/icons.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/icons.ts
|
|
2
|
+
import * as icons from "@mui/icons-material";
|
|
3
|
+
import { pascalCaseToKebabCase } from "./utils.mjs";
|
|
4
|
+
var variantSuffix = {
|
|
5
|
+
outlined: "Outlined",
|
|
6
|
+
rounded: "Rounded",
|
|
7
|
+
twoTone: "TwoTone",
|
|
8
|
+
sharp: "Sharp"
|
|
9
|
+
};
|
|
10
|
+
function getMuiIconBindingBySuffix(compare) {
|
|
11
|
+
return Object.fromEntries(
|
|
12
|
+
Object.entries(icons).reduce((acc, [key, value]) => {
|
|
13
|
+
if (!compare(value.name))
|
|
14
|
+
return acc;
|
|
15
|
+
acc.push([pascalCaseToKebabCase(key), value]);
|
|
16
|
+
return acc;
|
|
17
|
+
}, [])
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function getMuiFilledIconBindings() {
|
|
21
|
+
return getMuiIconBindingBySuffix(
|
|
22
|
+
(value) => value.endsWith(variantSuffix.outlined) || value.endsWith(variantSuffix.rounded) || value.endsWith(variantSuffix.twoTone) || value.endsWith(variantSuffix.sharp)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function getMuiOutlinedIconBindings() {
|
|
26
|
+
return getMuiIconBindingBySuffix((value) => value.endsWith(variantSuffix.outlined));
|
|
27
|
+
}
|
|
28
|
+
function getMuiRoundedIconBindings() {
|
|
29
|
+
return getMuiIconBindingBySuffix((value) => value.endsWith(variantSuffix.rounded));
|
|
30
|
+
}
|
|
31
|
+
function getMuiTwoToneIconsBindings() {
|
|
32
|
+
return getMuiIconBindingBySuffix((value) => value.endsWith(variantSuffix.twoTone));
|
|
33
|
+
}
|
|
34
|
+
function getMuiSharpIconBindings() {
|
|
35
|
+
return getMuiIconBindingBySuffix((value) => value.endsWith(variantSuffix.sharp));
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
getMuiFilledIconBindings,
|
|
39
|
+
getMuiOutlinedIconBindings,
|
|
40
|
+
getMuiRoundedIconBindings,
|
|
41
|
+
getMuiSharpIconBindings,
|
|
42
|
+
getMuiTwoToneIconsBindings
|
|
43
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ogs-gmbh/guthrie-mui-bindings",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "UI integration layer that connects the dynamic JSON-driven rendering capabilities of Guthrie with the component ecosystem of Material UI (MUI) in TypeScript applications.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"guthrie",
|
|
7
|
+
"mui",
|
|
8
|
+
"material-ui",
|
|
9
|
+
"react",
|
|
10
|
+
"typescript",
|
|
11
|
+
"json-renderer",
|
|
12
|
+
"dynamic-ui",
|
|
13
|
+
"ui-bindings",
|
|
14
|
+
"component-mapping",
|
|
15
|
+
"schema-driven-ui",
|
|
16
|
+
"json-to-ui",
|
|
17
|
+
"icons",
|
|
18
|
+
"ui-components",
|
|
19
|
+
"frontend",
|
|
20
|
+
"declarative-ui"
|
|
21
|
+
],
|
|
22
|
+
"homepage": "https://ogs-gmbh.github.io/guthrie-mui-bindings/",
|
|
23
|
+
"bugs": "https://github.com/OGS-GmbH/guthrie-mui-bindings/issues",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "OGS GmbH",
|
|
26
|
+
"contributors": [
|
|
27
|
+
{
|
|
28
|
+
"name": "Simon Kovtyk",
|
|
29
|
+
"email": "simon@kovtyk.com",
|
|
30
|
+
"url": "https://simonkov.dev"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./public-api.d.ts",
|
|
36
|
+
"default": "./public-api.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"repository": "https://github.com/OGS-GmbH/guthrie-mui-bindings",
|
|
40
|
+
"type": "module",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@mui/icons-material": "^7.3.9",
|
|
43
|
+
"@mui/material": "^7.3.9",
|
|
44
|
+
"react": "^19"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Elements } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the {@link getGuthrieMuiBindings} function.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @author Simon Kovtyk
|
|
7
|
+
* @category Types
|
|
8
|
+
*/
|
|
9
|
+
type GetGuthrieMuiBindingsOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Icon variants to include in the returned bindings. If not specified, only filled icons will be included.
|
|
12
|
+
* @default `["filled"]`
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @author Simon Kovtyk
|
|
16
|
+
*/
|
|
17
|
+
icons?: Array<"outlined" | "rounded" | "twoTone" | "sharp" | "filled">;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to include MUI components in the returned bindings. If not specified, components will be included by default.
|
|
20
|
+
* @default `true`
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @author Simon Kovtyk
|
|
24
|
+
*/
|
|
25
|
+
components?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* A function to map the original component and icon names to custom names in the returned bindings. If not specified, original names will be used.
|
|
28
|
+
*
|
|
29
|
+
* @since 1.0.0
|
|
30
|
+
* @author Simon Kovtyk
|
|
31
|
+
*/
|
|
32
|
+
mapNames?: (value: string) => string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Get a set of bindings for using Material UI components and icons with Guthrie. The returned bindings can be customized by specifying options (see {@link GetGuthrieMuiBindingsOptions}).
|
|
36
|
+
*
|
|
37
|
+
* @param options - Options to customize the returned bindings.
|
|
38
|
+
* @returns A set of bindings for using Material UI components and icons with Guthrie.
|
|
39
|
+
*
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
* @author Simon Kovtyk
|
|
42
|
+
* @category Bindings
|
|
43
|
+
*/
|
|
44
|
+
declare function getGuthrieMuiBindings(options: GetGuthrieMuiBindingsOptions): Elements;
|
|
45
|
+
export type { GetGuthrieMuiBindingsOptions };
|
|
46
|
+
export { getGuthrieMuiBindings };
|
|
47
|
+
export * from "./components";
|
|
48
|
+
export * from "./icons";
|
|
49
|
+
export * from "./types";
|
package/public-api.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/public-api.ts
|
|
2
|
+
import { muiComponentBindings } from "./components.mjs";
|
|
3
|
+
import { getMuiFilledIconBindings, getMuiOutlinedIconBindings, getMuiRoundedIconBindings, getMuiSharpIconBindings, getMuiTwoToneIconsBindings } from "./icons.mjs";
|
|
4
|
+
export * from "./components.mjs";
|
|
5
|
+
export * from "./icons.mjs";
|
|
6
|
+
export * from "./types.mjs";
|
|
7
|
+
var defaultOptions = {
|
|
8
|
+
icons: ["filled"],
|
|
9
|
+
components: true
|
|
10
|
+
};
|
|
11
|
+
function getGuthrieMuiBindings(options) {
|
|
12
|
+
let elements = {};
|
|
13
|
+
const configuredComponents = options?.components ?? defaultOptions.components;
|
|
14
|
+
if (configuredComponents) {
|
|
15
|
+
elements = {
|
|
16
|
+
...elements,
|
|
17
|
+
...muiComponentBindings
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const configuredIcons = options?.icons ?? defaultOptions.icons;
|
|
21
|
+
configuredIcons?.forEach((variant) => {
|
|
22
|
+
let icons;
|
|
23
|
+
switch (variant) {
|
|
24
|
+
case "outlined": {
|
|
25
|
+
icons = getMuiOutlinedIconBindings();
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "sharp": {
|
|
29
|
+
icons = getMuiSharpIconBindings();
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "twoTone": {
|
|
33
|
+
icons = getMuiTwoToneIconsBindings();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "rounded": {
|
|
37
|
+
icons = getMuiRoundedIconBindings();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "filled": {
|
|
41
|
+
icons = getMuiFilledIconBindings();
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
elements = {
|
|
46
|
+
...elements,
|
|
47
|
+
...icons
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
if (options?.mapNames === void 0)
|
|
51
|
+
return elements;
|
|
52
|
+
return Object.fromEntries(
|
|
53
|
+
Object.entries(elements).map(([key, value]) => [options.mapNames(key), value])
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
getGuthrieMuiBindings
|
|
58
|
+
};
|
package/types.d.ts
ADDED
package/types.mjs
ADDED
|
File without changes
|
package/utils.d.ts
ADDED
package/utils.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
function pascalCaseToKebabCase(value) {
|
|
3
|
+
let result = "";
|
|
4
|
+
for (const char of value) {
|
|
5
|
+
if (char.toUpperCase() !== char) {
|
|
6
|
+
result += char;
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
result += `-${char.toLowerCase()}`;
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
pascalCaseToKebabCase
|
|
15
|
+
};
|