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

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 (106) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/index.js.map +4 -4
  3. package/dist/widget/ui/src/components/Alert/Alert.d.ts.map +1 -1
  4. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  5. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.d.ts +6 -0
  6. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.d.ts.map +1 -0
  7. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts +4 -0
  8. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -0
  9. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.stories.d.ts +7 -0
  10. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.stories.d.ts.map +1 -0
  11. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.styles.d.ts → FullExpandedQuote/FullExpandedQuote.styles.d.ts} +652 -3
  12. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.styles.d.ts.map → FullExpandedQuote/FullExpandedQuote.styles.d.ts.map} +1 -1
  13. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.types.d.ts → FullExpandedQuote/FullExpandedQuote.types.d.ts} +17 -9
  14. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts.map +1 -0
  15. package/dist/widget/ui/src/components/FullExpandedQuote/index.d.ts +2 -0
  16. package/dist/widget/ui/src/components/FullExpandedQuote/index.d.ts.map +1 -0
  17. package/dist/widget/ui/src/components/FullExpandedQuote/mock.d.ts.map +1 -0
  18. package/dist/widget/ui/src/components/List/List.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/List/List.types.d.ts +1 -0
  20. package/dist/widget/ui/src/components/List/List.types.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/List/index.d.ts +1 -0
  22. package/dist/widget/ui/src/components/List/index.d.ts.map +1 -1
  23. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  24. package/dist/widget/ui/src/components/Popover/Popover.d.ts.map +1 -1
  25. package/dist/widget/ui/src/components/Popover/Popover.types.d.ts +2 -0
  26. package/dist/widget/ui/src/components/Popover/Popover.types.d.ts.map +1 -1
  27. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +1 -1
  28. package/dist/widget/ui/src/components/Select/select.styles.d.ts.map +1 -1
  29. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts +4 -0
  30. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
  31. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts +6 -0
  32. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts.map +1 -0
  33. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts +780 -0
  34. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts.map +1 -0
  35. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts +30 -0
  36. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts.map +1 -0
  37. package/dist/widget/ui/src/components/Tabs/index.d.ts +2 -0
  38. package/dist/widget/ui/src/components/Tabs/index.d.ts.map +1 -0
  39. package/dist/widget/ui/src/components/index.d.ts +3 -1
  40. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  41. package/dist/widget/ui/src/icons/Bridges.d.ts +5 -0
  42. package/dist/widget/ui/src/icons/Bridges.d.ts.map +1 -0
  43. package/dist/widget/ui/src/icons/Document.d.ts +5 -0
  44. package/dist/widget/ui/src/icons/Document.d.ts.map +1 -0
  45. package/dist/widget/ui/src/icons/Exchange.d.ts +5 -0
  46. package/dist/widget/ui/src/icons/Exchange.d.ts.map +1 -0
  47. package/dist/widget/ui/src/icons/Explorer.d.ts +5 -0
  48. package/dist/widget/ui/src/icons/Explorer.d.ts.map +1 -0
  49. package/dist/widget/ui/src/icons/InProgress.d.ts.map +1 -1
  50. package/dist/widget/ui/src/icons/More.d.ts +5 -0
  51. package/dist/widget/ui/src/icons/More.d.ts.map +1 -0
  52. package/dist/widget/ui/src/icons/Report.d.ts +5 -0
  53. package/dist/widget/ui/src/icons/Report.d.ts.map +1 -0
  54. package/dist/widget/ui/src/icons/Request.d.ts +5 -0
  55. package/dist/widget/ui/src/icons/Request.d.ts.map +1 -0
  56. package/dist/widget/ui/src/icons/Support.d.ts +5 -0
  57. package/dist/widget/ui/src/icons/Support.d.ts.map +1 -0
  58. package/dist/widget/ui/src/icons/index.d.ts +19 -11
  59. package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
  60. package/package.json +2 -2
  61. package/readme.md +1 -0
  62. package/src/components/Alert/Alert.styles.ts +3 -1
  63. package/src/components/Alert/Alert.tsx +6 -1
  64. package/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.tsx +78 -0
  65. package/src/components/{ExpandedRoute/ExpandedRoute.stories.tsx → FullExpandedQuote/FullExpandedQuote.stories.tsx} +4 -4
  66. package/src/components/{ExpandedRoute/ExpandedRoute.styles.ts → FullExpandedQuote/FullExpandedQuote.styles.ts} +27 -5
  67. package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +182 -0
  68. package/src/components/{ExpandedRoute/ExpandedRoute.types.ts → FullExpandedQuote/FullExpandedQuote.types.ts} +17 -8
  69. package/src/components/FullExpandedQuote/index.ts +1 -0
  70. package/src/components/List/List.tsx +2 -3
  71. package/src/components/List/List.types.ts +1 -0
  72. package/src/components/List/index.ts +1 -0
  73. package/src/components/ListItem/ListItem.styles.ts +2 -0
  74. package/src/components/Popover/Popover.tsx +4 -3
  75. package/src/components/Popover/Popover.types.ts +2 -0
  76. package/src/components/QuoteCost/QuoteCost.styles.ts +2 -0
  77. package/src/components/Select/Select.tsx +24 -24
  78. package/src/components/Select/select.styles.ts +30 -54
  79. package/src/components/Tabs/Tabs.stories.tsx +12 -0
  80. package/src/components/Tabs/Tabs.styles.tsx +157 -0
  81. package/src/components/Tabs/Tabs.tsx +95 -0
  82. package/src/components/Tabs/Tabs.types.tsx +32 -0
  83. package/src/components/Tabs/index.ts +1 -0
  84. package/src/components/index.ts +3 -1
  85. package/src/icons/Bridges.tsx +19 -0
  86. package/src/icons/Document.tsx +50 -0
  87. package/src/icons/Exchange.tsx +22 -0
  88. package/src/icons/Explorer.tsx +20 -0
  89. package/src/icons/InProgress.tsx +13 -8
  90. package/src/icons/More.tsx +30 -0
  91. package/src/icons/Report.tsx +20 -0
  92. package/src/icons/Request.tsx +65 -0
  93. package/src/icons/Support.tsx +40 -0
  94. package/src/icons/index.ts +19 -11
  95. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts +0 -4
  96. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts.map +0 -1
  97. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts +0 -7
  98. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts.map +0 -1
  99. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.types.d.ts.map +0 -1
  100. package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts +0 -2
  101. package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts.map +0 -1
  102. package/dist/widget/ui/src/components/ExpandedRoute/mock.d.ts.map +0 -1
  103. package/src/components/ExpandedRoute/ExpandedRoute.tsx +0 -147
  104. package/src/components/ExpandedRoute/index.ts +0 -1
  105. /package/dist/widget/ui/src/components/{ExpandedRoute → FullExpandedQuote}/mock.d.ts +0 -0
  106. /package/src/components/{ExpandedRoute → FullExpandedQuote}/mock.ts +0 -0
