@fluentui/web-components 2.0.1 → 2.1.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +38 -2
  3. package/dist/dts/anchor/anchor.stories.d.ts +1 -1
  4. package/dist/dts/badge/badge.stories.d.ts +1 -1
  5. package/dist/dts/button/button.stories.d.ts +1 -1
  6. package/dist/dts/calendar/calendar.stories.d.ts +86 -0
  7. package/dist/dts/calendar/calendar.styles.d.ts +7 -0
  8. package/dist/dts/calendar/index.d.ts +18 -0
  9. package/dist/dts/custom-elements.d.ts +13 -11
  10. package/dist/dts/menu/menu.stories.d.ts +1 -1
  11. package/dist/dts/text-area/text-area.stories.d.ts +1 -1
  12. package/dist/dts/text-field/text-field.stories.d.ts +1 -1
  13. package/dist/dts/tooltip/tooltip.stories.d.ts +1 -1
  14. package/dist/esm/accordion/accordion-item/accordion-item.styles.js +6 -5
  15. package/dist/esm/calendar/calendar.stories.js +115 -0
  16. package/dist/esm/calendar/calendar.styles.js +133 -0
  17. package/dist/esm/calendar/index.js +31 -0
  18. package/dist/esm/checkbox/checkbox.styles.js +0 -1
  19. package/dist/esm/custom-elements.js +3 -1
  20. package/dist/esm/divider/divider.styles.js +1 -2
  21. package/dist/esm/flipper/flipper.styles.js +0 -1
  22. package/dist/esm/listbox/listbox.styles.js +5 -1
  23. package/dist/esm/listbox-option/listbox-option.styles.js +0 -1
  24. package/dist/esm/menu/menu.styles.js +9 -2
  25. package/dist/esm/menu-item/menu-item.styles.js +1 -2
  26. package/dist/esm/progress/progress/progress.styles.js +0 -1
  27. package/dist/esm/progress/progress-ring/progress-ring.styles.js +0 -1
  28. package/dist/esm/radio/radio.styles.js +0 -1
  29. package/dist/esm/radio-group/radio-group.styles.js +0 -2
  30. package/dist/esm/slider/slider.styles.js +0 -1
  31. package/dist/esm/switch/switch.styles.js +3 -3
  32. package/dist/esm/tabs/tabs.stories.js +56 -2
  33. package/dist/esm/tabs/tabs.styles.js +1 -0
  34. package/dist/fluent-web-components.api.json +141 -12
  35. package/dist/web-components.d.ts +12 -0
  36. package/dist/web-components.js +700 -20
  37. package/dist/web-components.min.js +147 -143
  38. package/docs/api-report.md +12 -7
  39. package/package.json +1 -1
