@nethru/ui 1.0.47 → 1.0.49

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Box, Button, IconButton, Stack, Tooltip, Typography } from "@mui/material";
2
+ import { Button, IconButton, Stack, Tooltip, Typography } from "@mui/material";
3
3
  import AddIcon from "@mui/icons-material/Add";
4
4
  import DeleteIcon from "@mui/icons-material/Delete";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -7,12 +7,14 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  import { Fragment as _Fragment } from "react/jsx-runtime";
8
8
  export default function AppendableFormList({
9
9
  forms,
10
+ gap = 1,
11
+ addOns,
10
12
  onAppend,
11
13
  onRemove,
12
14
  readOnly
13
15
  }) {
14
16
  return /*#__PURE__*/_jsxs(Stack, {
15
- gap: 1,
17
+ gap: gap,
16
18
  children: [/*#__PURE__*/_jsxs(_Fragment, {
17
19
  children: [forms.map((form, index) => /*#__PURE__*/_jsxs(Stack, {
18
20
  direction: "row",
@@ -39,13 +41,15 @@ export default function AppendableFormList({
39
41
  },
40
42
  children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
41
43
  })]
42
- }), !readOnly && /*#__PURE__*/_jsx(Box, {
43
- children: /*#__PURE__*/_jsx(Button, {
44
+ }), !readOnly && /*#__PURE__*/_jsxs(Stack, {
45
+ direction: "row",
46
+ gap: 1,
47
+ children: [/*#__PURE__*/_jsx(Button, {
44
48
  variant: "text",
45
49
  startIcon: /*#__PURE__*/_jsx(AddIcon, {}),
46
50
  onClick: onAppend,
47
51
  children: "\uCD94\uAC00"
48
- })
52
+ }), addOns]
49
53
  })]
50
54
  });
51
55
  }
package/dist/Dialog.js CHANGED
@@ -1,26 +1,40 @@
1
- import { Zoom } from "@mui/material";
1
+ import { Slide, Zoom } from "@mui/material";
2
2
  import MuiDialog from "@mui/material/Dialog";
3
3
  import { forwardRef } from "react";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const Transition = /*#__PURE__*/forwardRef(function Transition(props, ref) {
5
+ const ZoomTransition = /*#__PURE__*/forwardRef(function (props, ref) {
6
6
  return /*#__PURE__*/_jsx(Zoom, {
7
7
  ref: ref,
8
8
  ...props
9
9
  });
10
10
  });
11
+ const SlideTransition = /*#__PURE__*/forwardRef(function (props, ref) {
12
+ return /*#__PURE__*/_jsx(Slide, {
13
+ direction: "down",
14
+ ref: ref,
15
+ ...props
16
+ });
17
+ });
11
18
  export default function Dialog({
19
+ center = true,
12
20
  contentFontSize = 16,
13
21
  children,
14
22
  sx,
15
23
  ...props
16
24
  }) {
25
+ const styles = {
26
+ '& .MuiDialog-container': {
27
+ alignItems: center ? 'center' : 'flex-start'
28
+ },
29
+ '.MuiTypography-root.MuiDialogContentText-root': {
30
+ fontSize: contentFontSize
31
+ }
32
+ };
17
33
  return /*#__PURE__*/_jsx(MuiDialog, {
18
- TransitionComponent: Transition,
34
+ TransitionComponent: center ? ZoomTransition : SlideTransition,
19
35
  sx: {
20
- ...sx,
21
- '.MuiTypography-root.MuiDialogContentText-root': {
22
- fontSize: contentFontSize
23
- }
36
+ ...styles,
37
+ ...sx
24
38
  },
25
39
  ...props,
26
40
  children: children
@@ -12,10 +12,12 @@ export default function ListItemText({
12
12
  }) {
13
13
  const [hover, setHover] = useState(false);
14
14
  return /*#__PURE__*/_jsx(MuiListItemText, {
15
- primary: /*#__PURE__*/_jsx(Typography, {
15
+ primary: typeof primary === 'string' ? /*#__PURE__*/_jsx(Typography, {
16
16
  fontSize: 17,
17
17
  fontWeight: 600,
18
18
  children: primary
19
+ }) : /*#__PURE__*/_jsx(Box, {
20
+ children: primary
19
21
  }),
20
22
  secondary: /*#__PURE__*/_jsxs(Stack, {
21
23
  direction: "row",
@@ -0,0 +1,35 @@
1
+ import { Autocomplete, Box, Divider } from "@mui/material";
2
+ import { TextField } from "@nethru/ui";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export default function SearchableSelect({
6
+ label,
7
+ options,
8
+ ...props
9
+ }) {
10
+ return /*#__PURE__*/_jsx(Autocomplete, {
11
+ autoHighlight: true,
12
+ disableClearable: true,
13
+ options: options,
14
+ renderInput: params => /*#__PURE__*/_jsx(TextField, {
15
+ variant: "standard",
16
+ label: label,
17
+ ...params
18
+ }),
19
+ renderOption: (props, option) => /*#__PURE__*/_jsx(_Fragment, {
20
+ children: option.type === 'divider' ? /*#__PURE__*/_jsx(Divider, {
21
+ ...props,
22
+ sx: {
23
+ mb: 0.5
24
+ }
25
+ }) : /*#__PURE__*/_jsx(Box, {
26
+ component: "li",
27
+ ...props,
28
+ children: option.label
29
+ })
30
+ }),
31
+ getOptionDisabled: option => option.type === 'divider',
32
+ isOptionEqualToValue: (option, value) => option.id === value.id,
33
+ ...props
34
+ });
35
+ }
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ export { default as ListItemText } from "./ListItemText";
23
23
  export { default as MainHeader } from "./MainHeader";
24
24
  export { default as PropertyTable } from "./PropertyTable";
25
25
  export { default as ReferenceChipList } from "./ReferenceChipList";
26
+ export { default as SearchableSelect } from "./SearchableSelect";
26
27
  export { default as SearchTextField } from "./SearchTextField";
27
28
  export { default as Section } from "./Section";
28
29
  export { default as Select } from "./Select";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"