@soul-refiner/design-system 0.2.112 → 0.2.114

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { COLORS } from 'common';
3
- type NativeProps = Pick<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onBlur' | 'onBlurCapture' | 'onClick' | 'onChange' | 'onMouseDown' | 'onMouseDownCapture' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseOut' | 'onMouseOver'>;
3
+ type NativeProps = Pick<React.HTMLAttributes<HTMLDivElement>, 'className' | 'children' | 'onBlur' | 'onBlurCapture' | 'onClick' | 'onChange' | 'onMouseDown' | 'onMouseDownCapture' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseOut' | 'onMouseOver'>;
4
4
  export interface DropdownProps extends NativeProps, React.PropsWithChildren {
5
5
  checkbox?: boolean;
6
6
  closeOnChange?: boolean;
@@ -4,9 +4,10 @@ export interface FeatureCardProps {
4
4
  editable?: boolean;
5
5
  href?: string;
6
6
  image: string;
7
+ onDelete?: () => void;
7
8
  onSave?: (title: string, content: string) => void;
8
9
  sx?: string;
9
10
  title: string;
10
11
  uploadModal?: React.ReactElement;
11
12
  }
12
- export declare const FeatureCard: ({ content, editable, href, image, onSave, sx, title, uploadModal, }: FeatureCardProps) => React.JSX.Element;
13
+ export declare const FeatureCard: ({ content, editable, href, image, onDelete, onSave, sx, title, uploadModal, }: FeatureCardProps) => React.JSX.Element;
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { Box, Button, Modal } from '../../';
5
- import { Camera, Checkmark, Close, Pencil } from '../../../icons';
6
- export const FeatureCard = ({ content = '', editable, href, image, onSave, sx, title = '', uploadModal, }) => {
5
+ import { Camera, Checkmark, Close, Pencil, Trash } from '../../../icons';
6
+ export const FeatureCard = ({ content = '', editable, href, image, onDelete, onSave, sx, title = '', uploadModal, }) => {
7
7
  const [editing, setEditing] = React.useState(false);
8
8
  const [editingTitle, setTitle] = React.useState(() => title);
9
9
  const [editingContent, setContent] = React.useState(() => content);
@@ -60,13 +60,24 @@ export const FeatureCard = ({ content = '', editable, href, image, onSave, sx, t
60
60
  &:hover {
61
61
  background-color: var(--color-grey-10);
62
62
  }
63
- ` })))))));
63
+ ` }),
64
+ onDelete && (React.createElement(Trash, { onClick: onDelete, sx: `
65
+ padding: 8px;
66
+ border-radius: 4px;
67
+ cursor: pointer;
68
+ background-color: var(--color-white);
69
+ box-shadow: var(--elevation-1);
70
+ &:hover {
71
+ background-color: var(--color-grey-10);
72
+ }
73
+ ` }))))))));
64
74
  };
65
75
  const Wrapper = styled.div `
66
76
  text-decoration: none;
67
77
  `;
68
78
  const Figure = styled.figure `
69
79
  max-width: 352px;
80
+ box-sizing: border-box;
70
81
  display: flex;
71
82
  flex-flow: column nowrap;
72
83
  gap: 16px;
@@ -145,6 +156,12 @@ const Content = styled.figcaption `
145
156
  font-weight: 400;
146
157
  line-height: 20px;
147
158
  letter-spacing: -0.084px;
159
+ overflow: hidden;
160
+ text-overflow: ellipsis;
161
+ display: -webkit-box;
162
+ line-clamp: 1;
163
+ -webkit-line-clamp: 1;
164
+ -webkit-box-orient: vertical;
148
165
  `;
149
166
  const EditTitle = styled.input `
150
167
  width: calc(100% - 24px);
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
+ import { DropdownOptionProps } from '../../';
2
3
  export interface PriceCardProps {
3
4
  actions: React.ReactElement;
4
5
  content: string;
6
+ dotsActions?: (Omit<DropdownOptionProps, 'selected'> | 'break')[];
5
7
  features: string[];
6
8
  featureTitle: string;
9
+ label?: string;
7
10
  price: string;
8
11
  title: string;
9
12
  }
