@junyiacademy/ui-test 0.0.13 → 0.0.14

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.
@@ -35,9 +35,6 @@ const StyledFormControl = styles_1.styled((_a) => {
35
35
  borderColor: theme.palette[color].main,
36
36
  },
37
37
  },
38
- [`& .${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
39
- borderColor: `${theme.palette.error.main}`,
40
- },
41
38
  }));
42
39
  const StyledInputLabel = styles_1.styled((_a) => {
43
40
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
@@ -69,15 +66,20 @@ const StyledInputLabel = styles_1.styled((_a) => {
69
66
  }));
70
67
  const StyledOutlinedInput = styles_1.styled((props) => (react_1.default.createElement(core_1.OutlinedInput, Object.assign({ classes: {
71
68
  root: classes.outlineInputRoot,
72
- focused: classes.outlineInputFocused,
73
69
  input: classes.outlineInputInput,
70
+ focused: classes.outlineInputFocused,
74
71
  inputMarginDense: classes.outlineInputInputMarginDense,
75
72
  notchedOutline: classes.outlineInputNotchedOutline,
76
73
  disabled: classes.outlineInputDisabled,
77
74
  error: classes.outlineInputError,
78
75
  } }, props))))(({ theme }) => ({
79
- [`&.${classes.outlineInputRoot}.${classes.outlineInputFocused}`]: {
80
- backgroundColor: theme.palette.action.selected,
76
+ [`&.${classes.outlineInputRoot}`]: {
77
+ [`&.${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
78
+ borderColor: `${theme.palette.error.main}`,
79
+ },
80
+ [`& .${classes.outlineInputInputMarginDense}`]: {
81
+ padding: '14.5px 15px 14.5px 12px',
82
+ },
81
83
  },
82
84
  [`& .${classes.outlineInputInput}`]: {
83
85
  color: theme.palette.text.primary,
@@ -85,9 +87,6 @@ const StyledOutlinedInput = styles_1.styled((props) => (react_1.default.createEl
85
87
  background: 'rgba(0,0,0,0)',
86
88
  },
87
89
  },
88
- [`& .${classes.outlineInputInputMarginDense}`]: {
89
- padding: '14.5px 15px 14.5px 12px',
90
- },
91
90
  }));
92
91
  const StyledSelect = styles_1.styled((_a) => {
93
92
  var { paperMaxHeight: _paperMaxHeight, hasAdornment: _hasAdornment, className } = _a, props = tslib_1.__rest(_a, ["paperMaxHeight", "hasAdornment", "className"]);
@@ -112,7 +111,7 @@ const StyledSelect = styles_1.styled((_a) => {
112
111
  left: hasAdornment ? '24px !important' : '70px',
113
112
  },
114
113
  }));
115
- const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'medium', 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', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
116
115
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
117
116
  const hasHelperText = !!helperText;
