Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharzil committed Feb 26, 2025
2 parents ec31df8 + 1664fca commit 9b02b2c
Show file tree
Hide file tree
Showing 21 changed files with 491 additions and 60 deletions.
11 changes: 11 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.29.0](https://github.com/mondaycom/vibe/compare/@vibe/core@3.28.2...@vibe/core@3.29.0) (2025-02-24)


### Features

* **List:** add role props ([#2771](https://github.com/mondaycom/vibe/issues/2771)) ([a079690](https://github.com/mondaycom/vibe/commit/a07969084be9088801263eac29d65aa344adf040))





## [3.28.2](https://github.com/mondaycom/vibe/compare/@vibe/core@3.28.1...@vibe/core@3.28.2) (2025-02-19)


Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vibe/core",
"version": "3.28.2",
"version": "3.29.0",
"description": "Official monday.com UI resources for application development in React.js",
"repository": {
"type": "git",
Expand Down
34 changes: 17 additions & 17 deletions packages/core/src/components/Avatar/__stories__/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default {
export const Overview = {
render: avatarTemplate.bind({}),
name: "Overview",

args: {
size: "large",
src: window.location.origin + "/" + person1,
Expand All @@ -87,54 +86,54 @@ export const Overview = {

export const Size = {
render: () => (
<>
<Flex gap="medium">
<Avatar size="xs" src={person1} type="img" ariaLabel="Julia Martinez" />
<Avatar size="small" src={person1} type="img" ariaLabel="Julia Martinez" />
<Avatar size="medium" src={person1} type="img" ariaLabel="Julia Martinez" />
<Avatar size="large" src={person1} type="img" ariaLabel="Julia Martinez" />
</>
</Flex>
)
};

export const Disable = {
render: () => (
<>
<Flex gap="medium">
<Avatar size="xs" src={person1} type="img" disabled />
<Avatar size="small" src={person1} type="img" disabled />
<Avatar size="medium" src={person1} type="img" disabled />
<Avatar size="large" src={person1} type="img" disabled />
</>
</Flex>
)
};

export const AvatarWithText = {
render: () => (
<>
<Flex gap="medium">
<Avatar size="xs" type="text" text="RM" backgroundColor="lipstick" ariaLabel="Ron Meir" />
<Avatar size="small" type="text" text="RM" backgroundColor="lipstick" ariaLabel="Ron Meir" />
<Avatar size="medium" type="text" text="RM" backgroundColor="lipstick" ariaLabel="Ron Meir" />
<Avatar size="large" type="text" text="RM" backgroundColor="done-green" ariaLabel="Ron Meir" />
</>
</Flex>
)
};

export const SquareAvatar = {
render: () => (
<>
<Flex gap="medium">
<Avatar size="xs" type="text" text="R" backgroundColor="bright-blue" square ariaLabel="Ron" />
<Avatar size="small" type="text" text="R" backgroundColor="bright-blue" square ariaLabel="Ron" />
<Avatar size="medium" type="icon" icon={WhatsNew} backgroundColor="aquamarine" square ariaLabel="Present" />
<Avatar size="large" type="text" text="RM" backgroundColor="working_orange" square ariaLabel="Ron Meir" />
</>
</Flex>
)
};

export const AvatarWithRightBadge = {
render: () => (
<>
<Flex gap="medium">
<Avatar size="large" type="img" src={person1} bottomRightBadgeProps={{ src: guest }} ariaLabel="Julia Martinez" />
<Avatar size="large" type="img" src={person1} bottomRightBadgeProps={{ src: owner }} ariaLabel="Julia Martinez" />
</>
</Flex>
),
parameters: {
docs: {
Expand All @@ -147,11 +146,10 @@ export const AvatarWithRightBadge = {

export const AvatarWithLeftBadge = {
render: () => (
<>
{" "}
<Flex gap="medium">
<Avatar size="large" type="img" src={person1} bottomLeftBadgeProps={{ src: home }} ariaLabel="Julia Martinez" />
<Avatar size="large" type="img" src={person1} bottomLeftBadgeProps={{ src: minus }} ariaLabel="Julia Martinez" />
</>
</Flex>
),
parameters: {
docs: {
Expand Down Expand Up @@ -211,9 +209,11 @@ export const ClickableAvatar = {
}, []);

return (
<Flex direction="column" gap="medium">
<Avatar size="large" type="img" src={person1} ariaLabel="Julia Martinez" onClick={incrementCount} />
<Counter count={count} />
<Flex>
<Flex direction="column" gap="medium">
<Avatar size="large" type="img" src={person1} ariaLabel="Julia Martinez" onClick={incrementCount} />
<Counter count={count} />
</Flex>
</Flex>
);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import TableHeaderCell from "../../Table/TableHeaderCell/TableHeaderCell";
import TableBody from "../../Table/TableBody/TableBody";
import TableRow from "../../Table/TableRow/TableRow";
import TableCell from "../../Table/TableCell/TableCell";
import styles from "./AvatarGroup.stories.module.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: AvatarGroup
Expand Down Expand Up @@ -48,7 +47,7 @@ export default {
parameters: {
docs: {
liveEdit: {
scope: { styles, StoryDescription, person1, person2, person3 }
scope: { StoryDescription, person1, person2, person3, person4 }
}
}
}
Expand Down Expand Up @@ -89,6 +88,9 @@ export const Overview: StoryObj<typeof avatarGroupTemplate> = {
person4: window.location.origin + "/" + person4
}
},
argTypes: {
persons: { table: { disable: true } }
},
parameters: {
docs: {
liveEdit: {
Expand Down Expand Up @@ -239,7 +241,7 @@ export const MaxAvatarsToDisplay: Story = {
const [max, setMax] = useState(4);

return (
<Flex direction="column" gap="medium" align="start" className={styles.sliderCountContainer}>
<Flex direction="column" gap="medium" align="start" style={{ width: "100%" }}>
<Slider
size="small"
min={1}
Expand Down
50 changes: 50 additions & 0 deletions packages/core/src/components/BaseListItem/BaseListItem.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.wrapper {
display: flex;
align-items: center;
gap: var(--spacing-xs);
border-radius: var(--border-radius-small);
color: var(--primary-text-color);

&:hover:not(.disabled), &.highlighted {
background-color: var(--primary-background-hover-color);
}

&.disabled {
color: var(--disabled-text-color);
}

&.selected {
background-color: var(--primary-selected-color);

&:hover, &.highlighted {
background-color: var(--primary-selected-hover-color);
}
}

&.small {
padding: 6px 8px;
}

&.medium {
padding: 10px 12px;
}

&.large {
padding: 14px 12px;
}

.avatar,
.icon{
flex-shrink: 0;
}

.indent {
width: 20px;
}

.endElement {
padding-inline-start: var(--spacing-small);
margin-inline-start: auto;
display: flex;
}
}
64 changes: 64 additions & 0 deletions packages/core/src/components/BaseListItem/BaseListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { forwardRef, useMemo } from "react";
import cx from "classnames";
import styles from "./BaseListItem.module.scss";
import { getStyle } from "../../helpers/typesciptCssModulesHelper";
import Text from "../Text/Text";
import { BaseListItemProps } from "./BaseListItem.types";
import { VibeComponent } from "../../types";
import { Tooltip } from "../Tooltip";
import { TextType } from "../Text";
import { renderSideElement } from "./utils";

const BaseListItem: VibeComponent<BaseListItemProps, HTMLLIElement> = forwardRef(
(
{
label,
size = "medium",
selected,
disabled,
startElement,
endElement,
highlighted,
tooltipProps = {},
className,
rtl = false,
id,
role = "option",
...rest
}: BaseListItemProps,
ref
) => {
const listItemClassNames = useMemo(
() =>
cx(
styles.wrapper,
{
[styles.selected]: selected,
[styles.disabled]: disabled,
[styles.highlighted]: highlighted
},
getStyle(styles, size),
className
),
[selected, disabled, highlighted, size, className]
);

const textVariant: TextType = size === "small" ? "text2" : "text1";

return (
<Tooltip {...tooltipProps} content={tooltipProps?.content} position={rtl ? "left" : "right"}>
<li id={id} ref={ref} className={listItemClassNames} role={role} {...rest}>
{startElement && renderSideElement(startElement, disabled, textVariant)}
<Text type={textVariant} color="inherit">
{label}
</Text>
{endElement && (
<div className={styles.endElement}>{renderSideElement(endElement, disabled, textVariant)}</div>
)}
</li>
</Tooltip>
);
}
);

export default BaseListItem;
63 changes: 63 additions & 0 deletions packages/core/src/components/BaseListItem/BaseListItem.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, { ReactNode, AriaRole } from "react";
import { SubIcon, VibeComponentProps } from "../../types";
import { TooltipProps } from "../Tooltip";

export interface BaseListItemProps extends React.LiHTMLAttributes<HTMLLIElement>, VibeComponentProps {
value?: string;
/**
* Primary text content of the list item
*/
label: string;
/**
* Size of the list item. Will influence the padding and font size.
*/
size?: BaseListItemSizes;
/**
* Indicates whether the list item is selected.
*/
selected?: boolean;
/**
* Indicates whether the list item is disabled.
*/
disabled?: boolean;
/**
* Element to render at the start of the list item.
* Can be an avatar, icon, inset or a custom rendered element.
*/
startElement?: StartElement;
/**
* Element to render at the end of the list item.
* Can be an icon, suffix, or a custom rendered element.
*/
endElement?: EndElement;
/**
* Whether item should have highlight styling
*/
highlighted?: boolean;
/**
* Use when there's a need to display a tooltip on the list item (e.g., explain why disabled).
*/
tooltipProps?: Partial<TooltipProps>;
/**
* determines the position of the tooltip according to the direction.
*/
rtl?: boolean;
/**
* ARIA role for the list item.
*/
role?: AriaRole;
index?: number;
}

export type BaseListItemSizes = "small" | "medium" | "large";

export type SideElement =
| { type: "avatar"; value: string; square?: boolean }
| { type: "icon"; value: SubIcon }
| { type: "indent" }
| { type: "suffix"; value: string }
| { type: "custom"; render: () => ReactNode };

export type StartElement = Extract<SideElement, { type: "avatar" | "icon" | "indent" | "custom" }>;

export type EndElement = Extract<SideElement, { type: "icon" | "suffix" | "custom" }>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { createStoryMetaSettingsDecorator } from "../../../storybook";
import { createComponentTemplate } from "vibe-storybook-components";
import BaseListItem from "../BaseListItem";
import { Meta, StoryObj } from "@storybook/react";

type Story = StoryObj<typeof BaseListItem>;

const metaSettings = createStoryMetaSettingsDecorator({
component: BaseListItem
});

export default {
title: "Internal/BaseListItem",
component: BaseListItem,
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators,
tags: ["internal"]
} satisfies Meta<typeof BaseListItem>;

const baseListItemTemplate = createComponentTemplate(BaseListItem);
import { Email } from "@vibe/icons";
import person1 from "./person1.png";

export const Overview: Story = {
render: baseListItemTemplate.bind({}),
args: {
label: "This is a list item",
startElement: { type: "avatar", value: person1 },
endElement: { type: "icon", value: Email },
tooltipProps: { content: "tooltip content" }
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9b02b2c

Please sign in to comment.