10
- export declare const PriceCard: ({ actions, content, featureTitle, features, price, title, }: PriceCardProps) => React.JSX.Element;
13
+ export declare const PriceCard: ({ actions, content, dotsActions, featureTitle, features, label, price, title, }: PriceCardProps) => React.JSX.Element;
@@ -1,11 +1,24 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
- import { Box, H, P } from '../../';
5
- import { Checkmark } from '../../../icons';
6
- export const PriceCard = ({ actions, content, featureTitle, features, price, title, }) => {
4
+ import { Box, Button, H, P, Dropdown } from '../../';
5
+ import { Checkmark, EllipsisHorizontal } from '../../../icons';
6
+ export const PriceCard = ({ actions, content, dotsActions, featureTitle, features, label, price, title, }) => {
7
7
  const id = React.useId();
8
8
  return (React.createElement(Price, null,
9
+ dotsActions && !!dotsActions.length && (React.createElement(Dropdown, { className: "dot-dropdown", hasArrow: true, maintainState: false, offset: [0, 32], options: dotsActions, sx: `
10
+ position: absolute;
11
+ top: 6px;
12
+ right: 6px;
13
+ display: none;
14
+ `, trigger: React.createElement(Button, { icon: React.createElement(EllipsisHorizontal, null), showChevron: false, type: "outlined", size: "small", className: "icon" }), onClick: (e) => e.preventDefault() })),
15
+ label && (React.createElement(Box, { "$justify": "center", sx: `
16
+ width: 100%;
17
+ position: absolute;
18
+ z-index: -1;
19
+ top: -33px;` },
20
+ React.createElement(Label, null,
21
+ React.createElement(P, { as: "span", "$fontSize": 12, "$lineHeight": 16, "$mediumBold": true, "$textClampLines": 1 }, label)))),
9
22
  React.createElement(Box, { "$align": "stretch", "$display": "flex", "$dir": "column", "$gap": 24, sx: `
10
23
  padding: 24px 48px;
11
24
  background-color: var(--color-grey-10);
@@ -26,6 +39,8 @@ export const PriceCard = ({ actions, content, featureTitle, features, price, tit
26
39
  React.createElement(P, { "$fontSize": 14, "$lineHeight": 20 }, item))))))));
27
40
  };
28
41
  const Price = styled.figure `
42
+ position: relative;
43
+ z-index: 1;
29
44
  margin: 0px;
30
45
  padding: 0px;
31
46
  width: 280px;
@@ -33,11 +48,25 @@ const Price = styled.figure `
33
48
  border-radius: 16px;
34
49
  box-shadow: var(--elevation-2);
35
50
  user-select: none;
51
+ border: 1px solid transparent;
36
52
 
37
53
  &:hover {
38
54
  border: 1px solid var(--color-primary-blue-3);
55
+
56
+ .dot-dropdown {
57
+ display: flex;
58
+ }
39
59
  }
40
60
  `;
61
+ const Label = styled.div `
62
+ max-width: calc(100% - 32px);
63
+ box-sizing: border-box;
64
+ padding: 8px 24px;
65
+ border-radius: 16px 16px 0px 0px;
66
+ background-color: var(--color-grey-10);
67
+ box-shadow: var(--elevation-2);
68
+ border-bottom: 1px solid var(--color-grey-9);
69
+ `;
41
70
  const Divider = styled.div `
42
71
  height: 1px;
43
72
  width: 100%;
@@ -17,6 +17,7 @@ export interface CoursesSelectionProps extends NativeProps, React.PropsWithChild
17
17
  courseIsSelected: Record<string, boolean>;
18
18
  setCourseIsSelected: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
19
19
  subtitle: string;
20
+ onlyOneCanBeSelected: boolean;
20
21
  }
21
- export declare const CoursesSelection: ({ closeOnChange, closeOnBlur, disabled, offset, sx, containerSx, courses, label, courseIsSelected, setCourseIsSelected, subtitle, ...rest }: CoursesSelectionProps) => React.JSX.Element;
22
+ export declare const CoursesSelection: ({ closeOnChange, closeOnBlur, disabled, offset, sx, containerSx, courses, label, courseIsSelected, setCourseIsSelected, subtitle, onlyOneCanBeSelected, ...rest }: CoursesSelectionProps) => React.JSX.Element;
22
23
  export {};
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { Button, P, Box, H } from '../..';
5
5
  import { GraduationCap, Search as SearchIcon, Plus, Close, } from '../../../icons';
6
- export const CoursesSelection = ({ closeOnChange = true, closeOnBlur = true, disabled = false, offset = [0, 0], sx, containerSx, courses, label, courseIsSelected, setCourseIsSelected, subtitle, ...rest }) => {
6
+ export const CoursesSelection = ({ closeOnChange = true, closeOnBlur = true, disabled = false, offset = [0, 0], sx, containerSx, courses, label, courseIsSelected, setCourseIsSelected, subtitle, onlyOneCanBeSelected = false, ...rest }) => {
7
7
  const wrapperRef = React.useRef(null);
8
8
  const [open, setOpen] = React.useState(false);
9
9
  React.useEffect(() => {
@@ -33,10 +33,14 @@ export const CoursesSelection = ({ closeOnChange = true, closeOnBlur = true, dis
33
33
  React.createElement(P, { "$color": "grey-4", "$fontSize": 14, sx: "margin-top: 32px;" }, subtitle),
34
34
  React.createElement(Button, { type: "dropdown", isDropdownOpen: open, onClick: handleOpen, customDropdownIcon: SearchIcon, sx: "margin-top: 32px;" }, label),
35
35
  open && (React.createElement(Container, { "$offset": offset, "$sx": containerSx }, courses.map((course) => (React.createElement(OptionWrapper, { key: course.id, "$disabled": disabled, onClick: () => {
36
- setCourseIsSelected({
37
- ...courseIsSelected,
38
- [course.id]: true,
39
- });
36
+ setCourseIsSelected(onlyOneCanBeSelected
37
+ ? {
38
+ [course.id]: true,
39
+ }
40
+ : {
41
+ ...courseIsSelected,
42
+ [course.id]: true,
43
+ });
40
44
  if (closeOnChange) {
41
45
  setOpen(false);
42
46
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface CalendarInputProps {
3
- selectedDate: Date;
3
+ selectedDate: Date | null;
4
4
  onSelect: (value: Date) => void;
5
5
  }
6
6
  export declare const CalendarInput: ({ selectedDate, onSelect: parentOnSelect, }: CalendarInputProps) => React.JSX.Element;
@@ -15,10 +15,10 @@ export const CalendarInput = ({ selectedDate, onSelect: parentOnSelect, }) => {
15
15
  firstOfMonth.setDate(1);
16
16
  const pickerRef = React.useRef(null);
17
17
  const [show, setShow] = React.useState(false);
18
- const [displayDate, setDisplayDate] = React.useState(() => selectedDate.toDateString());
19
- const [componentSelectedDate, setComponentSelectedDate] = React.useState(() => selectedDate.toDateString());
18
+ const [displayDate, setDisplayDate] = React.useState(() => selectedDate?.toDateString() || new Date().toDateString());
19
+ const [componentSelectedDate, setComponentSelectedDate] = React.useState(() => selectedDate?.toDateString() || new Date().toDateString());
20
20
  React.useEffect(() => {
21
- setComponentSelectedDate(selectedDate.toDateString());
21
+ setComponentSelectedDate(selectedDate?.toDateString() || new Date().toDateString());
22
22
  }, [selectedDate]);
23
23
  const handleShow = () => setShow((prev) => !prev);
24
24
  const handleBlur = (event) => {
@@ -56,11 +56,11 @@ export const CalendarInput = ({ selectedDate, onSelect: parentOnSelect, }) => {
56
56
  onSelect(new Date(`${month}-${day}-${year}`));
57
57
  };
58
58
  const handleCancel = () => {
59
- setComponentSelectedDate(selectedDate.toDateString());
59
+ setComponentSelectedDate(selectedDate?.toDateString() || new Date().toDateString());
60
60
  setShow(false);
61
61
  };
62
62
  const calendar = buildCalendar(new Date(displayDate).getMonth() + 1, new Date(displayDate).getFullYear());
63
- const [month, day, year] = selectedDate
63
+ const [month, day, year] = (selectedDate || new Date())
64
64
  .toLocaleString('default', {
65
65
  year: '2-digit',
66
66
  month: '2-digit',
@@ -69,7 +69,7 @@ export const CalendarInput = ({ selectedDate, onSelect: parentOnSelect, }) => {
69
69
  .split('/');
70
70
  return (React.createElement(Wrapper, { onBlurCapture: handleBlur, ref: pickerRef, tabIndex: 0 },
71
71
  React.createElement(InputWrapper, null,
72
- React.createElement(Input, { value: `${month} / ${day} / ${year}`, onFocus: handleShow, style: { letterSpacing: '1px', fontSize: '16px' }, readOnly: true }),
72
+ React.createElement(Input, { value: selectedDate ? `${month} / ${day} / ${year}` : '', onFocus: handleShow, style: { letterSpacing: '1px', fontSize: '16px' }, readOnly: true }),
73
73
  React.createElement(CalendarIcon, null)),
74
74
  show && (React.createElement(DateSelector, null,
75
75
  React.createElement(InnerWrapper, null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.112",
3
+ "version": "0.2.114",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {