@soul-refiner/design-system 0.1.20 → 0.1.22

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": "@soul-refiner/design-system",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "main": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -54,6 +54,7 @@
54
54
  "react-dnd-html5-backend": "^16.0.1",
55
55
  "react-dom": "^18.2.0",
56
56
  "react-is": "^18.2.0",
57
+ "react-tooltip": "^5.18.0",
57
58
  "scheduler": "^0.23.0",
58
59
  "slate": "^0.94.1",
59
60
  "slate-history": "^0.93.0",
@@ -34,7 +34,7 @@ type NativeProps = Pick<
34
34
  | 'onMouseOut'
35
35
  | 'onMouseOver'
36
36
  | 'title'
37
- > & { value?: string };
37
+ > & { value?: string; href?: string };
38
38
 
39
39
  export interface BoxProps
40
40
  extends BackgroundColor,
@@ -10,3 +10,5 @@ export { Progress } from './progress';
10
10
  export type { ProgressProps } from './progress';
11
11
  export { Toast } from './toast';
12
12
  export type { ToastProps } from './toast';
13
+ export { Tooltip } from './tooltip';
14
+ export type { TooltipProps } from './tooltip';
@@ -0,0 +1,2 @@
1
+ export { Tooltip } from './tooltip';
2
+ export type { TooltipProps } from './tooltip';
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { Tooltip as ReactTooltip, PlacesType } from 'react-tooltip';
3
+
4
+ export interface TooltipProps extends React.PropsWithChildren {
5
+ content: string;
6
+ place: PlacesType;
7
+ }
8
+
9
+ export const Tooltip = ({ children, content, place = 'top' }: TooltipProps) => {
10
+ const id = React.useId();
11
+ return (
12
+ <>
13
+ <ReactTooltip
14
+ id={id}
15
+ place={place}
16
+ style={{
17
+ fontFamily: 'Inter',
18
+ fontSize: '12px',
19
+ fontWeight: 400,
20
+ lineHeight: '150%',
21
+ textAlign: 'center',
22
+ padding: '8px',
23
+ maxWidth: '280px',
24
+ backgroundColor: 'var(--color-grey-3)',
25
+ boxShadow: 'var(--elevation-2)',
26
+ borderRadius: '4px',
27
+ }}
28
+ />
29
+ {React.Children.map(children, (child) => {
30
+ return (
31
+ React.isValidElement(child) &&
32
+ React.cloneElement(child, {
33
+ 'data-tooltip-id': id,
34
+ 'data-tooltip-content': content,
35
+ } as any)
36
+ );
37
+ })}
38
+ </>
39
+ );
40
+ };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { Button, P } from 'components';
4
- import { ChevronLeft, ChevronRight } from 'icons';
5
3
  import { MONTHS, WEEKDAYS } from 'common';
4
+ import { Button, P } from 'components';
5
+ import { ChevronLeft, ChevronRight, ArrowRight } from 'icons';
6
6
  import { buildCalendar, getMonthDays, zeroPad } from 'utils';
7
7
 
