@soul-refiner/design-system 0.1.4 → 0.1.6

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.4",
3
+ "version": "0.1.6",
4
4
  "main": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { Styles } from 'common';
4
- import { Box, P } from 'components';
4
+ import { P } from 'components';
5
+ import { Box } from '../../atoms/box/box';
5
6
  import { ChevronDown, ChevronUp } from 'icons';
6
7
 
7
8
  const LG_ICON_SIZE = 20;
@@ -15,6 +16,18 @@ const SM_FONT_SIZE = 14;
15
16
  const SM_PADDING = '5px 15px';
16
17
  const SM_PADDING_WO_CHILDREN = '7px';
17
18
 
19
+ type NativeProps = Pick<
20
+ React.HTMLAttributes<HTMLButtonElement>,
21
+ | 'dangerouslySetInnerHTML'
22
+ | 'onClick'
23
+ | 'onMouseDown'
24
+ | 'onMouseDownCapture'
25
+ | 'onMouseEnter'
26
+ | 'onMouseLeave'
27
+ | 'onMouseOut'
28
+ | 'onMouseOver'
29
+ > & { value?: string };
30
+
18
31
  type ButtonTypes =
19
32
  | 'primary'
20
33
  | 'secondary'
@@ -26,13 +39,15 @@ type ButtonTypes =
26
39
  type ButtonSize = 'small' | 'large';
27
40
  type ButtonShape = 'none' | 'small' | 'medium-small' | 'large';
28
41
 
