@ssa-ui-kit/widgets 3.10.2 → 3.11.0

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.
@@ -3,4 +3,4 @@ import { ListGoalsProps } from './types';
3
3
  *
4
4
  * UI Component that uses CardList to render a list of goals
5
5
  */
6
- export declare const ListGoals: ({ goals }: ListGoalsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ export declare const ListGoals: ({ goals, avatarBorder }: ListGoalsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { ItemCardProps } from './types';
2
- export declare const ListGoalsCard: ({ image, title, details, progressProps, }: ItemCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const ListGoalsCard: ({ image, title, details, progressProps, avatarBorder, }: ItemCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -9,6 +9,8 @@ export type Goal = {
9
9
  };
10
10
  export interface ListGoalsProps {
11
11
  goals: Array<Goal>;
12
+ /** Shows a border around the avatar in each goal card. @default false */
13
+ avatarBorder?: boolean;
12
14
  }
13
15
  export type ProgressProps = Partial<React.ComponentProps<typeof ProgressCircle>>;
14
16
  export interface ItemCardProps {
@@ -16,4 +18,6 @@ export interface ItemCardProps {
16
18
  title: string;
17
19
  details: string;
18
20
  progressProps: ProgressProps;
21
+ /** Shows a border around the avatar. @default false */
22
+ avatarBorder?: boolean;
19
23
  }
@@ -1,2 +1,2 @@
1
1
  import { MealPlannerProps } from './types';
2
- export declare const MealPlanner: ({ data }: MealPlannerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const MealPlanner: ({ data, avatarBorder }: MealPlannerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { MealPlannerCardProps } from './types';
2
- export declare const MealPlannerCard: ({ name, image, carbs, protein, fat, }: MealPlannerCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const MealPlannerCard: ({ name, image, carbs, protein, fat, avatarBorder, }: MealPlannerCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -5,6 +5,8 @@ export interface MealPlannerCardProps {
5
5
  carbs: number;
6
6
  protein: number;
7
7
  fat: number;
8
+ /** Shows a border around the avatar. @default false */
9
+ avatarBorder?: boolean;
8
10
  }
9
11
  export type MealPlannerData = MealPlannerCardProps & {
10
12
  id: number;
@@ -17,4 +19,6 @@ export interface MealPlannerProps {
17
19
  data: {
18
20
  [mealName: string]: MealPlannerItem;
19
21
  };
22
+ /** Shows a border around the avatar in each meal card. @default false */
23
+ avatarBorder?: boolean;
20
24
  }
@@ -3,4 +3,4 @@ import { UpcomingWorkoutCardProps } from './types';
3
3
  *
4
4
  * UI Component that use CardList to render a list of upcoming workouts
5
5
  */
6
- export declare const UpcomingWorkoutCard: ({ image, title, workoutTime, renderDetails, onClick, }: UpcomingWorkoutCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ export declare const UpcomingWorkoutCard: ({ image, title, workoutTime, renderDetails, onClick, avatarBorder, }: UpcomingWorkoutCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { UpcomingWorkoutsProps } from './types';
2
- export declare const UpcomingWorkouts: ({ workouts }: UpcomingWorkoutsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const UpcomingWorkouts: ({ workouts, avatarBorder, }: UpcomingWorkoutsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -4,6 +4,8 @@ export interface UpcomingWorkoutCardProps {
4
4
  workoutTime: string;
5
5
  renderDetails: () => React.ReactNode;
6
6
  onClick?: () => void;
7
+ /** Shows a border around the avatar. @default false */
8
+ avatarBorder?: boolean;
7
9
  }
8
10
  export type Workout = {
9
11
  id: string;
@@ -18,4 +20,6 @@ export type Workout = {
18
20
  };
19
21
  export interface UpcomingWorkoutsProps {
20
22
  workouts: Array<Workout>;
23
+ /** Shows a border around the avatar in each workout card. @default false */
24
+ avatarBorder?: boolean;
21
25
  }
@@ -1,5 +1,8 @@
1
1
  import { User } from './types';
2
- declare const UserCard: ({ user }: {
2
+ interface UserCardProps {
3
3
  user: User | null;
4
- }) => import("@emotion/react/jsx-runtime").JSX.Element;
4
+ /** Shows a border around the avatar. @default false */
5
+ avatarBorder?: boolean;
6
+ }
7
+ declare const UserCard: ({ user, avatarBorder }: UserCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
5
8
  export default UserCard;
@@ -1,3 +1,7 @@
1
1
  import { User } from './types';
2
- declare const UserCardCredentials: ({ name, email, }: Partial<Pick<User, "name" | "email">>) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ interface UserCardCredentialsProps extends Partial<Pick<User, 'name' | 'email'>> {
3
+ /** Shows a border around the avatar. @default false */
4
+ avatarBorder?: boolean;
5
+ }
6
+ declare const UserCardCredentials: ({ name, email, avatarBorder, }: UserCardCredentialsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
3
7
  export default UserCardCredentials;
package/dist/index.js CHANGED
@@ -21330,7 +21330,8 @@ const UpcomingWorkoutCard = ({
21330
21330
  title,
21331
21331
  workoutTime,
21332
21332
  renderDetails,
21333
- onClick
21333
+ onClick,
21334
+ avatarBorder = false
21334
21335
  }) => {
21335
21336
  const theme = (0,react_namespaceObject.useTheme)();
21336
21337
  return (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Card, {
@@ -21338,8 +21339,9 @@ const UpcomingWorkoutCard = ({
21338
21339
  children: (0,jsx_runtime_namespaceObject.jsxs)(core_namespaceObject.Wrapper, {
21339
21340
  direction: "row",
21340
21341
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Avatar, {
21341
- size: 42,
21342
- image: image
21342
+ size: core_namespaceObject.AvatarSizes.large,
21343
+ image: image,
21344
+ border: avatarBorder
21343
21345
  }), (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.CardContent, {
21344
21346
  css: UpcomingWorkoutCard_ref,
21345
21347
  children: (0,jsx_runtime_namespaceObject.jsxs)(core_namespaceObject.Wrapper, {
@@ -21381,7 +21383,8 @@ const UpcomingWorkoutCard = ({
21381
21383
 
21382
21384
 
21383
21385
  const UpcomingWorkouts = ({
21384
- workouts
21386
+ workouts,
21387
+ avatarBorder
21385
21388
  }) => (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.CardList, {
21386
21389
  title: "Upcoming Workout",
21387
21390
  items: workouts,
@@ -21390,6 +21393,7 @@ const UpcomingWorkouts = ({
21390
21393
  title: workout.title,
21391
21394
  workoutTime: workout.workoutTime,
21392
21395
  onClick: workout.handleClick,
21396
+ avatarBorder: avatarBorder,
21393
21397
  renderDetails: () => (0,jsx_runtime_namespaceObject.jsxs)(external_react_namespaceObject.Fragment, {
21394
21398
  children: [(0,jsx_runtime_namespaceObject.jsx)("strong", {
21395
21399
  children: workout.details.exercises
@@ -21754,7 +21758,8 @@ const ListGoalsCard = ({
21754
21758
  image,
21755
21759
  title,
21756
21760
  details,
21757
- progressProps
21761
+ progressProps,
21762
+ avatarBorder = false
21758
21763
  }) => {
21759
21764
  const {
21760
21765
  size = 50,
@@ -21768,8 +21773,9 @@ const ListGoalsCard = ({
21768
21773
  children: (0,jsx_runtime_namespaceObject.jsxs)(core_namespaceObject.Wrapper, {
21769
21774
  direction: "row",
21770
21775
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Avatar, {
21771
- size: 42,
21776
+ size: core_namespaceObject.AvatarSizes.large,
21772
21777
  image: image,
21778
+ border: avatarBorder,
21773
21779
  css: ListGoalsCard_ref2
21774
21780
  }), (0,jsx_runtime_namespaceObject.jsxs)(core_namespaceObject.CardContent, {
21775
21781
  css: ListGoalsCard_ref,
@@ -21806,7 +21812,8 @@ const ListGoalsCard = ({
21806
21812
  * UI Component that uses CardList to render a list of goals
21807
21813
  */
21808
21814
  const ListGoals = ({
21809
- goals
21815
+ goals,
21816
+ avatarBorder
21810
21817
  }) => {
21811
21818
  return (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.CardList, {
21812
21819
  title: "Goals",
@@ -21818,7 +21825,8 @@ const ListGoals = ({
21818
21825
  progressProps: {
21819
21826
  currentValue: goal.completion,
21820
21827
  color: goal.color
21821
- }
21828
+ },
21829
+ avatarBorder: avatarBorder
21822
21830
  })
21823
21831
  });
21824
21832
  };
@@ -21887,7 +21895,8 @@ const MealPlannerCard = ({
21887
21895
  image,
21888
21896
  carbs,
21889
21897
  protein,
21890
- fat
21898
+ fat,
21899
+ avatarBorder = false
21891
21900
  }) => {
21892
21901
  const listItems = {
21893
21902
  carbs,
@@ -21897,8 +21906,9 @@ const MealPlannerCard = ({
21897
21906
  return (0,jsx_runtime_namespaceObject.jsxs)(core_namespaceObject.Wrapper, {
21898
21907
  css: MealPlannerCard_ref2,
21899
21908
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Avatar, {
21900
- size: 64,
21901
- image: image
21909
+ size: core_namespaceObject.AvatarSizes.large,
21910
+ image: image,
21911
+ border: avatarBorder
21902
21912
  }), (0,jsx_runtime_namespaceObject.jsxs)("div", {
21903
21913
  css: MealPlannerCard_ref,
21904
21914
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Typography, {
@@ -21949,7 +21959,8 @@ var MealPlanner_ref2 = true ? {
21949
21959
  styles: "line-height:normal"
21950
21960
  } : 0;
21951
21961
  const MealPlanner = ({
21952
- data
21962
+ data,
21963
+ avatarBorder
21953
21964
  }) => {
21954
21965
  const [selectedOption, setSelectedOption] = (0,external_react_namespaceObject.useState)(null);
21955
21966
  const [options, setOptions] = (0,external_react_namespaceObject.useState)([]);
@@ -22009,7 +22020,8 @@ const MealPlanner = ({
22009
22020
  id,
22010
22021
  ...props
22011
22022
  }) => (0,jsx_runtime_namespaceObject.jsx)(MealPlannerCard, {
22012
- ...props
22023
+ ...props,
22024
+ avatarBorder: avatarBorder
22013
22025
  }, id))
22014
22026
  })
22015
22027
  })]
@@ -22168,14 +22180,16 @@ var UserCardCredentials_ref2 = true ? {
22168
22180
  } : 0;
22169
22181
  const UserCardCredentials = ({
22170
22182
  name,
22171
- email
22183
+ email,
22184
+ avatarBorder = false
22172
22185
  }) => (0,jsx_runtime_namespaceObject.jsxs)("div", {
22173
22186
  css: UserCardCredentials_container,
22174
22187
  children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
22175
22188
  css: UserCardCredentials_ref2,
22176
22189
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Avatar, {
22177
- size: 42,
22178
- image: 'https://firebasestorage.googleapis.com/v0/b/admin-themes.appspot.com/o/img%2Fface%2Fface_46.png?alt=media&token=aaa3a75c-4779-4887-b011-352f8dd6c214'
22190
+ size: core_namespaceObject.AvatarSizes.large,
22191
+ image: 'https://firebasestorage.googleapis.com/v0/b/admin-themes.appspot.com/o/img%2Fface%2Fface_46.png?alt=media&token=aaa3a75c-4779-4887-b011-352f8dd6c214',
22192
+ border: avatarBorder
22179
22193
  }), (0,jsx_runtime_namespaceObject.jsxs)("div", {
22180
22194
  css: UserCardCredentials_ref,
22181
22195
  children: [(0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.Typography, {
@@ -22209,7 +22223,8 @@ var UserCard_ref = true ? {
22209
22223
  styles: "cursor:pointer"
22210
22224
  } : 0;
22211
22225
  const UserCard = ({
22212
- user
22226
+ user,
22227
+ avatarBorder
22213
22228
  }) => (0,jsx_runtime_namespaceObject.jsxs)(external_react_namespaceObject.Fragment, {
22214
22229
  children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
22215
22230
  css: UserCard_container,
@@ -22225,7 +22240,8 @@ const UserCard = ({
22225
22240
  })
22226
22241
  }), (0,jsx_runtime_namespaceObject.jsx)(UserCard_UserCardCredentials, {
22227
22242
  name: user?.name,
22228
- email: user?.email
22243
+ email: user?.email,
22244
+ avatarBorder: avatarBorder
22229
22245
  })]
22230
22246
  }), (0,jsx_runtime_namespaceObject.jsx)(UserCard_UserCardBMI, {
22231
22247
  weight: user?.weight,
@@ -22584,10 +22600,17 @@ const BalancePieChart = (0,react_namespaceObject.withTheme)(({
22584
22600
  }
22585
22601
  return isSaved;
22586
22602
  });
22603
+ const isAllValuesZero = data.length > 0 && chartData.length === 0;
22587
22604
  const chartColors = (chartColorPalette || pieChartColors).filter((item, index) => !filteredIndexes.includes(index));
22588
- if (chartColors.length < chartData.length) {
22589
- for (let i = 0; i < chartData.length - chartColors.length; i++) {
22590
- chartColors.push(core_namespaceObject.mainTheme.colors.purpleLighter);
22605
+ const chartDataWithZeroFallback = isAllValuesZero ? [{
22606
+ id: '__zero__',
22607
+ value: 1,
22608
+ label: '__zero__'
22609
+ }] : chartData;
22610
+ const chartColorsWithZeroFallback = isAllValuesZero ? [theme.palette.secondary.dark] : chartColors;
22611
+ if (chartColorsWithZeroFallback.length < chartDataWithZeroFallback.length) {
22612
+ for (let i = 0; i < chartDataWithZeroFallback.length - chartColorsWithZeroFallback.length; i++) {
22613
+ chartColorsWithZeroFallback.push(core_namespaceObject.mainTheme.colors.purpleLighter);
22591
22614
  }
22592
22615
  }
22593
22616
  if (Object.keys(pieChartProps.cardProps || {}).length) {
@@ -22602,9 +22625,9 @@ const BalancePieChart = (0,react_namespaceObject.withTheme)(({
22602
22625
  onFullscreenModeChange?.(pieChartFullscreenMode);
22603
22626
  };
22604
22627
  return (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.PieChart, {
22605
- data: chartData,
22628
+ data: chartDataWithZeroFallback,
22606
22629
  features: Array.from(featuresList),
22607
- colors: chartColors,
22630
+ colors: chartColorsWithZeroFallback,
22608
22631
  onFullscreenModeChange: handleFullscreenModeChange,
22609
22632
  animate: false,
22610
22633
  title: (0,jsx_runtime_namespaceObject.jsx)(BalancePieChartTitle, {}),