8
8
  export interface DatePickerProps {
@@ -238,9 +238,9 @@ export const DatePicker = ({
238
238
  <span>
239
239
  {startDate.toLocaleDateString('en-US').replaceAll('/', '-')}
240
240
  </span>
241
- {!!endDate &&
242
- startDate.toDateString() !== endDate?.toDateString() &&
243
- ' 🡒 '}
241
+ {!!endDate && startDate.toDateString() !== endDate?.toDateString() && (
242
+ <ArrowRight sx="padding: 0px 8px; margin-bottom: -2px;" />
243
+ )}
244
244
  {startDate.toDateString() !== endDate?.toDateString() && (
245
245
  <span>
246
246
  {endDate?.toLocaleDateString('en-US').replaceAll('/', '-')}
@@ -388,9 +388,12 @@ const Trigger = styled.button`
388
388
  outline: none;
389
389
  line-height: 100%;
390
390
  font-family: Inter;
391
+ font-size: 14px;
392
+ line-height: 20px;
391
393
  cursor: pointer;
392
394
 
393
395
  span {
396
+ line-height: 20px;
394
397
  color: var(--color-blue-5);
395
398
  }
396
399
 
@@ -0,0 +1,172 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box } from 'components';
4
+ import { ChevronLeft, ChevronRight } from 'icons';
5
+
6
+ export interface BreadcrumbProps extends React.PropsWithChildren {
7
+ previous?: boolean;
8
+ }
9
+
10
+ const Breadcrumb = ({ children, previous }: BreadcrumbProps) => {
11
+ const _children = React.Children.toArray(children);
12
+
13
+ if (previous) {
14
+ return (
15
+ <Box
16
+ $align="center"
17
+ $gap={8}
18
+ sx="& > *:last-child { color: var(--color-grey-3) !important; };"
19
+ >
20
+ <>
21
+ <ChevronLeft color="grey-3" size={24} />
22
+ {React.isValidElement(_children[0]) &&
23
+ React.cloneElement(_children[0], {
24
+ icon: undefined,
25
+ avatar: undefined,
26
+ } as any)}
27
+ </>
28
+ </Box>
29
+ );
30
+ }
31
+
32
+ return (
33
+ <Box $align="center" $gap={8}>
34
+ {_children.map((child, index) => {
35
+ if (
36
+ React.isValidElement(child) &&
37
+ (child.type as any)?.displayName === 'BreadcrumbItem'
38
+ ) {
39
+ return (
40
+ <>
41
+ {child}
42
+ {_children.length - 1 !== index && (
43
+ <ChevronRight color="grey-3" size={24} />
44
+ )}
45
+ </>
46
+ );
47
+ }
48
+ return null;
49
+ })}
50
+ </Box>
51
+ );
52
+ };
53
+
54
+ type IconColor = 'blue' | 'pink' | 'purple' | 'mint' | 'orange' | 'ocean';
55
+
56
+ export interface BreadcrumbItemProps extends React.PropsWithChildren {
57
+ avatar?: React.ReactElement;
58
+ href?: string;
59
+ icon?: React.ReactElement;
60
+ iconColor?: IconColor;
61
+ onClick?: React.MouseEventHandler;
62
+ }
63
+
64
+ export const BreadcrumbItem = ({
65
+ avatar,
66
+ children,
67
+ href,
68
+ icon,
69
+ iconColor = 'blue',
70
+ onClick,
71
+ }: BreadcrumbItemProps) => {
72
+ return (
73
+ <Item
74
+ as={href ? 'a' : 'div'}
75
+ href={href}
76
+ onClick={onClick}
77
+ $type={icon ? 'icon' : avatar ? 'avatar' : 'text'}
78
+ $iconColor={`hue-${iconColor}-1`}
79
+ >
80
+ {icon && (
81
+ <IconWrapper $color={iconColor}>
82
+ {React.cloneElement(icon, { color: `hue-${iconColor}-1`, size: 24 })}
83
+ </IconWrapper>
84
+ )}
85
+ {avatar}
86
+ {children}
87
+ </Item>
88
+ );
89
+ };
90
+
91
+ Breadcrumb.Item = BreadcrumbItem;
92
+ BreadcrumbItem.displayName = 'Breadcrumb.Item';
93
+
94
+ const Item = styled.div<{
95
+ as: string;
96
+ $type: 'text' | 'avatar' | 'icon';
97
+ $iconColor?: string;
98
+ }>`
99
+ display: flex;
100
+ flex-flow: row nowrap;
101
+ align-items: center;
102
+ font-family: Inter;
103
+ color: var(--color-grey-3);
104
+
105
+ ${({ as }) =>
106
+ as === 'a'
107
+ ? `
108
+ text-decoration: none;
109
+ color: var(--color-primary-blue-2);
110
+
111
+ &:hover {
112
+ position: relative;
113
+ &:after {
114
+ content: '';
115
+ position: absolute;
116
+ width: 100%;
117
+ height: 1px;
118
+ bottom: 0px;
119
+ right: 0px;
120
+ background-color: var(--color-primary-blue-1);
121
+ }
122
+ }`
123
+ : ''}
124
+
125
+ ${({ $type, $iconColor }) =>
126
+ $type === 'icon'
127
+ ? `
128
+ gap: 32px;
129
+ font-size: 24px;
130
+ font-weight: 700;
131
+ line-height: 36px;
132
+ color: var(--color-${$iconColor});
133
+
134
+ &:hover {
135
+ &:after {
136
+ width: calc(100% - 80px);
137
+ background-color: var(--color-${$iconColor});
138
+ }
139
+ }`
140
+ : $type === 'avatar'
141
+ ? `
142
+ padding: 4px;
143
+ gap: 16px;
144
+ font-size: 18px;
145
+ font-weight: 700;
146
+ line-height: 26px;
147
+ color: var(--color-grey-1);
148
+ &:hover {
149
+ &:after {
150
+ background-color: var(--color-primary-blue-2);
151
+ }
152
+ }`
153
+ : `
154
+ padding: 4px 0px;
155
+ font-size: 16px;
156
+ font-weight: 500;
157
+ line-height: 24px;
158
+ `}
159
+ `;
160
+
161
+ const IconWrapper = styled.div<{ $color: IconColor }>`
162
+ background-color: ${({ $color }) => `var(--color-hue-${$color}-2)`};
163
+ height: 48px;
164
+ width: 48px;
165
+ display: flex;
166
+ justify-content: center;
167
+ align-items: center;
168
+ box-sizing: border-box;
169
+ border-radius: 8px;
170
+ `;
171
+
172
+ export { Breadcrumb };
@@ -0,0 +1,2 @@
1
+ export { Breadcrumb } from './breadcrumb';
2
+ export type { BreadcrumbProps, BreadcrumbItemProps } from './breadcrumb';
@@ -1,2 +1,4 @@
1
+ export { Breadcrumb } from './breadcrumb';
2
+ export type { BreadcrumbProps, BreadcrumbItemProps } from './breadcrumb';
1
3
  export { Tabs } from './tabs';
2
4
  export type { TabProps } from './tabs';