@platformatic/ui-components 0.1.124 → 0.1.125

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.
Files changed (176) hide show
  1. package/dist/assets/index-78f54889.js +206 -0
  2. package/dist/assets/index-89e9ad97.css +1 -0
  3. package/dist/index.html +2 -2
  4. package/dist/main.css +0 -10
  5. package/fonts/Inter/Inter-VariableFont_slnt,wght.ttf +0 -0
  6. package/fonts/Inter/OFL.txt +93 -0
  7. package/fonts/Inter/README.txt +72 -0
  8. package/fonts/Inter/static/Inter-Black.ttf +0 -0
  9. package/fonts/Inter/static/Inter-Bold.ttf +0 -0
  10. package/fonts/Inter/static/Inter-ExtraBold.ttf +0 -0
  11. package/fonts/Inter/static/Inter-ExtraLight.ttf +0 -0
  12. package/fonts/Inter/static/Inter-Light.ttf +0 -0
  13. package/fonts/Inter/static/Inter-Medium.ttf +0 -0
  14. package/fonts/Inter/static/Inter-Regular.ttf +0 -0
  15. package/fonts/Inter/static/Inter-SemiBold.ttf +0 -0
  16. package/fonts/Inter/static/Inter-Thin.ttf +0 -0
  17. package/fonts/{Montserrat/fonts.css → fonts.css} +7 -0
  18. package/index.js +8 -0
  19. package/package.json +1 -1
  20. package/src/components/BorderedBox.jsx +25 -6
  21. package/src/components/BorderedBox.module.css +3 -0
  22. package/src/components/Common.module.css +34 -3
  23. package/src/components/HorizontalSeparator.jsx +2 -1
  24. package/src/components/HorizontalSeparator.module.css +19 -0
  25. package/src/components/LoadingSpinnerV2.jsx +45 -0
  26. package/src/components/LoadingSpinnerV2.module.css +8 -0
  27. package/src/components/Modal.jsx +36 -3
  28. package/src/components/Modal.module.css +9 -1
  29. package/src/components/ModalDirectional.jsx +83 -0
  30. package/src/components/ModalDirectional.module.css +38 -0
  31. package/src/components/PlatformaticIcon.jsx +20 -5
  32. package/src/components/SearchBarV2.jsx +120 -0
  33. package/src/components/SearchBarV2.module.css +28 -0
  34. package/src/components/TabbedWindowV2.jsx +82 -0
  35. package/src/components/TabbedWindowV2.module.css +17 -0
  36. package/src/components/VerticalSeparator.jsx +18 -6
  37. package/src/components/VerticalSeparator.module.css +3 -0
  38. package/src/components/constants.js +10 -2
  39. package/src/components/forms/Field.jsx +29 -8
  40. package/src/components/forms/Field.module.css +7 -1
  41. package/src/components/forms/Input.jsx +73 -8
  42. package/src/components/forms/Input.module.css +8 -3
  43. package/src/components/forms/Select.jsx +98 -20
  44. package/src/components/forms/Select.module.css +17 -6
  45. package/src/components/forms/ToggleSwitch.jsx +11 -5
  46. package/src/components/forms/ToggleSwitch.module.css +2 -2
  47. package/src/components/icons/AddIcon.jsx +12 -5
  48. package/src/components/icons/AlertIcon.jsx +12 -5
  49. package/src/components/icons/AllInOneIcon.jsx +12 -5
  50. package/src/components/icons/ApiCloudIcon.jsx +12 -5
  51. package/src/components/icons/ApiEmptyIcon.jsx +12 -5
  52. package/src/components/icons/ApiIcon.jsx +12 -5
  53. package/src/components/icons/ApiIconClosed.jsx +10 -4
  54. package/src/components/icons/ApiPerformanceIcon.jsx +12 -5
  55. package/src/components/icons/AppEmptyIcon.jsx +12 -5
  56. package/src/components/icons/AppIcon.jsx +12 -5
  57. package/src/components/icons/AppListIcon.jsx +12 -5
  58. package/src/components/icons/AppWorkspace.jsx +5 -2
  59. package/src/components/icons/ApplicationTypeIcon.jsx +12 -5
  60. package/src/components/icons/ArrowDownFullIcon.jsx +12 -5
  61. package/src/components/icons/ArrowDownIcon.jsx +12 -5
  62. package/src/components/icons/ArrowLeftIcon.jsx +12 -5
  63. package/src/components/icons/ArrowLongLeftIcon.jsx +84 -0
  64. package/src/components/icons/ArrowLongRightIcon.jsx +12 -5
  65. package/src/components/icons/ArrowRightIcon.jsx +12 -5
  66. package/src/components/icons/ArrowUpIcon.jsx +12 -5
  67. package/src/components/icons/BellIcon.jsx +12 -5
  68. package/src/components/icons/BillingIcon.jsx +12 -5
  69. package/src/components/icons/Calendar1DayIcon.jsx +12 -5
  70. package/src/components/icons/Calendar7DaysIcon.jsx +12 -5
  71. package/src/components/icons/CalendarIcon.jsx +12 -5
  72. package/src/components/icons/CheckListIcon.jsx +12 -5
  73. package/src/components/icons/CircleAddIcon.jsx +12 -5
  74. package/src/components/icons/CircleArrowLeftIcon.jsx +12 -5
  75. package/src/components/icons/CircleArrowRightIcon.jsx +12 -5
  76. package/src/components/icons/CircleCheckMarkButtonIcon.jsx +7 -3
  77. package/src/components/icons/CircleCheckMarkFullIcon.jsx +12 -5
  78. package/src/components/icons/CircleCheckMarkIcon.jsx +10 -4
  79. package/src/components/icons/CircleCloseHoverIcon.jsx +12 -5
  80. package/src/components/icons/CircleCloseIcon.jsx +12 -5
  81. package/src/components/icons/CircleCopyPasteIcon.jsx +12 -5
  82. package/src/components/icons/CircleDownloadIcon.jsx +12 -5
  83. package/src/components/icons/CircleEditIcon.jsx +12 -5
  84. package/src/components/icons/CircleExclamationIcon.jsx +5 -2
  85. package/src/components/icons/CircleFullIcon.jsx +12 -5
  86. package/src/components/icons/CircleGearIcon.jsx +12 -5
  87. package/src/components/icons/CircleRestartIcon.jsx +12 -5
  88. package/src/components/icons/CircleSubtractIcon.jsx +12 -5
  89. package/src/components/icons/CircleTwoArrowsDownIcon.jsx +12 -5
  90. package/src/components/icons/CircleTwoArrowsUpIcon.jsx +12 -5
  91. package/src/components/icons/CloseIcon.jsx +12 -5
  92. package/src/components/icons/CloudIcon.jsx +12 -5
  93. package/src/components/icons/ConfigureDatabaseIcon.jsx +12 -5
  94. package/src/components/icons/CopyPasteIcon.jsx +12 -5
  95. package/src/components/icons/CreatingAppIcon.jsx +12 -5
  96. package/src/components/icons/CreditCardIcon.jsx +12 -5
  97. package/src/components/icons/DatabaseIcon.jsx +12 -5
  98. package/src/components/icons/DatabaseMigrationIcon.jsx +12 -5
  99. package/src/components/icons/DepencenciesReloadIcon.jsx +12 -5
  100. package/src/components/icons/EditDocumentIcon.jsx +12 -5
  101. package/src/components/icons/EditIcon.jsx +12 -5
  102. package/src/components/icons/EnlargeIcon.jsx +12 -5
  103. package/src/components/icons/EntryIcon.jsx +12 -5
  104. package/src/components/icons/ExpandIcon.jsx +92 -0
  105. package/src/components/icons/ExploreDocIcon.jsx +12 -5
  106. package/src/components/icons/EyeClosedIcon.jsx +12 -5
  107. package/src/components/icons/EyeOpenedIcon.jsx +12 -5
  108. package/src/components/icons/FolderIcon.jsx +83 -0
  109. package/src/components/icons/FoldersIcon.jsx +86 -0
  110. package/src/components/icons/GearIcon.jsx +12 -5
  111. package/src/components/icons/GenerationLoadingIcon.jsx +12 -5
  112. package/src/components/icons/GitHubRepo2Icon.jsx +12 -5
  113. package/src/components/icons/GitHubRepoIcon.jsx +12 -5
  114. package/src/components/icons/GiveOwnershipIcon.jsx +12 -5
  115. package/src/components/icons/GraphQLIcon.jsx +12 -5
  116. package/src/components/icons/Icons.module.css +7 -2
  117. package/src/components/icons/ImportApplicationIcon.jsx +12 -5
  118. package/src/components/icons/KeyIcon.jsx +12 -5
  119. package/src/components/icons/LabelIcon.jsx +12 -5
  120. package/src/components/icons/LayersIcon.jsx +12 -5
  121. package/src/components/icons/LensIcon.jsx +12 -5
  122. package/src/components/icons/LiveIcon.jsx +12 -5
  123. package/src/components/icons/LoadingAppIcon.jsx +12 -5
  124. package/src/components/icons/LogOutIcon.jsx +5 -2
  125. package/src/components/icons/MetricsIcon.jsx +12 -5
  126. package/src/components/icons/MetricsLoadingIcon.jsx +12 -5
  127. package/src/components/icons/NameAppIcon.jsx +12 -5
  128. package/src/components/icons/OrganizationIcon.jsx +12 -5
  129. package/src/components/icons/OutOfBoxGraphQLIcon.jsx +12 -5
  130. package/src/components/icons/PlatformaticComposerIcon.jsx +12 -5
  131. package/src/components/icons/PlatformaticDBIcon.jsx +12 -5
  132. package/src/components/icons/PlatformaticRuntimeIcon.jsx +12 -5
  133. package/src/components/icons/PlatformaticServiceIcon.jsx +12 -5
  134. package/src/components/icons/PlayIcon.jsx +12 -5
  135. package/src/components/icons/PreviewPRIcon.jsx +12 -5
  136. package/src/components/icons/PullRequestIcon.jsx +12 -5
  137. package/src/components/icons/PullRequestLoadingIcon.jsx +12 -5
  138. package/src/components/icons/RequestOwnershipIcon.jsx +12 -5
  139. package/src/components/icons/RestartIcon.jsx +12 -5
  140. package/src/components/icons/RocketIcon.jsx +12 -5
  141. package/src/components/icons/RunningIcon.jsx +12 -5
  142. package/src/components/icons/SendIcon.jsx +12 -5
  143. package/src/components/icons/ServiceIcon.jsx +12 -5
  144. package/src/components/icons/SlotIcon.jsx +12 -5
  145. package/src/components/icons/SocialDiscordIcon.jsx +12 -5
  146. package/src/components/icons/SocialGitHubIcon.jsx +12 -5
  147. package/src/components/icons/SocialGitLabIcon.jsx +12 -5
  148. package/src/components/icons/SocialLinkedInIcon.jsx +12 -5
  149. package/src/components/icons/SocialNPMIcon.jsx +12 -5
  150. package/src/components/icons/SocialXIcon.jsx +12 -5
  151. package/src/components/icons/SortableIcon.jsx +93 -0
  152. package/src/components/icons/StackablesPluginIcon.jsx +134 -0
  153. package/src/components/icons/StackablesTemplateIcon.jsx +133 -0
  154. package/src/components/icons/StopIcon.jsx +12 -5
  155. package/src/components/icons/SwitchIcon.jsx +12 -5
  156. package/src/components/icons/TeamsIcon.jsx +12 -5
  157. package/src/components/icons/TerminalIcon.jsx +12 -5
  158. package/src/components/icons/TrashIcon.jsx +95 -0
  159. package/src/components/icons/TwoUsersIcon.jsx +12 -5
  160. package/src/components/icons/UpgradeIcon.jsx +12 -5
  161. package/src/components/icons/UserIcon.jsx +12 -5
  162. package/src/components/icons/UserRemoveIcon.jsx +5 -2
  163. package/src/components/icons/UserRoleIcon.jsx +5 -2
  164. package/src/components/icons/WorkspaceDynamicIcon.jsx +12 -5
  165. package/src/components/icons/WorkspaceEmptyIcon.jsx +12 -5
  166. package/src/components/icons/WorkspaceFailIcon.jsx +12 -5
  167. package/src/components/icons/WorkspaceGitHubIcon.jsx +12 -5
  168. package/src/components/icons/WorkspaceLoadingIcon.jsx +12 -5
  169. package/src/components/icons/WorkspaceReadyIcon.jsx +12 -5
  170. package/src/components/icons/WorkspaceStaticIcon.jsx +12 -5
  171. package/src/components/icons/index.js +23 -7
  172. package/src/stories/ModalDirectional.stories.jsx +45 -0
  173. package/src/stories/forms/Select.stories.jsx +33 -1
  174. package/tailwind.config.cjs +5 -2
  175. package/dist/assets/index-3a61658e.css +0 -1
  176. package/dist/assets/index-8f6ac36c.js +0 -206
