@addev-be/ui 0.20.2 → 0.20.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/ui",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "watch": "tsc -b --watch",
@@ -20,7 +20,7 @@
20
20
  "update-version": "../../node/update-version.mjs"
21
21
  },
22
22
  "devDependencies": {
23
- "@addev-be/framework-utils": "^0.20.2",
23
+ "@addev-be/framework-utils": "^0.20.3",
24
24
  "@types/lodash": "^4",
25
25
  "@types/react": "^18.3.3",
26
26
  "@types/react-dom": "^18.3.0",
@@ -4,21 +4,20 @@ import styled from 'styled-components';
4
4
 
5
5
  export type ColumnsProps = {
6
6
  columns?: number | string[];
7
+ $maxColumnWidth?: string;
7
8
  } & SpaceProps;
8
9
 
9
10
  export const Columns = styled.div<ColumnsProps>`
10
11
  display: grid;
11
12
  grid-gap: var(--space-6);
12
- grid-template-columns: ${({ columns }) => {
13
- if (typeof columns === 'number') {
14
- return columns === 2
15
- ? `repeat(2, calc(50% - var(--space-6) / 2))`
16
- : `repeat(${columns}, 1fr)`;
17
- }
18
- return columns?.join(' ') || 'none';
19
- }};
13
+ width: 100%;
20
14
 
21
- ${space}
15
+ grid-template-columns: ${({ columns = 1, $maxColumnWidth = '1fr' }) =>
16
+ typeof columns === 'number'
17
+ ? `repeat(${columns}, minmax(0, ${$maxColumnWidth}))`
18
+ : columns?.join(' ') ?? 'none'};
19
+
20
+ ${space};
22
21
  `;
23
22
 
24
23
  export const Column = styled.div`
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  import { TabProps } from './types';
10
10
 
11
- export const TabView: FC<TabProps> = ({ tabs }) => {
11
+ export const TabView: FC<TabProps> = ({ tabs, overflow = false }) => {
12
12
  const [activeIndex, setActiveIndex] = useState(0);
13
13
  const activeTab = tabs[activeIndex];
14
14
 
@@ -27,7 +27,9 @@ export const TabView: FC<TabProps> = ({ tabs }) => {
27
27
  </TabContainer>
28
28
  ))}
29
29
  </TabListContainer>
30
- <TabContentContainer>{activeTab.content}</TabContentContainer>
30
+ <TabContentContainer $isOverflow={overflow}>
31
+ {activeTab.content}
32
+ </TabContentContainer>
31
33
  </TabViewContainer>
32
34
  );
33
35
  };
@@ -9,16 +9,15 @@ export const TabViewContainer = styled.div`
9
9
  height: 100%;
10
10
  `;
11
11
 
12
- export const TabListContainer = styled.div`
12
+ export const TabListContainer = styled.div<{}>`
13
13
  display: flex;
14
- flex-direction: row;
14
+ gap: var(--space-4);
15
15
  flex-shrink: 0;
16
- justify-content: flex-start;
17
- gap: var(--space-2);
18
16
  overflow-x: scroll;
19
17
  scrollbar-width: none;
20
18
  padding: var(--space-2) var(--space-2);
21
19
  font-size: var(--text-base);
20
+ white-space: nowrap;
22
21
  `;
23
22
 
24
23
  export const TabContainer = styled.div<{
@@ -53,9 +52,13 @@ export const TabContainer = styled.div<{
53
52
  `;
54
53
 
55
54
  export const TabContentContainer = styled.div<{
56
- $isActive?: boolean;
55
+ $isOverflow?: boolean;
57
56
  }>`
58
57
  display: flex;
59
58
  height: 100%;
60
- overflow: hidden;
59
+
60
+ ${({ $isOverflow }) => css`
61
+ overflow: ${$isOverflow ? 'auto' : 'hidden'};
62
+ scroll-behavior: smooth;
63
+ `}
61
64
  `;
@@ -13,4 +13,5 @@ export type Tab = {
13
13
 
14
14
  export type TabProps = {
15
15
  tabs: Tab[];
16
+ overflow?: boolean;
16
17
  };