@platformatic/ui-components 0.1.123 → 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 (178) 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/Sidebar.jsx +91 -86
  35. package/src/components/Sidebar.module.css +4 -4
  36. package/src/components/TabbedWindowV2.jsx +82 -0
  37. package/src/components/TabbedWindowV2.module.css +17 -0
  38. package/src/components/VerticalSeparator.jsx +18 -6
  39. package/src/components/VerticalSeparator.module.css +3 -0
  40. package/src/components/constants.js +10 -2
  41. package/src/components/forms/Field.jsx +29 -8
  42. package/src/components/forms/Field.module.css +7 -1
  43. package/src/components/forms/Input.jsx +73 -8
  44. package/src/components/forms/Input.module.css +8 -3
  45. package/src/components/forms/Select.jsx +98 -20
  46. package/src/components/forms/Select.module.css +17 -6
  47. package/src/components/forms/ToggleSwitch.jsx +11 -5
  48. package/src/components/forms/ToggleSwitch.module.css +2 -2
  49. package/src/components/icons/AddIcon.jsx +12 -5
  50. package/src/components/icons/AlertIcon.jsx +12 -5
  51. package/src/components/icons/AllInOneIcon.jsx +12 -5
  52. package/src/components/icons/ApiCloudIcon.jsx +12 -5
  53. package/src/components/icons/ApiEmptyIcon.jsx +12 -5
  54. package/src/components/icons/ApiIcon.jsx +12 -5
  55. package/src/components/icons/ApiIconClosed.jsx +10 -4
  56. package/src/components/icons/ApiPerformanceIcon.jsx +12 -5
  57. package/src/components/icons/AppEmptyIcon.jsx +12 -5
  58. package/src/components/icons/AppIcon.jsx +12 -5
  59. package/src/components/icons/AppListIcon.jsx +12 -5
  60. package/src/components/icons/AppWorkspace.jsx +5 -2
  61. package/src/components/icons/ApplicationTypeIcon.jsx +12 -5
  62. package/src/components/icons/ArrowDownFullIcon.jsx +12 -5
  63. package/src/components/icons/ArrowDownIcon.jsx +12 -5
  64. package/src/components/icons/ArrowLeftIcon.jsx +12 -5
  65. package/src/components/icons/ArrowLongLeftIcon.jsx +84 -0
  66. package/src/components/icons/ArrowLongRightIcon.jsx +12 -5
  67. package/src/components/icons/ArrowRightIcon.jsx +12 -5
  68. package/src/components/icons/ArrowUpIcon.jsx +12 -5
  69. package/src/components/icons/BellIcon.jsx +12 -5
  70. package/src/components/icons/BillingIcon.jsx +12 -5
  71. package/src/components/icons/Calendar1DayIcon.jsx +12 -5
  72. package/src/components/icons/Calendar7DaysIcon.jsx +12 -5
  73. package/src/components/icons/CalendarIcon.jsx +12 -5
  74. package/src/components/icons/CheckListIcon.jsx +12 -5
  75. package/src/components/icons/CircleAddIcon.jsx +12 -5
  76. package/src/components/icons/CircleArrowLeftIcon.jsx +12 -5
  77. package/src/components/icons/CircleArrowRightIcon.jsx +12 -5
  78. package/src/components/icons/CircleCheckMarkButtonIcon.jsx +7 -3
  79. package/src/components/icons/CircleCheckMarkFullIcon.jsx +12 -5
  80. package/src/components/icons/CircleCheckMarkIcon.jsx +10 -4
  81. package/src/components/icons/CircleCloseHoverIcon.jsx +12 -5
  82. package/src/components/icons/CircleCloseIcon.jsx +12 -5
  83. package/src/components/icons/CircleCopyPasteIcon.jsx +12 -5
  84. package/src/components/icons/CircleDownloadIcon.jsx +12 -5
  85. package/src/components/icons/CircleEditIcon.jsx +12 -5
  86. package/src/components/icons/CircleExclamationIcon.jsx +5 -2
  87. package/src/components/icons/CircleFullIcon.jsx +12 -5
  88. package/src/components/icons/CircleGearIcon.jsx +12 -5
  89. package/src/components/icons/CircleRestartIcon.jsx +12 -5
  90. package/src/components/icons/CircleSubtractIcon.jsx +12 -5
  91. package/src/components/icons/CircleTwoArrowsDownIcon.jsx +12 -5
  92. package/src/components/icons/CircleTwoArrowsUpIcon.jsx +12 -5
  93. package/src/components/icons/CloseIcon.jsx +12 -5
  94. package/src/components/icons/CloudIcon.jsx +12 -5
  95. package/src/components/icons/ConfigureDatabaseIcon.jsx +12 -5
  96. package/src/components/icons/CopyPasteIcon.jsx +12 -5
  97. package/src/components/icons/CreatingAppIcon.jsx +12 -5
  98. package/src/components/icons/CreditCardIcon.jsx +12 -5
  99. package/src/components/icons/DatabaseIcon.jsx +12 -5
  100. package/src/components/icons/DatabaseMigrationIcon.jsx +12 -5
  101. package/src/components/icons/DepencenciesReloadIcon.jsx +12 -5
  102. package/src/components/icons/EditDocumentIcon.jsx +12 -5
  103. package/src/components/icons/EditIcon.jsx +12 -5
  104. package/src/components/icons/EnlargeIcon.jsx +12 -5
  105. package/src/components/icons/EntryIcon.jsx +12 -5
  106. package/src/components/icons/ExpandIcon.jsx +92 -0
  107. package/src/components/icons/ExploreDocIcon.jsx +12 -5
  108. package/src/components/icons/EyeClosedIcon.jsx +12 -5
  109. package/src/components/icons/EyeOpenedIcon.jsx +12 -5
  110. package/src/components/icons/FolderIcon.jsx +83 -0
  111. package/src/components/icons/FoldersIcon.jsx +86 -0
  112. package/src/components/icons/GearIcon.jsx +12 -5
  113. package/src/components/icons/GenerationLoadingIcon.jsx +12 -5
  114. package/src/components/icons/GitHubRepo2Icon.jsx +12 -5
  115. package/src/components/icons/GitHubRepoIcon.jsx +12 -5
  116. package/src/components/icons/GiveOwnershipIcon.jsx +12 -5
  117. package/src/components/icons/GraphQLIcon.jsx +12 -5
  118. package/src/components/icons/Icons.module.css +7 -2
  119. package/src/components/icons/ImportApplicationIcon.jsx +12 -5
  120. package/src/components/icons/KeyIcon.jsx +12 -5
  121. package/src/components/icons/LabelIcon.jsx +12 -5
  122. package/src/components/icons/LayersIcon.jsx +12 -5
  123. package/src/components/icons/LensIcon.jsx +12 -5
  124. package/src/components/icons/LiveIcon.jsx +12 -5
  125. package/src/components/icons/LoadingAppIcon.jsx +12 -5
  126. package/src/components/icons/LogOutIcon.jsx +5 -2
  127. package/src/components/icons/MetricsIcon.jsx +12 -5
  128. package/src/components/icons/MetricsLoadingIcon.jsx +12 -5
  129. package/src/components/icons/NameAppIcon.jsx +12 -5
  130. package/src/components/icons/OrganizationIcon.jsx +12 -5
  131. package/src/components/icons/OutOfBoxGraphQLIcon.jsx +12 -5
  132. package/src/components/icons/PlatformaticComposerIcon.jsx +12 -5
  133. package/src/components/icons/PlatformaticDBIcon.jsx +12 -5
  134. package/src/components/icons/PlatformaticRuntimeIcon.jsx +12 -5
  135. package/src/components/icons/PlatformaticServiceIcon.jsx +12 -5
  136. package/src/components/icons/PlayIcon.jsx +12 -5
  137. package/src/components/icons/PreviewPRIcon.jsx +12 -5
  138. package/src/components/icons/PullRequestIcon.jsx +12 -5
  139. package/src/components/icons/PullRequestLoadingIcon.jsx +12 -5
  140. package/src/components/icons/RequestOwnershipIcon.jsx +12 -5
  141. package/src/components/icons/RestartIcon.jsx +12 -5
  142. package/src/components/icons/RocketIcon.jsx +12 -5
  143. package/src/components/icons/RunningIcon.jsx +12 -5
  144. package/src/components/icons/SendIcon.jsx +12 -5
  145. package/src/components/icons/ServiceIcon.jsx +12 -5
  146. package/src/components/icons/SlotIcon.jsx +12 -5
  147. package/src/components/icons/SocialDiscordIcon.jsx +12 -5
  148. package/src/components/icons/SocialGitHubIcon.jsx +12 -5
  149. package/src/components/icons/SocialGitLabIcon.jsx +12 -5
  150. package/src/components/icons/SocialLinkedInIcon.jsx +12 -5
  151. package/src/components/icons/SocialNPMIcon.jsx +12 -5
  152. package/src/components/icons/SocialXIcon.jsx +12 -5
  153. package/src/components/icons/SortableIcon.jsx +93 -0
  154. package/src/components/icons/StackablesPluginIcon.jsx +134 -0
  155. package/src/components/icons/StackablesTemplateIcon.jsx +133 -0
  156. package/src/components/icons/StopIcon.jsx +12 -5
  157. package/src/components/icons/SwitchIcon.jsx +12 -5
  158. package/src/components/icons/TeamsIcon.jsx +12 -5
  159. package/src/components/icons/TerminalIcon.jsx +12 -5
  160. package/src/components/icons/TrashIcon.jsx +95 -0
  161. package/src/components/icons/TwoUsersIcon.jsx +12 -5
  162. package/src/components/icons/UpgradeIcon.jsx +12 -5
  163. package/src/components/icons/UserIcon.jsx +12 -5
  164. package/src/components/icons/UserRemoveIcon.jsx +5 -2
  165. package/src/components/icons/UserRoleIcon.jsx +5 -2
  166. package/src/components/icons/WorkspaceDynamicIcon.jsx +12 -5
  167. package/src/components/icons/WorkspaceEmptyIcon.jsx +12 -5
  168. package/src/components/icons/WorkspaceFailIcon.jsx +12 -5
  169. package/src/components/icons/WorkspaceGitHubIcon.jsx +12 -5
  170. package/src/components/icons/WorkspaceLoadingIcon.jsx +12 -5
  171. package/src/components/icons/WorkspaceReadyIcon.jsx +12 -5
  172. package/src/components/icons/WorkspaceStaticIcon.jsx +12 -5
  173. package/src/components/icons/index.js +23 -7
  174. package/src/stories/ModalDirectional.stories.jsx +45 -0
  175. package/src/stories/forms/Select.stories.jsx +33 -1
  176. package/tailwind.config.cjs +5 -2
  177. package/dist/assets/index-3a61658e.css +0 -1
  178. package/dist/assets/index-8f6ac36c.js +0 -206
