@rango-dev/ui 0.29.1-next.1 → 0.29.1-next.4

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 (48) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +4 -4
  3. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  4. package/dist/widget/ui/src/components/List/List.d.ts.map +1 -1
  5. package/dist/widget/ui/src/components/List/List.types.d.ts +1 -0
  6. package/dist/widget/ui/src/components/List/List.types.d.ts.map +1 -1
  7. package/dist/widget/ui/src/components/List/index.d.ts +1 -0
  8. package/dist/widget/ui/src/components/List/index.d.ts.map +1 -1
  9. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  10. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +1 -1
  11. package/dist/widget/ui/src/components/Select/select.styles.d.ts.map +1 -1
  12. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts +4 -0
  13. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
  14. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts +6 -0
  15. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts.map +1 -0
  16. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts +780 -0
  17. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts.map +1 -0
  18. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts +30 -0
  19. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts.map +1 -0
  20. package/dist/widget/ui/src/components/Tabs/index.d.ts +2 -0
  21. package/dist/widget/ui/src/components/Tabs/index.d.ts.map +1 -0
  22. package/dist/widget/ui/src/components/index.d.ts +2 -0
  23. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  24. package/dist/widget/ui/src/icons/Bridges.d.ts +5 -0
  25. package/dist/widget/ui/src/icons/Bridges.d.ts.map +1 -0
  26. package/dist/widget/ui/src/icons/Exchange.d.ts +5 -0
  27. package/dist/widget/ui/src/icons/Exchange.d.ts.map +1 -0
  28. package/dist/widget/ui/src/icons/index.d.ts +2 -0
  29. package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/readme.md +1 -0
  32. package/src/components/Alert/Alert.styles.ts +3 -1
  33. package/src/components/List/List.tsx +2 -3
  34. package/src/components/List/List.types.ts +1 -0
  35. package/src/components/List/index.ts +1 -0
  36. package/src/components/ListItem/ListItem.styles.ts +1 -0
  37. package/src/components/QuoteCost/QuoteCost.styles.ts +2 -0
  38. package/src/components/Select/Select.tsx +24 -24
  39. package/src/components/Select/select.styles.ts +30 -54
  40. package/src/components/Tabs/Tabs.stories.tsx +12 -0
  41. package/src/components/Tabs/Tabs.styles.tsx +157 -0
  42. package/src/components/Tabs/Tabs.tsx +95 -0
  43. package/src/components/Tabs/Tabs.types.tsx +32 -0
  44. package/src/components/Tabs/index.ts +1 -0
  45. package/src/components/index.ts +2 -0
  46. package/src/icons/Bridges.tsx +19 -0
  47. package/src/icons/Exchange.tsx +22 -0
  48. package/src/icons/index.ts +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/Tabs.styles.tsx"],"names":[],"mappings":";;;AAGA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAmCf,CAAC;AAEH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAqFd,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA6BtB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ import type { Tabs } from './Tabs.styles';
3
+ import type * as Stitches from '@stitches/react';
4
+ type BaseItem = {
5
+ id: string | number;
6
+ tooltip?: React.ReactNode;
7
+ };
8
+ type ItemWithTitle = BaseItem & {
9
+ title: string;
10
+ icon?: React.ReactNode;
11
+ };
12
+ type ItemWithIcon = BaseItem & {
13
+ icon: React.ReactNode;
14
+ title?: string;
15
+ };
16
+ type Item = ItemWithTitle | ItemWithIcon;
17
+ type BaseProps = Stitches.VariantProps<typeof Tabs>;
18
+ type BaseType = Exclude<BaseProps['type'], object>;
19
+ type BaseBorderRadius = Exclude<BaseProps['borderRadius'], object>;
20
+ export interface PropTypes {
21
+ items: Item[];
22
+ container?: HTMLElement;
23
+ onChange: (item: Item) => void;
24
+ value: string;
25
+ type: BaseType;
26
+ borderRadius?: BaseBorderRadius;
27
+ className?: string;
28
+ }
29
+ export {};
30
+ //#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 +1,2 @@
1
+ export { TabsComponent as Tabs } from './Tabs';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -53,4 +53,6 @@ export * from './Popover';
53
53
  export * from './Flags';