@@ -0,0 +1,133 @@
1
+ import { css } from "@microsoft/fast-element";
2
+ import { display, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
3
+ import { SystemColors } from '@microsoft/fast-web-utilities';
4
+ import { accentFillRest, baseHeightMultiplier, bodyFont, controlCornerRadius, density, designUnit, fillColor, foregroundOnAccentRest, neutralForegroundHint, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { DirectionalStyleSheetBehavior } from '../styles';
6
+ /**
7
+ * LTR styles for calendar
8
+ * @internal
9
+ */
10
+ const ltrStyles = css `
11
+ .day.disabled::before {
12
+ transform: translate(-50%, 0) rotate(45deg);
13
+ }
14
+ `;
15
+ /**
16
+ * RTL styles for calendar
17
+ * @internal
18
+ */
19
+ const rtlStyles = css `
20
+ .day.disabled::before {
21
+ transform: translate(50%, 0) rotate(-45deg);
22
+ }
23
+ `;
24
+ /**
25
+ * Styles for calendar
26
+ * @public
27
+ */
28
+ export const calendarStyles = (context, definition) => css `
29
+ ${display("inline-block")} :host {
30
+ --calendar-cell-size: calc((${baseHeightMultiplier} + 2 + ${density}) * ${designUnit} * 1px);
31
+ --calendar-gap: 2px;
32
+ font-family: ${bodyFont};
33
+ font-size: ${typeRampBaseFontSize};
34
+ line-height: ${typeRampBaseLineHeight};
35
+ color: ${neutralForegroundRest};
36
+ }
37
+
38
+ .title {
39
+ padding: calc(${designUnit} * 2px);
40
+ font-weight: 600;
41
+ }
42
+
43
+ .days {
44
+ text-align: center;
45
+ }
46
+
47
+ .week-days,
48
+ .week {
49
+ display: grid;
50
+ grid-template-columns: repeat(7, 1fr);
51
+ grid-gap: var(--calendar-gap);
52
+ border: 0;
53
+ padding: 0;
54
+ }
55
+
56
+ .day,
57
+ .week-day {
58
+ border: 0;
59
+ width: var(--calendar-cell-size);
60
+ height: var(--calendar-cell-size);
61
+ line-height: var(--calendar-cell-size);
62
+ padding: 0;
63
+ box-sizing: initial;
64
+ }
65
+
66
+ .week-day {
67
+ font-weight: 600;
68
+ }
69
+
70
+ .day {
71
+ border: calc(${strokeWidth} * 1px) solid transparent;
72
+ border-radius: calc(${controlCornerRadius} * 1px);
73
+ }
74
+
75
+ .interact .day {
76
+ cursor: pointer;
77
+ }
78
+
79
+ .date {
80
+ height: 100%;
81
+ }
82
+
83
+ .inactive .date,
84
+ .inactive.disabled::before {
85
+ color: ${neutralForegroundHint};
86
+ }
87
+
88
+ .disabled::before {
89
+ content: '';
90
+ display: inline-block;
91
+ width: calc(var(--calendar-cell-size) * .8);
92
+ height: calc(${strokeWidth} * 1px);
93
+ background: currentColor;
94
+ position: absolute;
95
+ margin-top: calc(var(--calendar-cell-size) / 2);
96
+ transform-origin: center;
97
+ z-index: 1;
98
+ }
99
+
100
+ .selected {
101
+ color: ${accentFillRest};
102
+ border: 1px solid ${accentFillRest};
103
+ background: ${fillColor};
104
+ }
105
+
106
+ .selected + .selected {
107
+ border-start-start-radius: 0;
108
+ border-end-start-radius: 0;
109
+ border-inline-start-width: 0;
110
+ padding-inline-start: calc(var(--calendar-gap) + (${strokeWidth} + ${controlCornerRadius}) * 1px);
111
+ margin-inline-start: calc((${controlCornerRadius} * -1px) - var(--calendar-gap));
112
+ }
113
+
114
+ .today.disabled::before {
115
+ color: ${foregroundOnAccentRest};
116
+ }
117
+
118
+ .today .date {
119
+ color: ${foregroundOnAccentRest};
120
+ background: ${accentFillRest};
121
+ border-radius: 50%;
122
+ position: relative;
123
+ }
124
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
125
+ .day.selected {
126
+ color: ${SystemColors.Highlight};
127
+ }
128
+
129
+ .today .date {
130
+ background: ${SystemColors.Highlight};
131
+ color: ${SystemColors.HighlightText};
132
+ }
133
+ `), new DirectionalStyleSheetBehavior(ltrStyles, rtlStyles));
@@ -0,0 +1,31 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, booleanConverter } from '@microsoft/fast-element';
3
+ import { CalendarTitleTemplate, Calendar as FoundationCalendar, calendarTemplate as template, } from '@microsoft/fast-foundation';
4
+ import { calendarStyles as styles } from './calendar.styles';
5
+ /**
6
+ * Updated Calendar class that is readonly by default
7
+ */
8
+ export class Calendar extends FoundationCalendar {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.readonly = true;
12
+ }
13
+ }
14
+ __decorate([
15
+ attr({ converter: booleanConverter })
16
+ ], Calendar.prototype, "readonly", void 0);
17
+ /**
18
+ * The Fluent Calendar Element. Implements {@link @microsoft/fast-foundation#Calendar},
19
+ * {@link @microsoft/fast-foundation#calendarTemplate}
20
+ *
21
+ * @public
22
+ * @remarks
23
+ * HTML Element \<fluent-calendar\>
24
+ */
25
+ export const fluentCalendar = Calendar.compose({
26
+ baseName: 'calendar',
27
+ template,
28
+ styles,
29
+ title: CalendarTitleTemplate,
30
+ });
31
+ export { styles as calendarStyles };
@@ -7,7 +7,6 @@ export const checkboxStyles = (context, definition) => css `
7
7
  ${display('inline-flex')} :host {
8
8
  align-items: center;
9
9
  outline: none;
10
- margin: calc(${designUnit} * 1px) 0;
11
10
  ${
12
11
  /*
13
12
  * Chromium likes to select label text or the default slot when
@@ -5,6 +5,7 @@ import { fluentBadge } from './badge/index';
5
5
  import { fluentBreadcrumb } from './breadcrumb/index';
6
6
  import { fluentBreadcrumbItem } from './breadcrumb-item/index';
7
7
  import { fluentButton } from './button/index';
8
+ import { fluentCalendar } from './calendar/index';
8
9
  import { fluentCard } from './card/index';
9
10
  import { fluentCheckbox } from './checkbox/index';
10
11
  import { fluentCombobox } from './combobox/index';
@@ -34,7 +35,7 @@ import { fluentToolbar } from './toolbar/index';
34
35
  import { fluentTooltip } from './tooltip/index';
35
36
  import { fluentTreeView } from './tree-view/index';
36
37
  import { fluentTreeItem } from './tree-item/index';
37
- export { fluentAccordion, fluentAccordionItem, fluentAnchor, fluentAnchoredRegion, fluentBadge, fluentBreadcrumb, fluentBreadcrumbItem, fluentButton, fluentCard, fluentCheckbox, fluentCombobox, fluentDataGrid, fluentDataGridCell, fluentDataGridRow, fluentDesignSystemProvider, fluentDialog, fluentDivider, fluentFlipper, fluentHorizontalScroll, fluentListbox, fluentOption, fluentMenu, fluentMenuItem, fluentNumberField, fluentProgress, fluentProgressRing, fluentRadio, fluentRadioGroup, fluentSelect, fluentSkeleton, fluentSlider, fluentSliderLabel, fluentSwitch, fluentTabs, fluentTab, fluentTabPanel, fluentTextArea, fluentTextField, fluentToolbar, fluentTooltip, fluentTreeView, fluentTreeItem, };
38
+ export { fluentAccordion, fluentAccordionItem, fluentAnchor, fluentAnchoredRegion, fluentBadge, fluentBreadcrumb, fluentBreadcrumbItem, fluentButton, fluentCard, fluentCalendar, fluentCheckbox, fluentCombobox, fluentDataGrid, fluentDataGridCell, fluentDataGridRow, fluentDesignSystemProvider, fluentDialog, fluentDivider, fluentFlipper, fluentHorizontalScroll, fluentListbox, fluentOption, fluentMenu, fluentMenuItem, fluentNumberField, fluentProgress, fluentProgressRing, fluentRadio, fluentRadioGroup, fluentSelect, fluentSkeleton, fluentSlider, fluentSliderLabel, fluentSwitch, fluentTabs, fluentTab, fluentTabPanel, fluentTextArea, fluentTextField, fluentToolbar, fluentTooltip, fluentTreeView, fluentTreeItem, };
38
39
  /**
39
40
  * All Fluent UI Web Components
40
41
  * @public
@@ -48,6 +49,7 @@ export const allComponents = {
48
49
  fluentBreadcrumb,
49
50
  fluentBreadcrumbItem,
50
51
  fluentButton,
52
+ fluentCalendar,
51
53
  fluentCard,
52
54
  fluentCheckbox,
53
55
  fluentCombobox,
@@ -1,11 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { designUnit, neutralStrokeDividerRest, strokeWidth } from '../design-tokens';
3
+ import { neutralStrokeDividerRest, strokeWidth } from '../design-tokens';
4
4
  export const dividerStyles = (context, definition) => css `
