Skip to content

Commit

Permalink
chore(web-components): add missing exports and cleanup options (#32405)
Browse files Browse the repository at this point in the history
  • Loading branch information
davatron5000 authored Aug 28, 2024
1 parent 29373ad commit e15398a
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: add missing exports for LinkStyles and MessageBar and remove default option from DividerApperance and ImageFit",
"packageName": "@fluentui/web-components",
"email": "rupertdavid@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,29 @@ Fluent UI Web Components takes a "bring your own polyfill" approach so that proj

Here's a list of features we're leveraging and their current [Baseline](https://web.dev/baseline) browser support.

| | Chrome | Edge | Firefox | Safari |
| ---------------------- | ------ | ---- | ------- | ------ |
| HTML Popover Attribute | 114 | 114 | 125 | 17 |
| CSS Anchor Positioning | 125 | 125 |||
<table>
<tr>
<th></th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox</th>
<th>Safari</th>
</tr>
<tr>
<td>HTML Popover Attribute</td>
<td>114</td>
<td>114</td>
<td>125</td>
<td>17</td>
</tr>
<tr>
<td>CSS Anchor Positioning</td>
<td>125</td>
<td>125</td>
<td>❌</td>
<td>❌</td>
</tr>
</table>

## HTML Popover

Expand Down
1 change: 0 additions & 1 deletion packages/web-components/src/divider/divider.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const DividerAppearance = {
strong: 'strong',
brand: 'brand',
subtle: 'subtle',
default: 'default',
} as const;

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/divider/divider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ test.describe('Divider', () => {
await expect(element).toHaveJSProperty('alignContent', 'end');

await element.evaluate((node: Divider) => {
node.appearance = 'default';
node.appearance = undefined;
});

await expect(element).toHaveJSProperty('appearance', 'default');
await expect(element).not.toHaveJSProperty('appearance', 'default');

await element.evaluate((node: Divider) => {
node.appearance = 'strong';
Expand Down
13 changes: 7 additions & 6 deletions packages/web-components/src/divider/divider.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ export default {
title: 'Components/Divider',
args: {
content: 'Section One',
alignContent: undefined,
alignContent: DividerAlignContent.center,
appearance: undefined,
inset: false,
orientation: undefined,
orientation: DividerOrientation.horizontal,
role: DividerRole.separator,
},
argTypes: {
content: {
Expand All @@ -70,7 +71,7 @@ export default {
summary: 'Fluent v9. Determines the alignment of the content within the divider.',
},
defaultValue: {
summary: 'undefined',
summary: DividerAlignContent.center,
},
},
options: Object.values(DividerAlignContent),
Expand All @@ -88,7 +89,7 @@ export default {
summary: 'undefined',
},
},
options: Object.values(DividerAppearance),
options: ['undefined', ...Object.values(DividerAppearance)],
control: {
type: 'select',
},
Expand All @@ -100,7 +101,7 @@ export default {
summary: 'Inherited from FASTDivider. Aria role for the divider.',
},
defaultValue: {
summary: 'separator',
summary: DividerRole.separator,
},
},
options: Object.values(DividerRole),
Expand Down Expand Up @@ -129,7 +130,7 @@ export default {
'Inherited from FASTDivider. Layout can be horizontal or vertical. Adds aria-orientation to component.',
},
defaultValue: {
summary: undefined,
summary: DividerOrientation.horizontal,
},
},
options: Object.values(DividerOrientation),
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/divider/divider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class Divider extends BaseDivider {
* Adds padding to the beginning and end of the divider.
*/
@attr({ mode: 'boolean' })
public inset?: boolean = false;
public inset?: boolean;

/**
* Handles changes to inset custom states
Expand Down
1 change: 0 additions & 1 deletion packages/web-components/src/image/image.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const ImageFit = {
center: 'center',
contain: 'contain',
cover: 'cover',
default: 'default',
} as const;
/**
* Types for image fit
Expand Down
6 changes: 3 additions & 3 deletions packages/web-components/src/image/image.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
block: false,
bordered: false,
shadow: false,
fit: ImageFit.default,
fit: undefined,
shape: ImageShape.square,
},
argTypes: {
Expand Down Expand Up @@ -62,10 +62,10 @@ export default {
description: 'Determines how the image will be scaled and positioned within its parent container.',
table: {
defaultValue: {
summary: 'default',
summary: 'undefined',
},
},
options: Object.values(ImageFit),
options: ['undefined', ...Object.values(ImageFit)],
control: 'select',
},
role: {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Image extends FASTElement {
* HTML attribute: block.
*/
@attr({ mode: 'boolean' })
public block?: boolean = false;
public block?: boolean;

/**
* Handles changes to block custom states
Expand Down
11 changes: 10 additions & 1 deletion packages/web-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export {
accordionStyles,
accordionTemplate,
} from './accordion/index.js';
export { Link, LinkAppearance, LinkDefinition, LinkTemplate, LinkTarget } from './link/index.js';
export { Link, LinkAppearance, LinkDefinition, LinkTemplate, LinkStyles, LinkTarget } from './link/index.js';
export {
Avatar,
AvatarActive,
Expand Down Expand Up @@ -127,6 +127,15 @@ export {
AnchorButtonTemplate,
AnchorTarget,
} from './anchor-button/index.js';
export {
MessageBar,
MessageBarDefinition,
MessageBarIntent,
MessageBarLayout,
MessageBarShape,
MessageBarStyles,
MessageBarTemplate,
} from './message-bar/index.js';
export {
MenuButton,
MenuButtonAppearance,
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/src/link/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { definition as LinkDefinition } from './link.definition.js';
export { Link } from './link.js';
export { LinkAppearance, LinkTarget } from './link.options.js';
export { styles as LinkStyles } from './link.styles.js';
export { template as LinkTemplate } from './link.template.js';
4 changes: 1 addition & 3 deletions packages/web-components/src/link/link.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ export const styles = css`
font-family: ${fontFamilyBase};
font-size: ${fontSizeBase300};
font-weight: ${fontWeightRegular};
margin: 0;
padding: 0;
overflow: inherit;
text-align: left;
text-align: start;
text-decoration: none;
text-decoration-thinkness: ${strokeWidthThin};
text-overflow: inherit;
Expand Down
8 changes: 4 additions & 4 deletions packages/web-components/src/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ export class Menu extends FASTElement {
* @public
*/
@attr({ attribute: 'open-on-hover', mode: 'boolean' })
public openOnHover?: boolean = false;
public openOnHover?: boolean;

/**
* Determines if the menu should open on right click.
* @public
*/
@attr({ attribute: 'open-on-context', mode: 'boolean' })
public openOnContext?: boolean = false;
public openOnContext?: boolean;

/**
* Determines if the menu should close on scroll.
* @public
*/
@attr({ attribute: 'close-on-scroll', mode: 'boolean' })
public closeOnScroll?: boolean = false;
public closeOnScroll?: boolean;

/**
* Determines if the menu open state should persis on click of menu item
* @public
*/
@attr({ attribute: 'persist-on-item-click', mode: 'boolean' })
public persistOnItemClick?: boolean = false;
public persistOnItemClick?: boolean;

/**
* Holds the slotted menu list.
Expand Down

0 comments on commit e15398a

Please sign in to comment.