@@ -0,0 +1,83 @@
1
+ 'use strict'
2
+ import React, { useState, useEffect } from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import useEscapeKey from '../hooks/useEscapeKey'
5
+ import styles from './ModalDirectional.module.css'
6
+ import {
7
+ SMALL,
8
+ WHITE
9
+ } from './constants'
10
+ import PlatformaticIcon from './PlatformaticIcon'
11
+
12
+ function ModalDirectional ({
13
+ setIsOpen,
14
+ title,
15
+ titleClassName,
16
+ children,
17
+ smallLayout
18
+ }) {
19
+ const className = `${styles.container} ${styles.modalLeftCover} ${smallLayout ? styles.smallLayout : styles.normalLayout}`
20
+ const [modalClassName] = useState(className)
21
+ const [variantModalClassName, setVariantModalClassName] = useState(`${styles.container} ${styles.modalLeftCover}`)
22
+
23
+ useEffect(() => {
24
+ setVariantModalClassName(`${modalClassName} ${styles.modalLeftCoverEntering}`)
25
+ }, [])
26
+
27
+ useEscapeKey(() => closeModal())
28
+
29
+ function closeModal () {
30
+ setVariantModalClassName(`${modalClassName} ${styles.modalLeftCoverLeaving}`)
31
+ setTimeout(() => {
32
+ setIsOpen(false)
33
+ }, 300)
34
+ }
35
+
36
+ return (
37
+ <>
38
+ <div className={styles.blur} onClick={() => closeModal()} />
39
+ <div className={variantModalClassName}>
40
+ <div className={styles.modalLefty}>
41
+ <div className={styles.headerClassName}>
42
+ <PlatformaticIcon iconName='ArrowLongLeftIcon' color={WHITE} size={SMALL} onClick={() => closeModal()} />
43
+ <span className={titleClassName}>{title}</span>
44
+ </div>
45
+ {children}
46
+ </div>
47
+ </div>
48
+ </>
49
+ )
50
+ }
51
+
52
+ ModalDirectional.propTypes = {
53
+ /**
54
+ * children
55
+ */
56
+ children: PropTypes.node,
57
+ /**
58
+ * setIsOpen
59
+ */
60
+ setIsOpen: PropTypes.func,
61
+ /**
62
+ * title
63
+ */
64
+ title: PropTypes.string,
65
+ /**
66
+ * title
67
+ */
68
+ titleClassName: PropTypes.string,
69
+ /**
70
+ * smallLayout
71
+ */
72
+ smallLayout: PropTypes.bool
73
+ }
74
+
75
+ ModalDirectional.defaultProps = {
76
+ children: null,
77
+ setIsOpen: () => {},
78
+ title: '',
79
+ titleClassName: '',
80
+ smallLayout: false
81
+ }
82
+
83
+ export default ModalDirectional
@@ -0,0 +1,38 @@
1
+ .blur {
2
+ @apply absolute top-0 left-0 w-full h-full z-10 bg-rich-black/75;
3
+ }
4
+ .container {
5
+ @apply z-20 fixed top-0 -right-[100%] min-h-full h-full bg-rich-black border-solid border-white border-l;
6
+ }
7
+ .normalLayout {
8
+ @apply max-w-[75%] min-w-[75%];
9
+ }
10
+ .smallLayout {
11
+ @apply max-w-[34%] min-w-[34%];
12
+ }
13
+ .modalLeftCover {
14
+ @apply overflow-y-auto w-full ;
15
+ }
16
+ .modalLeftCoverEntering {
17
+ animation: come-in 400ms forwards;
18
+ }
19
+ .modalLeftCoverLeaving {
20
+ animation: come-out 200ms forwards;
21
+ }
22
+ .headerClassName {
23
+ @apply flex items-center gap-x-2 pb-4;
24
+ }
25
+ .modalLefty {
26
+ @apply py-20 px-[7.5rem];
27
+ height: calc(100% - 10rem);
28
+ }
29
+
30
+ @keyframes come-in {
31
+ from {right: -100%}
32
+ to {right: 0%}
33
+ }
34
+
35
+ @keyframes come-out {
36
+ from {right: 0%}
37
+ to {right: -100%}
38
+ }
@@ -6,19 +6,29 @@ import Icons from './icons'
6
6
  import styles from './PlatformaticIcon.module.css'