54
54
  export * from './Select';
55
55
  export * from './QuoteTag';
56
+ export * from './Tabs';
57
+ export type { SvgIconProps } from './SvgIcon';
56
58
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UA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AAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
2
+ import React from 'react';
3
+ declare function SvgBridges(props: SvgIconPropsWithChildren): React.FunctionComponentElement<SvgIconPropsWithChildren>;
4
+ export default SvgBridges;
5
+ //# sourceMappingURL=Bridges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bridges.d.ts","sourceRoot":"","sources":["../../../../../src/icons/Bridges.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,iBAAS,UAAU,CAAC,KAAK,EAAE,wBAAwB,4DAWlD;AACD,eAAe,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
2
+ import React from 'react';
3
+ declare function SvgExchange(props: SvgIconPropsWithChildren): React.FunctionComponentElement<SvgIconPropsWithChildren>;
4
+ export default SvgExchange;
5
+ //# sourceMappingURL=Exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exchange.d.ts","sourceRoot":"","sources":["../../../../../src/icons/Exchange.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,iBAAS,WAAW,CAAC,KAAK,EAAE,wBAAwB,4DAcnD;AACD,eAAe,WAAW,CAAC"}
@@ -2,6 +2,7 @@ export { default as AddIcon } from './Add';
2
2
  export { default as AutoThemeIcon } from './AutoTheme';
3
3
  export { default as AutorenewIcon } from './Autorenew';
4
4
  export { default as BorderRadiusIcon } from './BorderRadius';
5
+ export { default as BridgeIcon } from './Bridges';
5
6
  export { default as ChevronDownIcon } from './ChevronDown';
6
7
  export { default as ChevronLeftIcon } from './ChevronLeft';
7
8
  export { default as ChevronRightIcon } from './ChevronRight';
@@ -18,6 +19,7 @@ export { default as DoneIcon } from './Done';
18
19
  export { default as EvmCategoryIcon } from './EvmCategory';
19
20
  export { default as ErrorIcon } from './Error';
20
21
  export { default as ExitIcon } from './Exit';
22
+ export { default as ExchangeIcon } from './Exchange';
21
23
  export { default as ExternalLinkIcon } from './ExternalLink';
22
24
  export { default as FontIcon } from './Font';
23
25
  export { default as GasIcon } from './Gas';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceR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C/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.29.1-next.1",
3
+ "version": "0.29.1-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
package/readme.md CHANGED
@@ -5,3 +5,4 @@ Rango UI design system components
5
5
  ### Icons
6
6
 
7
7
  Add your svg icon to `svgs/resources/` then run `yarn build:icons`.