5
5
  ${display('block')} :host {
6
6
  box-sizing: content-box;
7
7
  height: 0;
8
- margin: calc(${designUnit} * 1px) 0;
9
8
  border: none;
10
9
  border-top: calc(${strokeWidth} * 1px) solid ${neutralStrokeDividerRest};
11
10
  }
@@ -8,7 +8,6 @@ export const flipperStyles = (context, definition) => css `
8
8
  height: calc((${heightNumber} + ${designUnit}) * 1px);
9
9
  justify-content: center;
10
10
  align-items: center;
11
- margin: 0;
12
11
  fill: currentcolor;
13
12
  color: ${neutralFillStrongRest};
14
13
  background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
@@ -1,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display, } from '@microsoft/fast-foundation';
2
+ import { display, ListboxOption } from '@microsoft/fast-foundation';
3
3
  import { controlCornerRadius, designUnit, focusStrokeOuter, neutralStrokeRest, strokeWidth, } from '../design-tokens';
4
4
  export const listboxStyles = (context, definition) => css `
5
5
  ${display('inline-flex')} :host {
@@ -11,6 +11,10 @@ export const listboxStyles = (context, definition) => css `
11
11
  outline: none;
12
12
  }
13
13
 
14
+ ::slotted(${context.tagFor(ListboxOption)}) {
15
+ margin: 0 calc(${designUnit} * 1px);
16
+ }
17
+
14
18
  :host(:focus-within:not([disabled])) {
15
19
  border-color: ${focusStrokeOuter};
16
20
  box-shadow: 0 0 0 1px ${focusStrokeOuter} inset;
@@ -17,7 +17,6 @@ export const optionStyles = (context, definition) => css `
17
17
  font-size: ${typeRampBaseFontSize};
18
18
  height: calc(${heightNumber} * 1px);
19
19
  line-height: ${typeRampBaseLineHeight};
20
- margin: 0 calc(${designUnit} * 1px);
21
20
  outline: none;
22
21
  overflow: hidden;
23
22
  align-items: center;
@@ -1,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
2
+ import { display, Divider, forcedColorsStylesheetBehavior, MenuItem } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from "@microsoft/fast-web-utilities";
4
4
  import { elevationShadowFlyout } from '../styles/index';
5
5
  import { designUnit, layerCornerRadius, neutralLayerFloating, neutralStrokeDividerRest, strokeWidth, } from '../design-tokens';
@@ -9,7 +9,6 @@ export const menuStyles = (context, definition) => css `
9
9
  border: calc(${strokeWidth} * 1px) solid transparent;
10
10
  border-radius: calc(${layerCornerRadius} * 1px);
11
11
  box-shadow: ${elevationShadowFlyout};
12
- margin: 0;
13
12
  padding: calc(${designUnit} * 1px) 0;
14
13
  max-width: 368px;
15
14
  min-width: 64px;
@@ -20,6 +19,14 @@ export const menuStyles = (context, definition) => css `
20
19
  margin: 0 calc(${designUnit} * 2px);
21
20
  }
