@junyiacademy/ui-test 0.0.14 → 1.4.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.
@@ -17,8 +17,9 @@ export interface SelectProps extends MuiSelectProp {
17
17
  SelectProps?: object | Partial<MuiSelectProp>;
18
18
  color?: 'primary' | 'secondary';
19
19
  size?: 'medium' | 'small';
20
- width?: number | 'auto';
21
- paperMaxHeight?: number | 'auto';
20
+ width?: number | string;
21
+ selectMargin?: number | string;
22
+ paperMaxHeight?: number | string;
22
23
  error?: boolean;
23
24
  hasLabel?: boolean;
24
25
  hasShrink?: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MenuItemProps } from '@material-ui/core';
3
3
  export interface SelectMenuItemProps extends MenuItemProps {
4
- width: number | 'auto';
4
+ width: number | string;
5
5
  value?: any;
6
6
  disabled?: boolean;
7
7
  }
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from '../../interfaces';
2
- export declare const OutlinedSelect: ({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
2
+ export declare const OutlinedSelect: ({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, selectMargin, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
3
3
  export default OutlinedSelect;
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from '../../interfaces';
2
- export declare function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
2
+ export declare function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, selectMargin, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
3
3
  export default StandardSelect;
@@ -16,8 +16,11 @@ const StyledMenuItem = styles_1.styled((_a) => {
16
16
  width: width,
17
17
  whiteSpace: 'unset',
18
18
  color: theme.palette.text.primary,
19
- [`& .${classes.menuItemSelected}`]: {
19
+ [`&.${classes.menuItemSelected}`]: {
20
20
  backgroundColor: theme.palette.grey[300],
21
+ ['&:hover']: {
22
+ backgroundColor: theme.palette.grey[200],
23
+ },
21
24
  },
22
25
  }));
23
26
  const SelectMenuItem = react_1.default.forwardRef((_a, ref) => {
@@ -24,11 +24,11 @@ const classes = {
24
24
  selectPaper: `${PREFIX}-menuPaper`,
25
25
  };
26
26
  const StyledFormControl = styles_1.styled((_a) => {
27
- var { color: _color, width: _width } = _a, props = tslib_1.__rest(_a, ["color", "width"]);
28
- return react_1.default.createElement(core_1.FormControl, Object.assign({}, props));
29
- })(({ color, width, theme }) => ({
30
- margin: theme.spacing(1),
31
- width: width,
27
+ var { color: _color, width: _width, selectMargin: _selectMargin } = _a, props = tslib_1.__rest(_a, ["color", "width", "selectMargin"]);
28
+ return (react_1.default.createElement(core_1.FormControl, Object.assign({}, props)));
29
+ })(({ color, width, selectMargin, theme }) => ({
30
+ width,
31
+ margin: selectMargin,
32
32
  backgroundColor: 'white',
33
33
  '&:hover': {
34
34
  [`& :not(.${classes.outlineInputDisabled}):not(.${classes.outlineInputError}) .${classes.outlineInputNotchedOutline}`]: {
@@ -111,10 +111,10 @@ const StyledSelect = styles_1.styled((_a) => {
111
111
  left: hasAdornment ? '24px !important' : '70px',
112
112
  },
113
113
  }));
114
- const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'small', width = 'auto', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
114
+ const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'small', width = 'auto', selectMargin = 0, paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
115
115
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
116
116
  const hasHelperText = !!helperText;
117
- return (react_1.default.createElement(StyledFormControl, { size: size, width: width, disabled: disabled, error: error, color: color },
117
+ return (react_1.default.createElement(StyledFormControl, { size: size, width: width, selectMargin: selectMargin, disabled: disabled, error: error, color: color },
118
118
  hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, placeholder)),
119
119
  react_1.default.createElement(StyledSelect, Object.assign({ value: value, paperMaxHeight: paperMaxHeight, hasAdornment: hasAdornment, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? placeholder : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
120
120
  hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
@@ -21,11 +21,11 @@ const classes = {
21
21
  selectDisabled: `${PREFIX}-selectDisabled`,
22
22
  };
23
23
  const StyledFormControl = styles_1.styled((_a) => {
24
- var { width: _width } = _a, props = tslib_1.__rest(_a, ["width"]);
24
+ var { width: _width, selectMargin: _selectMargin } = _a, props = tslib_1.__rest(_a, ["width", "selectMargin"]);
25
25
  return (react_1.default.createElement(core_1.FormControl, Object.assign({}, props)));
26
- })(({ width, theme }) => ({
26
+ })(({ width, selectMargin, theme }) => ({
27
27
  width,
28
- margin: theme.spacing(0, 4, 4, 4),
28
+ margin: selectMargin,
29
29
  }));
30
30
  const StyledInputLabel = styles_1.styled((_a) => {
31
31
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
@@ -85,10 +85,10 @@ const StyledInput = styles_1.styled((_a) => {
85
85
  },
86
86
  },
87
87
  }));
88
- function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'small', width = 'auto', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
88
+ function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'small', width = 'auto', selectMargin = '0', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
89
89
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
90
90
  const hasHelperText = !!helperText;
91
- return (react_1.default.createElement(StyledFormControl, { color: color, size: size, width: width, disabled: disabled, error: error },
91
+ return (react_1.default.createElement(StyledFormControl, { color: color, size: size, width: width, selectMargin: selectMargin, disabled: disabled, error: error },
92
92
  react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, placeholder),
93
93
  react_1.default.createElement(StyledSelect, Object.assign({ value: value, paperMaxHeight: paperMaxHeight, hasAdornment: hasAdornment, input: react_1.default.createElement(StyledInput, Object.assign({ color: color }, InputProps)) }, SelectProps), children),
94
94
  hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const styles_1 = require("@material-ui/core/styles");
7
7
  const ArrowRightRounded_1 = tslib_1.__importDefault(require("@material-ui/icons/ArrowRightRounded"));
8
- const OutlinedSelect_1 = tslib_1.__importDefault(require("../select/OutlinedSelect"));
8
+ const Select_1 = tslib_1.__importDefault(require("../select/Select"));
9
9
  const SelectMenuItem_1 = tslib_1.__importDefault(require("../menu-item/SelectMenuItem"));
10
10
  // self-defined-configs
11
11
  const PLACEHOLDER = '請選擇';
@@ -26,6 +26,7 @@ const StyledArrowRightRoundedIcon = styles_1.styled(ArrowRightRounded_1.default)
26
26
  color: '#444',
27
27
  }));
28
28
  const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSelectedTopicIds, }) => {
29
+ const theme = styles_1.useTheme();
29
30
  const [selectedTopicIds, setSelectedTopicIds] = react_1.useState([]);
30
31
  const [layeredTopicList, setLayeredTopicList] = react_1.useState([]);
31
32
  const [isFocusedList, setIsFocusedList] = react_1.useState([]);
@@ -82,12 +83,12 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
82
83
  setLayeredTopicList([topicTree]);
83
84
  }, [topicTree]);
84
85
  if (layeredTopicList.length === 0) {
85
- return (react_1.default.createElement(OutlinedSelect_1.default, { size: 'small', width: 220, placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
86
+ return (react_1.default.createElement(Select_1.default, { variant: 'outlined', size: 'small', width: 220, selectMargin: theme.spacing(1), placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
86
87
  }
87
88
  return (react_1.default.createElement(FiltersWrapper, null, layeredTopicList.map((layeredTopic, layerNumber) => {
88
89
  const hasLabel = isFocusedList[layerNumber] || !selectedTopicIds[layerNumber];
89
90
  return (react_1.default.createElement(SelectWrapper, { key: layeredTopic.id },
90
- react_1.default.createElement(OutlinedSelect_1.default, { size: 'small', width: 220, paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
91
+ react_1.default.createElement(Select_1.default, { variant: 'outlined', size: 'small', width: 220, selectMargin: theme.spacing(1), paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
91
92
  'data-testid': `layered-topic-${layerNumber}`,
92
93
  }, InputProps: {
93
94
  inputProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "0.0.14",
3
+ "version": "1.4.0",
4
4
  "description": "junyiacademy ui library",
5
5
  "main": "./dist/libs/ui/src/index.js",
6
6
  "typings": "./declarations/libs/ui/src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@material-ui/core": "4.9.10",
21
21
  "@material-ui/icons": "4.9.1",
22
- "react": "16.13.1"
22
+ "react": "17.0.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "typescript": "~4.1.4"
@@ -24,8 +24,9 @@ export interface SelectProps extends MuiSelectProp {
24
24
  SelectProps?: object | Partial<MuiSelectProp>
25
25
  color?: 'primary' | 'secondary'
26
26
  size?: 'medium' | 'small'
27
- width?: number | 'auto'
28
- paperMaxHeight?: number | 'auto'
27
+ width?: number | string
28
+ selectMargin?: number | string
29
+ paperMaxHeight?: number | string
29
30
  error?: boolean
30
31
  hasLabel?: boolean
31
32
  hasShrink?: boolean
@@ -10,7 +10,7 @@ const classes = {
10
10
  }
11
11
 
12
12
  interface StyledMenuItemProps {
13
- width: number | 'auto'
13
+ width: number | string
14
14
  theme?: Theme
15
15
  }
16
16
 
@@ -20,13 +20,16 @@ const StyledMenuItem = styled(({ width: _width, ...props }) => (
20
20
  width: width,
21
21
  whiteSpace: 'unset',
22
22
  color: theme.palette.text.primary,
23
- [`& .${classes.menuItemSelected}`]: {
23
+ [`&.${classes.menuItemSelected}`]: {
24
24
  backgroundColor: theme.palette.grey[300],
25
+ ['&:hover']: {
26
+ backgroundColor: theme.palette.grey[200],
27
+ },
25
28
  },
26
29
  }))
27
30
 
28
31
  export interface SelectMenuItemProps extends MenuItemProps {
29
- width: number | 'auto'
32
+ width: number | string
30
33
  value?: any
31
34
  disabled?: boolean
32
35
  }
@@ -31,15 +31,18 @@ const classes = {
31
31
 
32
32
  interface StyledFormControlProps {
33
33
  color: 'primary' | 'secondary'
34
- width: number | 'auto'
34
+ width: number | string
35
+ selectMargin: number | string
35
36
  theme?: Theme
36
37
  }
37
38
 
38
39
  const StyledFormControl = styled(
39
- ({ color: _color, width: _width, ...props }) => <FormControl {...props} />
40
- )(({ color, width, theme }: StyledFormControlProps) => ({
41
- margin: theme.spacing(1),
42
- width: width,
40
+ ({ color: _color, width: _width, selectMargin: _selectMargin, ...props }) => (
41
+ <FormControl {...props} />
42
+ )
43
+ )(({ color, width, selectMargin, theme }: StyledFormControlProps) => ({
44
+ width,
45
+ margin: selectMargin,
43
46
  backgroundColor: 'white',
44
47
  '&:hover': {
45
48
  [`& :not(.${classes.outlineInputDisabled}):not(.${classes.outlineInputError}) .${classes.outlineInputNotchedOutline}`]: {
@@ -119,7 +122,7 @@ const StyledOutlinedInput = styled((props) => (
119
122
  }))
120
123
 
121
124
  interface StyledSelectProps {
122
- paperMaxHeight: number | 'auto'
125
+ paperMaxHeight: number | string
123
126
  hasAdornment: boolean
124
127
  }
125
128
 
@@ -165,6 +168,7 @@ export const OutlinedSelect = ({
165
168
  color = 'primary',
166
169
  size = 'small',
167
170
  width = 'auto',
171
+ selectMargin = 0,
168
172
  paperMaxHeight = 'auto',
169
173
  error = false,
170
174
  hasLabel = true,
@@ -178,6 +182,7 @@ export const OutlinedSelect = ({
178
182
  <StyledFormControl
179
183
  size={size}
180
184
  width={width}
185
+ selectMargin={selectMargin}
181
186
  disabled={disabled}
182
187
  error={error}
183
188
  color={color}
@@ -43,19 +43,28 @@ export default {
43
43
  control: { type: 'radio' },
44
44
  },
45
45
  width: {
46
- type: { name: 'number', required: false },
46
+ type: { name: 'number | string', required: false },
47
47
  description: `Adjust width`,
48
48
  table: {
49
- type: { summary: 'number' },
49
+ type: { summary: 'number | string' },
50
50
  defaultValue: { summary: 'auto' },
51
51
  },
52
52
  control: { type: 'number' },
53
53
  },
54
+ selectMargin: {
55
+ type: { name: 'number | string', required: false },
56
+ description: `Adjust margin`,
57
+ table: {
58
+ type: { summary: 'number | string' },
59
+ defaultValue: { summary: '0' },
60
+ },
61
+ control: { type: 'number' },
62
+ },
54
63
  paperMaxHeight: {
55
- type: { name: 'number', required: false },
64
+ type: { name: 'number | string', required: false },
56
65
  description: `Adjust select menu paper max height.`,
57
66
  table: {
58
- type: { summary: 'number' },
67
+ type: { summary: 'number | string' },
59
68
  defaultValue: { summary: 'auto' },
60
69
  },
61
70
  control: { type: 'number' },
@@ -28,15 +28,18 @@ const classes = {
28
28
 
29
29
  interface StyledFormControlProps {
30
30
  color: 'primary' | 'secondary'
31
- width: number | 'auto'
31
+ width: number | string
32
+ selectMargin: number | string
32
33
  theme?: Theme
33
34
  }
34
35
 
35
- const StyledFormControl = styled(({ width: _width, ...props }) => (
36
- <FormControl {...props} />
37
- ))(({ width, theme }: StyledFormControlProps) => ({
36
+ const StyledFormControl = styled(
37
+ ({ width: _width, selectMargin: _selectMargin, ...props }) => (
38
+ <FormControl {...props} />
39
+ )
40
+ )(({ width, selectMargin, theme }: StyledFormControlProps) => ({
38
41
  width,
39
- margin: theme.spacing(0, 4, 4, 4),
42
+ margin: selectMargin,
40
43
  }))
41
44
 
42
45
  interface StyledInputLabelProps {
@@ -64,7 +67,7 @@ const StyledInputLabel = styled(({ color: _color, ...props }) => (
64
67
  }))
65
68
 
66
69
  interface StyledSelectProps {
67
- paperMaxHeight: number | 'auto'
70
+ paperMaxHeight: number | string
68
71
  hasAdornment: boolean
69
72
  }
70
73
 
@@ -137,6 +140,7 @@ export function StandardSelect({
137
140
  color = 'primary',
138
141
  size = 'small',
139
142
  width = 'auto',
143
+ selectMargin = '0',
140
144
  paperMaxHeight = 'auto',
141
145
  error = false,
142
146
  hasShrink = false,
@@ -150,6 +154,7 @@ export function StandardSelect({
150
154
  color={color}
151
155
  size={size}
152
156
  width={width}
157
+ selectMargin={selectMargin}
153
158
  disabled={disabled}
154
159
  error={error}
155
160
  >
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Theme, styled } from '@material-ui/core/styles'
2
+ import { Theme, styled, useTheme } from '@material-ui/core/styles'
3
3
  import ArrowRightRoundedIcon from '@material-ui/icons/ArrowRightRounded'
4
4
  import type { ITopicTreeNode } from '../../interfaces'
5
- import OutlinedSelect from '../select/OutlinedSelect'
5
+ import Select from '../select/Select'
6
6
  import SelectMenuItem from '../menu-item/SelectMenuItem'
7
7
 
8
8
  // self-defined-configs
@@ -52,6 +52,7 @@ export const TopicFilter = ({
52
52
  hasArrow,
53
53
  initSelectedTopicIds,
54
54
  }: TopicFilterProps) => {
55
+ const theme = useTheme()
55
56
  const [selectedTopicIds, setSelectedTopicIds] = useState([])
56
57
  const [layeredTopicList, setLayeredTopicList] = useState([])
57
58
  const [isFocusedList, setIsFocusedList] = useState([])
@@ -125,12 +126,14 @@ export const TopicFilter = ({
125
126
 
126
127
  if (layeredTopicList.length === 0) {
127
128
  return (
128
- <OutlinedSelect
129
+ <Select
130
+ variant='outlined'
129
131
  size='small'
130
132
  width={220}
133
+ selectMargin={theme.spacing(1)}
131
134
  placeholder='載入資料中...'
132
135
  disabled
133
- ></OutlinedSelect>
136
+ ></Select>
134
137
  )
135
138
  }
136
139
  return (
@@ -140,9 +143,11 @@ export const TopicFilter = ({
140
143
  isFocusedList[layerNumber] || !selectedTopicIds[layerNumber]
141
144
  return (
142
145
  <SelectWrapper key={layeredTopic.id}>
143
- <OutlinedSelect
146
+ <Select
147
+ variant='outlined'
144
148
  size='small'
145
149
  width={220}
150
+ selectMargin={theme.spacing(1)}
146
151
  paperMaxHeight={412}
147
152
  hasLabel={hasLabel}
148
153
  placeholder={PLACEHOLDER}
@@ -187,7 +192,7 @@ export const TopicFilter = ({
187
192
  {childTopic.title}
188
193
  </SelectMenuItem>
189
194
  ))}
190
- </OutlinedSelect>
195
+ </Select>
191
196
  {hasArrow && layerNumber !== layeredTopicList.length - 1 && (
192
197
  <StyledArrowRightRoundedIcon
193
198
  fontSize='large'
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { AlertProps as MuiAlertProps } from '@material-ui/lab';
3
- export interface AlertProps extends MuiAlertProps {
4
- severity?: 'success' | 'info' | 'warning' | 'error';
5
- action?: boolean;
6
- buttonLink?: string;
7
- isNewTab?: boolean;
8
- cross?: boolean;
9
- handleCrossClick?: () => void;
10
- children?: React.ReactNode;
11
- }
12
- export declare const JuiAlert: ({ severity, action, buttonLink, isNewTab, cross, handleCrossClick, children, ...otherProps }: AlertProps) => JSX.Element;
13
- export default JuiAlert;
@@ -1,10 +0,0 @@
1
- export interface SelectionItemProps {
2
- handleInput: () => {};
3
- label1: string;
4
- value1: string;
5
- label2: string;
6
- value2: string;
7
- isError: boolean;
8
- }
9
- export declare function SelectionItem({ handleInput, label1, value1, label2, value2, isError, }: SelectionItemProps): JSX.Element;
10
- export default SelectionItem;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JuiAlert = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const styles_1 = require("@material-ui/core/styles");
7
- const Alert_1 = tslib_1.__importDefault(require("@material-ui/lab/Alert"));
8
- const Button_1 = require("../button/Button");
9
- const CheckCircleOutline_1 = tslib_1.__importDefault(require("@material-ui/icons/CheckCircleOutline"));
10
- // self-defined-components
11
- const PREFIX = 'JuiAlert';
12
- const alertClasses = {
13
- alertRoot: `${PREFIX}-alertRoot`,
14
- alertMessage: `${PREFIX}-alertMessage`,
15
- };
16
- const buttonClasses = {
17
- buttonRoot: `${PREFIX}-buttonRoot`,
18
- };
19
- const StyledAlert = styles_1.styled((_a) => {
20
- var props = tslib_1.__rest(_a, []);
21
- return (react_1.default.createElement(Alert_1.default, Object.assign({ classes: {
22
- root: alertClasses.alertRoot,
23
- message: alertClasses.alertMessage,
24
- } }, props)));
25
- })({
26
- [`&.${alertClasses.alertRoot}`]: {
27
- height: '48px',
28
- padding: '0 16px',
29
- alignItems: 'center',
30
- },
31
- [`& .${alertClasses.alertMessage}`]: {
32
- display: 'flex',
33
- width: '100%',
34
- justifyContent: 'space-between',
35
- alignItems: 'center',
36
- },
37
- });
38
- const StyledButton = styles_1.styled((_a) => {
39
- var { severity: _severity } = _a, props = tslib_1.__rest(_a, ["severity"]);
40
- return (react_1.default.createElement(Button_1.Button, Object.assign({ classes: { root: buttonClasses.buttonRoot } }, props)));
41
- })(({ severity }) => ({
42
- [`&.${buttonClasses.buttonRoot}`]: {
43
- padding: '4px 10px',
44
- margin: '0 0 0 20px',
45
- minWidth: '74px',
46
- color: severity === 'info'
47
- ? 'rgb(13, 60, 97)'
48
- : severity === 'error'
49
- ? 'rgb(97, 26, 21)'
50
- : severity === 'success'
51
- ? 'rgb(30, 70, 32)'
52
- : 'rgb(102, 60, 0)',
53
- fontWeight: '700',
54
- },
55
- }));
56
- const JuiAlert = (_a) => {
57
- var { severity = 'info', action = false, buttonLink = '', isNewTab = true, cross = false, handleCrossClick, children } = _a, otherProps = tslib_1.__rest(_a, ["severity", "action", "buttonLink", "isNewTab", "cross", "handleCrossClick", "children"]);
58
- const handleButtonClick = () => {
59
- window.open(buttonLink, `${isNewTab ? '_blank' : '_self'}`);
60
- };
61
- const AlertChildren = () => {
62
- return (react_1.default.createElement(react_1.default.Fragment, null,
63
- children,
64
- action && (react_1.default.createElement(StyledButton, { severity: severity, size: 'small', onClick: handleButtonClick }, "ACTION"))));
65
- };
66
- if (cross) {
67
- return (react_1.default.createElement(StyledAlert, Object.assign({ severity: severity, iconMapping: { success: react_1.default.createElement(CheckCircleOutline_1.default, { fontSize: 'inherit' }) }, onClose: handleCrossClick }, otherProps), AlertChildren()));
68
- }
69
- return (react_1.default.createElement(StyledAlert, Object.assign({ severity: severity, iconMapping: { success: react_1.default.createElement(CheckCircleOutline_1.default, { fontSize: 'inherit' }) } }, otherProps), AlertChildren()));
70
- };
71
- exports.JuiAlert = JuiAlert;
72
- exports.default = exports.JuiAlert;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectionItem = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const core_1 = require("@material-ui/core");
7
- const Radio_1 = require("../radio/Radio");
8
- function SelectionItem({ handleInput, label1, value1, label2, value2, isError, }) {
9
- return (react_1.default.createElement(react_1.default.Fragment, null,
10
- react_1.default.createElement(core_1.RadioGroup, { onChange: handleInput },
11
- react_1.default.createElement(Radio_1.Radio, { label: label1, value: value1 }),
12
- react_1.default.createElement(Radio_1.Radio, { label: label2, value: value2 })),
13
- isError && react_1.default.createElement(core_1.FormHelperText, null, "\u8ACB\u9078\u64C7")));
14
- }
15
- exports.SelectionItem = SelectionItem;
16
- exports.default = SelectionItem;