7
7
  import { COLORS_ICON, MAIN_GREEN, SIZES, SMALL } from './constants'
8
8
 
9
- function PlatformaticIcon ({ iconName, color, onClick, size, classes, tip, ...rest }) {
9
+ function PlatformaticIcon ({
10
+ iconName,
11
+ color,
12
+ onClick,
13
+ size,
14
+ classes,
15
+ tip,
16
+ disabled,
17
+ ...rest
18
+ }) {
10
19
  let icon = <></>
11
20
  if (iconName) {
12
21
  icon = React.createElement(Icons[`${iconName}`], {
13
22
  color,
14
23
  size,
15
24
  tip,
25
+ disabled,
16
26
  ...rest
17
27
  })
18
- if (onClick) {
28
+ if (onClick && !disabled) {
19
29
  let className = styles.cursorPointer
20
30
  if (classes) className += ` ${classes}`
21
- icon = (<span className={className} onClick={onClick}>{icon}</span>)
31
+ icon = (<div className={className} onClick={onClick}>{icon}</div>)
22
32
  }
23
33
  }
24
34
  return (
@@ -53,7 +63,11 @@ PlatformaticIcon.propTypes = {
53
63
  /**
54
64
  * tip
55
65
  */
56
- tip: PropTypes.string
66
+ tip: PropTypes.string,
67
+ /**
68
+ * disabled
69
+ */
70
+ disabled: PropTypes.bool
57
71
  }
58
72
 
59
73
  PlatformaticIcon.defaultProps = {
@@ -62,7 +76,8 @@ PlatformaticIcon.defaultProps = {
62
76
  size: SMALL,
63
77
  onClick: () => {},
64
78
  classes: '',
65
- tip: ''
79
+ tip: '',
80
+ disabled: false
66
81
  }
67
82
 
68
83
  export default PlatformaticIcon
@@ -0,0 +1,120 @@
1
+ 'use strict'
2
+ import React, { useRef, useState } from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import styles from './SearchBarV2.module.css'
5
+ import PlatformaticIcon from './PlatformaticIcon'
6
+ import { MEDIUM, WHITE } from './constants'
7
+ function SearchBarV2 ({
8
+ onSubmit,
9
+ onChange,
10
+ onClear,
11
+ color,
12
+ onFocusColor,
13
+ placeholder,
14
+ dataAttrName,
15
+ dataAttrValue
16
+ }) {
17
+ const inputRef = useRef()
18
+ const [wrapperClassName, setWrapperClassName] = useState(normalClassName())
19
+ const [isOnFocus, setIsOnFocus] = useState(false)
20
+ const dataProps = {}
21
+ if (dataAttrName && dataAttrValue) {
22
+ dataProps[`data-${dataAttrName}`] = dataAttrValue
23
+ }
24
+ function handleSearch () {
25
+ if (onSubmit) {
26
+ const value = inputRef.current.value
27
+ return onSubmit(value)
28
+ }
29
+ }
30
+
31
+ function handleChange () {
32
+ if (onChange) {
33
+ const value = inputRef.current.value
34
+ return onChange(value)
35
+ }
36
+ }
37
+
38
+ function handleClear () {
39
+ inputRef.current.value = ''
40
+ return onClear()
41
+ }
42
+
43
+ function onFocus () {
44
+ if (!isOnFocus) {
45
+ setIsOnFocus(true)
46
+ setWrapperClassName(onFocusClassName())
47
+ }
48
+ }
49
+
50
+ function onBlur () {
51
+ setIsOnFocus(false)
52
+ setWrapperClassName(normalClassName())
53
+ }
54
+
55
+ function onFocusClassName () {
56
+ return `${styles.container} ${styles.wrapperPadding} ${styles.onFocus}`
57
+ }
58
+
59
+ function normalClassName () {
60
+ return `${styles.container} ${styles.wrapperPadding} ${styles.onBlur}`
61
+ }
62
+
63
+ return (
64
+ <div className={wrapperClassName} {...dataProps}>
65
+ <PlatformaticIcon iconName='LensIcon' color={isOnFocus ? onFocusColor : color} size={MEDIUM} onClick={handleSearch} />
66
+ <input type='text' placeholder={placeholder} className={styles.input} ref={inputRef} onChange={handleChange} onFocus={onFocus} onBlur={onBlur} />
67
+ <div className={styles.clearContainer}>
68
+ <PlatformaticIcon iconName='CircleCloseIcon' color={isOnFocus ? onFocusColor : color} size={MEDIUM} onClick={handleClear} />
69
+ </div>
70
+ </div>
71
+ )
72
+ }
73
+
74
+ SearchBarV2.propTypes = {
75
+ /**
76
+ * onSubmit
77
+ */
78
+ onSubmit: PropTypes.func,
79
+ /**
80
+ * onSubmit
81
+ */
82
+ onChange: PropTypes.func,
83
+ /**
84
+ * onSubmit
85
+ */
86
+ onClear: PropTypes.func,
87
+ /**
88
+ * color
89
+ */
90
+ color: PropTypes.string,
91
+ /**
92
+ * onFocusColor
93
+ */
94
+ onFocusColor: PropTypes.string,
95
+ /**
96
+ * placeholder
97
+ */
98
+ placeholder: PropTypes.string,
99
+ /**
100
+ * dataAttrName
101
+ */
102
+ dataAttrName: PropTypes.string,
103
+ /**
104
+ * dataAttrValue
105
+ */
106
+ dataAttrValue: PropTypes.string
107
+ }
108
+
109
+ SearchBarV2.defaultProps = {
110
+ color: WHITE,
111
+ onFocusColor: WHITE,
112
+ onSubmit: () => {},
113
+ onChange: () => {},
114
+ onClear: () => {},
115
+ placeholder: 'Search',
116
+ dataAttrName: '',
117
+ dataAttrValue: ''
118
+ }
119
+
120
+ export default SearchBarV2
@@ -0,0 +1,28 @@
1
+ .container {
2
+ @apply relative flex gap-x-2 w-full h-auto border border-solid box-border rounded-md;
3
+ }
4
+ .input {
5
+ @apply w-full p-0 bg-transparent border-none text-white ;
6
+ }
7
+ .onFocus {
8
+ @apply border-white;
9
+ }
10
+ .onBlur {
11
+ @apply border-white/15;
12
+ }
13
+ .fillWhite {
14
+ @apply fill-white;
15
+ }
16
+ .container > input:focus {
17
+ @apply outline-none;
18
+ }
19
+ .title {
20
+ @apply font-semibold text-white text-3xl pb-4;
21
+ }
22
+ .clearContainer {
23
+ @apply absolute right-[1rem] translate-y-[-50%];
24
+ }
25
+ .wrapperPadding {
26
+ @apply px-2 py-1.5;
27
+ }
28
+
@@ -40,95 +40,100 @@ function Sidebar (props) {
40
40
 
41
41
  return (
42
42
  <div className={`${styles.container} ${collapsed && styles.collapsed}`}>
43
- {collapsed
44
- ? (
45
- <>
46
- <ButtonFullRounded
47
- className={buttonFullRoundedClassName}
48
- iconName='CircleArrowRightIcon'
49
- iconSize={MEDIUM}
50
- iconColor={WHITE}
51
- hoverEffect={BACKGROUND_COLOR_OPAQUE}
52
- onClick={() => { setCollapsed(false) }}
53
- bordered={false}
54
- />
55
- <button type='button' className={styles.buttonExpand} onClick={() => { setCollapsed(false) }}>
56
- <Icons.WorkspaceStaticIcon color='white' size='large' />
57
- </button>
58
- <div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
59
- {title}
60
- </div>
61
- <HorizontalSeparator marginBottom={0} marginTop={0} />
62
- <div className={styles.bottom}>
63
- <button type='button' className={styles.buttonSettings} onClick={onClickSettings}>
64
- <Icons.GearIcon color='white' size='large' />
65
- </button>
66
- </div>
67
- </>
68
- )
69
- : (
70
- <>
71
- <ButtonFullRounded
72
- className={buttonFullRoundedClassName}
73
- iconName='CircleArrowLeftIcon'
74
- iconSize={MEDIUM}
75
- iconColor={WHITE}
76
- hoverEffect={BACKGROUND_COLOR_OPAQUE}
77
- onClick={() => { setCollapsed(true) }}
78
- bordered={false}
79
- />
80
- <div className={styles.title} data-testid='lateral-bar-title'>
81
- {title}
82
- </div>
83
- <div className={styles.items} data-test-id='lateral-bar-items'>
84
- {items.map(item => {
85
- const isSelected = selectedItem === item.id
86
- return (
87
- <React.Fragment key={item.id}>
88
- <button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} type='button' onClick={() => onClickItemSelected(item)}>
89
- {item.iconName && (<PlatformaticIcon
90
- iconName={item.iconName}
91
- color={isSelected ? 'main-green' : 'white'}
92
- tip={item.title}
93
- size='medium'
94
- />)}
95
- <div className={`${styles.item} ${isSelected ? styles.itemSelected : ''}`}>
96
- <span className={styles.itemSubTitle}>{item.subTitle}</span>
97
- <span className={styles.itemTitle}>{item.title}</span>
98
- </div>
99
- </button>
100
- <ReactTooltip place='top' type='info' />
101
- </React.Fragment>
102
- )
103
- })}
104
- <button className={`${styles.buttonCreate} ${collapsed && styles.buttonItemCollapsed} ${disabledCreateButton} ${!disableClickAdd && styles.hoverSemibold}`} onClick={onClickAdd} disabled={disableClickAdd}>
105
- <PlatformaticIcon
106
- iconName='CircleAddIcon'
107
- color='white'
108
- size='medium'
109
- tip={addTitle}
110
- onClick={null}
111
- />
112
- {!collapsed && <span className={styles.item}>{addTitle}</span>}
43
+ <div>
44
+ {collapsed
45
+ ? (
46
+ <>
47
+ <ButtonFullRounded
48
+ className={buttonFullRoundedClassName}
49
+ iconName='CircleArrowRightIcon'
50
+ iconSize={MEDIUM}
51
+ iconColor={WHITE}
52
+ hoverEffect={BACKGROUND_COLOR_OPAQUE}
53
+ onClick={() => { setCollapsed(false) }}
54
+ bordered={false}
55
+ />
56
+ <button type='button' className={styles.buttonExpand} onClick={() => { setCollapsed(false) }}>
57
+ <Icons.WorkspaceStaticIcon color='white' size='large' />
113
58
  </button>
114
- </div>
115
- <HorizontalSeparator marginBottom={2} marginTop={2} />
116
-
117
- <div className={styles.bottom}>
118
- <Button
119
- label={labelButtonSettings}
120
- color={WHITE}
121
- onClick={onClickSettings}
122
- platformaticIcon={{ iconName: 'GearIcon', color: WHITE }}
123
- fullWidth
124
- bold
125
- size={MEDIUM}
126
- disabled={disableClickSettings}
59
+ <div className={styles.titleCollapsed} data-testid='lateral-bar-title'>
60
+ {title}
61
+ </div>
62
+ <HorizontalSeparator marginBottom={0} marginTop={0} />
63
+ </>
64
+ )
65
+ : (
66
+ <>
67
+ <ButtonFullRounded
68
+ className={buttonFullRoundedClassName}
69
+ iconName='CircleArrowLeftIcon'
70
+ iconSize={MEDIUM}
71
+ iconColor={WHITE}
127
72
  hoverEffect={BACKGROUND_COLOR_OPAQUE}
73
+ onClick={() => { setCollapsed(true) }}
74
+ bordered={false}
128
75
  />
129
- </div>
130
- </>
131
- )}
76
+ <div className={styles.title} data-testid='lateral-bar-title'>
77
+ {title}
78
+ </div>
79
+ <div className={styles.items} data-test-id='lateral-bar-items'>
80
+ {items.map(item => {
81
+ const isSelected = selectedItem === item.id
82
+ return (
83
+ <React.Fragment key={item.id}>
84
+ <button className={`${styles.buttonItem} ${collapsed && styles.buttonItemCollapsed}`} type='button' onClick={() => onClickItemSelected(item)}>
85
+ {item.iconName && (<PlatformaticIcon
86
+ iconName={item.iconName}
87
+ color={isSelected ? 'main-green' : 'white'}
88
+ tip={item.title}
89
+ size='medium'
90
+ />)}
91
+ <div className={`${styles.item} ${isSelected ? styles.itemSelected : ''}`}>
92
+ <span className={styles.itemSubTitle}>{item.subTitle}</span>
93
+ <span className={styles.itemTitle}>{item.title}</span>
94
+ </div>
95
+ </button>
96
+ <ReactTooltip place='top' type='info' />
97
+ </React.Fragment>
98
+ )
99
+ })}
100
+ <button className={`${styles.buttonCreate} ${collapsed && styles.buttonItemCollapsed} ${disabledCreateButton} ${!disableClickAdd && styles.hoverSemibold}`} onClick={onClickAdd} disabled={disableClickAdd}>
101
+ <PlatformaticIcon
102
+ iconName='CircleAddIcon'
103
+ color='white'
104
+ size='medium'
105
+ tip={addTitle}
106
+ onClick={null}
107
+ />
108
+ {!collapsed && <span className={styles.item}>{addTitle}</span>}
109
+ </button>
110
+ </div>
111
+ <HorizontalSeparator marginBottom={2} marginTop={2} />
112
+ </>
113
+ )}
114
+ </div>
115
+
116
+ <div>
117
+ {collapsed
118
+ ? (
119
+ <button type='button' className={styles.buttonSettings} onClick={onClickSettings}>
120
+ <Icons.GearIcon color='white' size='large' />
121
+ </button>
122
+ )
123
+ : (
124
+ <Button
125
+ label={labelButtonSettings}
126
+ color={WHITE}
127
+ onClick={onClickSettings}
128
+ platformaticIcon={{ iconName: 'GearIcon', color: WHITE }}
129
+ fullWidth
130
+ bold
131
+ size={MEDIUM}
132
+ disabled={disableClickSettings}
133
+ hoverEffect={BACKGROUND_COLOR_OPAQUE}
134
+ />
135
+ )}
136
+ </div>
132
137
  </div>
133
138
  )
134
139
  }
@@ -1,7 +1,10 @@
1
1
  .container {
2
- @apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative min-h-[80vh] z-10 bg-dark-blue;
2
+ @apply max-w-[216px] w-full p-4 border border-white rounded-md h-auto relative min-h-[80vh] z-10 bg-dark-blue flex flex-col gap-y-6 justify-between;
3
3
  transition: max-width 0.2s linear;
4
4
  }
5
+ .content {
6
+ @apply flex flex-col justify-between
7
+ }
5
8
  .collapsed {
6
9
  @apply max-w-[96px] text-center;
7
10
  }
@@ -54,9 +57,6 @@
54
57
  .items {
55
58
  @apply flex flex-col gap-y-4;
56
59
  }
57
- .bottom {
58
- @apply absolute left-0 bottom-[1rem] w-full px-4;
59
- }
60
60
  .titleSettings {
61
61
  @apply text-white font-semibold ml-3;
62
62
  }
@@ -0,0 +1,82 @@
1
+ 'use strict'
2
+ import React, { useEffect, useState } from 'react'
3
+ import PropTypes from 'prop-types'
4
+ import styles from './TabbedWindowV2.module.css'
5
+ import commonStyles from './Common.module.css'
6
+ import { MAIN_DARK_BLUE, OPACITY_30, TRANSPARENT, WHITE } from './constants'
7
+ import VerticalSeparator from './VerticalSeparator'
8
+
9
+ function TabbedWindowV2 ({ tabs, keySelected, backgroundColor }) {
10
+ const headers = []
11
+ const keys = []
12
+ const components = []
13
+ tabs.forEach((tab) => {
14
+ headers.push(tab.headerComponent)
15
+ keys.push(tab.key)
16
+ components.push(tab.component)
17
+ })
18
+ const [currentComponent, setCurrentComponent] = useState(components[0])
19
+ const className = commonStyles.fullWidth + ' ' + commonStyles[`background-color-${backgroundColor}`] + ' '
20
+
21
+ useEffect(() => {
22
+ if (keySelected) {
23
+ const indexKey = keys.findIndex(key => key === keySelected)
24
+ setCurrentComponent(components[indexKey])
25
+ }
26
+ }, [keySelected])
27
+
28
+ function renderHeaders () {
29
+ const cmps = []
30
+ headers.forEach((header, index) => {
31
+ if (index > 0) {
32
+ cmps.push(<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} key={`vs${index}`} />)
33
+ }
34
+ cmps.push(header())
35
+ /* const element = header()
36
+ cmps.push(
37
+ React.cloneElement(element, {
38
+ key: element.key,
39
+ onClick: () => {setCurrentTab(index)},
40
+ })
41
+ ) */
42
+ })
43
+ return cmps
44
+ }
45
+
46
+ return (
47
+ <div className={`${styles.container} ${className}`}>
48
+ <div className={styles['tabs-header']}>
49
+ {renderHeaders()}
50
+ </div>
51
+ <div className={styles['tabs-content']}>{currentComponent}</div>
52
+ </div>
53
+ )
54
+ }
55
+
56
+ TabbedWindowV2.propTypes = {
57
+ /**
58
+ * tabs
59
+ */
60
+ tabs: PropTypes.array,
61
+ /**
62
+ * keySelected
63
+ */
64
+ keySelected: PropTypes.string,
65
+ /**
66
+ * callbackSelected
67
+ */
68
+ callbackSelected: PropTypes.func,
69
+ /**
70
+ * backgroundColor
71
+ */
72
+ backgroundColor: PropTypes.oneOf([WHITE, MAIN_DARK_BLUE, TRANSPARENT])
73
+ }
74
+
75
+ TabbedWindowV2.defaultProps = {
76
+ tabs: [],
77
+ keySelected: '',
78
+ callbackSelected: () => {},
79
+ backgroundColor: MAIN_DARK_BLUE
80
+ }
81
+
82
+ export default TabbedWindowV2
@@ -0,0 +1,17 @@
1
+ .container {
2
+ @apply flex flex-col gap-y-10
3
+ }
4
+ .tabs-header {
5
+ @apply flex justify-start items-center gap-x-0;
6
+ }
7
+ .tabs-content {
8
+ @apply min-h-screen
9
+ }
10
+ .tab::before {
11
+ display: block;
12
+ content: attr(title);
13
+ font-weight: bold;
14
+ height: 0;
15
+ overflow: hidden;
16
+ visibility: hidden;
17
+ }
@@ -1,23 +1,35 @@
1
1
  'use strict'
2
2
  import React from 'react'
3
3
  import PropTypes from 'prop-types'
4
- import { DARK_GREEN, MAIN_DARK_BLUE } from './constants'
4
+ import { DARK_GREEN, MAIN_DARK_BLUE, OPACITY_10, OPACITY_20, OPACITY_30, OPACITY_60, OPACITY_100, WHITE } from './constants'
5
5
  import commonStyles from './Common.module.css'
6
+ import styles from './VerticalSeparator.module.css'
6
7
 
7
- function VerticalSeparator ({ color }) {
8
- const className = commonStyles[`text--${color}`] + ' my-auto mx-5'
9
- return <span className={className}> | </span>
8
+ function VerticalSeparator ({ color, backgroundColorOpacity }) {
9
+ const backgroundColor = commonStyles[`background-color-${color}`]
10
+ const backgroundOpacity = commonStyles[`background-color-opaque-${backgroundColorOpacity}`]
11
+ const className = `${backgroundColor} ${backgroundOpacity} ${styles.fullHeight}`
12
+ return <div className={className} />
10
13
  }
11
14
 
12
15
  VerticalSeparator.propTypes = {
13
16
  /**
14
17
  * color
15
18
  */
16
- color: PropTypes.oneOf([DARK_GREEN, MAIN_DARK_BLUE])
19
+ color: PropTypes.oneOf([DARK_GREEN, MAIN_DARK_BLUE, WHITE]),
20
+ /**
21
+ * backgroundColorOpacity
22
+ */
23
+ backgroundColorOpacity: PropTypes.oneOf([OPACITY_10,
24
+ OPACITY_20,
25
+ OPACITY_30,
26
+ OPACITY_60,
27
+ OPACITY_100])
17
28
  }
18
29
 
19
30
  VerticalSeparator.defaultProps = {
20
- color: DARK_GREEN
31
+ color: DARK_GREEN,
32
+ backgroundColorOpacity: 100
21
33
  }
22
34
 
23
35
  export default VerticalSeparator
@@ -0,0 +1,3 @@
1
+ .fullHeight {
2
+ @apply h-full min-h-[18px] w-[1px];
3
+ }