29
- export interface ButtonProps extends React.PropsWithChildren {
42
+ export interface ButtonProps extends NativeProps, React.PropsWithChildren {
30
43
  as?: React.ElementType;
31
44
  disabled?: boolean;
45
+ fluid?: boolean;
32
46
  icon?: React.ReactElement | undefined;
33
47
  isDropdownOpen?: boolean;
34
48
  roundness?: ButtonShape;
35
49
  size?: ButtonSize;
50
+ sx?: string;
36
51
  type?: ButtonTypes;
37
52
  }
38
53
 
@@ -40,10 +55,12 @@ export const Button = ({
40
55
  as = 'button',
41
56
  children,
42
57
  disabled,
58
+ fluid = false,
43
59
  icon,
44
60
  isDropdownOpen,
45
- size = 'large',
46
61
  roundness = 'large',
62
+ size = 'large',
63
+ sx,
47
64
  type = 'primary',
48
65
  ...props
49
66
  }: ButtonProps) => {
@@ -85,12 +102,14 @@ export const Button = ({
85
102
  disabled={disabled}
86
103
  $align="center"
87
104
  $display="flex"
105
+ $fluid={fluid}
88
106
  $gap={size === 'large' ? 12 : 8}
89
107
  $hasChildren={!!children}
90
108
  $justify="center"
91
109
  $padding={padding}
92
110
  $roundness={roundness}
93
111
  $size={size}
112
+ $sx={sx}
94
113
  {...props}
95
114
  >
96
115
  {buttonIcon}
@@ -120,7 +139,9 @@ const Components = (): Record<ButtonTypes, any> => ({
120
139
  });
121
140
 
122
141
  const base = css<{
142
+ $fluid: boolean;
123
143
  $roundness: ButtonShape;
144
+ $sx?: string;
124
145
  }>`
125
146
  display: flex;
126
147
  border-radius: ${({ $roundness }) =>
@@ -135,6 +156,12 @@ const base = css<{
135
156
  user-select: none;
136
157
  box-sizing: border-box;
137
158
  outline: none;
159
+ ${({ $fluid }) =>
160
+ $fluid
161
+ ? `flex-basis: max-content;
162
+ flex: 1 !important;
163
+ width: max-content`
164
+ : ''}
138
165
 
139
166
  svg {
140
167
  fill: currentColor;
@@ -146,10 +173,14 @@ const base = css<{
146
173
  color: var(--color-grey-7) !important;
147
174
  cursor: unset !important;
148
175
  }
176
+
177
+ ${({ $sx }) => ($sx ? $sx : '')}
149
178
  `;
150
179
 
151
180
  const Primary = styled(Box)<{
181
+ $fluid: boolean;
152
182
  $roundness: ButtonShape;
183
+ $sx?: string;
153
184
  }>`
154
185
  background-color: var(--color-primary-blue-2);
155
186
  color: var(--color-white);
@@ -171,7 +202,9 @@ const Primary = styled(Box)<{
171
202
  `;
172
203
 
173
204
  const Secondary = styled(Box)<{
205
+ $fluid: boolean;
174
206
  $roundness: ButtonShape;
207
+ $sx?: string;
175
208
  }>`
176
209
  background-color: var(--color-primary-blue-4);
177
210
  color: var(--color-primary-blue-2);
@@ -192,7 +225,9 @@ const Secondary = styled(Box)<{
192
225
  `;
193
226
 
194
227
  const Outlined = styled(Box)<{
228
+ $fluid: boolean;
195
229
  $roundness: ButtonShape;
230
+ $sx?: string;
196
231
  }>`
197
232
  background-color: var(--color-white);
198
233
  color: var(--color-grey-3);
@@ -208,7 +243,9 @@ const Outlined = styled(Box)<{
208
243
  `;
209
244
 
210
245
  const Danger = styled(Box)<{
246
+ $fluid: boolean;
211
247
  $roundness: ButtonShape;
248
+ $sx?: string;
212
249
  }>`
213
250
  background-color: var(--color-red-4);
214
251
  color: var(--color-white);
@@ -230,7 +267,9 @@ const Danger = styled(Box)<{
230
267
  `;
231
268
 
232
269
  const Text = styled(Box)<{
270
+ $fluid: boolean;
233
271
  $roundness: ButtonShape;
272
+ $sx?: string;
234
273
  }>`
235
274
  background-color: transparent;
236
275
  border: 1px solid transparent;
@@ -255,7 +294,9 @@ const Text = styled(Box)<{
255
294
  `;
256
295
 
257
296
  const Raised = styled(Box)<{
297
+ $fluid: boolean;
258
298
  $roundness: ButtonShape;
299
+ $sx?: string;
259
300
  }>`
260
301
  background-color: var(--color-white);
261
302
  color: var(--color-grey-3);
@@ -282,7 +323,9 @@ const Raised = styled(Box)<{
282
323
  `;
283
324
 
284
325
  const Special = styled(Box)<{
326
+ $fluid: boolean;
285
327
  $roundness: ButtonShape;
328
+ $sx?: string;
286
329
  }>`
287
330
  background-color: transparent;
288
331
  border: 1px solid transparent;
@@ -0,0 +1,392 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, Checkbox, P } from 'components';
4
+
5
+ type NativeProps = Pick<
6
+ React.HTMLAttributes<HTMLDivElement>,
7
+ | 'children'
8
+ | 'onBlur'
9
+ | 'onBlurCapture'
10
+ | 'onClick'
11
+ | 'onChange'
12
+ | 'onMouseDown'
13
+ | 'onMouseDownCapture'
14
+ | 'onMouseEnter'
15
+ | 'onMouseLeave'
16
+ | 'onMouseOut'
17
+ | 'onMouseOver'
18
+ >;
19
+
20
+ export interface DropdownProps extends NativeProps, React.PropsWithChildren {
21
+ checkbox?: boolean;
22
+ closeOnChange?: boolean;
23
+ closeOnBlur?: boolean;
24
+ defaultValue?: string | string[];
25
+ disabled?: boolean;
26
+ hasArrow?: boolean;
27
+ maintainState?: boolean;
28
+ multiple?: boolean;
29
+ offset?: [number, number];
30
+ open?: 'right' | 'left';
31
+ options?: (Omit<DropdownOptionProps, 'selected' | 'onClick'> | 'break')[];
32
+ sx?: string;
33
+ trigger: React.ReactElement;
34
+ }
35
+
36
+ const Dropdown = ({
37
+ checkbox,
38
+ children,
39
+ closeOnChange = true,
40
+ closeOnBlur = true,
41
+ defaultValue = '',
42
+ disabled = false,
43
+ hasArrow,
44
+ maintainState = true,
45
+ multiple,
46
+ offset = [0, 16],
47
+ onChange,
48
+ open: openDirection = 'right',
49
+ options,
50
+ sx,
51
+ trigger,
52
+ ...rest
53
+ }: DropdownProps) => {
54
+ const id = React.useId();
55
+ const wrapperRef = React.useRef<HTMLDivElement>(null);
56
+ const optionsRef = React.useRef<HTMLDivElement>(null);
57
+ const [open, setOpen] = React.useState(false);
58
+ const [selected, setSelected] = React.useState(() =>
59
+ defaultValue ? defaultValue : multiple ? [] : ''
60
+ );
61
+
62
+ React.useEffect(() => {
63
+ if (disabled) {
64
+ setOpen(false);
65
+ }
66
+ }, [disabled]);
67
+
68
+ const handleOpen = () => {
69
+ if (disabled) {
70
+ return;
71
+ }
72
+ setOpen((prev) => !prev);
73
+ };
74
+
75
+ const handleBlur = (event: React.FocusEvent) => {
76
+ if (
77
+ closeOnBlur &&
78
+ wrapperRef?.current &&
79
+ !wrapperRef?.current?.contains(event.relatedTarget)
80
+ ) {
81
+ setOpen(false);
82
+ }
83
+ };
84
+
85
+ const handleChangeSingle = (event: React.MouseEvent<HTMLDivElement>) => {
86
+ event.stopPropagation();
87
+ const value =
88
+ (event.target as HTMLDivElement).getAttribute('data-value') ?? '';
89
+
90
+ if (selected !== value) {
91
+ setSelected(value);
92
+ } else {
93
+ setSelected('');
94
+ }
95
+ if (closeOnChange) {
96
+ setOpen(false);
97
+ }
98
+ if (onChange) onChange(event);
99
+ };
100
+
101
+ const handleChangeMultiple = (event: React.MouseEvent<HTMLDivElement>) => {
102
+ event.stopPropagation();
103
+ const value =
104
+ (event.target as HTMLDivElement).getAttribute('data-value') ?? '';
105
+
106
+ if (Array.isArray(selected) && selected.includes(value)) {
107
+ setSelected((prev) =>
108
+ (prev as string[]).filter((item) => item !== value)
109
+ );
110
+ } else {
111
+ setSelected((prev) => [value, ...prev]);
112
+ }
113
+ if (closeOnChange) {
114
+ setOpen(false);
115
+ }
116
+ if (onChange) onChange(event);
117
+ };
118
+
119
+ const handleChange = multiple ? handleChangeMultiple : handleChangeSingle;
120
+
121
+ const isSelected = (value: string) =>
122
+ maintainState && multiple ? selected.includes(value) : value === selected;
123
+
124
+ /**
125
+ * allow for the API to accept children as options
126
+ * or options prop
127
+ */
128
+ let dropdownOptions: React.ReactElement[] | null | undefined = null;
129
+ if (children) {
130
+ dropdownOptions = React.Children.map(children, (child) => {
131
+ let props: Partial<DropdownOptionProps> & {
132
+ label: string;
133
+ value: string;
134
+ };
135
+
136
+ if (React.isValidElement(child)) {
137
+ // eslint is okay bc deconstruction removes field
138
+ // eslint-disable-next-line
139
+ const { onClick, ...possibleProps } = child.props;
140
+ props = possibleProps;
141
+
142
+ return (
143
+ <Option
144
+ key={props.value}
145
+ checkbox={!!checkbox}
146
+ onClick={handleChange}
147
+ selected={isSelected(props.value)}
148
+ {...props}
149
+ />
150
+ );
151
+ } else {
152
+ return null;
153
+ }
154
+ });
155
+ }
156
+
157
+ if (options) {
158
+ dropdownOptions = options.map((option, index) => {
159
+ if (typeof option === 'string' && option === 'break')
160
+ return <Spacer key={`${id}-spacer-${index}`} />;
161
+ return (
162
+ <Option
163
+ key={option.value}
164
+ checkbox={!!checkbox}
165
+ onClick={handleChange}
166
+ selected={isSelected(option.value)}
167
+ {...option}
168
+ />
169
+ );
170
+ });
171
+ }
172
+
173
+ return (
174
+ <Wrapper
175
+ $sx={sx}
176
+ tabIndex={0}
177
+ ref={wrapperRef}
178
+ onBlurCapture={handleBlur}
179
+ {...rest}
180
+ >
181
+ {React.cloneElement(
182
+ trigger,
183
+ typeof trigger.type === 'string'
184
+ ? { onClick: handleOpen }
185
+ : { isDropdownOpen: open, onClick: handleOpen }
186
+ )}
187
+ {open && (
188
+ <Container
189
+ $hasArrow={hasArrow}
190
+ $offset={offset}
191
+ $openDirection={openDirection}
192
+ ref={optionsRef}
193
+ >
194
+ {dropdownOptions}
195
+ </Container>
196
+ )}
197
+ </Wrapper>
198
+ );
199
+ };
200
+
201
+ const Wrapper = styled.div<{ $sx?: string }>`
202
+ position: relative;
203
+ display: block;
204
+ outline: none;
205
+ ${({ $sx }) => ($sx ? $sx : '')}
206
+ `;
207
+
208
+ const Container = styled.div<{
209
+ $hasArrow?: boolean;
210
+ $offset?: [number, number];
211
+ $openDirection: 'left' | 'right';
212
+ }>`
213
+ z-index: 1;
214
+ background-color: var(--color-white);
215
+ position: absolute;
216
+ width: max-content;
217
+ z-index: 100;
218
+ outline: none;
219
+ cursor: pointer;
220
+ box-shadow: var(--elevation-2);
221
+ border-radius: 8px;
222
+
223
+ & > div:first-of-type {
224
+ border-radius: 8px 8px 0px 0px;
225
+ }
226
+
227
+ & > div:last-of-type {
228
+ border-radius: 0px 0px 8px 8px;
229
+ }
230
+
231
+ ${({ $openDirection }) => ($openDirection === 'left' ? 'right: 100%;' : '')}
232
+
233
+ ${({ $hasArrow, $offset }) =>
234
+ $hasArrow
235
+ ? `
236
+ &:before {
237
+ content: '';
238
+ position: absolute;
239
+ width: 15px;
240
+ height: 15px;
241
+ transform: rotate(45deg) translate(${($offset?.[0] || 0) + 8}px, ${
242
+ ($offset?.[1] || 0) - 32
243
+ }px);
244
+ background-color: var(--color-white);
245
+ }
246
+ `
247
+ : ''}
248
+ ${({ $offset }) =>
249
+ $offset ? `transform: translate(${$offset[0]}px, ${$offset[1]}px);` : ''}
250
+ `;
251
+
252
+ export interface DropdownOptionProps {
253
+ checkbox?: boolean;
254
+ color?: string;
255
+ disabled?: boolean;
256
+ icon?: React.ReactElement;
257
+ label: React.ReactNode;
258
+ onClick?: (event: React.MouseEvent<HTMLDivElement>) => void | undefined;
259
+ selected: boolean;
260
+ sublabel?: string;
261
+ sx?: string;
262
+ value: string;
263
+ }
264
+
265
+ const Option = ({
266
+ checkbox,
267
+ disabled,
268
+ icon,
269
+ label,
270
+ onClick,
271
+ selected,
272
+ sublabel,
273
+ sx,
274
+ value,
275
+ }: DropdownOptionProps) => {
276
+ return (
277
+ <OptionWrapper
278
+ data-value={value}
279
+ onClick={!disabled ? onClick : undefined}
280
+ $disabled={disabled}
281
+ $hasCheckbox={!!checkbox}
282
+ $hasSublabel={!!sublabel}
283
+ $selected={selected}
284
+ $sx={sx}
285
+ >
286
+ {checkbox ? <Checkbox selected={selected} /> : icon}
287
+ <Box $dir="column" $display="flex">
288
+ <P
289
+ $color="grey-4"
290
+ $fontSize={14}
291
+ $lineHeight={20}
292
+ $mediumBold
293
+ $textClampLines={1}
294
+ >
295
+ {label}
296
+ </P>
297
+ {sublabel && (
298
+ <P
299
+ $color="grey-4"
300
+ $fontSize={12}
301
+ $lineHeight={16}
302
+ $textClampLines={1}
303
+ >
304
+ {sublabel}
305
+ </P>
306
+ )}
307
+ </Box>
308
+ </OptionWrapper>
309
+ );
310
+ };
311
+
312
+ Option.displayName = 'Dropdown.Option';
313
+ Dropdown.Option = Option;
314
+
315
+ const OptionWrapper = styled.div<{
316
+ $disabled?: boolean;
317
+ $hasCheckbox?: boolean;
318
+ $hasSublabel?: boolean;
319
+ $selected?: boolean;
320
+ $sx?: string;
321
+ }>`
322
+ position: relative;
323
+ z-index: 1;
324
+ padding: ${({ $hasSublabel }) => ($hasSublabel ? 10 : 12)}px 16px;
325
+ user-select: none;
326
+ display: flex;
327
+ align-items: center;
328
+ gap: 8px;
329
+
330
+ & > * {
331
+ pointer-events: none;
332
+ }
333
+
334
+ ${({ $disabled, $selected, $hasCheckbox }) => {
335
+ if ($disabled) {
336
+ return `cursor: initial;
337
+ color: var(--color-grey-7);
338
+ background-color: var(--color-grey-10);`;
339
+ }
340
+
341
+ if ($hasCheckbox) {
342
+ return `&:hover {
343
+ background-color: var(--color-grey-10);
344
+ }`;
345
+ }
346
+
347
+ if ($selected) {
348
+ return `
349
+ background-color: var(--color-grey-9);
350
+ &:active {
351
+ background-color: var(--color-grey-8);
352
+ }`;
353
+ }
354
+
355
+ return `
356
+ &:hover {
357
+ background-color: var(--color-grey-10);
358
+ }
359
+
360
+ &:active {
361
+ background-color: var(--color-grey-8);
362
+ }
363
+ `;
364
+ }}
365
+ ${({ $sx }) => ($sx ? $sx : '')}
366
+ `;
367
+
368
+ export interface DropdownSpacerProps {
369
+ sx?: string;
370
+ }
371
+
372
+ const Spacer = ({ sx }: DropdownSpacerProps) => {
373
+ return <SpacerWrapper $sx={sx} />;
374
+ };
375
+
376
+ Spacer.displayName = 'Dropdown.Spacer';
377
+ Dropdown.Spacer = Spacer;
378
+
379
+ const SpacerWrapper = styled.div<{
380
+ $sx?: string;
381
+ }>`
382
+ width: 100%;
383
+ height: 1px;
384
+ background-color: var(--color-grey-8);
385
+
386
+ &:hover {
387
+ appearance: none;
388
+ }
389
+ ${({ $sx }) => ($sx ? $sx : '')}
390
+ `;
391
+
392
+ export { Dropdown };
@@ -0,0 +1,6 @@
1
+ export { Dropdown } from './dropdown';
2
+ export type {
3
+ DropdownOptionProps,
4
+ DropdownProps,
5
+ DropdownSpacerProps,
6
+ } from './dropdown';
@@ -1,2 +1,8 @@
1
1
  export { Button } from './button';
2
2
  export type { ButtonProps } from './button';
3
+ export { Dropdown } from './dropdown';
4
+ export type {
5
+ DropdownOptionProps,
6
+ DropdownProps,
7
+ DropdownSpacerProps,
8
+ } from './dropdown';
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { Typography, TypographyProps } from './typography';
3
+ import { TypographyProps } from './typography';
4
+ import { Styles } from 'common';
4
5
 
5
6
  export interface CommonProps extends TypographyProps {
6
7
  as?: React.ElementType;
@@ -18,6 +19,7 @@ export const P = ({
18
19
  $fontSize = 16,
19
20
  $lineHeight = 24,
20
21
  $textAlign = 'left',
22
+
21
23
  ...rest
22
24
  }: ParagraphProps) => (
23
25
  <StyledP
@@ -31,8 +33,15 @@ export const P = ({
31
33
  </StyledP>
32
34
  );
33
35
 
34
- const StyledP = styled(Typography)<ParagraphProps>`
36
+ const StyledP = styled.p<ParagraphProps>`
37
+ margin: 0px;
38
+ font-family: Inter;
35
39
  font-size: ${({ $fontSize }) => $fontSize + 'px'};
36
40
  line-height: ${({ $lineHeight }) => $lineHeight + 'px'};
37
41
  text-align: ${({ $textAlign }) => $textAlign || 'left'};
42
+ ${Styles.color}
43
+ ${Styles.weight}
44
+ ${Styles.typography}
45
+ ${Styles.styleable}
46
+ ${({ $textClampLines }) => ($textClampLines ? Styles.textClamp : '')}
38
47
  `;
@@ -30,7 +30,7 @@ export type TypographyProps = Pick<
30
30
  | 'onMouseLeave'
31
31
  | 'onMouseOut'
32
32
  | 'onMouseOver'
33
- > & { value?: string } & Color &
33
+ > & { value?: string; href?: string } & Color &
34
34
  Styleable &
35
35
  TextClamp &
36
36
  TypographyStyle &
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Styles } from 'common';
4
+ import { Box, BoxProps, Button, P } from 'components';
5
+ import {
6
+ AlertCircle,
7
+ AlertOctogon,
8
+ AlertTriangle,
9
+ Close,
10
+ Information,
11
+ } from 'icons';
12
+
13
+ type BannerTypes = 'error' | 'info' | 'success' | 'warning';
14
+
15
+ export interface BannerProps {
16
+ content: string;
17
+ href: string;
18
+ onClose: () => void;
19
+ title: string;
20
+ type: BannerTypes;
21
+ }
22
+
23
+ export const Banner = ({
24
+ content,
25
+ href,
26
+ onClose,
27
+ title,
28
+ type,
29
+ }: BannerProps) => {
30
+ const iconLookup: Record<BannerTypes, React.ReactElement> = {
31
+ error: <AlertOctogon size={24} />,
32
+ info: <Information size={24} />,
33
+ success: <AlertCircle size={24} />,
34
+ warning: <AlertTriangle size={24} />,
35
+ };
36
+
37
+ return (
38
+ <Wrapper as="output" $align="center" $dir="row" $gap={8} $type={type}>
39
+ {iconLookup[type]}
40
+ <Box $dir="row" $gap={4} $align="center">
41
+ <P as="span" $semiBold>
42
+ {title}
43
+ </P>
44
+ <P as="span">{content}</P>
45
+ <P as="a" href={href} $color="primary-blue-2">
46
+ Read more
47
+ </P>
48
+ </Box>
49
+ <Button icon={<Close size={24} />} onClick={onClose} type="special" />
50
+ </Wrapper>
51
+ );
52
+ };
53
+
54
+ const Wrapper = styled.output<
55
+ BoxProps & {
56
+ $type: BannerTypes;
57
+ }
58
+ >`
59
+ width: 100%;
60
+ box-sizing: border-box;
61
+ padding: 12px 16px;
62
+ display: flex;
63
+ background-color: ${({ $type }) =>
64
+ $type === 'error'
65
+ ? 'var(--color-red-9)'
66
+ : $type === 'info'
67
+ ? 'var(--color-blue-9)'
68
+ : $type === 'success'
69
+ ? 'var(--color-green-9)'
70
+ : 'var(--color-orange-9)'};
71
+ border-bottom: 1px solid
72
+ ${({ $type }) =>
73
+ $type === 'error'
74
+ ? 'var(--color-red-4)'
75
+ : $type === 'info'
76
+ ? 'var(--color-blue-4)'
77
+ : $type === 'success'
78
+ ? 'var(--color-green-3)'
79
+ : 'var(--color-orange-5)'};
80
+ box-shadow: var(--elevation-2);
81
+ border-radius: var(--small);
82
+
83
+ & > svg {
84
+ fill: ${({ $type }) =>
85
+ $type === 'error'
86
+ ? 'var(--color-red-4)'
87
+ : $type === 'info'
88
+ ? 'var(--color-blue-4)'
89
+ : $type === 'success'
90
+ ? 'var(--color-green-3)'
91
+ : 'var(--color-orange-5)'};
92
+ }
93
+
94
+ a {
95
+ position: relative;
96
+ cursor: pointer;
97
+
98
+ &::after {
99
+ position: absolute;
100
+ content: '';
101
+ width: 100%;
102
+ height: 1px;
103
+ right: 0px;
104
+ left: 0px;
105
+ bottom: 0px;
106
+ background-color: var(--color-primary-blue-2);
107
+ }
108
+ }
109
+
110
+ button {
111
+ padding: 0px;
112
+ margin-left: auto;
113
+ }
114
+
115
+ ${Styles.flex}
116
+ `;
@@ -0,0 +1,2 @@
1
+ export { Banner } from './banner';
2
+ export type { BannerProps } from './banner';
@@ -1,2 +1,8 @@
1
+ export { Banner } from './banner';
2
+ export type { BannerProps } from './banner';
1
3
  export { Loader } from './loader';
2
4
  export type { LoaderProps } from './loader';
5
+ export { Notification } from './notification';
6
+ export type { NotificationProps } from './notification';
7
+ export { Toast } from './toast';
8
+ export type { ToastProps } from './toast';
@@ -0,0 +1,2 @@
1
+ export { Notification } from './notification';
2
+ export type { NotificationProps } from './notification';
@@ -0,0 +1,127 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Styles } from 'common';
4
+ import { Box, BoxProps, Button, P } from 'components';
5
+ import {
6
+ AlertCircle,
7
+ AlertOctogon,
8
+ AlertTriangle,
9
+ Close,
10
+ Information,
11
+ } from 'icons';
12
+
13
+ type NotificationTypes = 'error' | 'info' | 'success' | 'warning';
14
+
15
+ export interface NotificationProps {
16
+ content: string;
17
+ href?: string;
18
+ onClose: () => void;
19
+ sx?: string;
20
+ title: string;
21
+ type: NotificationTypes;
22
+ }
23
+
24
+ export const Notification = ({
25
+ content,
26
+ href,
27
+ onClose,
28
+ sx,
29
+ title,
30
+ type,
31
+ }: NotificationProps) => {
32
+ const iconLookup: Record<NotificationTypes, React.ReactElement> = {
33
+ error: <AlertOctogon size={24} />,
34
+ info: <Information size={24} />,
35
+ success: <AlertCircle size={24} />,
36
+ warning: <AlertTriangle size={24} />,
37
+ };
38
+
39
+ return (
40
+ <Wrapper
41
+ as={href ? 'a' : 'output'}
42
+ href={href}
43
+ $dir="column"
44
+ $gap={8}
45
+ $sx={sx}
46
+ $type={type}
47
+ >
48
+ <Box $dir="row" $gap={8} $flex={1}>
49
+ {iconLookup[type]}
50
+ <P as="span" $semiBold>
51
+ {title}
52
+ </P>
53
+ <Button
54
+ icon={<Close size={24} />}
55
+ onClick={onClose}
56
+ sx="margin-left: auto;"
57
+ type="special"
58
+ />
59
+ </Box>
60
+ <Box $align="center" $dir="row" $gap={4}>
61
+ <P as="span" sx="padding-left: 32px;">
62
+ {content}
63
+ </P>
64
+ </Box>
65
+ </Wrapper>
66
+ );
67
+ };
68
+
69
+ const Wrapper = styled.output<
70
+ BoxProps & {
71
+ $sx?: string;
72
+ $type: NotificationTypes;
73
+ }
74
+ >`
75
+ text-decoration: none;
76
+ width: 100%;
77
+ box-sizing: border-box;
78
+ padding: 16px;
79
+ display: flex;
80
+ background-color: ${({ $type }) =>
81
+ $type === 'error'
82
+ ? 'var(--color-red-9)'
83
+ : $type === 'info'
84
+ ? 'var(--color-blue-9)'
85
+ : $type === 'success'
86
+ ? 'var(--color-green-9)'
87
+ : 'var(--color-orange-9)'};
88
+ border: 1px solid
89
+ ${({ $type }) =>
90
+ $type === 'error'
91
+ ? 'var(--color-red-8)'
92
+ : $type === 'info'
93
+ ? 'var(--color-blue-8)'
94
+ : $type === 'success'
95
+ ? 'var(--color-green-8)'
96
+ : 'var(--color-orange-8)'};
97
+ box-shadow: var(--elevation-2);
98
+ border-radius: var(--small);
99
+
100
+ & > div > svg {
101
+ fill: ${({ $type }) =>
102
+ $type === 'error'
103
+ ? 'var(--color-red-4)'
104
+ : $type === 'info'
105
+ ? 'var(--color-blue-4)'
106
+ : $type === 'success'
107
+ ? 'var(--color-green-3)'
108
+ : 'var(--color-orange-5)'};
109
+ }
110
+
111
+ button > svg {
112
+ fill: unset;
113
+ }
114
+
115
+ a {
116
+ position: relative;
117
+ cursor: pointer;
118
+ }
119
+
120
+ button {
121
+ padding: 0px;
122
+ margin-left: auto;
123
+ }
124
+
125
+ ${Styles.flex}
126
+ ${({ $sx }) => ($sx ? $sx : '')}
127
+ `;
@@ -0,0 +1,2 @@
1
+ export { Toast } from './toast';
2
+ export type { ToastProps } from './toast';
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Styles } from 'common';
4
+ import { BoxProps, Button, P } from 'components';
5
+ import {
6
+ AlertCircle,
7
+ AlertOctogon,
8
+ AlertTriangle,
9
+ Close,
10
+ Information,
11
+ } from 'icons';
12
+
13
+ type ToastTypes = 'error' | 'info' | 'success' | 'warning';
14
+
15
+ export interface ToastProps {
16
+ content: string;
17
+ href?: string;
18
+ onClose: () => void;
19
+ type: ToastTypes;
20
+ }
21
+
22
+ export const Toast = ({ content, href, onClose, type }: ToastProps) => {
23
+ const iconLookup: Record<ToastTypes, React.ReactElement> = {
24
+ error: <AlertOctogon size={24} />,
25
+ info: <Information size={24} />,
26
+ success: <AlertCircle size={24} />,
27
+ warning: <AlertTriangle size={24} />,
28
+ };
29
+
30
+ return (
31
+ <Wrapper as="output" $align="center" $dir="row" $gap={8} $type={type}>
32
+ {iconLookup[type]}
33
+ <P as="span">{content}</P>
34
+ {href && (
35
+ <P sx="padding-left: 8px;" as="a" href={href} $color="primary-blue-2">
36
+ View
37
+ </P>
38
+ )}
39
+ <Button icon={<Close size={24} />} onClick={onClose} type="special" />
40
+ </Wrapper>
41
+ );
42
+ };
43
+
44
+ const Wrapper = styled.output<
45
+ BoxProps & {
46
+ $type: ToastTypes;
47
+ }
48
+ >`
49
+ position: fixed;
50
+ bottom: 24px;
51
+ right: 24px;
52
+ width: 99vw;
53
+ max-width: 476px;
54
+ box-sizing: border-box;
55
+ padding: 12px 16px;
56
+ display: flex;
57
+ box-shadow: var(--elevation-2);
58
+ border-radius: var(--small);
59
+
60
+ &::before {
61
+ position: absolute;
62
+ content: '';
63
+ left: 0px;
64
+ width: 4px;
65
+ height: 100%;
66
+ background-color: ${({ $type }) =>
67
+ $type === 'error'
68
+ ? 'var(--color-red-4)'
69
+ : $type === 'info'
70
+ ? 'var(--color-blue-4)'
71
+ : $type === 'success'
72
+ ? 'var(--color-green-3)'
73
+ : 'var(--color-orange-5)'};
74
+ border-radius: 8px 0px 0px 8px;
75
+ }
76
+
77
+ & > svg {
78
+ fill: ${({ $type }) =>
79
+ $type === 'error'
80
+ ? 'var(--color-red-4)'
81
+ : $type === 'info'
82
+ ? 'var(--color-blue-4)'
83
+ : $type === 'success'
84
+ ? 'var(--color-green-3)'
85
+ : 'var(--color-orange-5)'};
86
+ }
87
+
88
+ a {
89
+ &:hover {
90
+ cursor: pointer;
91
+ text-decoration: underline;
92
+ }
93
+ }
94
+
95
+ button {
96
+ padding: 0px;
97
+ margin-left: auto;
98
+ }
99
+
100
+ ${Styles.flex}
101
+ `;
@@ -14,7 +14,7 @@ import {
14
14
  } from './icons';
15
15
 
16
16
  type NativeProps = Pick<
17
- React.HTMLAttributes<HTMLAnchorElement>,
17
+ React.HTMLAttributes<any>,
18
18
  | 'onBlur'
19
19
  | 'onBlurCapture'
20
20
  | 'onClick'
@@ -43,8 +43,18 @@ type Status =
43
43
  | 'declined'
44
44
  | 'approved';
45
45
 
46
- type Size = 96 | 72 | 64 | 56 | 48 | 40 | 36 | 32 | 24;
47
- type SizeStrings = '96' | '72' | '64' | '56' | '48' | '40' | '36' | '32' | '24';
46
+ type Size = 96 | 72 | 64 | 56 | 48 | 40 | 36 | 32 | 24 | 16;
47
+ type SizeStrings =
48
+ | '96'
49
+ | '72'
50
+ | '64'
51
+ | '56'
52
+ | '48'
53
+ | '40'
54
+ | '36'
55
+ | '32'
56
+ | '24'
57
+ | '16';
48
58
 
49
59
  export interface AvatarProps extends NativeProps {
50
60
  as?: React.ElementType;
@@ -62,7 +72,7 @@ export interface AvatarProps extends NativeProps {
62
72
  */
63
73
  const iconReference: Record<
64
74
  Status | 'none',
65
- React.JSXElementConstructor<SVGElement>
75
+ React.JSXElementConstructor<any>
66
76
  > = {
67
77
  approved: Approved,
68
78
  busy: Busy,
@@ -85,6 +95,7 @@ const iconSize: Record<SizeStrings, number> = {
85
95
  '36': 14,
86
96
  '32': 14,
87
97
  '24': 12,
98
+ '16': 8,
88
99
  };
89
100
 
90
101
  const iconOffsetX: Record<SizeStrings, number> = {
@@ -97,6 +108,7 @@ const iconOffsetX: Record<SizeStrings, number> = {
97
108
  '36': -12,
98
109
  '32': -12,
99
110
  '24': -10,
111
+ '16': -8,
100
112
  };
101
113
 
102
114
  const iconOffsetY: Record<SizeStrings, number> = {
@@ -109,6 +121,7 @@ const iconOffsetY: Record<SizeStrings, number> = {
109
121
  '36': -2,
110
122
  '32': -2,
111
123
  '24': -2,
124
+ '16': -1,
112
125
  };
113
126
 
114
127
  /**
@@ -1,15 +1,6 @@
1
- export { Button } from './actions';
2
- export type { ButtonProps } from './actions';
3
- export { Box, Display, H, P, Typography } from './atoms';
4
- export type {
5
- BoxProps,
6
- DisplayProps,
7
- HeadingProps,
8
- ParagraphProps,
9
- TypographyProps,
10
- } from './atoms';
1
+ export * from './actions';
2
+ export * from './atoms';
11
3
  export * from './feedback';
12
- export { Avatar, Icon } from './iconography';
13
- export type { AvatarGroupProps, AvatarProps, IconProps } from './iconography';
14
- export { Modal } from './surfaces';
15
- export type { ModalContentProps, ModalProps } from './surfaces';
4
+ export * from './iconography';
5
+ export * from './input';
6
+ export * from './surfaces';
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Styles } from 'common';
4
+ import { BoxProps } from 'components';
5
+ import { Checkmark } from 'icons';
6
+
7
+ type NativeProps = Pick<
8
+ React.HTMLAttributes<HTMLDivElement>,
9
+ | 'onClick'
10
+ | 'onChange'
11
+ | 'onMouseDown'
12
+ | 'onMouseDownCapture'
13
+ | 'onMouseEnter'
14
+ | 'onMouseLeave'
15
+ | 'onMouseOut'
16
+ | 'onMouseOver'
17
+ >;
18
+
19
+ export interface CheckboxProps extends NativeProps {
20
+ disabled?: boolean;
21
+ selected: boolean;
22
+ }
23
+
24
+ export const Checkbox = ({ disabled, selected, ...rest }: CheckboxProps) => {
25
+ return (
26
+ <Box
27
+ $align="center"
28
+ $disabled={!!disabled}
29
+ $display="flex"
30
+ $justify="center"
31
+ $selected={selected}
32
+ {...rest}
33
+ >
34
+ {selected && <Checkmark color="white" />}
35
+ </Box>
36
+ );
37
+ };
38
+
39
+ const Box = styled.div<
40
+ {
41
+ $disabled: boolean;
42
+ $selected: boolean;
43
+ } & BoxProps
44
+ >`
45
+ display: flex;
46
+ width: 20px;
47
+ height: 20px;
48
+ border-radius: 4px;
49
+ cursor: pointer;
50
+ box-sizing: border-box;
51
+
52
+ ${({ $selected }) =>
53
+ $selected
54
+ ? `background-color: var(--color-primary-blue-2);
55
+ border: 1px solid var(--color-primary-blue-2);`
56
+ : 'border: 1px solid var(--color-grey-8);'}
57
+ ${Styles.flex}
58
+ `;
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from './checkbox';
2
+ export type { CheckboxProps } from './checkbox';
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from './checkbox';
2
+ export type { CheckboxProps } from './checkbox';
@@ -134,12 +134,7 @@ const Wrapper = styled.div<{
134
134
  : 'display: none;'}
135
135
  ${({ $backgroundDark }) =>
136
136
  $backgroundDark
137
- ? `background: radial-gradient(
138
- 79.02% 79.02% at 50% 0%,
139
- rgba(0, 27, 58, 0.8) 0%,
140
- rgba(0, 0, 0, 0.8) 100%
141
- );
142
- backdrop-filter: blur(5px);
137
+ ? `background: rgba(0, 0, 0, 0.5);
143
138
  cursor: pointer;`
144
139
  : ''}
145
140
  position: fixed;
@@ -160,20 +155,22 @@ const Content = styled.div`
160
155
  box-shadow: var(--elevation-2);
161
156
  border-radius: var(--small);
162
157
  cursor: initial;
158
+ padding: 24px;
159
+ display: flex;
160
+ flex-direction: column;
161
+ gap: 24px;
163
162
 
164
163
  [class~='header'] {
165
164
  display: flex;
166
165
  align-items: center;
167
- padding: 16px;
168
- border-bottom: 1px solid var(--color-grey-8);
169
- > *:first-child {
166
+
167
+ div:first-child {
170
168
  flex: 1;
171
- display: block;
172
169
  }
173
170
  }
174
171
 
175
172
  [class~='footer'] {
176
- padding: 16px;
177
- border-top: 1px solid var(--color-grey-8);
173
+ position: relative;
174
+ padding-top: 16px;
178
175
  }
179
176
  `;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Icon, IconProps } from 'components';
3
+
4
+ export const CheckmarkFilled = (props: IconProps) => {
5
+ return (
6
+ <Icon {...props}>
7
+ <path d="M10.6 16.6L17.65 9.55L16.25 8.15L10.6 13.8L7.75 10.95L6.35 12.35L10.6 16.6ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" />
8
+ </Icon>
9
+ );
10
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Icon, IconProps } from 'components';
3
+
4
+ export const CloseFilled = (props: IconProps) => {
5
+ return (
6
+ <Icon {...props}>
7
+ <path d="M8.4 17L12 13.4L15.6 17L17 15.6L13.4 12L17 8.4L15.6 7L12 10.6L8.4 7L7 8.4L10.6 12L7 15.6L8.4 17ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" />
8
+ </Icon>
9
+ );
10
+ };
@@ -21,12 +21,14 @@ export { CameraAdd } from './camera_add';
21
21
  export { CameraSlash } from './camera_slash';
22
22
  export { Checkmark } from './checkmark';
23
23
  export { CheckmarkCircle } from './checkmark_circle';
24
+ export { CheckmarkFilled } from './checkmark_filled';
24
25
  export { Checkmarks } from './checkmarks';
25
26
  export { Circle } from './circle';
26
27
  export { CircleSlash } from './circle_slash';
27
28
  export { ClearTextStyle } from './clear_text_style';
28
29
  export { Close } from './close';
29
30
  export { CloseCircle } from './close_circle';
31
+ export { CloseFilled } from './close_filled';
30
32
  export { Copy } from './copy';
31
33
  export { Delete } from './delete';
32
34
  export { Detail } from './detail';
@@ -70,6 +72,7 @@ export { Minimize } from './minimize';
70
72
  export { MicrophoneSlash } from './microphone_slash';
71
73
  export { Minus } from './minus';
72
74
  export { MinusCircle } from './minus_circle';
75
+ export { MoveItem } from './move_item';
73
76
  export { New } from './new';
74
77
  export { Newspaper } from './newspaper';
75
78
  export { NotePad } from './note_pad';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Icon, IconProps } from 'components';
3
+
4
+ export const MoveItem = (props: IconProps) => {
5
+ return (
6
+ <Icon {...props}>
7
+ <path d="M8 11H20.15L18.6 9.45L20 8L24 12L20 16L18.6 14.55L20.15 13H8V11ZM15 9V5H5V19H15V15H17V19C17 19.55 16.8042 20.0208 16.4125 20.4125C16.0208 20.8042 15.55 21 15 21H5C4.45 21 3.97917 20.8042 3.5875 20.4125C3.19583 20.0208 3 19.55 3 19V5C3 4.45 3.19583 3.97917 3.5875 3.5875C3.97917 3.19583 4.45 3 5 3H15C15.55 3 16.0208 3.19583 16.4125 3.5875C16.8042 3.97917 17 4.45 17 5V9H15Z" />
8
+ </Icon>
9
+ );
10
+ };
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "es2022",
4
- "lib": ["es2022", "ESNext"],
4
+ "lib": ["es2022", "ESNext", "DOM"],
5
5
  "module": "ES6",
6
6
  "jsx": "react",
7
7
  "strict": true,