118
117
  return (react_1.default.createElement(StyledFormControl, { size: size, width: width, disabled: disabled, error: error, color: color },
@@ -11,7 +11,6 @@ const classes = {
11
11
  inputLabelFocused: `${PREFIX}-inputLabelFocused`,
12
12
  inputLabelMarginDense: `${PREFIX}-inputLabelMarginDense`,
13
13
  inputLabelError: `${PREFIX}-inputLabelError`,
14
- inputRoot: `${PREFIX}-inputRoot`,
15
14
  inputFocused: `${PREFIX}-inputFocused`,
16
15
  inputInput: `${PREFIX}-input`,
17
16
  inputUnderline: `${PREFIX}-inputUnderline`,
@@ -63,8 +62,6 @@ const StyledSelect = styles_1.styled((_a) => {
63
62
  const StyledInput = styles_1.styled((_a) => {
64
63
  var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
65
64
  return (react_1.default.createElement(core_1.Input, Object.assign({ classes: {
66
- root: classes.inputRoot,
67
- focused: classes.inputFocused,
68
65
  input: classes.inputInput,
69
66
  disabled: classes.inputDisabled,
70
67
  underline: classes.inputUnderline,
@@ -72,9 +69,6 @@ const StyledInput = styles_1.styled((_a) => {
72
69
  } }, props)));
73
70
  })(({ color, theme }) => ({
74
71
  color: theme.palette.text.primary,
75
- [`&.${classes.inputRoot}.${classes.inputFocused}`]: {
76
- backgroundColor: theme.palette.action.selected,
77
- },
78
72
  [`& .${classes.inputInput}`]: {
79
73
  ['&:focus']: {
80
74
  background: 'rgba(0,0,0,0)',
@@ -91,7 +85,7 @@ const StyledInput = styles_1.styled((_a) => {
91
85
  },
92
86
  },
93
87
  }));
94
- function StandardSelect({ placeholder, helperText, InputProps, SelectProps, children, color = 'primary', size = 'medium', 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', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
95
89
  const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
96
90
  const hasHelperText = !!helperText;
97
91
  return (react_1.default.createElement(StyledFormControl, { color: color, size: size, width: width, disabled: disabled, error: error },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
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",
@@ -46,9 +46,6 @@ const StyledFormControl = styled(
46
46
  borderColor: theme.palette[color].main,
47
47
  },
48
48
  },
49
- [`& .${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
50
- borderColor: `${theme.palette.error.main}`,
51
- },
52
49
  }))
53
50
 
54
51
  interface StyledInputLabelProps {
@@ -95,8 +92,8 @@ const StyledOutlinedInput = styled((props) => (
95
92
  <OutlinedInput
96
93
  classes={{
97
94
  root: classes.outlineInputRoot,
98
- focused: classes.outlineInputFocused,
99
95
  input: classes.outlineInputInput,
96
+ focused: classes.outlineInputFocused,
100
97
  inputMarginDense: classes.outlineInputInputMarginDense,
101
98
  notchedOutline: classes.outlineInputNotchedOutline,
102
99
  disabled: classes.outlineInputDisabled,
@@ -105,8 +102,13 @@ const StyledOutlinedInput = styled((props) => (
105
102
  {...props}
106
103
  />
107
104
  ))(({ theme }: StyledOutlinedInputProps) => ({
108
- [`&.${classes.outlineInputRoot}.${classes.outlineInputFocused}`]: {
109
- backgroundColor: theme.palette.action.selected,
105
+ [`&.${classes.outlineInputRoot}`]: {
106
+ [`&.${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
107
+ borderColor: `${theme.palette.error.main}`,
108
+ },
109
+ [`& .${classes.outlineInputInputMarginDense}`]: {
110
+ padding: '14.5px 15px 14.5px 12px',
111
+ },
110
112
  },
111
113
  [`& .${classes.outlineInputInput}`]: {
112
114
  color: theme.palette.text.primary,
@@ -114,9 +116,6 @@ const StyledOutlinedInput = styled((props) => (
114
116
  background: 'rgba(0,0,0,0)',
115
117
  },
116
118
  },
117
- [`& .${classes.outlineInputInputMarginDense}`]: {
118
- padding: '14.5px 15px 14.5px 12px',
119
- },
120
119
  }))
121
120
 
122
121
  interface StyledSelectProps {
@@ -164,7 +163,7 @@ export const OutlinedSelect = ({
164
163
  SelectProps,
165
164
  children,
166
165
  color = 'primary',
167
- size = 'medium',
166
+ size = 'small',
168
167
  width = 'auto',
169
168
  paperMaxHeight = 'auto',
170
169
  error = false,
@@ -22,12 +22,22 @@ export default {
22
22
  options: ['primary', 'secondary'],
23
23
  control: { type: 'radio' },
24
24
  },
25
+ variant: {
26
+ type: { name: 'string', required: false },
27
+ description: 'The variant to use.',
28
+ table: {
29
+ type: { summary: 'standard | outlined' },
30
+ defaultValue: { summary: 'standard' },
31
+ },
32
+ options: ['standard', 'outlined'],
33
+ control: { type: 'radio' },
34
+ },
25
35
  size: {
26
36
  type: { name: 'string', required: false },
27
37
  description: `Adjust size`,
28
38
  table: {
29
39
  type: { summary: 'medium | small' },
30
- defaultValue: { summary: 'medium' },
40
+ defaultValue: { summary: 'small' },
31
41
  },
32
42
  options: ['small', 'medium'],
33
43
  control: { type: 'radio' },
@@ -161,143 +171,8 @@ const StyledInputAdornment = styled(({ disabled: _disabled, ...props }) => (
161
171
  },
162
172
  }))
163
173
 
164
- // Outlined Select start with here.
165
- interface OutlinedSelectWithMenuProps {
166
- startAdornment?: React.ReactNode
167
- }
168
-
169
- const OutlinedSelectWithMenu = ({
170
- startAdornment,
171
- ...props
172
- }: SelectProps & OutlinedSelectWithMenuProps) => {
173
- const [item, setItem] = useState<string>('')
174
-
175
- const handleChange = (event) => {
176
- setItem(event.target.value)
177
- }
178
- return (
179
- <Select
180
- variant='outlined'
181
- InputProps={{
182
- onChange: (e) => {
183
- handleChange(e)
184
- },
185
- startAdornment,
186
- }}
187
- value={item}
188
- {...props}
189
- >
190
- <SelectMenuItem width={props.width} value='' disabled>
191
- {PLACEHOLDER}
192
- </SelectMenuItem>
193
- <SelectMenuItem width={props.width} value='Test'>
194
- This is a select menu item
195
- </SelectMenuItem>
196
- <SelectMenuItem width={props.width} value='Example'>
197
- Example
198
- </SelectMenuItem>
199
- </Select>
200
- )
201
- }
202
-
203
- const OutlinedValueOnlyStory: Story<SelectProps> = (args) => (
204
- <OutlinedSelectWithMenu {...args} />
205
- )
206
-
207
- export const OutlinedValueOnly = OutlinedValueOnlyStory.bind({})
208
-
209
- OutlinedValueOnly.args = {
210
- color: 'primary',
211
- size: 'medium',
212
- width: 220,
213
- paperMaxHeight: 412,
214
- hasLabel: true,
215
- placeholder: PLACEHOLDER,
216
- helperText: 'Pick your choice',
217
- disabled: false,
218
- SelectProps: {},
219
- }
220
-
221
- const OutlinedSelectWithError = ({
222
- startAdornment,
223
- ...props
224
- }: SelectProps & OutlinedSelectWithMenuProps) => {
225
- const [item, setItem] = useState<string>('')
226
-
227
- const handleChange = (event) => {
228
- setItem(event.target.value)
229
- }
230
- return (
231
- <Select
232
- variant='outlined'
233
- InputProps={{
234
- onChange: (e) => {
235
- handleChange(e)
236
- },
237
- startAdornment,
238
- }}
239
- value={item}
240
- error={item === ''}
241
- helperText={item === '' ? ERROR_PLACEHOLDER : ''}
242
- {...props}
243
- >
244
- <SelectMenuItem width={props.width} value='' disabled>
245
- {PLACEHOLDER}
246
- </SelectMenuItem>
247
- <SelectMenuItem width={props.width} value='Option1'>
248
- This is a select menu item
249
- </SelectMenuItem>
250
- <SelectMenuItem width={props.width} value='Option2'>
251
- This is option 2
252
- </SelectMenuItem>
253
- </Select>
254
- )
255
- }
256
-
257
- const OutlinedWithErrorStory: Story<SelectProps> = (args) => (
258
- <OutlinedSelectWithError {...args} />
259
- )
260
-
261
- export const OutlinedWithError = OutlinedWithErrorStory.bind({})
262
-
263
- OutlinedWithError.args = {
264
- color: 'primary',
265
- size: 'medium',
266
- width: 220,
267
- paperMaxHeight: 412,
268
- hasLabel: true,
269
- placeholder: PLACEHOLDER,
270
- disabled: false,
271
- SelectProps: {},
272
- }
273
-
274
- const OutlinedWithPrefixStory: Story<SelectProps> = (args) => (
275
- <OutlinedSelectWithMenu
276
- startAdornment={
277
- <StyledInputAdornment position='start' disabled={args.disabled}>
278
- <Visibility />
279
- </StyledInputAdornment>
280
- }
281
- {...args}
282
- />
283
- )
284
-
285
- export const OutlinedWithPrefix = OutlinedWithPrefixStory.bind({})
286
-
287
- OutlinedWithPrefix.args = {
288
- color: 'primary',
289
- size: 'medium',
290
- width: 220,
291
- paperMaxHeight: 412,
292
- hasLabel: true,
293
- placeholder: PLACEHOLDER,
294
- helperText: 'Pick your choice',
295
- disabled: false,
296
- SelectProps: {},
297
- }
298
-
299
174
  // Standard Select start with here.
300
- const StandardSelectWithMenu = (props: SelectProps) => {
175
+ const SelectWithMenu = (props: SelectProps) => {
301
176
  const [item, setItem] = useState<string>('')
302
177
 
303
178
  const handleChange = (event) => {
@@ -306,7 +181,6 @@ const StandardSelectWithMenu = (props: SelectProps) => {
306
181
 
307
182
  return (
308
183
  <Select
309
- variant='standard'
310
184
  value={item}
311
185
  SelectProps={{
312
186
  onChange: (e) => {
@@ -328,15 +202,16 @@ const StandardSelectWithMenu = (props: SelectProps) => {
328
202
  )
329
203
  }
330
204
 
331
- const StandardValueOnlyStory: Story<SelectProps> = (args) => (
332
- <StandardSelectWithMenu {...args} />
205
+ const ValueOnlyStory: Story<SelectProps> = (args) => (
206
+ <SelectWithMenu {...args} />
333
207
  )
334
208
 
335
- export const StandardValueOnly = StandardValueOnlyStory.bind({})
209
+ export const ValueOnly = ValueOnlyStory.bind({})
336
210
 
337
- StandardValueOnly.args = {
211
+ ValueOnly.args = {
338
212
  color: 'primary',
339
- size: 'medium',
213
+ variant: 'standard',
214
+ size: 'small',
340
215
  width: 300,
341
216
  paperMaxHeight: 300,
342
217
  hasShrink: false,
@@ -345,7 +220,7 @@ StandardValueOnly.args = {
345
220
  disabled: false,
346
221
  }
347
222
 
348
- const StandardSelectWithError = (props: SelectProps) => {
223
+ const SelectWithError = (props: SelectProps) => {
349
224
  const [item, setItem] = useState<string>('')
350
225
 
351
226
  const handleChange = (event) => {
@@ -354,7 +229,6 @@ const StandardSelectWithError = (props: SelectProps) => {
354
229
 
355
230
  return (
356
231
  <Select
357
- variant='standard'
358
232
  value={item}
359
233
  SelectProps={{
360
234
  onChange: (e) => {
@@ -378,15 +252,16 @@ const StandardSelectWithError = (props: SelectProps) => {
378
252
  )
379
253
  }
380
254
 
381
- const StandardWithErrorStory: Story<SelectProps> = (args) => (
382
- <StandardSelectWithError {...args} />
255
+ const WithErrorStory: Story<SelectProps> = (args) => (
256
+ <SelectWithError {...args} />
383
257
  )
384
258
 
385
- export const StandardWithError = StandardWithErrorStory.bind({})
259
+ export const WithError = WithErrorStory.bind({})
386
260
 
387
- StandardWithError.args = {
261
+ WithError.args = {
388
262
  color: 'primary',
389
- size: 'medium',
263
+ variant: 'standard',
264
+ size: 'small',
390
265
  width: 300,
391
266
  paperMaxHeight: 300,
392
267
  hasShrink: false,
@@ -394,8 +269,8 @@ StandardWithError.args = {
394
269
  disabled: false,
395
270
  }
396
271
 
397
- const StandardWithPrefixStory: Story<SelectProps> = (args) => (
398
- <StandardSelectWithMenu
272
+ const WithPrefixStory: Story<SelectProps> = (args) => (
273
+ <SelectWithMenu
399
274
  InputProps={{
400
275
  startAdornment: (
401
276
  <StyledInputAdornment position='start' disabled={args.disabled}>
@@ -407,11 +282,12 @@ const StandardWithPrefixStory: Story<SelectProps> = (args) => (
407
282
  />
408
283
  )
409
284
 
410
- export const StandardWithPrefix = StandardWithPrefixStory.bind({})
285
+ export const WithPrefix = WithPrefixStory.bind({})
411
286
 
412
- StandardWithPrefix.args = {
287
+ WithPrefix.args = {
413
288
  color: 'primary',
414
- size: 'medium',
289
+ variant: 'standard',
290
+ size: 'small',
415
291
  width: 300,
416
292
  paperMaxHeight: 300,
417
293
  hasShrink: false,
@@ -16,7 +16,6 @@ const classes = {
16
16
  inputLabelFocused: `${PREFIX}-inputLabelFocused`,
17
17
  inputLabelMarginDense: `${PREFIX}-inputLabelMarginDense`,
18
18
  inputLabelError: `${PREFIX}-inputLabelError`,
19
- inputRoot: `${PREFIX}-inputRoot`,
20
19
  inputFocused: `${PREFIX}-inputFocused`,
21
20
  inputInput: `${PREFIX}-input`,
22
21
  inputUnderline: `${PREFIX}-inputUnderline`,
@@ -103,8 +102,6 @@ interface StyledInputProps {
103
102
  const StyledInput = styled(({ color: _color, ...props }) => (
104
103
  <Input
105
104
  classes={{
106
- root: classes.inputRoot,
107
- focused: classes.inputFocused,
108
105
  input: classes.inputInput,
109
106
  disabled: classes.inputDisabled,
110
107
  underline: classes.inputUnderline,
@@ -114,9 +111,6 @@ const StyledInput = styled(({ color: _color, ...props }) => (
114
111
  />
115
112
  ))(({ color, theme }: StyledInputProps) => ({
116
113
  color: theme.palette.text.primary,
117
- [`&.${classes.inputRoot}.${classes.inputFocused}`]: {
118
- backgroundColor: theme.palette.action.selected,
119
- },
120
114
  [`& .${classes.inputInput}`]: {
121
115
  ['&:focus']: {
122
116
  background: 'rgba(0,0,0,0)',
@@ -141,7 +135,7 @@ export function StandardSelect({
141
135
  SelectProps,
142
136
  children,
143
137
  color = 'primary',
144
- size = 'medium',
138
+ size = 'small',
145
139
  width = 'auto',
146
140
  paperMaxHeight = 'auto',
147
141
  error = false,