@soul-refiner/design-system 0.2.129 → 0.2.130

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.
@@ -6,9 +6,9 @@ export interface TabProps {
6
6
  items: {
7
7
  color?: TabColors;
8
8
  disabled?: boolean;
9
- href?: string;
10
9
  icon?: React.ReactElement;
11
10
  label: string;
11
+ onClick: () => void;
12
12
  }[];
13
13
  onChange?: (index: number) => void;
14
14
  size?: TabSizes;
@@ -17,7 +17,7 @@ export interface TabProps {
17
17
  declare const Tabs: {
18
18
  ({ activeIndex, items, onChange, size, sx, }: TabProps): React.JSX.Element;
19
19
  Item: {
20
- ({ active, color, disabled, href, icon, label, onClick, size, }: TabsItemProps): React.JSX.Element;
20
+ ({ active, color, disabled, icon, label, onClick, size, }: TabsItemProps): React.JSX.Element;
21
21
  displayName: string;
22
22
  };
23
23
  };
@@ -25,7 +25,6 @@ export interface TabsItemProps {
25
25
  active: boolean;
26
26
  color?: TabColors;
27
27
  disabled?: boolean;
28
- href?: string;
29
28
  icon?: React.ReactElement;
30
29
  label: string;
31
30
  onClick?: () => void;
@@ -46,7 +46,10 @@ const colorLookup = {
46
46
  };
47
47
  const Tabs = ({ activeIndex, items, onChange, size = 'large', sx, }) => {
48
48
  const id = React.useId();
49
- return (React.createElement(Wrapper, { "$sx": sx }, items.map((item, index) => (React.createElement(Item, { active: activeIndex === index, color: item?.color, disabled: item?.disabled, href: item?.href, icon: item?.icon, key: id + index.toString(36), label: item.label, onClick: () => onChange && onChange(index), size: size })))));
49
+ return (React.createElement(Wrapper, { "$sx": sx }, items.map((item, index) => (React.createElement(Item, { active: activeIndex === index, color: item?.color, disabled: item?.disabled, icon: item?.icon, key: id + index.toString(36), label: item.label, onClick: () => {
50
+ item.onClick();
51
+ onChange && onChange(index);
52
+ }, size: size })))));
50
53
  };
51
54
  const Wrapper = styled.div `
52
55
  display: flex;
@@ -63,14 +66,13 @@ const Wrapper = styled.div `
63
66
 
64
67
  ${({ $sx }) => ($sx ? $sx : '')}
65
68
  `;
66
- const Item = ({ active, color, disabled, href, icon, label, onClick, size = 'large', }) => {
67
- const isAnchor = !!href;
69
+ const Item = ({ active, color, disabled, icon, label, onClick, size = 'large', }) => {
68
70
  const inputColor = disabled ? 'grey' : color ? color : 'blue';
69
71
  const iconColor = colorLookup[inputColor].icon;
70
72
  const bgColor = colorLookup[inputColor].bg;
71
73
  const fontSize = size === 'large' ? 16 : size === 'medium' ? 14 : 12;
72
74
  const lineHeight = size === 'large' ? 24 : size === 'medium' ? 20 : 16;
73
- return (React.createElement(Element, { as: isAnchor ? 'a' : 'div', href: href, onClick: !disabled && onClick ? onClick : undefined, "$active": active, "$color": iconColor, "$disabled": disabled, "$hasIcon": !!icon, "$size": size },
75
+ return (React.createElement(Element, { as: "a", onClick: !disabled && onClick ? onClick : undefined, "$active": active, "$color": iconColor, "$disabled": disabled, "$hasIcon": !!icon, "$size": size },
74
76
  icon && React.createElement(IconWrapper, { "$bg": bgColor }, icon),
75
77
  React.createElement(P, { "$fontSize": fontSize, "$lineHeight": lineHeight, "$semiBold": true }, label)));
76
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.129",
3
+ "version": "0.2.130",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {