@soul-refiner/design-system 0.2.128 → 0.2.130

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.
@@ -4,10 +4,17 @@ interface MediaItem {
4
4
  duration: number;
5
5
  progress?: number;
6
6
  src: string;
7
+ subtitles: Subtitle[];
7
8
  shortDescription: string;
8
9
  thumbnail: string;
9
10
  title: string;
10
11
  }
12
+ interface Subtitle {
13
+ id: string;
14
+ label: string;
15
+ locale: string;
16
+ src: string;
17
+ }
11
18
  export interface VideoPlayerProps {
12
19
  /**
13
20
  * @param activeIndex the media item from the playlist currently playing
@@ -31,10 +31,19 @@ export const VideoPlayer = ({ activeIndex, pip, playlist, onPipChange, onProgres
31
31
  React.createElement(P, { as: "h3", "$bold": true, "$color": "grey-8" }, subtitle))),
32
32
  React.createElement(ReactPlayer, { config: {
33
33
  file: {
34
+ attributes: {
35
+ crossOrigin: 'true',
36
+ },
34
37
  forceHLS: true,
35
38
  hlsOptions: {
36
39
  autoStartLoad: true,
37
40
  },
41
+ tracks: mediaItem.subtitles.map((subtitle) => ({
42
+ kind: 'subtitles',
43
+ label: subtitle.label,
44
+ src: subtitle.src,
45
+ srcLang: subtitle.locale,
46
+ })),
38
47
  },
39
48
  }, controls: true, height: "100%", light: React.createElement(Image, { alt: `thumbnail for ${title}`, layout: "fill", objectFit: "contain", priority: true, src: mediaItem.thumbnail }), onDisablePIP: () => onPipChange && onPipChange(false), onEnablePIP: () => onPipChange && onPipChange(true), onProgress: onProgress, onReady: handleReady, pip: pip, playing: true, ref: ref, style: {
40
49
  backgroundColor: 'var(--color-grey-0)',
@@ -6,9 +6,9 @@ export interface TabProps {
6
6
  items: {
7
7
  color?: TabColors;
8
8
  disabled?: boolean;
9
- href?: string;
10
9
  icon?: React.ReactElement;
11
10
  label: string;
11
+ onClick: () => void;
12
12
  }[];
13
13
  onChange?: (index: number) => void;
14
14
  size?: TabSizes;
@@ -17,7 +17,7 @@ export interface TabProps {
17
17
  declare const Tabs: {
18
18
  ({ activeIndex, items, onChange, size, sx, }: TabProps): React.JSX.Element;
19
19
  Item: {
20
- ({ active, color, disabled, href, icon, label, onClick, size, }: TabsItemProps): React.JSX.Element;
20
+ ({ active, color, disabled, icon, label, onClick, size, }: TabsItemProps): React.JSX.Element;
21
21
  displayName: string;
22
22
  };
23
23
  };
@@ -25,7 +25,6 @@ export interface TabsItemProps {
25
25
  active: boolean;
26
26
  color?: TabColors;
27
27
  disabled?: boolean;
28
- href?: string;
29
28
  icon?: React.ReactElement;
30
29
  label: string;
31
30
  onClick?: () => void;
@@ -46,7 +46,10 @@ const colorLookup = {
46
46
  };
47
47
  const Tabs = ({ activeIndex, items, onChange, size = 'large', sx, }) => {
48
48
  const id = React.useId();
49
- return (React.createElement(Wrapper, { "$sx": sx }, items.map((item, index) => (React.createElement(Item, { active: activeIndex === index, color: item?.color, disabled: item?.disabled, href: item?.href, icon: item?.icon, key: id + index.toString(36), label: item.label, onClick: () => onChange && onChange(index), size: size })))));
49
+ return (React.createElement(Wrapper, { "$sx": sx }, items.map((item, index) => (React.createElement(Item, { active: activeIndex === index, color: item?.color, disabled: item?.disabled, icon: item?.icon, key: id + index.toString(36), label: item.label, onClick: () => {
50
+ item.onClick();
51
+ onChange && onChange(index);
52
+ }, size: size })))));
50
53
  };
51
54
  const Wrapper = styled.div `
52
55
  display: flex;
@@ -63,14 +66,13 @@ const Wrapper = styled.div `
63
66
 
64
67
  ${({ $sx }) => ($sx ? $sx : '')}
65
68
  `;
66
- const Item = ({ active, color, disabled, href, icon, label, onClick, size = 'large', }) => {
67
- const isAnchor = !!href;
69
+ const Item = ({ active, color, disabled, icon, label, onClick, size = 'large', }) => {
68
70
  const inputColor = disabled ? 'grey' : color ? color : 'blue';
69
71
  const iconColor = colorLookup[inputColor].icon;
70
72
  const bgColor = colorLookup[inputColor].bg;
71
73
  const fontSize = size === 'large' ? 16 : size === 'medium' ? 14 : 12;
72
74
  const lineHeight = size === 'large' ? 24 : size === 'medium' ? 20 : 16;
73
- return (React.createElement(Element, { as: isAnchor ? 'a' : 'div', href: href, onClick: !disabled && onClick ? onClick : undefined, "$active": active, "$color": iconColor, "$disabled": disabled, "$hasIcon": !!icon, "$size": size },
75
+ return (React.createElement(Element, { as: "a", onClick: !disabled && onClick ? onClick : undefined, "$active": active, "$color": iconColor, "$disabled": disabled, "$hasIcon": !!icon, "$size": size },
74
76
  icon && React.createElement(IconWrapper, { "$bg": bgColor }, icon),
75
77
  React.createElement(P, { "$fontSize": fontSize, "$lineHeight": lineHeight, "$semiBold": true }, label)));
76
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.128",
3
+ "version": "0.2.130",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {