@fluentui/web-components 1.6.3 → 2.1.0
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.
- package/CHANGELOG.json +103 -1
- package/CHANGELOG.md +40 -2
- package/dist/dts/calendar/calendar.stories.d.ts +86 -0
- package/dist/dts/calendar/calendar.styles.d.ts +7 -0
- package/dist/dts/calendar/index.d.ts +18 -0
- package/dist/dts/color/palette.d.ts +43 -1
- package/dist/dts/color/recipes/contrast-and-delta-swatch-set.d.ts +11 -0
- package/dist/dts/color/recipes/contrast-swatch.d.ts +12 -0
- package/dist/dts/color/recipes/delta-swatch-set.d.ts +36 -0
- package/dist/dts/color/recipes/{neutral-divider.d.ts → delta-swatch.d.ts} +3 -2
- package/dist/dts/color/recipes/focus-stroke.d.ts +2 -2
- package/dist/dts/color/recipes/foreground-on-accent.d.ts +6 -0
- package/dist/dts/color/recipes/gradient-shadow-stroke.d.ts +7 -0
- package/dist/dts/color/recipes/gradient-swatch.d.ts +36 -0
- package/dist/dts/color/recipes/neutral-layer-1.d.ts +4 -0
- package/dist/dts/color/recipes/neutral-layer-2.d.ts +1 -5
- package/dist/dts/color/recipes/neutral-layer-3.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-4.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-floating.d.ts +1 -1
- package/dist/dts/color/recipes/underline-stroke.d.ts +7 -0
- package/dist/dts/color/swatch.d.ts +7 -0
- package/dist/dts/color/utilities/base-layer-luminance.d.ts +2 -2
- package/dist/dts/combobox/index.d.ts +1 -2
- package/dist/dts/custom-elements.d.ts +4 -2
- package/dist/dts/data-grid/data-grid-row.styles.d.ts +1 -1
- package/dist/dts/data-grid/index.d.ts +1 -1
- package/dist/dts/design-system-provider/index.d.ts +14 -29
- package/dist/dts/design-tokens.d.ts +198 -82
- package/dist/dts/menu/index.d.ts +11 -6
- package/dist/dts/menu/menu.stories.d.ts +1 -1
- package/dist/dts/select/index.d.ts +1 -1
- package/dist/dts/select/select.stories.d.ts +8 -0
- package/dist/dts/select/select.styles.d.ts +1 -0
- package/dist/dts/skeleton/skeleton.stories.d.ts +1 -0
- package/dist/dts/styles/elevation.d.ts +44 -5
- package/dist/dts/styles/patterns/button.styles.d.ts +7 -6
- package/dist/dts/styles/patterns/index.d.ts +1 -1
- package/dist/dts/styles/patterns/input.styles.d.ts +22 -0
- package/dist/dts/text-area/text-area.stories.d.ts +1 -1
- package/dist/dts/tree-view/tree-view.stories.d.ts +0 -5
- package/dist/esm/accordion/accordion-item/accordion-item.styles.js +54 -17
- package/dist/esm/accordion/accordion-item/index.js +4 -22
- package/dist/esm/accordion/accordion.styles.js +4 -4
- package/dist/esm/anchor/anchor.stories.js +2 -2
- package/dist/esm/anchor/anchor.styles.js +8 -2
- package/dist/esm/badge/badge.styles.js +10 -2
- package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +44 -53
- package/dist/esm/breadcrumb-item/index.js +2 -4
- package/dist/esm/button/button.stories.js +1 -1
- package/dist/esm/button/button.styles.js +21 -71
- package/dist/esm/calendar/calendar.stories.js +115 -0
- package/dist/esm/calendar/calendar.styles.js +133 -0
- package/dist/esm/calendar/index.js +31 -0
- package/dist/esm/card/card.stories.js +14 -0
- package/dist/esm/card/card.styles.js +23 -32
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/checkbox/checkbox.styles.js +58 -51
- package/dist/esm/checkbox/index.js +5 -13
- package/dist/esm/color/palette.js +174 -12
- package/dist/esm/color/recipes/contrast-and-delta-swatch-set.js +28 -0
- package/dist/esm/color/recipes/contrast-swatch.js +12 -0
- package/dist/esm/color/recipes/delta-swatch-set.js +53 -0
- package/dist/esm/color/recipes/{neutral-divider.js → delta-swatch.js} +3 -2
- package/dist/esm/color/recipes/focus-stroke.js +4 -3
- package/dist/esm/color/recipes/foreground-on-accent.js +14 -0
- package/dist/esm/color/recipes/gradient-shadow-stroke.js +54 -0
- package/dist/esm/color/recipes/gradient-swatch.js +36 -0
- package/dist/esm/color/recipes/neutral-layer-1.js +7 -1
- package/dist/esm/color/recipes/neutral-layer-2.js +3 -9
- package/dist/esm/color/recipes/neutral-layer-3.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-4.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-floating.js +3 -4
- package/dist/esm/color/recipes/underline-stroke.js +31 -0
- package/dist/esm/color/swatch.js +22 -2
- package/dist/esm/color/utilities/base-layer-luminance.js +2 -2
- package/dist/esm/combobox/combobox.stories.js +1 -0
- package/dist/esm/combobox/index.js +6 -9
- package/dist/esm/custom-elements.js +3 -1
- package/dist/esm/data-grid/data-grid-cell.styles.js +4 -4
- package/dist/esm/data-grid/data-grid-row.styles.js +3 -3
- package/dist/esm/design-system-provider/design-system-provider.vscode.definition.json +17 -9
- package/dist/esm/design-system-provider/index.js +24 -39
- package/dist/esm/design-tokens.js +303 -217
- package/dist/esm/dialog/dialog.styles.js +2 -3
- package/dist/esm/divider/divider.styles.js +1 -2
- package/dist/esm/flipper/flipper.styles.js +28 -65
- package/dist/esm/flipper/index.js +4 -8
- package/dist/esm/listbox/listbox.styles.js +8 -29
- package/dist/esm/listbox-option/listbox-option.styles.js +52 -35
- package/dist/esm/menu/index.js +16 -6
- package/dist/esm/menu/menu.stories.js +16 -2
- package/dist/esm/menu/menu.styles.js +38 -27
- package/dist/esm/menu-item/index.js +6 -33
- package/dist/esm/menu-item/menu-item.stories.js +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +58 -84
- package/dist/esm/number-field/index.js +7 -3
- package/dist/esm/number-field/number-field.styles.js +30 -175
- package/dist/esm/progress/progress/index.js +1 -1
- package/dist/esm/progress/progress/progress.styles.js +13 -18
- package/dist/esm/progress/progress-ring/progress-ring.styles.js +65 -69
- package/dist/esm/radio/index.js +3 -1
- package/dist/esm/radio/radio.stories.js +3 -2
- package/dist/esm/radio/radio.styles.js +52 -42
- package/dist/esm/radio-group/radio-group.styles.js +0 -2
- package/dist/esm/select/index.js +6 -9
- package/dist/esm/select/select.stories.js +10 -2
- package/dist/esm/select/select.styles.js +100 -124
- package/dist/esm/select/select.vscode.definition.json +3 -0
- package/dist/esm/skeleton/skeleton.stories.js +3 -2
- package/dist/esm/skeleton/skeleton.styles.js +11 -6
- package/dist/esm/slider/slider.styles.js +54 -14
- package/dist/esm/slider-label/slider-label.styles.js +5 -6
- package/dist/esm/styles/direction.js +1 -1
- package/dist/esm/styles/elevation.js +54 -5
- package/dist/esm/styles/patterns/button.styles.js +274 -294
- package/dist/esm/styles/patterns/index.js +1 -1
- package/dist/esm/styles/patterns/input.styles.js +218 -0
- package/dist/esm/switch/index.js +3 -1
- package/dist/esm/switch/switch.stories.js +3 -3
- package/dist/esm/switch/switch.styles.js +79 -60
- package/dist/esm/tabs/tab/tab.styles.js +11 -14
- package/dist/esm/tabs/tabs.styles.js +9 -8
- package/dist/esm/text-area/text-area.stories.js +2 -2
- package/dist/esm/text-area/text-area.styles.js +16 -96
- package/dist/esm/text-field/text-field.stories.js +1 -1
- package/dist/esm/text-field/text-field.styles.js +16 -144
- package/dist/esm/toolbar/index.js +1 -0
- package/dist/esm/toolbar/toolbar.styles.js +56 -56
- package/dist/esm/tooltip/index.js +2 -4
- package/dist/esm/tooltip/tooltip.styles.js +14 -14
- package/dist/esm/tree-item/index.js +2 -8
- package/dist/esm/tree-item/tree-item.styles.js +45 -80
- package/dist/esm/tree-view/tree-view.stories.js +23 -11
- package/dist/fluent-web-components.api.json +4900 -2353
- package/dist/web-components.d.ts +397 -100
- package/dist/web-components.js +2240 -2175
- package/dist/web-components.min.js +158 -128
- package/docs/api-report.md +338 -80
- package/package.json +2 -5
- package/public/switches.ts +13 -14
- package/dist/dts/color/recipes/accent-fill.d.ts +0 -7
- package/dist/dts/color/recipes/accent-foreground.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-contrast.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-input.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-inverse.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-layer.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-fill-stealth.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill.d.ts +0 -14
- package/dist/dts/color/recipes/neutral-foreground-hint.d.ts +0 -10
- package/dist/dts/color/recipes/neutral-foreground.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-layer-card-container.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-stroke-strong.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-stroke.d.ts +0 -7
- package/dist/dts/styles/patterns/input.d.ts +0 -4
- package/dist/dts/utilities/math.d.ts +0 -24
- package/dist/esm/color/recipes/accent-fill.js +0 -18
- package/dist/esm/color/recipes/accent-foreground.js +0 -31
- package/dist/esm/color/recipes/neutral-fill-contrast.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-input.js +0 -14
- package/dist/esm/color/recipes/neutral-fill-inverse.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-layer.js +0 -7
- package/dist/esm/color/recipes/neutral-fill-stealth.js +0 -14
- package/dist/esm/color/recipes/neutral-fill.js +0 -21
- package/dist/esm/color/recipes/neutral-foreground-hint.js +0 -10
- package/dist/esm/color/recipes/neutral-foreground.js +0 -6
- package/dist/esm/color/recipes/neutral-layer-card-container.js +0 -9
- package/dist/esm/color/recipes/neutral-stroke-strong.js +0 -15
- package/dist/esm/color/recipes/neutral-stroke.js +0 -18
- package/dist/esm/styles/patterns/input.js +0 -31
- package/dist/esm/utilities/math.js +0 -49
|
@@ -1,99 +1,49 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { disabledCursor, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
|
|
3
|
-
import { SystemColors } from
|
|
3
|
+
import { SystemColors } from "@microsoft/fast-web-utilities";
|
|
4
4
|
import { AccentButtonStyles, baseButtonStyles, LightweightButtonStyles, OutlineButtonStyles, StealthButtonStyles, } from '../styles/';
|
|
5
5
|
import { appearanceBehavior } from '../utilities/behaviors';
|
|
6
|
-
import {
|
|
6
|
+
import { disabledOpacity } from '../design-tokens';
|
|
7
|
+
const interactivitySelector = ':not([disabled])';
|
|
8
|
+
const nonInteractivitySelector = '[disabled]';
|
|
7
9
|
export const buttonStyles = (context, definition) => css `
|
|
8
|
-
:host([disabled])
|
|
9
|
-
:host([disabled]:hover),
|
|
10
|
-
:host([disabled]:active) {
|
|
10
|
+
:host([disabled]) {
|
|
11
11
|
opacity: ${disabledOpacity};
|
|
12
|
-
background-color: ${neutralFillRest};
|
|
13
12
|
cursor: ${disabledCursor};
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
${baseButtonStyles(context, definition)}
|
|
15
|
+
${baseButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)}
|
|
17
16
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
18
|
-
:host([disabled])
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:host([disabled]) .control
|
|
22
|
-
:host([disabled]) .control:hover,
|
|
23
|
-
:host([appearance='neutral'][disabled]:hover) .control {
|
|
24
|
-
forced-color-adjust: none;
|
|
25
|
-
background-color: ${SystemColors.ButtonFace};
|
|
17
|
+
:host([disabled]) {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
:host([disabled]) .control {
|
|
26
21
|
border-color: ${SystemColors.GrayText};
|
|
27
22
|
color: ${SystemColors.GrayText};
|
|
28
|
-
|
|
23
|
+
fill: currentcolor;
|
|
29
24
|
}
|
|
30
25
|
`), appearanceBehavior('accent', css `
|
|
31
|
-
|
|
32
|
-
:host([appearance='accent'][disabled]:hover),
|
|
33
|
-
:host([appearance='accent'][disabled]:active) {
|
|
34
|
-
background: ${accentFillRest};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
${AccentButtonStyles}
|
|
26
|
+
${AccentButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)},
|
|
38
27
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
39
|
-
:host([
|
|
40
|
-
:host([appearance='accent'][disabled]) .control:hover {
|
|
28
|
+
:host([disabled]) .control {
|
|
41
29
|
background: ${SystemColors.ButtonFace};
|
|
42
|
-
border-color: ${SystemColors.GrayText};
|
|
43
|
-
color: ${SystemColors.GrayText};
|
|
44
30
|
}
|
|
45
31
|
`))), appearanceBehavior('lightweight', css `
|
|
46
|
-
|
|
47
|
-
:host([appearance='lightweight'][disabled]:active) {
|
|
48
|
-
background-color: transparent;
|
|
49
|
-
color: ${accentForegroundRest};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([appearance='lightweight'][disabled]) .content::before,
|
|
53
|
-
:host([appearance='lightweight'][disabled]:hover) .content::before,
|
|
54
|
-
:host([appearance='lightweight'][disabled]:active) .content::before {
|
|
55
|
-
background: transparent;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
${LightweightButtonStyles}
|
|
32
|
+
${LightweightButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)},
|
|
59
33
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
60
|
-
:host([
|
|
61
|
-
|
|
62
|
-
color: ${SystemColors.GrayText};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
:host([appearance='lightweight'][disabled]) .control:hover .content::before {
|
|
66
|
-
background: none;
|
|
34
|
+
:host([disabled]) .control {
|
|
35
|
+
border-color: ${SystemColors.ButtonFace};
|
|
67
36
|
}
|
|
68
37
|
`))), appearanceBehavior('outline', css `
|
|
69
|
-
|
|
70
|
-
:host([appearance='outline'][disabled]:active) {
|
|
71
|
-
background: transparent;
|
|
72
|
-
border-color: ${neutralStrokeRest};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
${OutlineButtonStyles}
|
|
38
|
+
${OutlineButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)}
|
|
76
39
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
77
|
-
:host([
|
|
40
|
+
:host([disabled]) .control {
|
|
78
41
|
border-color: ${SystemColors.GrayText};
|
|
79
42
|
}
|
|
80
43
|
`))), appearanceBehavior('stealth', css `
|
|
81
|
-
|
|
82
|
-
:host([appearance='stealth'][disabled]:hover),
|
|
83
|
-
:host([appearance='stealth'][disabled]:active) {
|
|
84
|
-
background: ${neutralFillStealthRest};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
${StealthButtonStyles}
|
|
44
|
+
${StealthButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)}
|
|
88
45
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
89
|
-
:host([
|
|
90
|
-
|
|
91
|
-
background: ${SystemColors.ButtonFace};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host([appearance='stealth'][disabled]) .control {
|
|
95
|
-
background: ${SystemColors.ButtonFace};
|
|
96
|
-
border-color: transparent;
|
|
97
|
-
color: ${SystemColors.GrayText};
|
|
46
|
+
:host([disabled]) .control {
|
|
47
|
+
border-color: ${SystemColors.ButtonFace};
|
|
98
48
|
}
|
|
99
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));
|
|
@@ -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 };
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { addons } from '@storybook/addons';
|
|
2
|
+
import { DOCS_RENDERED } from '@storybook/core-events';
|
|
3
|
+
import { DesignSystemProvider, StandardLuminance } from '../index-rollup';
|
|
1
4
|
import CardTemplate from './fixtures/card.html';
|
|
2
5
|
import './index';
|
|
6
|
+
addons.getChannel().addListener(DOCS_RENDERED, name => {
|
|
7
|
+
if (name.toLowerCase() === 'components/card') {
|
|
8
|
+
const els = document.getElementsByClassName('darkMode');
|
|
9
|
+
for (let i = 0; i < els.length; i++) {
|
|
10
|
+
const el = els[i];
|
|
11
|
+
if (el instanceof DesignSystemProvider) {
|
|
12
|
+
el.baseLayerLuminance = StandardLuminance.DarkMode;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
3
17
|
export default {
|
|
4
18
|
title: 'Components/Card',
|
|
5
19
|
};
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
|
|
3
3
|
import { SystemColors } from '@microsoft/fast-web-utilities';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { fillColor, layerCornerRadius, neutralForegroundRest, neutralStrokeLayerRest, strokeWidth, } from '../design-tokens';
|
|
5
|
+
import { elevationShadowCardRest } from '../styles';
|
|
6
6
|
export const cardStyles = (context, definition) => css `
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
${display('block')} :host {
|
|
8
|
+
display: block;
|
|
9
|
+
contain: content;
|
|
10
|
+
height: var(--card-height, 100%);
|
|
11
|
+
width: var(--card-width, 100%);
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
background: ${fillColor};
|
|
14
|
+
color: ${neutralForegroundRest};
|
|
15
|
+
border: calc(${strokeWidth} * 1px) solid ${neutralStrokeLayerRest};
|
|
16
|
+
border-radius: calc(${layerCornerRadius} * 1px);
|
|
17
|
+
box-shadow: ${elevationShadowCardRest};
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
content-visibility: auto;
|
|
30
|
-
}
|
|
31
|
-
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
32
|
-
:host {
|
|
33
|
-
forced-color-adjust: none;
|
|
34
|
-
background: ${SystemColors.Canvas};
|
|
35
|
-
box-shadow: 0 0 0 1px ${SystemColors.CanvasText};
|
|
36
|
-
}
|
|
37
|
-
`));
|
|
20
|
+
:host {
|
|
21
|
+
content-visibility: auto;
|
|
22
|
+
}
|
|
23
|
+
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
24
|
+
:host {
|
|
25
|
+
background: ${SystemColors.Canvas};
|
|
26
|
+
color: ${SystemColors.CanvasText};
|
|
27
|
+
}
|
|
28
|
+
`));
|
package/dist/esm/card/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export class Card extends FoundationCard {
|
|
|
31
31
|
*/
|
|
32
32
|
handleChange(source, propertyName) {
|
|
33
33
|
if (!this.cardFillColor) {
|
|
34
|
-
fillColor.setValueFor(this, (target) => neutralFillLayerRecipe.getValueFor(target).evaluate(target, fillColor.getValueFor(source)));
|
|
34
|
+
fillColor.setValueFor(this, (target) => neutralFillLayerRecipe.getValueFor(target).evaluate(target, fillColor.getValueFor(source)).rest);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|