@fluentui/web-components 2.0.0 → 2.1.1

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 (47) hide show
  1. package/CHANGELOG.json +103 -1
  2. package/CHANGELOG.md +40 -2
  3. package/dist/dts/calendar/calendar.stories.d.ts +86 -0
  4. package/dist/dts/calendar/calendar.styles.d.ts +7 -0
  5. package/dist/dts/calendar/index.d.ts +18 -0
  6. package/dist/dts/custom-elements.d.ts +3 -1
  7. package/dist/dts/text-area/text-area.stories.d.ts +1 -1
  8. package/dist/esm/anchor/anchor.stories.js +2 -2
  9. package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +14 -0
  10. package/dist/esm/button/button.styles.js +31 -1
  11. package/dist/esm/calendar/calendar.stories.js +115 -0
  12. package/dist/esm/calendar/calendar.styles.js +133 -0
  13. package/dist/esm/calendar/index.js +31 -0
  14. package/dist/esm/card/card.styles.js +1 -2
  15. package/dist/esm/checkbox/checkbox.styles.js +17 -27
  16. package/dist/esm/custom-elements.js +3 -1
  17. package/dist/esm/divider/divider.styles.js +1 -2
  18. package/dist/esm/flipper/flipper.styles.js +5 -18
  19. package/dist/esm/listbox/listbox.styles.js +7 -28
  20. package/dist/esm/listbox-option/listbox-option.styles.js +10 -7
  21. package/dist/esm/menu/menu.styles.js +16 -3
  22. package/dist/esm/menu-item/menu-item.styles.js +17 -19
  23. package/dist/esm/number-field/number-field.styles.js +5 -0
  24. package/dist/esm/progress/progress/progress.styles.js +3 -10
  25. package/dist/esm/progress/progress-ring/progress-ring.styles.js +5 -8
  26. package/dist/esm/radio/radio.styles.js +14 -18
  27. package/dist/esm/radio-group/radio-group.styles.js +0 -2
  28. package/dist/esm/select/select.styles.js +52 -55
  29. package/dist/esm/skeleton/skeleton.styles.js +7 -2
  30. package/dist/esm/slider/slider.styles.js +6 -2
  31. package/dist/esm/styles/patterns/button.styles.js +61 -63
  32. package/dist/esm/styles/patterns/input.styles.js +13 -25
  33. package/dist/esm/switch/switch.stories.js +1 -2
  34. package/dist/esm/switch/switch.styles.js +21 -20
  35. package/dist/esm/tabs/tab/tab.styles.js +4 -3
  36. package/dist/esm/tabs/tabs.stories.js +56 -2
  37. package/dist/esm/tabs/tabs.styles.js +1 -1
  38. package/dist/esm/text-area/text-area.stories.js +2 -2
  39. package/dist/esm/tree-item/tree-item.styles.js +20 -11
  40. package/dist/esm/tree-view/tree-view.stories.js +39 -22
  41. package/dist/fluent-web-components.api.json +131 -2
  42. package/dist/web-components.d.ts +12 -0
  43. package/dist/web-components.js +973 -352
  44. package/dist/web-components.min.js +147 -135
  45. package/docs/api-report.md +12 -7
  46. package/package.json +2 -5
  47. package/public/switches.ts +14 -14
package/CHANGELOG.json CHANGED
@@ -2,7 +2,109 @@
2
2
  "name": "@fluentui/web-components",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 22 Oct 2021 23:03:40 GMT",