8
+
@@ -4,7 +4,9 @@ export const Container = styled('div', {
4
4
  display: 'flex',
5
5
  flexDirection: 'column',
6
6
  borderRadius: '$xs',
7
-
7
+ '.title_typography': {
8
+ width: '100%',
9
+ },
8
10
  '.title_typography:first-letter': {
9
11
  textTransform: 'uppercase',
10
12
  },
@@ -7,12 +7,11 @@ import { ListItem } from '../ListItem';
7
7
  import { BaseList } from './List.styles';
8
8
 
9
9
  function List(props: ListPropTypes) {
10
- const container = props.type;
11
-
12
10
  return (
13
11
  <BaseList as={props.as}>
14
12
  {props.items.map((item) => {
15
- const { id, ...itemProps } = item;
13
+ const { id, type, ...itemProps } = item;
14
+ const container = type || props.type;
16
15
 
17
16
  if (!!container) {
18
17
  return React.cloneElement(container, {
@@ -6,6 +6,7 @@ export interface ListPropTypes {
6
6
  type?: React.ReactElement;
7
7
  items: (ListItemProps & {
8
8
  id: string;
9
+ type?: React.ReactElement;
9
10
  })[];
10
11
  as?: 'div' | 'ul';
11
12
  css?: Stitches.CSS;
@@ -1 +1,2 @@
1
1
  export { List } from './List';
2
+ export type { ListPropTypes } from './List.types';
@@ -35,6 +35,7 @@ export const BaseListItem = styled('li', {
35
35
  fontWeight: 'bold',
36
36
  display: 'flex',
37
37
  alignItems: 'center',
38
+ color: '$foreground',
38
39
  },
39
40
  },
40
41
  '.item-end-container': {
@@ -31,6 +31,8 @@ const blinker = keyframes({
31
31
  export const itemStyles = css({
32
32
  display: 'flex',
33
33
  alignItems: 'center',
34
+ cursor: 'default',
35
+
34
36
  '&.feeSection': {
35
37
  cursor: 'pointer',
36
38
  '&:hover': {
@@ -3,7 +3,7 @@ import type { PropTypes } from './Select.types';
3
3
  import * as Select from '@radix-ui/react-select';
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
5
 
6
- import { ChevronDownIcon, ChevronUpIcon } from '../../icons';
6
+ import { ChevronDownIcon, ChevronUpIcon, DoneIcon } from '../../icons';
7
7
  import { Typography } from '../Typography';
8
8
 
9
9
  import { SelectContent, SelectItem, SelectTrigger } from './select.styles';
@@ -31,47 +31,47 @@ export function SelectComponent(props: PropTypes) {
31
31
 
32
32
  return (
33
33
  <div ref={selectRef}>
34
- <Select.Root value={value.value} open={open}>
34
+ <Select.Root value={value?.value} open={open}>
35
35
  <SelectTrigger
36
36
  onKeyDown={(event) => event.key === 'Enter' && handleToggle()}
37
37
  onClick={handleToggle}
38
38
  open={open}
39
- aria-label={value.label}>
39
+ aria-label={value?.label}>
40
40
  <Select.Value>
41
41
  <Typography variant="body" size="small">
42
- {value.label}
42
+ {value?.label}
43
43
  </Typography>
44
44
  </Select.Value>
45
45
 
46
46
  <Select.Icon className="SelectIcon">
47
- <ChevronDownIcon size={12} />
47
+ <ChevronDownIcon size={12} color="black" />
48
48
  </Select.Icon>
49
49
  </SelectTrigger>
50
50
  <Select.Portal container={container}>
51
- <SelectContent>
51
+ <SelectContent position="popper" sideOffset={5}>
52
52
  <Select.ScrollUpButton className="SelectScrollButton">
53
53
  <ChevronUpIcon />
54
54
  </Select.ScrollUpButton>
55
55
  <Select.Viewport className="SelectViewport">
56
56
  <Select.Group>
57
- {options.map(
58
- (option) =>
59
- option.value !== value?.value && (
60
- <SelectItem
61
- onClick={() => {
62
- handleItemClick && handleItemClick(option);
63
- handleToggle();
64
- }}
65
- key={option.value}
66
- value={option.value}>
67
- <Select.ItemText>
68
- <Typography variant="body" size="small">
69
- {option.label}
70
- </Typography>
71
- </Select.ItemText>
72
- </SelectItem>
73
- )
74
- )}
57
+ {options.map((option) => (
58
+ <SelectItem
59
+ onClick={() => {
60
+ handleItemClick && handleItemClick(option);
61
+ handleToggle();
62
+ }}
63
+ key={option.value}
64
+ value={option.value}>
65
+ <Select.ItemText>
66
+ <Typography variant="body" size="small">
67
+ {option.label}
68
+ </Typography>
69
+ </Select.ItemText>
70
+ {option.value === value?.value && (
71
+ <DoneIcon size={14} color="secondary" />
72
+ )}
73
+ </SelectItem>
74
+ ))}
75
75
  </Select.Group>
76
76
  </Select.Viewport>
77
77
  <Select.ScrollDownButton className="SelectScrollButton">
@@ -9,92 +9,68 @@ export const SelectTrigger = styled(Select.Trigger, {
9
9
  justifyContent: 'space-between',
10
10
  alignItems: 'center',
11
11
  cursor: 'pointer',
12
- backgroundColor: '$secondary',
13
12
  padding: '$5 $10',
14
13
  border: 0,
14
+ outline: 0,
15
15
  whiteSpace: 'nowrap',
16
-
16
+ borderRadius: '$sm',
17
+ backgroundColor: '$neutral300',
18
+ [`.${darkTheme} &`]: {
19
+ backgroundColor: '$neutral400',
20
+ },
21
+ width: '100%',
22
+ '&:hover': {
23
+ backgroundColor: '$info100',
24
+ [`.${darkTheme} &`]: {
25
+ backgroundColor: '$neutral',
26
+ },
27
+ },
17
28
  '& svg': {
18
29
  transition: `all ${EXPANDABLE_QUOTE_TRANSITION_DURATION}ms ease`,
19
30
  },
20
-
31
+ '& ._typography': {
32
+ whiteSpace: 'nowrap',
33
+ },
21
34
  variants: {
22
35
  open: {
23
36
  true: {
24
- borderTopLeftRadius: '$sm',
25
- borderTopRightRadius: '$sm',
26
- '& ._typography, & svg': {
27
- color: '$secondary',
28
- },
29
-
30
37
  '& svg': {
31
38
  transform: 'rotate(180deg)',
32
39
  },
33
- backgroundColor: '$neutral100',
34
- [`.${darkTheme} &`]: {
35
- backgroundColor: '$neutral300',
36
- },
37
40
  },
38
41
  false: {
39
- borderRadius: '$md',
40
- '& ._typography, & svg': {
41
- color: '$background',
42
- [`.${darkTheme} &`]: {
43
- color: '$foreground',
44
- },
45
- },
46
42
  '& svg': {
47
43
  transform: 'rotate(0)',
48
44
  },
49
45
  },
50
46
  },
51
47
  },
52
- width: '100%',
53
- '& ._typography': {
54
- whiteSpace: 'nowrap',
55
- overflow: 'hidden',
56
- textOverflow: 'ellipsis',
57
- width: '52px',
58
- '@xs': {
59
- width: 'auto',
60
- },
61
- },
62
48
  });
63
49
 
64
50
  export const SelectContent = styled(Select.Content, {
65
- padding: '$5 $10',
66
- width: '100%',
67
- position: 'absolute',
68
- top: '38px',
69
- maxHeight: '146px',
51
+ width: 'var(--radix-select-trigger-width)',
52
+ maxHeight: 'var(--radix-select-content-available-height)',
70
53
  overflowY: 'auto',
71
- borderBottomLeftRadius: '$sm',
72
- borderBottomRightRadius: '$sm',
54
+ borderRadius: '$sm',
73
55
  boxShadow: '-5px 5px 10px 0px rgba(86, 86, 86, 0.10)',
74
- backgroundColor: '$neutral100',
75
- [`.${darkTheme} &`]: {
76
- backgroundColor: '$neutral300',
77
- },
56
+ backgroundColor: '$background',
78
57
  });
79
58
 
80
59
  export const SelectItem = styled(Select.Item, {
81
- padding: '$10 0',
82
- borderTop: '1px solid',
83
- borderColor: '$neutral300',
84
- [`.${darkTheme} &`]: {
85
- borderColor: '$neutral400',
86
- },
60
+ padding: '$10',
87
61
  listStyleType: 'none',
62
+ display: 'flex',
63
+ justifyContent: 'space-between',
64
+ alignItems: 'center',
88
65
  cursor: 'pointer',
89
- '&:hover': {
90
- '& ._typography': {
91
- color: '$colors$secondary',
92
- },
93
- },
94
66
  '&:focus': {
95
67
  outline: 'none',
96
- '& ._typography': {
97
- color: '$colors$secondary',
68
+ },
69
+
70
+ '&:hover': {
71
+ backgroundColor: '$info100',
72
+ [`.${darkTheme} &`]: {
73
+ backgroundColor: '$neutral',
98
74
  },
99
75
  },
100
76
  });
@@ -0,0 +1,12 @@
1
+ import type { PropTypes } from './Tabs.types';
2
+ import type { Meta } from '@storybook/react';
3
+
4
+ import React from 'react';
5
+
6
+ import { Tabs } from '.';
7
+
8
+ export default { title: 'Components/Tabs', component: Tabs } as Meta<
9
+ typeof Tabs
10
+ >;
11
+
12
+ export const Main = (args: PropTypes) => <Tabs {...args} />;
@@ -0,0 +1,157 @@
1
+ import { darkTheme, styled } from '../../theme';
2
+ import { Button } from '../Button';
3
+
4
+ export const Tabs = styled('div', {
5
+ display: 'flex',
6
+ flexDirection: 'row',
7
+ position: 'relative',
8
+ justifyContent: 'space-between',
9
+ height: '100%',
10
+ variants: {
11
+ type: {
12
+ secondary: {
13
+ border: '3px solid $neutral100',
14
+ backgroundColor: '$neutral100',
15
+ },
16
+ primary: {
17
+ $$color: '$colors$neutral200',
18
+ [`.${darkTheme} &`]: {
19
+ $$color: '$colors$neutral500',
20
+ },
21
+ borderColor: '$$color',
22
+ borderWidth: '5px',
23
+ borderStyle: 'solid',
24
+ backgroundColor: '$$color',
25
+ },
26
+ },
27
+ borderRadius: {
28
+ small: {
29
+ borderRadius: '$xs',
30
+ },
31
+ medium: {
32
+ borderRadius: '$sm',
33
+ },
34
+ full: {
35
+ borderRadius: '$xm',
36
+ },
37
+ },
38
+ },
39
+ });
40
+
41
+ export const Tab = styled(Button, {
42
+ color: '$neutral700',
43
+ backgroundColor: 'transparent',
44
+ height: '100%',
45
+ zIndex: 10,
46
+ '& ._text': {
47
+ display: 'flex',
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
50
+ justifyContent: 'center',
51
+ },
52
+ variants: {
53
+ borderRadius: {
54
+ small: {
55
+ borderRadius: '$xs',
56
+ },
57
+ medium: {
58
+ borderRadius: '$sm',
59
+ },
60
+ full: {
61
+ borderRadius: '$xm',
62
+ },
63
+ },
64
+ type: {
65
+ primary: {
66
+ padding: '$5 $10',
67
+ height: '100%',
68
+ },
69
+ secondary: {},
70
+ },
71
+ isActive: {
72
+ true: {
73
+ transition: 'color 0.8s linear',
74
+ },
75
+ false: {},
76
+ },
77
+ },
78
+
79
+ compoundVariants: [
80
+ {
81
+ type: 'secondary',
82
+ isActive: true,
83
+ css: {
84
+ $$color: '$colors$background',
85
+ [`.${darkTheme} &`]: {
86
+ $$color: '$colors$foreground',
87
+ },
88
+ color: '$$color',
89
+ },
90
+ },
91
+ {
92
+ type: 'secondary',
93
+ isActive: false,
94
+ css: {
95
+ '&:hover': {
96
+ backgroundColor: '$info100',
97
+ color: '$secondary500',
98
+ [`.${darkTheme} &`]: {
99
+ backgroundColor: 'transparent',
100
+ color: '$neutral700',
101
+ },
102
+ },
103
+ },
104
+ },
105
+
106
+ {
107
+ type: 'primary',
108
+ isActive: true,
109
+ css: {
110
+ color: '$secondary',
111
+ '& svg': {
112
+ color: '$secondary',
113
+ },
114
+ },
115
+ },
116
+ {
117
+ type: 'primary',
118
+ isActive: false,
119
+ css: {
120
+ '&:hover': {
121
+ backgroundColor: 'transparent',
122
+ },
123
+ },
124
+ },
125
+ ],
126
+ });
127
+
128
+ export const BackdropTab = styled('div', {
129
+ padding: '$4',
130
+ position: 'absolute',
131
+ inset: 0,
132
+ transition: 'transform 0.2s cubic-bezier(0, 0, 0.86, 1.2)',
133
+ '&.no-transition': {
134
+ transition: 'none',
135
+ },
136
+ variants: {
137
+ type: {
138
+ secondary: {
139
+ backgroundColor: '$secondary500',
140
+ },
141
+ primary: {
142
+ backgroundColor: '$background',
143
+ },
144
+ },
145
+ borderRadius: {
146
+ small: {
147
+ borderRadius: '$xs',
148
+ },
149
+ medium: {
150
+ borderRadius: '$sm',
151
+ },
152
+ full: {
153
+ borderRadius: '$xm',
154
+ },
155
+ },
156
+ },
157
+ });
@@ -0,0 +1,95 @@
1
+ import type { PropTypes } from './Tabs.types';
2
+
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+
5
+ import { Divider } from '../Divider';
6
+ import { Tooltip } from '../Tooltip';
7
+
8
+ import { BackdropTab, Tab, Tabs } from './Tabs.styles';
9
+
10
+ const INITIAL_RENDER_DELAY = 100;
11
+ export function TabsComponent(props: PropTypes) {
12
+ const {
13
+ items: tabItems,
14
+ onChange,
15
+ container = document.body,
16
+ value,
17
+ type,
18
+ borderRadius = 'medium',
19
+ className,
20
+ } = props;
21
+ const [tabWidth, setTabWidth] = useState(0);
22
+ const tabRef: React.Ref<HTMLButtonElement> = useRef(null);
23
+ const currentIndex = tabItems.findIndex((item) => item.id === value);
24
+
25
+ // State variable to track the initial render
26
+ const [initialRender, setInitialRender] = useState(true);
27
+ const transformPosition = currentIndex * tabWidth;
28
+
29
+ useEffect(() => {
30
+ const updateTabWidth = () => {
31
+ if (tabRef.current) {
32
+ const tabRect = tabRef.current.getBoundingClientRect();
33
+ setTabWidth(tabRect.width);
34
+ }
35
+ };
36
+ updateTabWidth();
37
+ window.addEventListener('resize', updateTabWidth);
38
+ return () => {
39
+ window.removeEventListener('resize', updateTabWidth);
40
+ };
41
+ }, []);
42
+
43
+ useEffect(() => {
44
+ // Set initialRender to false after a short delay
45
+ const timeout = setTimeout(() => {
46
+ setInitialRender(false);
47
+ clearTimeout(timeout);
48
+ }, INITIAL_RENDER_DELAY);
49
+ }, []);
50
+
51
+ return (
52
+ <Tabs
53
+ className={`_tabs ${className || ''}`}
54
+ type={type}
55
+ borderRadius={borderRadius}>
56
+ {tabItems.map((item, index) => (
57
+ <Tooltip
58
+ key={item.id}
59
+ style={{ width: '100%' }}
60
+ container={container}
61
+ side="bottom"
62
+ sideOffset={2}
63
+ content={item.tooltip}
64
+ open={!item.tooltip ? false : undefined}>
65
+ <Tab
66
+ className="_tab"
67
+ ref={index === 0 ? tabRef : null} // Set ref on the first tab
68
+ type={type}
69
+ fullWidth
70
+ disableRipple={true}
71
+ borderRadius={borderRadius}
72
+ onClick={() => onChange(item)}
73
+ size="small"
74
+ isActive={item.id === value}
75
+ variant="default">
76
+ {item.icon}
77
+ {!!item.icon && !!item.title && (
78
+ <Divider direction="horizontal" size="2" />
79
+ )}
80
+ {item.title}
81
+ </Tab>
82
+ </Tooltip>
83
+ ))}
84
+ <BackdropTab
85
+ type={type}
86
+ borderRadius={borderRadius}
87
+ className={`_backdrop-tab ${initialRender ? 'no-transition' : ''}`}
88
+ css={{
89
+ width: tabWidth,
90
+ transform: `translateX(${transformPosition}px)`,
91
+ }}
92
+ />
93
+ </Tabs>
94
+ );
95
+ }