Skip to content

Commit c0184cc

Browse files
feat(VariantManagement): introduce size prop & improve docs (#6166)
Co-authored-by: Marcus Notheis <[email protected]>
1 parent 80c9a65 commit c0184cc

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

packages/main/src/components/VariantManagement/VariantManagement.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
display: flex;
33
align-items: center;
44
text-align: center;
5+
flex-wrap: nowrap;
56
}
67

78
.title {
89
cursor: pointer;
910
color: var(--sapLinkColor);
10-
text-shadow: none;
11+
text-shadow: var(--sapContent_TextShadow);
1112

1213
&:hover {
1314
color: var(--sapLink_Hover_Color);

packages/main/src/components/VariantManagement/index.tsx

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,42 @@ import type { VariantItemPropTypes } from './VariantItem.js';
3737
import { classNames, styleData } from './VariantManagement.module.css.js';
3838

3939
/**
40-
* The `VariantManagement` component can be used to manage variants, such as FilterBar variants or AnalyticalTable variants.
40+
* The VariantManagement can be used to manage variants (views). You can use this component to create and maintain personalization changes.
41+
*
42+
* __Note:__ On the user interface, variants are generally referred to as "views".
43+
*
44+
* ### Matching header styles
45+
*
46+
* To ensure consistent header styles for different use-cases of the `VariantManagement`, we recommend setting the following styles to the `ui5-title` component:
47+
*
48+
* #### DynamicPage & ObjectPage
49+
*
50+
* - `font-family: var(--sapObjectHeader_Title_FontFamily);`
51+
*
52+
* __Header expanded__
53+
*
54+
* - `font-size: var(--sapObjectHeader_Title_FontSize);`
55+
*
56+
* __Header collapsed/snapped__
57+
*
58+
* - `font-size: var(--sapObjectHeader_Title_SnappedFontSize);`
59+
*
60+
* #### Tables
61+
*
62+
* - `font-size: var(--sapGroup_Title_FontSize);`
63+
*
64+
* #### Example
65+
*
66+
* ```css
67+
* .variantManagement [data-component-name="VariantManagementTitle"] {
68+
* font-family: var(--sapObjectHeader_Title_FontFamily);
69+
* font-size: var(--sapObjectHeader_Title_FontSize);
70+
* }
71+
* ```
72+
* ```jsx
73+
* <VariantManagement className="variantManagement">
74+
* ```
75+
*
4176
*/
4277
const VariantManagement = forwardRef<HTMLDivElement, VariantManagementPropTypes>((props, ref) => {
4378
const i18nBundle = useI18nBundle('@ui5/webcomponents-react');
@@ -47,6 +82,7 @@ const VariantManagement = forwardRef<HTMLDivElement, VariantManagementPropTypes>
4782
style,
4883
placement = PopoverPlacement.Bottom,
4984
level = TitleLevel.H4,
85+
size = TitleLevel.H4,
5086
onSelect,
5187
closeOnItemSelect,
5288
disabled,
@@ -292,7 +328,7 @@ const VariantManagement = forwardRef<HTMLDivElement, VariantManagementPropTypes>
292328
}}
293329
>
294330
<FlexBox onClick={disabled ? undefined : handleOpenVariantManagement}>
295-
<Title level={level} className={classNames.title}>
331+
<Title level={level} size={size} className={classNames.title} data-component-name="VariantManagementTitle">
296332
{selectedVariant?.children}
297333
</Title>
298334
{dirtyState && <div className={dirtyStateClasses}>{dirtyStateText}</div>}

packages/main/src/components/VariantManagement/types.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export interface VariantManagementPropTypes extends Omit<CommonProps, 'onSelect'
2626
children?: ReactNode | ReactNode[];
2727
/**
2828
* Determines on which side the VariantManagement popover is placed at.
29+
*
30+
* @default Bottom
2931
*/
3032
placement?: ResponsivePopoverPropTypes['placement'];
3133
/**
@@ -39,9 +41,17 @@ export interface VariantManagementPropTypes extends Omit<CommonProps, 'onSelect'
3941
*/
4042
closeOnItemSelect?: boolean;
4143
/**
42-
* Describes the `HTML Title` level of the variants.
44+
* Describes the `Title` HTML level (H1 - H6) of the selected variant. This property doesn't influence the style of the component, you can use the `size` prop for this purpose.
45+
*
46+
* @default H4
4347
*/
4448
level?: TitlePropTypes['level'];
49+
/**
50+
* Describes the `Title`'s `size` of the selected variant.
51+
*
52+
* @default H4
53+
*/
54+
size?: TitlePropTypes['size'];
4555
/**
4656
* Defines whether the VariantManagement is disabled.
4757
*/
@@ -54,6 +64,8 @@ export interface VariantManagementPropTypes extends Omit<CommonProps, 'onSelect'
5464
dirtyState?: boolean;
5565
/**
5666
* Text for the dirty state indicator.
67+
*
68+
* @default *
5769
*/
5870
dirtyStateText?: string;
5971
/**

0 commit comments

Comments
 (0)