@@ -4,12 +4,32 @@ import PropTypes from 'prop-types'
4
4
  import styles from './Input.module.css'
5
5
  import commonStyles from '../Common.module.css'
6
6
  import PlatformaticIcon from '../PlatformaticIcon'
7
- import { MAIN_DARK_BLUE, MAIN_GREEN } from '../constants'
7
+ import { MAIN_DARK_BLUE, MAIN_GREEN, WHITE } from '../constants'
8
8
  import BorderedBox from '../BorderedBox'
9
9
 
10
- function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled, beforeIcon, afterIcon, focused, placeholderApart }) {
11
- let inputClassName = `${commonStyles.fullWidth} ${styles.input} `
10
+ function Input ({
11
+ placeholder,
12
+ value,
13
+ name,
14
+ borderColor,
15
+ errorMessage,
16
+ onChange,
17
+ disabled,
18
+ beforeIcon,
19
+ afterIcon,
20
+ focused,
21
+ placeholderApart,
22
+ backgroundTransparent,
23
+ inputTextClassName,
24
+ verticalPaddingClassName,
25
+ dataAttrName,
26
+ dataAttrValue,
27
+ readOnly
28
+ }) {
29
+ let inputClassName = `${commonStyles.fullWidth} ${styles.input} ${inputTextClassName}`
30
+ inputClassName += verticalPaddingClassName || `${styles.inputDefaultVerticalPadding}`
12
31
  inputClassName += commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`]
32
+ if (backgroundTransparent) inputClassName += ` ${commonStyles['background-color-transparent']}`
13
33
  const showError = errorMessage.length > 0
14
34
  if (showError) inputClassName += ' ' + commonStyles['bordered--error-red']
15
35
  if (disabled) inputClassName += ' ' + commonStyles['apply-opacity-30']
@@ -17,11 +37,26 @@ function Input ({ placeholder, value, name, borderColor, errorMessage, onChange,
17
37
  if (afterIcon) inputClassName += ' ' + styles.afterIconPadding
18
38
  const inputPlaceholder = placeholderApart ? '' : placeholder
19
39
 
40
+ const dataProps = {}
41
+ if (dataAttrName && dataAttrValue) {
42
+ dataProps[`data-${dataAttrName}`] = dataAttrValue
43
+ }
44
+
20
45
  const cmp = (
21
- <div className={styles.container}>
46
+ <div className={styles.container} {...dataProps}>
22
47
  <div className={styles.inputContainer}>
23
48
  {beforeIcon && <div className={styles.beforeInputIcon}><PlatformaticIcon iconName={beforeIcon.iconName} size='small' data-testid='before-icon' color={beforeIcon.color} onClick={() => beforeIcon.onClick()} /></div>}
24
- <input type='text' name={name} value={value} className={inputClassName} onChange={onChange} disabled={disabled} placeholder={inputPlaceholder} />
49
+ <input
50
+ type='text'
51
+ name={name}
52
+ value={value}
53
+ className={inputClassName}
54
+ onChange={onChange}
55
+ disabled={disabled}
56
+ placeholder={inputPlaceholder}
57
+ readOnly={readOnly}
58
+ aria-readonly={readOnly}
59
+ />
25
60
  {placeholderApart && <p className={styles.placeholderAPart}>{placeholder}</p>}
26
61
  {afterIcon && <div className={styles.afterInputIcon}><PlatformaticIcon iconName={afterIcon.iconName} color={afterIcon.color} data-testid='after-icon' onClick={null} /></div>}
27
62
  </div>
@@ -48,7 +83,7 @@ Input.propTypes = {
48
83
  /**
49
84
  * color of border
50
85
  */
51
- borderColor: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE]),
86
+ borderColor: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE, WHITE]),
52
87
  /**
53
88
  * onChange
54
89
  */
@@ -80,7 +115,31 @@ Input.propTypes = {
80
115
  /**
81
116
  * placeholderApart
82
117
  */
83
- placeholderApart: PropTypes.bool
118
+ placeholderApart: PropTypes.bool,
119
+ /**
120
+ * backgroundTransparent
121
+ */
122
+ backgroundTransparent: PropTypes.bool,
123
+ /**
124
+ * inputTextClassName
125
+ */
126
+ inputTextClassName: PropTypes.string,
127
+ /**
128
+ * verticalPaddingClassName
129
+ */
130
+ verticalPaddingClassName: PropTypes.string,
131
+ /**
132
+ * dataAttrName
133
+ */
134
+ dataAttrName: PropTypes.string,
135
+ /**
136
+ * dataAttrValue
137
+ */
138
+ dataAttrValue: PropTypes.string,
139
+ /**
140
+ * readOnly
141
+ */
142
+ readOnly: PropTypes.bool
84
143
  }
85
144
 
86
145
  Input.defaultProps = {
@@ -94,7 +153,13 @@ Input.defaultProps = {
94
153
  beforeIcon: null,
95
154
  afterIcon: null,
96
155
  focused: false,
97
- shadowPlaceholder: false
156
+ shadowPlaceholder: false,
157
+ backgroundTransparent: false,
158
+ inputTextClassName: '',
159
+ verticalPaddingClassName: '',
160
+ dataAttrName: '',
161
+ dataAttrValue: '',
162
+ readOnly: false
98
163
  }
99
164
 
100
165
  export default Input
@@ -2,10 +2,15 @@
2
2
  @apply flex flex-col w-full relative;
3
3
  }
4
4
  .inputContainer {
5
- @apply flex h-10 relative z-20;
5
+ @apply flex min-h-[2.5rem] relative z-20;
6
6
  }
7
7
  .input {
8
- @apply border border-solid box-border rounded-md px-2 py-2.5 z-10;
8
+ padding-block: 0px;
9
+ padding-inline: 0px;
10
+ @apply border border-solid box-border rounded-md px-2 z-10;
11
+ }
12
+ .inputDefaultVerticalPadding {
13
+ @apply py-2.5;
9
14
  }
10
15
  .afterInputIcon,
11
16
  .beforeInputIcon {
@@ -42,4 +47,4 @@
42
47
  .input:focus {
43
48
  @apply shadow-main-dark-blue;
44
49
  outline: none;
45
- }
50
+ }
@@ -3,31 +3,68 @@ import React, { useState, useEffect, useRef } from 'react'
3
3
  import PropTypes from 'prop-types'
4
4
  import styles from './Select.module.css'
5
5
  import commonStyles from '../Common.module.css'
6
- import { MAIN_DARK_BLUE, MAIN_GREEN, SMALL } from '../constants'
6
+ import { MAIN_DARK_BLUE, MAIN_GREEN, RICH_BLACK, SMALL, WHITE } from '../constants'
7
7
  import PlatformaticIcon from '../PlatformaticIcon'
8
8
 
9
9
  function Select ({
10
+ defaultContainerClassName,
10
11
  placeholder,
11
12
  name,
12
13
  value,
13
14
  options,
15
+ defaultOptionsClassName,
16
+ optionsBorderedBottom,
14
17
  borderColor,
18
+ borderListColor,
15
19
  errorMessage,
16
20
  onChange,
17
21
  onSelect,
18
22
  onClear,
19
23
  disabled,
20
- optionsIconColor,
21
- optionSelected
24
+ mainColor,
25
+ optionSelected,
26
+ dataAttrName,
27
+ dataAttrValue,
28
+ backgroundColor
29
+
22
30
  }) {
23
31
  const inputRef = useRef()
24
32
  const [showOptions, setShowOptions] = useState(false)
25
33
  const [isSelected, setIsSelected] = useState(false)
34
+ const [isOnFocus, setIsOnFocus] = useState(false)
26
35
  const showError = errorMessage.length > 0
27
- let inputClassName = `${commonStyles.fullWidth} ${styles.select} `
28
- inputClassName += ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`]
36
+ const containerClassName = `${styles.container} ${defaultContainerClassName} `
37
+ let inputClassName = `${commonStyles.fullWidth} ${styles.select}`
38
+ inputClassName += ' ' + styles[`select-${mainColor}`]
39
+ inputClassName += ' ' + commonStyles[`text--${borderColor}`]
40
+ let optionsClassName = `${styles.options} ${defaultOptionsClassName} `
29
41
  if (showError) inputClassName += ' ' + commonStyles['bordered--error-red']
30
42
  if (disabled) inputClassName += ' ' + commonStyles['apply-opacity-30']
43
+ inputClassName += ' ' + commonStyles[`background-color-${backgroundColor}`]
44
+ optionsClassName += commonStyles[`background-color-${backgroundColor}`]
45
+
46
+ if (borderListColor) {
47
+ optionsClassName += ' ' + styles['bordered-options']
48
+ optionsClassName += ' ' + commonStyles[`bordered--${borderListColor}-30`]
49
+ }
50
+ let singleOptionClassName = `${styles.option} ` + commonStyles[`bordered--${mainColor}-15`] + ' ' + commonStyles[`hover-background-color-opaque-${mainColor}`]
51
+ if (optionsBorderedBottom) {
52
+ singleOptionClassName += ` ${styles['bordered-bottom']}`
53
+ }
54
+
55
+ const [wrapperClassName, setWrapperClassName] = useState(normalClassName())
56
+ function onFocusClassName () {
57
+ return inputClassName + ' ' + commonStyles[`bordered--${borderColor}-100`]
58
+ }
59
+
60
+ function normalClassName () {
61
+ return inputClassName + ' ' + commonStyles[`bordered--${borderColor}-15`]
62
+ }
63
+
64
+ const dataProps = {}
65
+ if (dataAttrName && dataAttrValue) {
66
+ dataProps[`data-${dataAttrName}`] = dataAttrValue
67
+ }
31
68
 
32
69
  function handleNotSelectable (callback = () => {}) {
33
70
  setIsSelected(true)
@@ -65,7 +102,7 @@ function Select ({
65
102
  function renderLi (option, index) {
66
103
  return (
67
104
  <li
68
- key={index} className={styles.option} onClick={() => {
105
+ key={index} className={singleOptionClassName} onClick={() => {
69
106
  if (option.notSelectable) {
70
107
  return handleNotSelectable(option.onClick && option.onClick())
71
108
  }
@@ -73,8 +110,8 @@ function Select ({
73
110
  }}
74
111
  >
75
112
  <div className={styles.liContent}>
76
- {option.iconName && <PlatformaticIcon iconName={option.iconName} color={optionsIconColor} size={SMALL} onClick={null} />}
77
- <span>{option.label}</span>
113
+ {option.iconName && <PlatformaticIcon iconName={option.iconName} color={mainColor} size={SMALL} onClick={null} />}
114
+ <span className={commonStyles[`text--${mainColor}`]}>{option.label}</span>
78
115
  </div>
79
116
  </li>
80
117
  )
@@ -83,8 +120,8 @@ function Select ({
83
120
  function renderOptions () {
84
121
  if (value.length === 0) {
85
122
  return (
86
- <ul className={styles.options}>
87
- {options.length > 0 ? options.map((option, index) => renderLi(option, index)) : <li className={styles.option}><div className={styles.liContent}>No data found</div></li>}
123
+ <ul className={optionsClassName}>
124
+ {options.length > 0 ? options.map((option, index) => renderLi(option, index)) : <li className={singleOptionClassName}><div className={styles.liContent}><span className={commonStyles[`text--${mainColor}`]}>No data found</span></div></li>}
88
125
  </ul>
89
126
  )
90
127
  }
@@ -92,8 +129,8 @@ function Select ({
92
129
  const filteredOptions = options.filter(option => !option.notFilterable).filter(option => option.label.toLowerCase().includes(value.toLowerCase()))
93
130
 
94
131
  return (
95
- <ul className={styles.options}>
96
- {filteredOptions.length > 0 ? filteredOptions.map((option, index) => renderLi(option, index)) : <li className={styles.option}><div className={styles.liContent}>No data found</div></li>}
132
+ <ul className={optionsClassName}>
133
+ {filteredOptions.length > 0 ? filteredOptions.map((option, index) => renderLi(option, index)) : <li className={singleOptionClassName}><div className={styles.liContent}><span className={commonStyles[`text--${mainColor}`]}>No data found</span></div></li>}
97
134
  {notFilterableOptions.length > 0 && notFilterableOptions.map((option, index) => renderLi(option, index))}
98
135
  </ul>
99
136
  )
@@ -110,6 +147,10 @@ function Select ({
110
147
  }
111
148
 
112
149
  function handleFocus () {
150
+ if (!isOnFocus) {
151
+ setIsOnFocus(true)
152
+ setWrapperClassName(onFocusClassName())
153
+ }
113
154
  setShowOptions(true)
114
155
  }
115
156
 
@@ -118,14 +159,16 @@ function Select ({
118
159
  setTimeout(() => {
119
160
  if (showOptions) {
120
161
  setShowOptions(false)
162
+ setIsOnFocus(false)
163
+ setWrapperClassName(normalClassName())
121
164
  }
122
165
  }, 250)
123
166
  }
124
167
 
125
168
  return (
126
- <div className={styles.container}>
169
+ <div className={containerClassName} {...dataProps}>
127
170
  <div className={styles.selectContainer}>
128
- <input type='text' name={name} value={value} className={inputClassName} ref={inputRef} onChange={onChange} disabled={disabled} placeholder={placeholder} onFocus={() => handleFocus()} onBlur={(e) => handleBlur(e)} />
171
+ <input type='text' name={name} value={value} className={wrapperClassName} ref={inputRef} onChange={onChange} disabled={disabled} placeholder={placeholder} onFocus={() => handleFocus()} onBlur={(e) => handleBlur(e)} />
129
172
  <div className={styles.icons}>
130
173
  {value?.length > 0 && <PlatformaticIcon iconName='CloseIcon' color={borderColor} onClick={() => clearValue()} />}
131
174
  <PlatformaticIcon iconName={showOptions ? 'ArrowUpIcon' : 'ArrowDownIcon'} color={borderColor} onClick={() => disabled ? null : setShowOptions(!showOptions)} />
@@ -138,6 +181,10 @@ function Select ({
138
181
  }
139
182
 
140
183
  Select.propTypes = {
184
+ /**
185
+ * defaultContainerClassName
186
+ */
187
+ defaultContainerClassName: PropTypes.string,
141
188
  /**
142
189
  * placeholder
143
190
  */
@@ -167,10 +214,22 @@ Select.propTypes = {
167
214
  notFilterable: PropTypes.bool,
168
215
  onClick: PropTypes.func
169
216
  })),
217
+ /**
218
+ * defaultOptionsClassName
219
+ */
220
+ defaultOptionsClassName: PropTypes.string,
221
+ /**
222
+ * optionsBorderedBottom
223
+ */
224
+ optionsBorderedBottom: PropTypes.bool,
170
225
  /**
171
226
  * color of border
172
227
  */
173
- borderColor: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE]),
228
+ borderColor: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE, WHITE]),
229
+ /**
230
+ * color of border UL
231
+ */
232
+ borderListColor: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE, WHITE]),
174
233
  /**
175
234
  * onChange
176
235
  */
@@ -188,9 +247,9 @@ Select.propTypes = {
188
247
  */
189
248
  disabled: PropTypes.bool,
190
249
  /**
191
- * optionsIconColor
250
+ * mainColor
192
251
  */
193
- optionsIconColor: PropTypes.string,
252
+ mainColor: PropTypes.oneOf([MAIN_DARK_BLUE, WHITE]),
194
253
  /**
195
254
  * optionSelected
196
255
  */
@@ -200,23 +259,42 @@ Select.propTypes = {
200
259
  PropTypes.string,
201
260
  PropTypes.number
202
261
  ])
203
- })
262
+ }),
263
+ /**
264
+ * dataAttrName
265
+ */
266
+ dataAttrName: PropTypes.string,
267
+ /**
268
+ * dataAttrValue
269
+ */
270
+ dataAttrValue: PropTypes.string,
271
+ /**
272
+ * backgroundColor
273
+ */
274
+ backgroundColor: PropTypes.oneOf([MAIN_DARK_BLUE, WHITE, RICH_BLACK])
204
275
  }
205
276
 
206
277
  Select.defaultProps = {
278
+ defaultContainerClassName: '',
207
279
  placeholder: 'this is the default',
208
280
  name: '',
209
281
  value: '',
210
282
  id: '',
211
283
  options: [],
284
+ defaultOptionsClassName: '',
285
+ optionsBorderedBottom: true,
212
286
  borderColor: MAIN_GREEN,
287
+ borderListColor: '',
213
288
  errorMessage: '',
214
289
  onChange: () => {},
215
290
  onSelect: () => {},
216
291
  onClear: () => {},
217
292
  disabled: false,
218
- optionsIconColor: MAIN_DARK_BLUE,
219
- optionSelected: null
293
+ mainColor: MAIN_DARK_BLUE,
294
+ optionSelected: null,
295
+ dataAttrName: '',
296
+ dataAttrValue: '',
297
+ backgroundColor: WHITE
220
298
  }
221
299
 
222
300
  export default Select
@@ -7,19 +7,30 @@
7
7
  .select {
8
8
  @apply px-2 h-full border border-solid box-border rounded-md ;
9
9
  }
10
- .select.active,
11
- .select:focus {
10
+
11
+ .select-main-dark-blue.active,
12
+ .select-main-dark-blue:focus {
12
13
  @apply shadow-main-dark-blue outline-none;
13
14
  }
15
+ .select-white.active,
16
+ .select-white:focus {
17
+ @apply shadow-white outline-none;
18
+ }
14
19
  .options {
15
- @apply absolute left-0 top-[42px] bg-white w-full max-h-[216px] overflow-y-scroll z-20;
16
- box-shadow: 0px 0px 10px rgb(0 40 61 / 25%);
20
+ @apply absolute left-0 top-[42px] w-full max-h-[216px] overflow-y-scroll z-20;
21
+ }
22
+ .bordered-options {
23
+ @apply border border-solid rounded-md
17
24
  }
18
25
  .option {
19
- @apply w-full border-b border-main-dark-blue/[.15] font-light cursor-pointer hover:bg-main-dark-blue hover:bg-opacity-10 z-10;
26
+ @apply w-full font-light cursor-pointer z-10;
27
+ }
28
+ .bordered-bottom {
29
+ @apply border-b
20
30
  }
21
31
  .icons {
22
- @apply absolute top-[50%] right-[0.5rem] translate-y-[-50%] flex gap-x-2;
32
+ @apply absolute top-[50%] right-[0.5rem] flex gap-x-2;
33
+ transform: translateY(-50%);
23
34
  }
24
35
  .liContent {
25
36
  @apply px-4 py-2 inline-flex items-center gap-x-1 relative z-[-1];
@@ -4,10 +4,10 @@ import PropTypes from 'prop-types'
4
4
  import styles from './ToggleSwitch.module.css'
5
5
  import commonStyles from '../Common.module.css'
6
6
 
7
- function ToggleSwitch ({ name, label, errorMessage, onChange, checked, disabled }) {
7
+ function ToggleSwitch ({ name, label, labelClassName, errorMessage, onChange, checked, disabled }) {
8
8
  let className = `${styles.switch} `
9
9
  if (disabled) className += styles.disabled
10
-
10
+ const styleLabel = labelClassName || styles.defaultLabel
11
11
  return (
12
12
  <>
13
13
  <div className={styles.container}>
@@ -15,7 +15,7 @@ function ToggleSwitch ({ name, label, errorMessage, onChange, checked, disabled
15
15
  <input type='checkbox' name={name} onChange={onChange} checked={checked} disabled={disabled} />
16
16
  <span className={`${styles.slider} ${styles.round}`} />
17
17
  </label>
18
- <span className={styles.label}>{label}</span>
18
+ <span className={styleLabel}>{label}</span>
19
19
  </div>
20
20
  {errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
21
21
  </>
@@ -46,7 +46,12 @@ ToggleSwitch.propTypes = {
46
46
  /**
47
47
  * onChange of border
48
48
  */
49
- onChange: PropTypes.func
49
+ onChange: PropTypes.func,
50
+ /**
51
+ * labelClassName
52
+ */
53
+ labelClassName: PropTypes.string
54
+
50
55
  }
51
56
 
52
57
  ToggleSwitch.defaultProps = {
@@ -55,7 +60,8 @@ ToggleSwitch.defaultProps = {
55
60
  errorMessage: '',
56
61
  checked: false,
57
62
  disabled: false,
58
- onChange: () => {}
63
+ onChange: () => {},
64
+ labelClassName: ''
59
65
  }
60
66
 
61
67
  export default ToggleSwitch
@@ -1,5 +1,5 @@
1
1
  .container {
2
- @apply flex w-full h-10 items-center;
2
+ @apply flex w-full h-10 items-center gap-x-2;
3
3
  }
4
4
  .switch {
5
5
  @apply relative inline-block w-[50px] h-[24px] cursor-pointer;
@@ -13,7 +13,7 @@
13
13
  -webkit-transition: .4s;
14
14
  transition: .4s;
15
15
  }
16
- .label {
16
+ .defaultLabel {
17
17
  @apply px-2 text-xs font-normal text-main-dark-blue;
18
18
  }
19
19
  .slider:before {
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5
5
 
6
- const AddIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ const AddIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  let icon = <></>
9
12
 
10
13
  switch (size) {
@@ -68,12 +71,16 @@ AddIcon.propTypes = {
68
71
  /**
69
72
  * Size
70
73
  */
71
- size: PropTypes.oneOf(SIZES)
74
+ size: PropTypes.oneOf(SIZES),
75
+ /**
76
+ * disabled
77
+ */
78
+ disabled: PropTypes.bool
72
79
  }
73
-
74
80
  AddIcon.defaultProps = {
75
81
  color: MAIN_DARK_BLUE,
76
- size: MEDIUM
82
+ size: MEDIUM,
83
+ disabled: false
77
84
  }
78
85
 
79
86
  export default AddIcon
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, ERROR_RED } from '../constants'
5
5
 
6
- const AlertIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ const AlertIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  let icon = <></>
9
12
 
10
13
  switch (size) {
@@ -71,12 +74,16 @@ AlertIcon.propTypes = {
71
74
  /**
72
75
  * Size
73
76
  */
74
- size: PropTypes.oneOf(SIZES)
77
+ size: PropTypes.oneOf(SIZES),
78
+ /**
79
+ * disabled
80
+ */
81
+ disabled: PropTypes.bool
75
82
  }
76
-
77
83
  AlertIcon.defaultProps = {
78
84
  color: ERROR_RED,
79
- size: MEDIUM
85
+ size: MEDIUM,
86
+ disabled: false
80
87
  }
81
88
 
82
89
  export default AlertIcon
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5
5
 
6
- const AllInOneIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ const AllInOneIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  let icon = <></>
9
12
 
10
13
  switch (size) {
@@ -101,12 +104,16 @@ AllInOneIcon.propTypes = {
101
104
  /**
102
105
  * Size
103
106
  */
104
- size: PropTypes.oneOf(SIZES)
107
+ size: PropTypes.oneOf(SIZES),
108
+ /**
109
+ * disabled
110
+ */
111
+ disabled: PropTypes.bool
105
112
  }
106
-
107
113
  AllInOneIcon.defaultProps = {
108
114
  color: MAIN_DARK_BLUE,
109
- size: MEDIUM
115
+ size: MEDIUM,
116
+ disabled: false
110
117
  }
111
118
 
112
119
  export default AllInOneIcon
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5
5
 
6
- const ApiCloudIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ const ApiCloudIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  let icon = <></>
9
12
 
10
13
  switch (size) {
@@ -83,12 +86,16 @@ ApiCloudIcon.propTypes = {
83
86
  /**
84
87
  * Size
85
88
  */
86
- size: PropTypes.oneOf(SIZES)
89
+ size: PropTypes.oneOf(SIZES),
90
+ /**
91
+ * disabled
92
+ */
93
+ disabled: PropTypes.bool
87
94
  }
88
-
89
95
  ApiCloudIcon.defaultProps = {
90
96
  color: MAIN_DARK_BLUE,
91
- size: MEDIUM
97
+ size: MEDIUM,
98
+ disabled: false
92
99
  }
93
100
 
94
101
  export default ApiCloudIcon
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, MEDIUM, EXTRA_LARGE, MAIN_DARK_BLUE } from '../constants'
5
5
 
6
- const ApiEmptyIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`] + ' '
6
+ const ApiEmptyIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  const filledClassName = styles[`filled-${color}`]
9
12
  let icon = <></>
10
13
 
@@ -131,12 +134,16 @@ ApiEmptyIcon.propTypes = {
131
134
  /**
132
135
  * Size
133
136
  */
134
- size: PropTypes.oneOf(SIZES)
137
+ size: PropTypes.oneOf(SIZES),
138
+ /**
139
+ * disabled
140
+ */
141
+ disabled: PropTypes.bool
135
142
  }
136
-
137
143
  ApiEmptyIcon.defaultProps = {
138
144
  color: MAIN_DARK_BLUE,
139
- size: MEDIUM
145
+ size: MEDIUM,
146
+ disabled: false
140
147
  }
141
148
 
142
149
  export default ApiEmptyIcon
@@ -3,8 +3,11 @@ import PropTypes from 'prop-types'
3
3
  import styles from './Icons.module.css'
4
4
  import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5
5
 
6
- const ApiIcon = ({ color, size }) => {
7
- const className = `${styles.noShrinkForFlex} ` + styles[`${color}`]
6
+ const ApiIcon = ({ color, size, disabled }) => {
7
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
8
+ if (disabled) {
9
+ className += ` ${styles.iconDisabled}`
10
+ }
8
11
  let icon = <></>
9
12
 
10
13
  switch (size) {
@@ -74,12 +77,16 @@ ApiIcon.propTypes = {
74
77
  /**
75
78
  * Size
76
79
  */
77
- size: PropTypes.oneOf(SIZES)
80
+ size: PropTypes.oneOf(SIZES),
81
+ /**
82
+ * disabled
83
+ */
84
+ disabled: PropTypes.bool
78
85
  }
79
-
80
86
  ApiIcon.defaultProps = {
81
87
  color: MAIN_DARK_BLUE,
82
- size: MEDIUM
88
+ size: MEDIUM,
89
+ disabled: false
83
90
  }
84
91
 
85
92
  export default ApiIcon