22
21
 
22
+ ::slotted(${context.tagFor(MenuItem)}) {
23
+ margin: 0 calc(${designUnit} * 1px);
24
+ }
25
+
26
+ ::slotted(${context.tagFor(Divider)}) {
27
+ margin: calc(${designUnit} * 1px) 0;
28
+ }
29
+
23
30
  ::slotted(hr) {
24
31
  box-sizing: content-box;
25
32
  height: 0;
@@ -2,7 +2,7 @@ import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { DirectionalStyleSheetBehavior, heightNumber } from '../styles/index';
5
- import { bodyFont, controlCornerRadius, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillStealthActive, neutralFillStealthHover, neutralForegroundHint, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { bodyFont, controlCornerRadius, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillStealthActive, neutralFillStealthHover, neutralForegroundHint, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
6
6
  export const menuItemStyles = (context, definition) => css `
7
7
  ${display('grid')} :host {
8
8
  contain: layout;
@@ -16,7 +16,6 @@ export const menuItemStyles = (context, definition) => css `
16
16
  justify-items: center;
17
17
  align-items: center;
18
18
  padding: 0;
19
- margin: 0 calc(${designUnit} * 1px);
20
19
  white-space: nowrap;
21
20
  color: ${neutralForegroundRest};
22
21
  fill: currentcolor;
@@ -7,7 +7,6 @@ export const progressStyles = (context, definition) => css `
7
7
  align-items: center;
8
8
  outline: none;
9
9
  height: calc((${strokeWidth} * 3) * 1px);
10
- margin: calc(${designUnit} * 1px) 0;
11
10
  }
12
11
 
13
12
  .progress {
@@ -9,7 +9,6 @@ export const progressRingStyles = (context, definition) => css `
9
9
  outline: none;
10
10
  height: calc(${heightNumber} * 1px);
11
11
  width: calc(${heightNumber} * 1px);
12
- margin: calc(${heightNumber} * 1px) 0;
13
12
  }
14
13
 
15
14
  .progress {
@@ -8,7 +8,6 @@ export const radioStyles = (context, definition) => css `
8
8
  --input-size: calc((${heightNumber} / 2) + ${designUnit});
9
9
  align-items: center;
10
10
  outline: none;
11
- margin: calc(${designUnit} * 1px) 0;
12
11
  ${
13
12
  /*
14
13
  * Chromium likes to select label text or the default slot when
@@ -1,10 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { designUnit } from '../design-tokens';
4
3
  export const radioGroupStyles = (context, definition) => css `
5
4
  ${display('flex')} :host {
6
5
  align-items: flex-start;
7
- margin: calc(${designUnit} * 1px) 0;
8
6
  flex-direction: column;
9
7
  }
10
8
 
@@ -11,7 +11,6 @@ export const sliderStyles = (context, definition) => css `
11
11
  --track-width: ${designUnit};
12
12
  align-items: center;
13
13
  width: 100%;
14
- margin: calc(${designUnit} * 1px) 0;
15
14
  user-select: none;
16
15
  box-sizing: border-box;
17
16
  border-radius: calc(${controlCornerRadius} * 1px);
@@ -12,7 +12,6 @@ export const switchStyles = (context, definition) => css `
12
12
  align-items: center;
13
13
  outline: none;
14
14
  font-family: ${bodyFont};
15
- margin: calc(${designUnit} * 1px) 0;
16
15
  ${
17
16
  /*
18
17
  * Chromium likes to select label text or the default slot when
@@ -104,8 +103,9 @@ export const switchStyles = (context, definition) => css `
104
103
  cursor: pointer;
105
104
  }
106
105
 
107
- .status-message {
108
- margin-inline-start: calc(${designUnit} * 2px + 2px);
106
+ ::slotted([slot="checked-message"]),
107
+ ::slotted([slot="unchecked-message"]) {
108
+ margin-inline-start: calc(${designUnit} * 2px + 2px);
109
109
  }
110
110
 
111
111
  :host(.checked) .switch {
@@ -21,9 +21,63 @@ const TabsTemplate = ({ activeId, activeIndicator, orientation }) => `
21
21
  <fluent-tab id="TabOne">Tab one</fluent-tab>
22
22
  <fluent-tab id="TabTwo">Tab two</fluent-tab>
23
23
  <fluent-tab id="TabThree">Tab three</fluent-tab>
24
- <fluent-tab-panel> Tab one content. This is for testing. </fluent-tab-panel>
24
+ <fluent-tab-panel>
25
+ Tab one content. This is for testing. Tab three content. This is for testing.
26
+ <br />
27
+ Tab one content. This is for testing.
28
+ <br />
29
+ Tab one content. This is for testing.
30
+ <br />
31
+ Tab one content. This is for testing.
32
+ <br />
33
+ Tab one content. This is for testing.
34
+ <br />
35
+ Tab one content. This is for testing.
36
+ <br />
37
+ Tab one content. This is for testing.
38
+ <br />
39
+ Tab one content. This is for testing.
40
+ <br />
41
+ Tab one content. This is for testing.
42
+ <br />
43
+ Tab one content. This is for testing.
44
+ <br />
45
+ Tab one content. This is for testing.
46
+ <br />
47
+ Tab one content. This is for testing.
48
+ <br />
49
+ Tab one content. This is for testing.
50
+ <br />
51
+ </fluent-tab-panel>
25
52
  <fluent-tab-panel> Tab two content. This is for testing. </fluent-tab-panel>
26
- <fluent-tab-panel> Tab three content. This is for testing. </fluent-tab-panel>
53
+ <fluent-tab-panel>
54
+ Tab three content. This is for testing. Tab three content. This is for testing.
55
+ <br />
56
+ Tab three content. This is for testing.
57
+ <br />
58
+ Tab three content. This is for testing.
59
+ <br />
60
+ Tab three content. This is for testing.
61
+ <br />
62
+ Tab three content. This is for testing.
63
+ <br />
64
+ Tab three content. This is for testing.
65
+ <br />
66
+ Tab three content. This is for testing.
67
+ <br />
68
+ Tab three content. This is for testing.
69
+ <br />
70
+ Tab three content. This is for testing.
71
+ <br />
72
+ Tab three content. This is for testing.
73
+ <br />
74
+ Tab three content. This is for testing.
75
+ <br />
76
+ Tab three content. This is for testing.
77
+ <br />
78
+ Tab three content. This is for testing.
79
+ <br />
80
+ </fluent-tab-panel>
27
81
  </fluent-tabs>`;
28
82
  export const Tabs = TabsTemplate.bind({});
29
83
  Tabs.args = {
@@ -63,6 +63,7 @@ export const tabsStyles = (context, definition) => css `
63
63
  position: relative;
64
64
  width: max-content;
65
65
  justify-self: end;
66
+ align-self: flex-start;
66
67
  width: 100%;
67
68
  }
68
69