@platformatic/ui-components 0.1.138 → 0.1.140

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@platformatic/ui-components",
3
3
  "description": "Platformatic UI Components",
4
- "version": "0.1.138",
4
+ "version": "0.1.140",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -5,7 +5,17 @@ import styles from './DropDown.module.css'
5
5
  import commonStyles from './Common.module.css'
6
6
  import PlatformaticIcon from './PlatformaticIcon'
7
7
  import { DARK_BLUE, LIGHT_BLUE, MAIN_DARK_BLUE, RICH_BLACK, WHITE } from './constants'
8
- function DropDown ({ pictureUrl, header, items, align, backgroundColor, textColor, borderColor, headerColor, lastButton }) {
8
+ function DropDown ({
9
+ pictureUrl,
10
+ header,
11
+ items,
12
+ align,
13
+ backgroundColor,
14
+ textColor,
15
+ borderColor,
16
+ headerColor,
17
+ lastButton
18
+ }) {
9
19
  const [open, setOpen] = useState(false)
10
20
  const borderClass = commonStyles[`bordered--${borderColor}-30`]
11
21
 
@@ -47,7 +57,7 @@ function DropDown ({ pictureUrl, header, items, align, backgroundColor, textColo
47
57
  <div className={classNameMenu}>
48
58
  {items.map((item, index) => {
49
59
  return (
50
- <div className={classNameItem} key={index}>
60
+ <div className={classNameItem} key={index} onClick={handleOpen}>
51
61
  {item}
52
62
  </div>
53
63
  )
@@ -95,7 +105,11 @@ DropDown.propTypes = {
95
105
  /**
96
106
  * lastButton
97
107
  */
98
- lastButton: PropTypes.node
108
+ lastButton: PropTypes.node,
109
+ /**
110
+ * callBackClose
111
+ */
112
+ callBackClose: PropTypes.func
99
113
  }
100
114
 
101
115
  DropDown.defaultProps = {
@@ -107,6 +121,7 @@ DropDown.defaultProps = {
107
121
  textColor: MAIN_DARK_BLUE,
108
122
  headerColor: WHITE,
109
123
  borderColor: WHITE,
110
- lastButton: null
124
+ lastButton: null,
125
+ callBackClose: () => {}
111
126
  }
112
127
  export default DropDown
@@ -13,11 +13,13 @@ function SearchBarV2 ({
13
13
  backgroundColor,
14
14
  placeholder,
15
15
  dataAttrName,
16
- dataAttrValue
16
+ dataAttrValue,
17
+ inputTextClassName
17
18
  }) {
18
19
  const inputRef = useRef()
19
20
  const baseClassName = `${styles.container} ${styles.wrapperPadding} ` + commonStyles[`background-color-${backgroundColor}`]
20
21
  const [wrapperClassName, setWrapperClassName] = useState(normalClassName())
22
+ const inputClassName = `${styles.input} ${inputTextClassName} `
21
23
  const [isOnFocus, setIsOnFocus] = useState(false)
22
24
  const [showClear, setShowClear] = useState(false)
23
25
  const dataProps = {}
@@ -68,7 +70,7 @@ function SearchBarV2 ({
68
70
  return (
69
71
  <div className={wrapperClassName} {...dataProps}>
70
72
  <PlatformaticIcon iconName='LensIcon' color={color} disabled={!isOnFocus} size={SMALL} onClick={handleSearch} />
71
- <input type='text' placeholder={placeholder} className={styles.input} ref={inputRef} onChange={handleChange} onFocus={onFocus} onBlur={onBlur} />
73
+ <input type='text' placeholder={placeholder} className={inputClassName} ref={inputRef} onChange={handleChange} onFocus={onFocus} onBlur={onBlur} />
72
74
  {showClear && (
73
75
  <div className={styles.clearContainer}>
74
76
  <PlatformaticIcon iconName='CircleCloseIcon' color={color} size={SMALL} onClick={handleClear} />
@@ -110,7 +112,11 @@ SearchBarV2.propTypes = {
110
112
  /**
111
113
  * dataAttrValue
112
114
  */
113
- dataAttrValue: PropTypes.string
115
+ dataAttrValue: PropTypes.string,
116
+ /**
117
+ * inputTextClassName
118
+ */
119
+ inputTextClassName: PropTypes.string
114
120
  }
115
121
 
116
122
  SearchBarV2.defaultProps = {
@@ -121,7 +127,9 @@ SearchBarV2.defaultProps = {
121
127
  onClear: () => { },
122
128
  placeholder: 'Search',
123
129
  dataAttrName: '',
124
- dataAttrValue: ''
130
+ dataAttrValue: '',
131
+ inputTextClassName: ''
132
+
125
133
  }
126
134
 
127
135
  export default SearchBarV2
@@ -1,14 +1,16 @@
1
1
  .container {
2
- @apply relative flex gap-x-2 w-full h-auto border border-solid box-border rounded-md;
2
+ @apply flex items-center gap-x-2 w-full h-auto border border-solid box-border rounded-md relative ;
3
3
  }
4
4
  .input {
5
5
  @apply w-full p-0 bg-transparent border-none text-white ;
6
+ padding-block: 0px;
7
+ padding-inline: 0px;
6
8
  }
7
9
  .onFocus {
8
10
  @apply border-white;
9
11
  }
10
12
  .onBlur {
11
- @apply border-white/15;
13
+ @apply border-white/70;
12
14
  }
13
15
  .fillWhite {
14
16
  @apply fill-white;
@@ -23,6 +25,6 @@
23
25
  @apply absolute right-[1rem];
24
26
  }
25
27
  .wrapperPadding {
26
- @apply px-2 py-1.5;
28
+ @apply px-2 py-1.5 md:px-3 md:py-[8.5px];
27
29
  }
28
30
 
@@ -14,7 +14,8 @@
14
14
  }
15
15
  .afterInputIcon,
16
16
  .beforeInputIcon {
17
- @apply absolute top-[50%] translate-y-[-50%] z-20;
17
+ @apply absolute top-[50%] z-20;
18
+ transform: translateY(-50%);
18
19
  }
19
20
  .beforeInputIcon {
20
21
  @apply left-0 ml-2
@@ -8,7 +8,8 @@
8
8
  @apply border border-solid box-border rounded-md px-2 py-2.5;
9
9
  }
10
10
  .afterInputIcon {
11
- @apply absolute top-[50%] translate-y-[-50%] z-10 ;
11
+ @apply absolute top-[50%] z-10 ;
12
+ transform: translateY(-50%);
12
13
  }
13
14
  .afterInputIcon {
14
15
  @apply right-0 mr-2
@@ -25,8 +25,8 @@ function Select ({
25
25
  optionSelected,
26
26
  dataAttrName,
27
27
  dataAttrValue,
28
- backgroundColor
29
-
28
+ backgroundColor,
29
+ inputTextClassName
30
30
  }) {
31
31
  const inputRef = useRef()
32
32
  const [showOptions, setShowOptions] = useState(false)
@@ -34,7 +34,7 @@ function Select ({
34
34
  const [isOnFocus, setIsOnFocus] = useState(false)
35
35
  const showError = errorMessage.length > 0
36
36
  const containerClassName = `${styles.container} ${defaultContainerClassName} `
37
- let inputClassName = `${commonStyles.fullWidth} ${styles.select}`
37
+ let inputClassName = `${commonStyles.fullWidth} ${styles.select} ${inputTextClassName}`
38
38
  inputClassName += ' ' + styles[`select-${mainColor}`]
39
39
  inputClassName += ' ' + commonStyles[`text--${borderColor}`]
40
40
  let optionsClassName = `${styles.options} ${defaultOptionsClassName} `
@@ -47,7 +47,7 @@ function Select ({
47
47
  optionsClassName += ' ' + styles['bordered-options']
48
48
  optionsClassName += ' ' + commonStyles[`bordered--${borderListColor}-30`]
49
49
  }
50
- let singleOptionClassName = `${styles.option} ` + commonStyles[`bordered--${mainColor}-15`] + ' ' + commonStyles[`hover-background-color-opaque-${mainColor}`]
50
+ let singleOptionClassName = `${styles.option} ` + commonStyles[`bordered--${mainColor}-70`] + ' ' + commonStyles[`hover-background-color-opaque-${mainColor}`]
51
51
  if (optionsBorderedBottom) {
52
52
  singleOptionClassName += ` ${styles['bordered-bottom']}`
53
53
  }
@@ -60,7 +60,7 @@ function Select ({
60
60
  }
61
61
 
62
62
  function normalClassName () {
63
- return inputClassName + ' ' + commonStyles[`bordered--${borderColor}-15`]
63
+ return inputClassName + ' ' + commonStyles[`bordered--${borderColor}-70`]
64
64
  }
65
65
 
66
66
  const dataProps = {}
@@ -112,7 +112,7 @@ function Select ({
112
112
  }}
113
113
  >
114
114
  <div className={styles.liContent}>
115
- {option.iconName && <PlatformaticIcon iconName={option.iconName} color={mainColor} size={SMALL} onClick={null} />}
115
+ {option.iconName && <PlatformaticIcon iconName={option.iconName} color={option.iconColor || mainColor} size={option.iconSize ?? SMALL} onClick={null} />}
116
116
  <span className={optionSpanClassName}>{option.label}</span>
117
117
  </div>
118
118
  {option.descriptionValue && <span className={`${optionSpanClassName} ${styles.descriptionValue}`}>{option.descriptionValue}</span>}
@@ -212,7 +212,9 @@ Select.propTypes = {
212
212
  PropTypes.string,
213
213
  PropTypes.number
214
214
  ]),
215
- icon: PropTypes.string,
215
+ iconName: PropTypes.string,
216
+ iconSize: PropTypes.string,
217
+ iconColor: PropTypes.string,
216
218
  notSelectable: PropTypes.bool,
217
219
  notFilterable: PropTypes.bool,
218
220
  onClick: PropTypes.func,
@@ -275,7 +277,11 @@ Select.propTypes = {
275
277
  /**
276
278
  * backgroundColor
277
279
  */
278
- backgroundColor: PropTypes.oneOf([MAIN_DARK_BLUE, WHITE, RICH_BLACK])
280
+ backgroundColor: PropTypes.oneOf([MAIN_DARK_BLUE, WHITE, RICH_BLACK]),
281
+ /**
282
+ * inputTextClassName
283
+ */
284
+ inputTextClassName: PropTypes.string
279
285
  }
280
286
 
281
287
  Select.defaultProps = {
@@ -298,7 +304,8 @@ Select.defaultProps = {
298
304
  optionSelected: null,
299
305
  dataAttrName: '',
300
306
  dataAttrValue: '',
301
- backgroundColor: WHITE
307
+ backgroundColor: WHITE,
308
+ inputTextClassName: ''
302
309
  }
303
310
 
304
311
  export default Select
@@ -5,7 +5,7 @@
5
5
  @apply w-full flex items-center relative z-10;
6
6
  }
7
7
  .select {
8
- @apply px-2 h-full border border-solid box-border rounded-md py-1.5;
8
+ @apply py-1.5 px-2 md:px-3 md:py-[10.5px] h-full border border-solid box-border rounded-md ;
9
9
  }
10
10
 
11
11
  .select-main-dark-blue.active,