groundfloor-react-ui 1.2.0 → 1.2.1

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.
@@ -173,6 +173,7 @@ const IconDiv = styled.div`
173
173
  `;
174
174
 
175
175
  export const DropdownSelect = ({
176
+
176
177
  label,
177
178
  labelStyle,
178
179
  optionArr,
@@ -194,19 +195,31 @@ export const DropdownSelect = ({
194
195
 
195
196
  isLoading,
196
197
  id,
198
+ iconName,
199
+ iconColor,
200
+ iconSize,
201
+ showIndicator,
202
+ leftIcon,
203
+ leftIconColor,
204
+ leftIconSize,
197
205
  ...props
198
206
  }) => {
199
207
 
200
208
  const activeTheme = useTheme() || defaultThemeColor
201
209
 
202
210
  const DropdownIndicator = (p) => {
203
- return (
204
- <components.DropdownIndicator {...p}>
205
- <IconDiv>
206
- <Icon icon='triangle-down' color={'black'} size={8} />
207
- </IconDiv>
208
- </components.DropdownIndicator>
209
- );
211
+
212
+ const drpdwn = <components.DropdownIndicator {...p}>
213
+
214
+
215
+ <IconDiv>
216
+ <Icon icon={iconName} color={iconColor} size={iconSize} />
217
+ {/* <Icon icon='triangle-down' color={'black'} size={8} /> */}
218
+ </IconDiv>
219
+
220
+ </components.DropdownIndicator>
221
+ return showIndicator === true ? drpdwn : null;
222
+
210
223
  };
211
224
 
212
225
  const ClearIndicator = (p) => {
@@ -225,6 +238,20 @@ export const DropdownSelect = ({
225
238
 
226
239
  </components.ClearIndicator>
227
240
  );
241
+
242
+ };
243
+
244
+ const LeftIcon = (props) => {
245
+ return (
246
+ <components.ValueContainer {...props}>
247
+ {leftIcon === '' ? null : <IconDiv style={{ paddingTop: '10px', paddingRight: '8px', marginLeft: '0', marginTop: '-16px' }}>
248
+ <Icon icon={leftIcon} color={leftIconColor} size={leftIconSize} />
249
+ </IconDiv>
250
+ }
251
+
252
+ {props.children}
253
+ </components.ValueContainer>
254
+ );
228
255
  };
229
256
 
230
257
  const Option = (p) => {
@@ -235,6 +262,8 @@ export const DropdownSelect = ({
235
262
  padding: '4px',
236
263
  fontSize: '8px',
237
264
  lineHeight: '10px',
265
+ minWidth: '15px',
266
+ minHeight: '15px'
238
267
  };
239
268
  const checked = (
240
269
  <div
@@ -289,8 +318,7 @@ export const DropdownSelect = ({
289
318
  border: !isValid
290
319
  ? '1px solid ' + activeTheme.ui['error']
291
320
  : '1px solid ' + activeTheme.border,
292
- // border: state.isFocused ? '4px solid red' : '4px solid green',
293
-
321
+ minWidth: '215px',
294
322
  height: `${height}px`,
295
323
  minHeight: `${height}px`,
296
324
  boxShadow: (state.isSelected || state.isFocused) && 'none',
@@ -319,6 +347,7 @@ export const DropdownSelect = ({
319
347
  }),
320
348
  valueContainer: (base) => ({
321
349
  ...base,
350
+ display: 'flex',
322
351
  fontSize: fontSize + 'px',
323
352
  }),
324
353
  indicatorsContainer: (base) => ({
@@ -336,7 +365,9 @@ export const DropdownSelect = ({
336
365
  boxShadow: '0px 6px 20px rgba(56, 66, 100, 0.15)',
337
366
  borderRadius: '4.32px',
338
367
  fontSize: fontSize + 'px',
339
- width: '100%'
368
+ width: '100%',
369
+
370
+
340
371
  }),
341
372
  singleValue: (base) => ({
342
373
  ...base,
@@ -362,9 +393,11 @@ export const DropdownSelect = ({
362
393
  padding: '10px',
363
394
  cursor: 'pointer',
364
395
  color: '#081348',
365
- width: '100%'
396
+ width: 'inherit',
366
397
 
367
398
  }),
399
+
400
+
368
401
  ...props.styles,
369
402
  };
370
403
  return (
@@ -399,6 +432,7 @@ export const DropdownSelect = ({
399
432
  DropdownIndicator,
400
433
  MultiValue,
401
434
  Option,
435
+ // ValueContainer: LeftIcon,
402
436
  ValueContainer,
403
437
  IndicatorSeparator: () => null,
404
438
  ClearIndicator,
@@ -406,7 +440,6 @@ export const DropdownSelect = ({
406
440
  className='select-manage-page'
407
441
  classNamePrefix='new-select'
408
442
  name={'select-dropdown'}
409
- id={id}
410
443
  onChange={setSelectedValue}
411
444
  placeholder={placeHolder}
412
445
  value={selectedValue}
@@ -418,8 +451,12 @@ export const DropdownSelect = ({
418
451
  closeMenuOnSelect={false}
419
452
  isSearchable={true}
420
453
  isLoading={isLoading}
454
+
455
+ id={id}
456
+
421
457
  isClearable={isClearable}
422
458
 
459
+
423
460
  {...props}
424
461
  />
425
462
  ) : dropdownType === 'asyncSingleSelect' ? (
@@ -430,19 +467,24 @@ export const DropdownSelect = ({
430
467
  styles={stylesComp}
431
468
  components={{
432
469
  DropdownIndicator,
470
+ // ValueContainer: LeftIcon,
471
+ ValueContainer,
433
472
  IndicatorSeparator: () => null,
434
473
  ClearIndicator,
435
474
  }}
436
475
  className='select-manage-page'
437
476
  classNamePrefix='new-select'
438
477
  name={'select-dropdown'}
439
- id={id}
440
478
  placeholder={placeHolder}
441
479
  onChange={setSelectedValue}
442
480
  isLoading={isLoading}
443
481
  isDisabled={isDisabled}
482
+
483
+ id={id}
484
+
444
485
  isClearable={isClearable}
445
486
 
487
+
446
488
  {...props}
447
489
  />
448
490
  ) : dropdownType === 'asyncMultiSelect' ? (
@@ -450,6 +492,7 @@ export const DropdownSelect = ({
450
492
  components={{
451
493
  DropdownIndicator,
452
494
  MultiValue,
495
+ // ValueContainer: LeftIcon,
453
496
  ValueContainer,
454
497
  Option,
455
498
  IndicatorSeparator: () => null,
@@ -458,7 +501,6 @@ export const DropdownSelect = ({
458
501
  className='select-manage-page'
459
502
  classNamePrefix='new-select'
460
503
  name={'select-dropdown'}
461
- id={id}
462
504
  onChange={setSelectedValue}
463
505
  placeholder={placeHolder}
464
506
  styles={stylesComp}
@@ -471,21 +513,26 @@ export const DropdownSelect = ({
471
513
  loadOptions={loadOptions}
472
514
  defaultOptions
473
515
  onInputChange={onInputChange}
516
+
517
+ id={id}
518
+
474
519
  isClearable={isClearable}
475
520
 
521
+
476
522
  {...props}
477
523
  />
478
524
  ) : (
479
525
  <Select
480
526
  components={{
481
527
  DropdownIndicator,
528
+ // ValueContainer: LeftIcon,
529
+ ValueContainer,
482
530
  IndicatorSeparator: () => null,
483
531
  ClearIndicator,
484
532
  }}
485
533
  className='select-manage-page'
486
534
  classNamePrefix='new-select'
487
535
  name={'select-dropdown'}
488
- id={id}
489
536
  options={optionArr}
490
537
  placeholder={placeHolder}
491
538
  isDisabled={isDisabled}
@@ -496,8 +543,12 @@ export const DropdownSelect = ({
496
543
  styles={stylesComp}
497
544
  onChange={setSelectedValue}
498
545
  isLoading={isLoading}
546
+
547
+ id={id}
548
+
499
549
  isClearable={isClearable}
500
550
 
551
+
501
552
  {...props}
502
553
  />
503
554
  )}
@@ -590,6 +641,31 @@ DropdownSelect.propTypes = {
590
641
  * id of the select
591
642
  */
592
643
  id: PropTypes.string,
644
+ /**
645
+ * iconName of the select
646
+ */
647
+ iconName: PropTypes.string,
648
+ /**
649
+ * iconColor of the select
650
+ */
651
+ iconColor: PropTypes.string,
652
+ /**
653
+ * iconSize of the select
654
+ */
655
+ iconSize: PropTypes.number,
656
+ /**
657
+ * leftIcon of the select
658
+ */
659
+ leftIcon: PropTypes.string,
660
+ /**
661
+ * iconColor of the select
662
+ */
663
+ leftIconColor: PropTypes.string,
664
+ /**
665
+ * iconSize of the select
666
+ */
667
+ leftIconSize: PropTypes.number,
668
+ showIndicator: PropTypes.bool
593
669
 
594
670
  };
595
671
 
@@ -613,5 +689,12 @@ DropdownSelect.defaultProps = {
613
689
  dropdownType: 'singleSelect',
614
690
  isDisabled: false,
615
691
  isLoading: false,
616
- id: ''
692
+ id: '',
693
+ iconName: 'triangle-down',
694
+ iconColor: 'black',
695
+ iconSize: 8,
696
+ leftIcon: 'magnifier-icon',
697
+ leftIconColor: 'black',
698
+ leftIconSize: 10,
699
+ showIndicator: true
617
700
  };