@junyiacademy/ui-test 1.5.2 → 1.5.3

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.
@@ -9,7 +9,6 @@ export interface ITopicTreeNode {
9
9
  title: string;
10
10
  }
11
11
  export interface SelectProps extends MuiSelectProp {
12
- placeholder: string;
13
12
  helperText?: string;
14
13
  InputProps?: (Partial<OutlinedInputProps> & {
15
14
  onChange: (e: ChangeEvent<HTMLInputElement>) => void;
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from '../../interfaces';
2
- export declare const OutlinedSelect: ({ placeholder, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
2
+ export declare const OutlinedSelect: ({ label, helperText, InputProps, SelectProps, className, children, color, size, 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, className, children, color, size, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
2
+ export declare function StandardSelect({ label, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
3
3
  export default StandardSelect;
@@ -57,11 +57,11 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
57
57
  },
58
58
  },
59
59
  }));
60
- const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
60
+ const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
61
61
  const hasHelperText = !!helperText;
62
62
  return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
63
- hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, placeholder)),
64
- react_1.default.createElement(material_1.Select, Object.assign({ label: placeholder, value: value, MenuProps: {
63
+ hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, label)),
64
+ react_1.default.createElement(material_1.Select, Object.assign({ label: label, value: value, MenuProps: {
65
65
  PaperProps: {
66
66
  sx: {
67
67
  maxHeight: paperMaxHeight,
@@ -76,7 +76,7 @@ const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, clas
76
76
  vertical: 'top',
77
77
  horizontal: 'left',
78
78
  },
79
- }, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? placeholder : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
79
+ }, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? label : '', disabled: disabled }, InputProps)) }, SelectProps), children),
80
80
  hasHelperText && react_1.default.createElement(material_1.FormHelperText, null, helperText)));
81
81
  };
82
82
  exports.OutlinedSelect = OutlinedSelect;
@@ -40,11 +40,11 @@ const StyledInput = styles_1.styled(material_1.Input, {
40
40
  },
41
41
  },
42
42
  }));
43
- function StandardSelect({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
43
+ function StandardSelect({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
44
44
  const hasHelperText = !!helperText;
45
45
  return (react_1.default.createElement(material_1.FormControl, { variant: 'standard', color: color, size: size, disabled: disabled, error: error, className: className },
46
- react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, placeholder),
47
- react_1.default.createElement(material_1.Select, Object.assign({ label: placeholder, value: value, MenuProps: {
46
+ react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label),
47
+ react_1.default.createElement(material_1.Select, Object.assign({ label: label, value: value, MenuProps: {
48
48
  PaperProps: {
49
49
  sx: {
50
50
  maxHeight: paperMaxHeight,
@@ -9,7 +9,7 @@ const material_1 = require("@mui/material");
9
9
  const Select_1 = tslib_1.__importDefault(require("../select/Select"));
10
10
  const SelectMenuItem_1 = tslib_1.__importDefault(require("../menu-item/SelectMenuItem"));
11
11
  // self-defined-configs
12
- const PLACEHOLDER = '請選擇';
12
+ const LABEL = '請選擇';
13
13
  const StyledSelect = styles_1.styled(Select_1.default)(({ theme }) => ({
14
14
  width: 220,
15
15
  margin: theme.spacing(1),
@@ -71,7 +71,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
71
71
  setLayeredTopicList([topicTree]);
72
72
  }, [topicTree]);
73
73
  if (layeredTopicList.length === 0) {
74
- return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
74
+ return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
75
75
  }
76
76
  return (react_1.default.createElement(material_1.Box, { sx: {
77
77
  display: 'flex',
@@ -83,7 +83,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
83
83
  display: 'flex',
84
84
  alignItems: 'center',
85
85
  }, key: layeredTopic.id },
86
- react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label: '\u8ACB\u9078\u64C7', paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
86
+ react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label: LABEL, paperMaxHeight: 412, hasLabel: hasLabel, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
87
87
  'data-testid': `layered-topic-${layerNumber}`,
88
88
  }, InputProps: {
89
89
  inputProps: {
@@ -107,7 +107,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
107
107
  });
108
108
  },
109
109
  } },
110
- react_1.default.createElement(SelectMenuItem_1.default, { disabled: true }, PLACEHOLDER),
110
+ react_1.default.createElement(SelectMenuItem_1.default, { disabled: true }, LABEL),
111
111
  layeredTopic.childTopics.map((childTopic) => (react_1.default.createElement(SelectMenuItem_1.default, { key: childTopic.id, value: childTopic.id, "data-testid": `layered-menuitem-${layerNumber}`, "data-is-content-topic": childTopic.isContentTopic }, childTopic.title)))),
112
112
  hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: (theme) => ({
113
113
  margin: theme.spacing(-1, -1.5),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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",