5
+ "date": "Thu, 02 Dec 2021 07:35:43 GMT",
6
+ "tag": "@fluentui/web-components_v2.1.1",
7
+ "version": "2.1.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "jes@microsoft.com",
12
+ "package": "@fluentui/web-components",
13
+ "commit": "a69b283c2eb799c0edc5276d9d1094d1f3d4e4ac",
14
+ "comment": "fix: tabpanel shifting in vertical layout"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 23 Nov 2021 07:27:34 GMT",
21
+ "tag": "@fluentui/web-components_v2.1.0",
22
+ "version": "2.1.0",
23
+ "comments": {
24
+ "minor": [
25
+ {
26
+ "author": "jes@microsoft.com",
27
+ "package": "@fluentui/web-components",
28
+ "commit": "2dbe9eadd8ae071bbb056ad15461c1c7ea8d9430",
29
+ "comment": "fix: remove margins from host elements"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 09 Nov 2021 07:38:11 GMT",
36
+ "tag": "@fluentui/web-components_v2.0.2",
37
+ "version": "2.0.2",
38
+ "comments": {
39
+ "patch": [
40
+ {
41
+ "author": "robarb@microsoft.com",
42
+ "package": "@fluentui/web-components",
43
+ "commit": "55a9400f93758ad7cb37789aa524a6eb6b2a5322",
44
+ "comment": "FluentUI calendar component"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Tue, 02 Nov 2021 07:37:01 GMT",
51
+ "tag": "@fluentui/web-components_v2.0.1",
52
+ "version": "2.0.1",
53
+ "comments": {
54
+ "patch": [
55
+ {
56
+ "author": "chhol@microsoft.com",
57
+ "package": "@fluentui/web-components",
58
+ "commit": "71d4e117d0bad7e238ff53e4d1a0671a6ead7085",
59
+ "comment": "fix web components webpack integration docs and update the package dependencies"
60
+ },
61
+ {
62
+ "author": "khamu@microsoft.com",
63
+ "package": "@fluentui/web-components",
64
+ "commit": "2cb0ac33d03c843c556c2cd554fd6ac9a91f4f33",
65
+ "comment": "fixed high contrast visual for web components"
66
+ },
67
+ {
68
+ "author": "chhol@microsoft.com",
69
+ "package": "@fluentui/web-components",
70
+ "commit": "e9e7f438f1530d5629108a27dfd1d81d7c107293",
71
+ "comment": "change input state styles to fix height and prevent z-index from blocking cursor"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "date": "Mon, 01 Nov 2021 21:28:50 GMT",
78
+ "tag": "@fluentui/web-components_v2.0.0",
79
+ "version": "2.0.0",
80
+ "comments": {
81
+ "none": [
82
+ {
83
+ "author": "brookdozer@gmail.com",
84
+ "package": "@fluentui/web-components",
85
+ "commit": "197823fe1233c21127dbce9c546c90e3e0e548be",
86
+ "comment": "Fixing visual update merge conflicts"
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "date": "Mon, 25 Oct 2021 07:38:02 GMT",
93
+ "tag": "@fluentui/web-components_v2.0.0",
94
+ "version": "2.0.0",
95
+ "comments": {
96
+ "none": [
97
+ {
98
+ "author": "chhol@microsoft.com",
99
+ "package": "@fluentui/web-components",
100
+ "comment": "remove beachball configuration override to again disallow major versions",
101
+ "commit": "a88fb53fb38a20912b7ddea33b5f3313a721e148"
102
+ }
103
+ ]
104
+ }
105
+ },
106
+ {
107
+ "date": "Fri, 22 Oct 2021 23:04:22 GMT",
6
108
  "tag": "@fluentui/web-components_v2.0.0",
7
109
  "version": "2.0.0",
8
110
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,50 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Fri, 22 Oct 2021 23:03:40 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 02 Dec 2021 07:35:43 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [2.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.1.1)
8
+
9
+ Thu, 02 Dec 2021 07:35:43 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.1.0..@fluentui/web-components_v2.1.1)
11
+
12
+ ### Patches
13
+
14
+ - fix: tabpanel shifting in vertical layout ([PR #20641](https://github.com/microsoft/fluentui/pull/20641) by jes@microsoft.com)
15
+
16
+ ## [2.1.0](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.1.0)
17
+
18
+ Tue, 23 Nov 2021 07:27:34 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.0.2..@fluentui/web-components_v2.1.0)
20
+
21
+ ### Minor changes
22
+
23
+ - fix: remove margins from host elements ([PR #20710](https://github.com/microsoft/fluentui/pull/20710) by jes@microsoft.com)
24
+
25
+ ## [2.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.0.2)
26
+
27
+ Tue, 09 Nov 2021 07:38:11 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.0.1..@fluentui/web-components_v2.0.2)
29
+
30
+ ### Patches
31
+
32
+ - FluentUI calendar component ([PR #20356](https://github.com/microsoft/fluentui/pull/20356) by robarb@microsoft.com)
33
+
34
+ ## [2.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.0.1)
35
+
36
+ Tue, 02 Nov 2021 07:37:01 GMT
37
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.0.0..@fluentui/web-components_v2.0.1)
38
+
39
+ ### Patches
40
+
41
+ - fix web components webpack integration docs and update the package dependencies ([PR #20429](https://github.com/microsoft/fluentui/pull/20429) by chhol@microsoft.com)
42
+ - fixed high contrast visual for web components ([PR #20418](https://github.com/microsoft/fluentui/pull/20418) by khamu@microsoft.com)
43
+ - change input state styles to fix height and prevent z-index from blocking cursor ([PR #20445](https://github.com/microsoft/fluentui/pull/20445) by chhol@microsoft.com)
44
+
7
45
  ## [2.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.0.0)
8
46
 
9
- Fri, 22 Oct 2021 23:03:40 GMT
47
+ Fri, 22 Oct 2021 23:04:22 GMT
10
48
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v1.6.3..@fluentui/web-components_v2.0.0)
11
49
 
12
50
  ### Major changes
@@ -0,0 +1,86 @@
1
+ import './index';
2
+ declare const _default: {
3
+ title: string;
4
+ component: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").CalendarOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").CalendarOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
5
+ argTypes: {
6
+ month: {
7
+ description: string;
8
+ control: {
9
+ type: string;
10
+ };
11
+ options: string[];
12
+ default: string;
13
+ };
14
+ year: {
15
+ description: string;
16
+ control: {
17
+ type: string;
18
+ };
19
+ options: string[];
20
+ default: string;
21
+ };
22
+ locale: {
23
+ control: {
24
+ type: string;
25
+ };
26
+ options: string[];
27
+ default: string;
28
+ description: string;
29
+ };
30
+ dayFormat: {
31
+ description: string;
32
+ options: string[];
33
+ control: {
34
+ type: string;
35
+ };
36
+ default: string;
37
+ };
38
+ weekdayFormat: {
39
+ description: string;
40
+ options: string[];
41
+ control: {
42
+ type: string;
43
+ };
44
+ default: string;
45
+ };
46
+ monthFormat: {
47
+ description: string;
48
+ options: string[];
49
+ control: {
50
+ type: string;
51
+ };
52
+ default: string;
53
+ };
54
+ yearFormat: {
55
+ description: string;
56
+ options: string[];
57
+ control: {
58
+ type: string;
59
+ };
60
+ default: string;
61
+ };
62
+ disabledDates: {
63
+ description: string;
64
+ options: any;
65
+ control: {
66
+ type: string;
67
+ };
68
+ };
69
+ selectedDates: {
70
+ description: string;
71
+ options: any;
72
+ control: {
73
+ type: string;
74
+ };
75
+ };
76
+ readonly: {
77
+ description: string;
78
+ control: {
79
+ type: string;
80
+ };
81
+ default: boolean;
82
+ };
83
+ };
84
+ };
85
+ export default _default;
86
+ export declare const Calendar: any;
@@ -0,0 +1,7 @@
1
+ import { ElementStyles } from "@microsoft/fast-element";
2
+ import { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation';
3
+ /**
4
+ * Styles for calendar
5
+ * @public
6
+ */
7
+ export declare const calendarStyles: (context: ElementDefinitionContext, definition: FoundationElementDefinition) => ElementStyles;
@@ -0,0 +1,18 @@
1
+ import { CalendarOptions, Calendar as FoundationCalendar } from '@microsoft/fast-foundation';
2
+ import { calendarStyles as styles } from './calendar.styles';
3
+ /**
4
+ * Updated Calendar class that is readonly by default
5
+ */
6
+ export declare class Calendar extends FoundationCalendar {
7
+ readonly: boolean;
8
+ }
9
+ /**
10
+ * The Fluent Calendar Element. Implements {@link @microsoft/fast-foundation#Calendar},
11
+ * {@link @microsoft/fast-foundation#calendarTemplate}
12
+ *
13
+ * @public
14
+ * @remarks
15
+ * HTML Element \<fluent-calendar\>
16
+ */
17
+ export declare const fluentCalendar: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<CalendarOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<CalendarOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
18
+ export { styles as calendarStyles };
@@ -9,6 +9,7 @@ import { fluentBadge } from './badge/index';
9
9
  import { fluentBreadcrumb } from './breadcrumb/index';
10
10
  import { fluentBreadcrumbItem } from './breadcrumb-item/index';
11
11
  import { fluentButton } from './button/index';
12
+ import { fluentCalendar } from './calendar/index';
12
13
  import { fluentCard } from './card/index';
13
14
  import { fluentCheckbox } from './checkbox/index';
14
15
  import { fluentCombobox } from './combobox/index';
@@ -38,7 +39,7 @@ import { fluentToolbar } from './toolbar/index';
38
39
  import { fluentTooltip } from './tooltip/index';
39
40
  import { fluentTreeView } from './tree-view/index';
40
41
  import { fluentTreeItem } from './tree-item/index';
41
- 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, };
42
+ 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, };
42
43
  /**
43
44
  * All Fluent UI Web Components
44
45
  * @public
@@ -52,6 +53,7 @@ export declare const allComponents: {
52
53
  fluentBreadcrumb: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("@microsoft/fast-foundation").Breadcrumb>;
53
54
  fluentBreadcrumbItem: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").BreadcrumbItemOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").BreadcrumbItemOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
54
55
  fluentButton: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./button").Button>;
56
+ fluentCalendar: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").CalendarOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").CalendarOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
55
57
  fluentCard: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import("./card").Card>;
56
58
  fluentCheckbox: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").CheckboxOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").CheckboxOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
57
59
  fluentCombobox: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").ComboboxOptions> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").ComboboxOptions, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
@@ -3,8 +3,8 @@ declare const _default: {
3
3
  component: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<import("@microsoft/fast-foundation").FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<import("@microsoft/fast-foundation").FoundationElementDefinition, typeof import(".").TextArea>;
4
4
  argTypes: {
5
5
  appearance: {
6
- options: string[];
7
6
  defaultValue: string;
7
+ options: string[];
8
8
  control: {
9
9
  type: string;
10
10
  };
@@ -11,15 +11,15 @@ export default {
11
11
  };
12
12
  const AnchorTemplate = ({ appearance, label }) => `
13
13
  <fluent-anchor
14
+ href="javascript:void"
14
15
  ${appearance ? `appearance="${appearance}"` : ''}
15
- href="https://bing.com" target="_blank"
16
16
  >
17
17
  ${label}
18
18
  </fluent-anchor>
19
19
  `;
20
20
  export const Anchor = AnchorTemplate.bind({});
21
21
  const example = `
22
- <fluent-anchor href="https://bing.com" target="_blank" appearance="neutral">Anchor</fluent-anchor>
22
+ <fluent-anchor href="#" appearance="neutral">Anchor</fluent-anchor>
23
23
  `;
24
24
  Anchor.args = {
25
25
  label: 'Anchor',
@@ -78,10 +78,24 @@ export const breadcrumbItemStyles = (context, definition) => css `
78
78
  .start,
79
79
  .end,
80
80
  .separator {
81
+ background: ${SystemColors.ButtonFace};
81
82
  color: ${SystemColors.ButtonText};
82
83
  fill: currentcolor;
83
84
  }
84
85
  .separator {
85
86
  fill: ${SystemColors.ButtonText};
86
87
  }
88
+ :host([href]) {
89
+ forced-color-adjust: none;
90
+ background: ${SystemColors.ButtonFace};
91
+ color: ${SystemColors.LinkText};
92
+ }
93
+ :host([href]) .control:hover {
94
+ background: ${SystemColors.LinkText};
95
+ color: ${SystemColors.HighlightText};
96
+ fill: currentcolor;
97
+ }
98
+ :host([href]) .control:${focusVisible}::after {
99
+ box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) ${SystemColors.LinkText} inset;
100
+ }
87
101
  `));
@@ -1,5 +1,6 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
+ import { SystemColors } from "@microsoft/fast-web-utilities";
3
4
  import { AccentButtonStyles, baseButtonStyles, LightweightButtonStyles, OutlineButtonStyles, StealthButtonStyles, } from '../styles/';
4
5
  import { appearanceBehavior } from '../utilities/behaviors';
5
6
  import { disabledOpacity } from '../design-tokens';
@@ -16,4 +17,33 @@ export const buttonStyles = (context, definition) => css `
16
17
  :host([disabled]) {
17
18
  opacity: 1;
18
19
  }
19
- `), appearanceBehavior('accent', AccentButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), appearanceBehavior('lightweight', LightweightButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), appearanceBehavior('outline', OutlineButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), appearanceBehavior('stealth', StealthButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)));
20
+ :host([disabled]) .control {
21
+ border-color: ${SystemColors.GrayText};
22
+ color: ${SystemColors.GrayText};
23
+ fill: currentcolor;
24
+ }
25
+ `), appearanceBehavior('accent', css `
26
+ ${AccentButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)},
27
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
28
+ :host([disabled]) .control {
29
+ background: ${SystemColors.ButtonFace};
30
+ }
31
+ `))), appearanceBehavior('lightweight', css `
32
+ ${LightweightButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)},
33
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
34
+ :host([disabled]) .control {
35
+ border-color: ${SystemColors.ButtonFace};
36
+ }
37
+ `))), appearanceBehavior('outline', css `
38
+ ${OutlineButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)}
39
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
40
+ :host([disabled]) .control {
41
+ border-color: ${SystemColors.GrayText};
42
+ }
43
+ `))), appearanceBehavior('stealth', css `
44
+ ${StealthButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)}
45
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
46
+ :host([disabled]) .control {
47
+ border-color: ${SystemColors.ButtonFace};
48
+ }
49
+ `))));
@@ -0,0 +1,115 @@
1
+ import './index';
2
+ import { fluentCalendar } from './index';
3
+ const now = new Date();
4
+ const years = new Array(9).fill(null).map((_, index) => (now.getFullYear() - 4 + index).toString());
5
+ const groupsToDates = matrix => matrix.map(days => days.map(day => `${now.getMonth() + 1}-${day}-${now.getFullYear()}`).join(','));
6
+ const disabledDates = groupsToDates([
7
+ [1, 2, 3, 4, now.getDate()],
8
+ [6, 7, 10, 18],
9
+ [8, 17, 24, 25],
10
+ [4, 11, 18, 25],
11
+ ]);
12
+ export default {
13
+ title: 'Components/Calendar',
14
+ component: fluentCalendar,
15
+ argTypes: {
16
+ month: {
17
+ description: 'Month of the calendar to display.',
18
+ control: { type: 'select' },
19
+ options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
20
+ default: 'The current month',
21
+ },
22
+ year: {
23
+ description: 'Year of the calendar to display.',
24
+ control: { type: 'select' },
25
+ options: years,
26
+ default: 'The current year',
27
+ },
28
+ locale: {
29
+ control: { type: 'select' },
30
+ options: ['en-US', 'fr-FR', 'de-DE', 'th-TH-u-ca-buddhist-nu-thai', 'ar-XE-u-ca-islamic-nu-arab'],
31
+ default: 'en-US',
32
+ description: 'Locale information which can include market (language and country), calendar type and numbering type.',
33
+ },
34
+ dayFormat: {
35
+ description: 'Formatting for the numbered days.',
36
+ options: ['2-digit', 'numeric'],
37
+ control: { type: 'select' },
38
+ default: 'numeric',
39
+ },
40
+ weekdayFormat: {
41
+ description: 'Formatting for the weekday titles.',
42
+ options: ['long', 'narrow', 'short'],
43
+ control: { type: 'select' },
44
+ default: 'short',
45
+ },
46
+ monthFormat: {
47
+ description: 'Formatting for the month name in the title.',
48
+ options: ['2-digit', 'long', 'narrow', 'numeric', 'short'],
49
+ control: { type: 'select' },
50
+ default: 'long',
51
+ },
52
+ yearFormat: {
53
+ description: 'Formatting for the year in the title.',
54
+ options: ['2-digit', 'numeric'],
55
+ control: { type: 'select' },
56
+ default: 'numeric',
57
+ },
58
+ disabledDates: {
59
+ description: 'Dates to be shown as disabled.',
60
+ options: disabledDates,
61
+ control: { type: 'select' },
62
+ },
63
+ selectedDates: {
64
+ description: 'Dates to be shown as selected',
65
+ options: disabledDates,
66
+ control: { type: 'select' },
67
+ },
68
+ readonly: {
69
+ description: 'A readonly version of the calendar without AT interactions.',
70
+ control: { type: 'boolean' },
71
+ default: true,
72
+ },
73
+ },
74
+ };
75
+ const CalendarTemplate = ({ month, year, locale, dayFormat, weekdayFormat, monthFormat, yearFormat, disabledDates, selectedDates, readonly, }) => `
76
+ <style>
77
+ div.docs-story > div:first-child {
78
+ height: 22em !important;
79
+ }
80
+ </style>
81
+ <fluent-calendar
82
+ ${month ? `month="${month}"` : ''}
83
+ ${year ? `year="${year}"` : ''}
84
+ ${locale ? `locale="${locale}"` : ''}
85
+ ${dayFormat ? `day-format="${dayFormat}"` : ''}
86
+ ${weekdayFormat ? `weekday-format="${weekdayFormat}"` : ''}
87
+ ${monthFormat ? `month-format="${monthFormat}"` : ''}
88
+ ${yearFormat ? `year-format="${yearFormat}"` : ''}
89
+ ${disabledDates ? `disabled-dates="${disabledDates}"` : ''}
90
+ ${selectedDates ? `selected-dates="${selectedDates}"` : ''}
91
+ ${readonly === false ? `readonly="false"` : ''}
92
+ ></fluent-calendar>
93
+ `;
94
+ export const Calendar = CalendarTemplate.bind({});
95
+ Calendar.args = {
96
+ label: 'Calendar',
97
+ month: (now.getMonth() + 1).toString(),
98
+ year: now.getFullYear().toString(),
99
+ locale: 'en-US',
100
+ readonly: true,
101
+ dayFormat: 'numeric',
102
+ weekdayFormat: 'short',
103
+ monthFormat: 'long',
104
+ yearFormat: 'numeric',
105
+ };
106
+ const example = `
107
+ <fluent-calendar></fluent-calendar>
108
+ `;
109
+ Calendar.parameters = {
110
+ docs: {
111
+ source: {
112
+ code: example,
113
+ },
114
+ },
115
+ };
@@ -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));