@junyiacademy/ui-test 0.0.9 → 0.0.10
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/declarations/libs/ui/src/lib/menu-item/SelectMenuItem.d.ts +1 -1
- package/declarations/libs/ui/src/lib/select/OutlinedSelect.d.ts +3 -5
- package/declarations/libs/ui/src/lib/select/StandardSelect.d.ts +2 -5
- package/dist/libs/ui/src/lib/select/OutlinedSelect.js +3 -3
- package/dist/libs/ui/src/lib/select/StandardSelect.js +2 -3
- package/package.json +1 -1
- package/src/lib/TopicFilter.stories.tsx +5 -3
- package/src/lib/select/OutlinedSelect.stories.tsx +38 -45
- package/src/lib/select/OutlinedSelect.tsx +15 -19
- package/src/lib/select/StandardSelect.tsx +9 -16
|
@@ -5,5 +5,5 @@ export interface SelectMenuItemProps extends MenuItemProps {
|
|
|
5
5
|
value?: any;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "button" | "slot" | "style" | "title" | "color" | "width" | "alignItems" | "translate" | "hidden" | "dense" | "disabled" | "classes" | "className" | "children" | "
|
|
8
|
+
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "button" | "slot" | "style" | "title" | "color" | "width" | "alignItems" | "translate" | "hidden" | "dense" | "disabled" | "classes" | "className" | "children" | "value" | "onChange" | "onKeyUp" | "onKeyDown" | "onBlur" | "onFocus" | "defaultValue" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "innerRef" | "key" | "selected" | "ContainerComponent" | "ContainerProps" | "disableGutters" | "divider" | "focusVisibleClassName"> & React.RefAttributes<HTMLLIElement>>;
|
|
9
9
|
export default SelectMenuItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
2
|
import { SelectProps, OutlinedInputProps } from '@material-ui/core';
|
|
3
|
-
export interface OutlinedSelectProps {
|
|
3
|
+
export interface OutlinedSelectProps extends SelectProps {
|
|
4
4
|
color?: 'primary' | 'secondary';
|
|
5
5
|
size?: 'medium' | 'small';
|
|
6
6
|
width?: number | 'auto';
|
|
@@ -10,13 +10,11 @@ export interface OutlinedSelectProps {
|
|
|
10
10
|
hasShrink?: boolean;
|
|
11
11
|
placeholder: string;
|
|
12
12
|
helperText?: string;
|
|
13
|
-
value?: unknown;
|
|
14
13
|
disabled?: boolean;
|
|
15
14
|
SelectProps?: object | Partial<SelectProps>;
|
|
16
15
|
OutlinedInputProps?: Partial<OutlinedInputProps> & {
|
|
17
16
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
18
17
|
};
|
|
19
|
-
children?: React.ReactNode;
|
|
20
18
|
}
|
|
21
|
-
declare const OutlinedSelect: ({ color, size, width, paperMaxHeight, error, hasLabel, hasShrink,
|
|
19
|
+
declare const OutlinedSelect: ({ placeholder, SelectProps, OutlinedInputProps, children, color, size, width, paperMaxHeight, error, hasLabel, hasShrink, helperText, value, disabled, }: OutlinedSelectProps) => JSX.Element;
|
|
22
20
|
export default OutlinedSelect;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { SelectProps, InputProps } from '@material-ui/core';
|
|
3
|
-
export interface StandardSelectProps {
|
|
2
|
+
export interface StandardSelectProps extends SelectProps {
|
|
4
3
|
color?: 'primary' | 'secondary';
|
|
5
4
|
size?: 'medium' | 'small';
|
|
6
5
|
width?: number | 'auto';
|
|
@@ -10,10 +9,8 @@ export interface StandardSelectProps {
|
|
|
10
9
|
placeholder: string;
|
|
11
10
|
helperText?: string;
|
|
12
11
|
InputProps?: object & Partial<InputProps>;
|
|
13
|
-
value?: unknown;
|
|
14
12
|
disabled?: boolean;
|
|
15
13
|
SelectProps?: object | Partial<SelectProps>;
|
|
16
|
-
children?: React.ReactNode;
|
|
17
14
|
}
|
|
18
|
-
export declare function StandardSelect({
|
|
15
|
+
export declare function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color, size, width, paperMaxHeight, error, hasShrink, value, disabled, }: StandardSelectProps): JSX.Element;
|
|
19
16
|
export default StandardSelect;
|
|
@@ -91,16 +91,16 @@ const StyledSelect = styles_1.styled((_a) => {
|
|
|
91
91
|
classes: { paper: className },
|
|
92
92
|
} }, props)));
|
|
93
93
|
})(({ hasAdornment, paperMaxHeight }) => ({
|
|
94
|
-
'
|
|
94
|
+
'&': {
|
|
95
95
|
maxHeight: paperMaxHeight,
|
|
96
96
|
left: hasAdornment ? '24px !important' : '70px',
|
|
97
97
|
},
|
|
98
98
|
}));
|
|
99
|
-
const OutlinedSelect = ({ color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false,
|
|
99
|
+
const OutlinedSelect = ({ placeholder, SelectProps, OutlinedInputProps, children, color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, helperText = '', value = '', disabled = false, }) => {
|
|
100
100
|
const hasAdornment = !!(OutlinedInputProps === null || OutlinedInputProps === void 0 ? void 0 : OutlinedInputProps.startAdornment);
|
|
101
101
|
const hasHelperText = !!helperText;
|
|
102
102
|
return (react_1.default.createElement(StyledFormControl, { size: size, width: width, disabled: disabled, error: error, color: color },
|
|
103
|
-
hasLabel
|
|
103
|
+
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, placeholder)),
|
|
104
104
|
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 }, OutlinedInputProps)) }, SelectProps), children),
|
|
105
105
|
hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
|
|
106
106
|
};
|
|
@@ -56,7 +56,6 @@ const StyledSelect = styles_1.styled((_a) => {
|
|
|
56
56
|
maxHeight: paperMaxHeight,
|
|
57
57
|
left: hasAdornment ? '48px !important' : '70px',
|
|
58
58
|
},
|
|
59
|
-
[`&.${classes.selectDisabled}`]: {},
|
|
60
59
|
}));
|
|
61
60
|
const StyledInput = styles_1.styled((_a) => {
|
|
62
61
|
var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
|
|
@@ -78,11 +77,11 @@ const StyledInput = styles_1.styled((_a) => {
|
|
|
78
77
|
},
|
|
79
78
|
},
|
|
80
79
|
}));
|
|
81
|
-
function StandardSelect({ color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasShrink = false,
|
|
80
|
+
function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'medium', width = 'auto', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
|
|
82
81
|
const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
|
|
83
82
|
const hasHelperText = !!helperText;
|
|
84
83
|
return (react_1.default.createElement(StyledFormControl, { color: color, size: size, width: width, disabled: disabled, error: error },
|
|
85
|
-
|
|
84
|
+
react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, placeholder),
|
|
86
85
|
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),
|
|
87
86
|
hasHelperText && react_1.default.createElement(core_1.FormHelperText, null, helperText)));
|
|
88
87
|
}
|
package/package.json
CHANGED
|
@@ -63,13 +63,15 @@ export default {
|
|
|
63
63
|
},
|
|
64
64
|
} as Meta
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const TopicFilterWithOutlinedSelectStory: Story<TopicFilterProps> = (args) => (
|
|
67
67
|
<TopicFilter {...args} />
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
export const
|
|
70
|
+
export const TopicFilterWithOutlinedSelect = TopicFilterWithOutlinedSelectStory.bind(
|
|
71
|
+
{}
|
|
72
|
+
)
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
TopicFilterWithOutlinedSelect.args = {
|
|
73
75
|
topicTree: topicTree,
|
|
74
76
|
onTopicSelected: () => {},
|
|
75
77
|
isLastLayer: (selectedTopic) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { Story, Meta } from '@storybook/react'
|
|
3
3
|
import { Theme, styled } from '@material-ui/core/styles'
|
|
4
|
-
import { InputAdornment } from '@material-ui/core'
|
|
4
|
+
import { InputAdornment, OutlinedInputProps } from '@material-ui/core'
|
|
5
5
|
import { Visibility } from '@material-ui/icons'
|
|
6
6
|
import OutlinedSelect, { OutlinedSelectProps } from './OutlinedSelect'
|
|
7
7
|
import SelectMenuItem from '../menu-item/SelectMenuItem'
|
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
},
|
|
52
52
|
control: { type: 'number' },
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
hasLabel: {
|
|
55
55
|
type: { name: 'boolean', required: false },
|
|
56
56
|
description: 'If true, the label is displayed.',
|
|
57
57
|
table: {
|
|
@@ -157,41 +157,47 @@ const StyledInputAdornment = styled(({ disabled: _disabled, ...props }) => (
|
|
|
157
157
|
},
|
|
158
158
|
}))
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<OutlinedSelect {...props}>
|
|
163
|
-
<SelectMenuItem width={220} value='' disabled>
|
|
164
|
-
{PLACEHOLDER}
|
|
165
|
-
</SelectMenuItem>
|
|
166
|
-
<SelectMenuItem width={220} value='Test'>
|
|
167
|
-
This is a select menu item
|
|
168
|
-
</SelectMenuItem>
|
|
169
|
-
<SelectMenuItem width={220} value='Example'>
|
|
170
|
-
Example
|
|
171
|
-
</SelectMenuItem>
|
|
172
|
-
</OutlinedSelect>
|
|
173
|
-
)
|
|
160
|
+
interface OutlinedSelectWithMenuProps {
|
|
161
|
+
startAdornment?: React.ReactNode
|
|
174
162
|
}
|
|
175
163
|
|
|
176
|
-
const
|
|
164
|
+
const OutlinedSelectWithMenu = ({
|
|
165
|
+
startAdornment,
|
|
166
|
+
...props
|
|
167
|
+
}: OutlinedSelectProps & OutlinedSelectWithMenuProps) => {
|
|
177
168
|
const [item, setItem] = useState<string>('')
|
|
178
169
|
|
|
179
170
|
const handleChange = (event) => {
|
|
180
171
|
setItem(event.target.value)
|
|
181
172
|
}
|
|
182
173
|
return (
|
|
183
|
-
<
|
|
174
|
+
<OutlinedSelect
|
|
184
175
|
OutlinedInputProps={{
|
|
185
176
|
onChange: (e) => {
|
|
186
177
|
handleChange(e)
|
|
187
178
|
},
|
|
179
|
+
startAdornment,
|
|
188
180
|
}}
|
|
189
181
|
value={item}
|
|
190
|
-
{...
|
|
191
|
-
|
|
182
|
+
{...props}
|
|
183
|
+
>
|
|
184
|
+
<SelectMenuItem width={220} value='' disabled>
|
|
185
|
+
{PLACEHOLDER}
|
|
186
|
+
</SelectMenuItem>
|
|
187
|
+
<SelectMenuItem width={220} value='Test'>
|
|
188
|
+
This is a select menu item
|
|
189
|
+
</SelectMenuItem>
|
|
190
|
+
<SelectMenuItem width={220} value='Example'>
|
|
191
|
+
Example
|
|
192
|
+
</SelectMenuItem>
|
|
193
|
+
</OutlinedSelect>
|
|
192
194
|
)
|
|
193
195
|
}
|
|
194
196
|
|
|
197
|
+
const ValueOnlyStory: Story<OutlinedSelectProps> = (args) => (
|
|
198
|
+
<OutlinedSelectWithMenu {...args} />
|
|
199
|
+
)
|
|
200
|
+
|
|
195
201
|
export const ValueOnly = ValueOnlyStory.bind({})
|
|
196
202
|
|
|
197
203
|
ValueOnly.args = {
|
|
@@ -199,36 +205,23 @@ ValueOnly.args = {
|
|
|
199
205
|
size: 'medium',
|
|
200
206
|
width: 220,
|
|
201
207
|
paperMaxHeight: 412,
|
|
202
|
-
|
|
208
|
+
hasLabel: true,
|
|
203
209
|
placeholder: PLACEHOLDER,
|
|
204
210
|
helperText: 'test',
|
|
205
211
|
disabled: false,
|
|
206
212
|
SelectProps: {},
|
|
207
213
|
}
|
|
208
214
|
|
|
209
|
-
const WithPrefixStory: Story<OutlinedSelectProps> = (args) =>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
handleChange(e)
|
|
220
|
-
},
|
|
221
|
-
startAdornment: (
|
|
222
|
-
<StyledInputAdornment position='start' disabled={args.disabled}>
|
|
223
|
-
<Visibility />
|
|
224
|
-
</StyledInputAdornment>
|
|
225
|
-
),
|
|
226
|
-
}}
|
|
227
|
-
value={item}
|
|
228
|
-
{...args}
|
|
229
|
-
/>
|
|
230
|
-
)
|
|
231
|
-
}
|
|
215
|
+
const WithPrefixStory: Story<OutlinedSelectProps> = (args) => (
|
|
216
|
+
<OutlinedSelectWithMenu
|
|
217
|
+
startAdornment={
|
|
218
|
+
<StyledInputAdornment position='start' disabled={args.disabled}>
|
|
219
|
+
<Visibility />
|
|
220
|
+
</StyledInputAdornment>
|
|
221
|
+
}
|
|
222
|
+
{...args}
|
|
223
|
+
/>
|
|
224
|
+
)
|
|
232
225
|
|
|
233
226
|
export const WithPrefix = WithPrefixStory.bind({})
|
|
234
227
|
|
|
@@ -237,7 +230,7 @@ WithPrefix.args = {
|
|
|
237
230
|
size: 'medium',
|
|
238
231
|
width: 220,
|
|
239
232
|
paperMaxHeight: 412,
|
|
240
|
-
|
|
233
|
+
hasLabel: true,
|
|
241
234
|
placeholder: PLACEHOLDER,
|
|
242
235
|
helperText: 'test',
|
|
243
236
|
disabled: false,
|
|
@@ -137,13 +137,13 @@ const StyledSelect = styled(
|
|
|
137
137
|
/>
|
|
138
138
|
)
|
|
139
139
|
)(({ hasAdornment, paperMaxHeight }: StyledSelectProps) => ({
|
|
140
|
-
'
|
|
140
|
+
'&': {
|
|
141
141
|
maxHeight: paperMaxHeight,
|
|
142
142
|
left: hasAdornment ? '24px !important' : '70px',
|
|
143
143
|
},
|
|
144
144
|
}))
|
|
145
145
|
|
|
146
|
-
export interface OutlinedSelectProps {
|
|
146
|
+
export interface OutlinedSelectProps extends SelectProps {
|
|
147
147
|
color?: 'primary' | 'secondary'
|
|
148
148
|
size?: 'medium' | 'small'
|
|
149
149
|
width?: number | 'auto'
|
|
@@ -153,16 +153,18 @@ export interface OutlinedSelectProps {
|
|
|
153
153
|
hasShrink?: boolean
|
|
154
154
|
placeholder: string
|
|
155
155
|
helperText?: string
|
|
156
|
-
value?: unknown
|
|
157
156
|
disabled?: boolean
|
|
158
157
|
SelectProps?: object | Partial<SelectProps>
|
|
159
158
|
OutlinedInputProps?: Partial<OutlinedInputProps> & {
|
|
160
159
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void
|
|
161
160
|
}
|
|
162
|
-
children?: React.ReactNode
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
const OutlinedSelect = ({
|
|
164
|
+
placeholder,
|
|
165
|
+
SelectProps,
|
|
166
|
+
OutlinedInputProps,
|
|
167
|
+
children,
|
|
166
168
|
color = 'primary',
|
|
167
169
|
size = 'medium',
|
|
168
170
|
width = 'auto',
|
|
@@ -170,13 +172,9 @@ const OutlinedSelect = ({
|
|
|
170
172
|
error = false,
|
|
171
173
|
hasLabel = true,
|
|
172
174
|
hasShrink = false,
|
|
173
|
-
placeholder,
|
|
174
175
|
helperText = '',
|
|
175
176
|
value = '',
|
|
176
177
|
disabled = false,
|
|
177
|
-
SelectProps,
|
|
178
|
-
OutlinedInputProps,
|
|
179
|
-
children,
|
|
180
178
|
}: OutlinedSelectProps) => {
|
|
181
179
|
const hasAdornment = !!OutlinedInputProps?.startAdornment
|
|
182
180
|
const hasHelperText = !!helperText
|
|
@@ -188,17 +186,15 @@ const OutlinedSelect = ({
|
|
|
188
186
|
error={error}
|
|
189
187
|
color={color}
|
|
190
188
|
>
|
|
191
|
-
{hasLabel
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
)
|
|
201
|
-
) : null}
|
|
189
|
+
{hasLabel && (
|
|
190
|
+
<StyledInputLabel
|
|
191
|
+
color={color}
|
|
192
|
+
variant='outlined'
|
|
193
|
+
shrink={hasShrink ? true : undefined}
|
|
194
|
+
>
|
|
195
|
+
{placeholder}
|
|
196
|
+
</StyledInputLabel>
|
|
197
|
+
)}
|
|
202
198
|
<StyledSelect
|
|
203
199
|
value={value}
|
|
204
200
|
paperMaxHeight={paperMaxHeight}
|
|
@@ -92,7 +92,6 @@ const StyledSelect = styled(
|
|
|
92
92
|
maxHeight: paperMaxHeight,
|
|
93
93
|
left: hasAdornment ? '48px !important' : '70px',
|
|
94
94
|
},
|
|
95
|
-
[`&.${classes.selectDisabled}`]: {},
|
|
96
95
|
}))
|
|
97
96
|
|
|
98
97
|
interface StyledInputProps {
|
|
@@ -123,7 +122,7 @@ const StyledInput = styled(({ color: _color, ...props }) => (
|
|
|
123
122
|
},
|
|
124
123
|
}))
|
|
125
124
|
|
|
126
|
-
export interface StandardSelectProps {
|
|
125
|
+
export interface StandardSelectProps extends SelectProps {
|
|
127
126
|
color?: 'primary' | 'secondary'
|
|
128
127
|
size?: 'medium' | 'small'
|
|
129
128
|
width?: number | 'auto'
|
|
@@ -133,26 +132,24 @@ export interface StandardSelectProps {
|
|
|
133
132
|
placeholder: string
|
|
134
133
|
helperText?: string
|
|
135
134
|
InputProps?: object & Partial<InputProps>
|
|
136
|
-
value?: unknown
|
|
137
135
|
disabled?: boolean
|
|
138
136
|
SelectProps?: object | Partial<SelectProps>
|
|
139
|
-
children?: React.ReactNode
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
export function StandardSelect({
|
|
140
|
+
placeholder,
|
|
141
|
+
helperText,
|
|
142
|
+
InputProps,
|
|
143
|
+
SelectProps,
|
|
144
|
+
children,
|
|
143
145
|
color = 'primary',
|
|
144
146
|
size = 'medium',
|
|
145
147
|
width = 'auto',
|
|
146
148
|
paperMaxHeight = 'auto',
|
|
147
149
|
error = false,
|
|
148
150
|
hasShrink = false,
|
|
149
|
-
placeholder,
|
|
150
|
-
helperText,
|
|
151
|
-
InputProps,
|
|
152
151
|
value = '',
|
|
153
|
-
SelectProps,
|
|
154
152
|
disabled = false,
|
|
155
|
-
children,
|
|
156
153
|
}: StandardSelectProps) {
|
|
157
154
|
const hasAdornment = !!InputProps?.startAdornment
|
|
158
155
|
const hasHelperText = !!helperText
|
|
@@ -164,13 +161,9 @@ export function StandardSelect({
|
|
|
164
161
|
disabled={disabled}
|
|
165
162
|
error={error}
|
|
166
163
|
>
|
|
167
|
-
{hasShrink ?
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</StyledInputLabel>
|
|
171
|
-
) : (
|
|
172
|
-
<StyledInputLabel color={color}>{placeholder}</StyledInputLabel>
|
|
173
|
-
)}
|
|
164
|
+
<StyledInputLabel color={color} shrink={hasShrink ? true : undefined}>
|
|
165
|
+
{placeholder}
|
|
166
|
+
</StyledInputLabel>
|
|
174
167
|
<StyledSelect
|
|
175
168
|
value={value}
|
|
176
169
|
paperMaxHeight={paperMaxHeight}
|