@@ -0,0 +1,182 @@
1
+ import type { DataLoadedProps, PropTypes } from './FullExpandedQuote.types';
2
+
3
+ import React from 'react';
4
+
5
+ import { ErrorIcon, WarningIcon } from '../../icons';
6
+ import { ChainToken } from '../ChainToken';
7
+ import { Image } from '../common';
8
+ import { Divider } from '../Divider';
9
+ import { QuoteCost } from '../QuoteCost';
10
+ import { QuoteTag } from '../QuoteTag';
11
+ import { Tooltip } from '../Tooltip';
12
+ import { Typography } from '../Typography';
13
+
14
+ import {
15
+ SkeletonHeader,
16
+ SkeletonItemLeft,
17
+ SkeletonItemRight,
18
+ SkeletonOutput,
19
+ } from './FullExpandedQuote.Skeletons';
20
+ import {
21
+ FromToken,
22
+ IconHighlight,
23
+ lastStepStyle,
24
+ LeftSection,
25
+ OutputSection,
26
+ RightSection,
27
+ RouteContainer,
28
+ RouteHeader,
29
+ StepItem,
30
+ Steps,
31
+ StyledPriceImpact,
32
+ SwapperContainer,
33
+ SwapperImage,
34
+ TagsContainer,
35
+ tokenLabelStyles,
36
+ VerticalLine,
37
+ } from './FullExpandedQuote.styles';
38
+
39
+ const ITEM_SKELETON_COUNT = 3;
40
+
41
+ export function FullExpandedQuote(props: PropTypes) {
42
+ const {
43
+ loading,
44
+ percentageChange,
45
+ warningLevel,
46
+ tooltipContainer,
47
+ onClick,
48
+ selected = false,
49
+ } = props;
50
+
51
+ const steps: DataLoadedProps['steps'] = loading
52
+ ? Array(ITEM_SKELETON_COUNT).fill(undefined)
53
+ : props.steps;
54
+ const numberOfSteps = steps.length;
55
+
56
+ return (
57
+ <RouteContainer selected={selected} onClick={onClick}>
58
+ <RouteHeader loading={loading}>
59
+ {loading ? (
60
+ <SkeletonHeader />
61
+ ) : (
62
+ <>
63
+ <QuoteCost
64
+ fee={props.fee}
65
+ time={props.time}
66
+ steps={numberOfSteps}
67
+ />
68
+ <TagsContainer>
69
+ {props.tags.map((tag) => (
70
+ <QuoteTag key={tag.label} label={tag.label} value={tag.value} />
71
+ ))}
72
+ </TagsContainer>
73
+ </>
74
+ )}
75
+ </RouteHeader>
76
+ <Steps>
77
+ {steps.map((step, index) => {
78
+ const key = `item-${index}`;
79
+ return (
80
+ <StepItem
81
+ key={key}
82
+ className={index === numberOfSteps - 1 ? lastStepStyle() : ''}>
83
+ {loading ? (
84
+ <SkeletonItemLeft />
85
+ ) : (
86
+ <LeftSection>
87
+ <ChainToken
88
+ size="small"
89
+ chainImage={step.from.chain.image}
90
+ tokenImage={step.from.token.image}
91
+ />
92
+ <FromToken>
93
+ <Tooltip
94
+ content={step.from.price.realValue}
95
+ container={tooltipContainer}
96
+ side="bottom"
97
+ open={!step.from.price.realValue ? false : undefined}>
98
+ <Typography size="xsmall" variant="body">
99
+ {step.from.price.value}
100
+ </Typography>
101
+ </Tooltip>
102
+ <Typography
103
+ size="xsmall"
104
+ variant="body"
105
+ className={tokenLabelStyles()}>
106
+ {step.from.token.displayName}
107
+ </Typography>
108
+ </FromToken>
109
+ </LeftSection>
110
+ )}
111
+ <RightSection>
112
+ {loading ? (
113
+ <SkeletonItemRight />
114
+ ) : (
115
+ <>
116
+ <SwapperContainer>
117
+ <SwapperImage state={step.state}>
118
+ <Image
119
+ size={15}
120
+ type="circular"
121
+ src={step.swapper.image}
122
+ />
123
+ {step.state && (
124
+ <IconHighlight type={step.state}>
125
+ {step.state === 'error' ? (
126
+ <ErrorIcon size={6} color="error" />
127
+ ) : (
128
+ <WarningIcon size={6} color="warning" />
129
+ )}
130
+ </IconHighlight>
131
+ )}
132
+ </SwapperImage>
133
+ <Typography size="xsmall" variant="body" align="center">
134
+ {step.swapper.displayName}
135
+ </Typography>
136
+ </SwapperContainer>
137
+
138
+ <VerticalLine />
139
+ </>
140
+ )}
141
+ </RightSection>
142
+ </StepItem>
143
+ );
144
+ })}
145
+ {!loading && (
146
+ <OutputSection>
147
+ <ChainToken
148
+ chainImage={steps[numberOfSteps - 1].to.chain.image}
149
+ tokenImage={steps[numberOfSteps - 1].to.token.image}
150
+ size="medium"
151
+ />
152
+ <div>
153
+ <Tooltip
154
+ content={props.outputPrice.realValue}
155
+ container={tooltipContainer}
156
+ open={!props.outputPrice.realValue ? false : undefined}>
157
+ <Typography size="xmedium" variant="title">
158
+ {props.outputPrice.value}
159
+ </Typography>
160
+ <Divider size={4} direction="horizontal" />
161
+ <Typography size="large" variant="body">
162
+ {steps[numberOfSteps - 1].to.token.displayName}
163
+ </Typography>
164
+ </Tooltip>
165
+ </div>
166
+ <StyledPriceImpact
167
+ size="xsmall"
168
+ warningLevel={warningLevel}
169
+ outputUsdValue={props.outputPrice.usdValue}
170
+ realOutputUsdValue={props.outputPrice.realUsdValue}
171
+ percentageChange={percentageChange}
172
+ tooltipProps={{
173
+ container: tooltipContainer,
174
+ }}
175
+ />
176
+ </OutputSection>
177
+ )}
178
+ {loading && <SkeletonOutput />}
179
+ </Steps>
180
+ </RouteContainer>
181
+ );
182
+ }
@@ -1,18 +1,27 @@
1
+ import type { SwapInputProps } from '../../containers/SwapInput/SwapInput.types';
1
2
  import type { PriceImpactProps } from '../PriceImpact/PriceImpact.types';
2
3
  import type { PropTypes as QuoteCostProps } from '../QuoteCost/QuoteCost.types';
3
4
  import type { Step } from '../StepDetails/StepDetails.types';
4
5
  import type { RouteTag } from 'rango-sdk';
5
- import type { SwapInputProps } from 'src/containers/SwapInput/SwapInput.types';
6
6
 
7
- export interface PropTypes {
8
- steps: Step[];
9
- tags: RouteTag[];
10
- time: QuoteCostProps['time'];
11
- fee: QuoteCostProps['fee'];
7
+ type BaseProps = {
12
8
  percentageChange?: PriceImpactProps['percentageChange'];
13
9
  warningLevel?: PriceImpactProps['warningLevel'];
14
- outputPrice: SwapInputProps['price'];
15
10
  tooltipContainer?: HTMLElement;
16
11
  onClick?: () => void;
17
12
  selected?: boolean;
18
- }
13
+ };
14
+
15
+ export type DataLoadedProps = {
16
+ steps: Step[];
17
+ tags: RouteTag[];
18
+ time: QuoteCostProps['time'];
19
+ fee: QuoteCostProps['fee'];
20
+ outputPrice: SwapInputProps['price'];
21
+ loading?: false;
22
+ };
23
+ type LoadingProps = {
24
+ loading: true;
25
+ };
26
+
27
+ export type PropTypes = BaseProps & (DataLoadedProps | LoadingProps);
@@ -0,0 +1 @@
1
+ export { FullExpandedQuote } from './FullExpandedQuote';
@@ -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': {
@@ -43,6 +44,7 @@ export const BaseListItem = styled('li', {
43
44
  alignItems: 'center',
44
45
  paddingLeft: '$10',
45
46
  overflow: 'hidden',
47
+ flexShrink: 0,
46
48
  },
47
49
  variants: {
48
50
  hasDivider: {
@@ -13,12 +13,12 @@ export const PopoverContentComponent = (
13
13
  props: PropsWithChildren<ContentType>,
14
14
  forwardedRef: Ref
15
15
  ) => {
16
- const { container, children, styles, ...rest } = props;
16
+ const { container, children, styles, hasArrow = true, ...rest } = props;
17
17
  return (
18
18
  <RadixPopover.Portal container={container}>
19
19
  <PopoverContainer {...rest} ref={forwardedRef}>
20
20
  {children}
21
- <PopoverArrow css={styles?.arrowStyles} />
21
+ {hasArrow && <PopoverArrow css={styles?.arrowStyles} />}
22
22
  </PopoverContainer>
23
23
  </RadixPopover.Portal>
24
24
  );
@@ -38,10 +38,11 @@ export function Popover(props: PropsWithChildren<PropTypes>) {
38
38
  collisionBoundary = [],
39
39
  collisionPadding = 0,
40
40
  container = document.body,
41
+ onOpenChange,
41
42
  ...rest
42
43
  } = props;
43
44
  return (
44
- <RadixPopover.Root>
45
+ <RadixPopover.Root onOpenChange={onOpenChange}>
45
46
  <RadixPopover.Trigger asChild>{children}</RadixPopover.Trigger>
46
47
  <PopoverContent
47
48
  align={align}
@@ -20,6 +20,8 @@ export interface ContentType {
20
20
  styles?: {
21
21
  arrowStyles?: CSS;
22
22
  };
23
+ hasArrow?: boolean;
24
+ onOpenChange?: (open: boolean) => void;
23
25
  }
24
26
 
25
27
  export type PropTypes = ContentType & {
@@ -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
+ });