@fluentui/react-calendar-compat 0.3.3 → 0.3.4
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.md +12 -2
- package/lib/components/Calendar/calendarNavigationIcons.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js +115 -0
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js +142 -0
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +395 -0
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js +92 -0
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +9 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +291 -0
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -0
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js +9 -0
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Calendar/calendarNavigationIcons.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js +127 -0
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js +154 -0
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +408 -0
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js +106 -0
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +15 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +303 -0
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js +15 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -0
- package/package.json +2 -2
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
useWeekCornerStyles: function() {
|
13
|
+
return useWeekCornerStyles;
|
14
|
+
},
|
15
|
+
weekCornersClassNames: function() {
|
16
|
+
return weekCornersClassNames;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
20
|
+
const _react = require("@griffel/react");
|
21
|
+
const _constants = require("../../utils/constants");
|
22
|
+
const _index = require("../../utils/index");
|
23
|
+
const weekCornersClassNames = {
|
24
|
+
topRightCornerDate: 'fui-CalendarDayGrid__topRightCornerDate',
|
25
|
+
topLeftCornerDate: 'fui-CalendarDayGrid__topLeftCornerDate',
|
26
|
+
bottomRightCornerDate: 'fui-CalendarDayGrid__bottomRightCornerDate',
|
27
|
+
bottomLeftCornerDate: 'fui-CalendarDayGrid__bottomLeftCornerDate'
|
28
|
+
};
|
29
|
+
function useWeekCornerStyles(props) {
|
30
|
+
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
|
31
|
+
/**
|
32
|
+
*
|
33
|
+
* Section for setting the rounded corner styles on individual day cells. Individual day cells need different
|
34
|
+
* corners to be rounded depending on which date range type and where the cell is located in the current grid.
|
35
|
+
* If we just round all of the corners, there isn't a good overlap and we get gaps between contiguous day boxes
|
36
|
+
* in Edge browser.
|
37
|
+
*
|
38
|
+
*/ const getWeekCornerStyles = (initialWeeks)=>{
|
39
|
+
const weekCornersStyled = {};
|
40
|
+
/* need to handle setting all of the corners on arbitrarily shaped blobs
|
41
|
+
__
|
42
|
+
__|A |
|
43
|
+
|B |C |__
|
44
|
+
|D |E |F |
|
45
|
+
|
46
|
+
in this case, A needs top left rounded, top right rounded
|
47
|
+
B needs top left rounded
|
48
|
+
C doesn't need any rounding
|
49
|
+
D needs bottom left rounded
|
50
|
+
E doesn't need any rounding
|
51
|
+
F needs top right rounding
|
52
|
+
*/ // cut off the animation transition weeks
|
53
|
+
const weeks = initialWeeks.slice(1, initialWeeks.length - 1);
|
54
|
+
// if there's an item above, lose both top corners. Item below, lose both bottom corners, etc.
|
55
|
+
weeks.forEach((week, weekIndex)=>{
|
56
|
+
week.forEach((day, dayIndex)=>{
|
57
|
+
const above = weeks[weekIndex - 1] && weeks[weekIndex - 1][dayIndex] && isInSameHoverRange(weeks[weekIndex - 1][dayIndex].originalDate, day.originalDate, weeks[weekIndex - 1][dayIndex].isSelected, day.isSelected);
|
58
|
+
const below = weeks[weekIndex + 1] && weeks[weekIndex + 1][dayIndex] && isInSameHoverRange(weeks[weekIndex + 1][dayIndex].originalDate, day.originalDate, weeks[weekIndex + 1][dayIndex].isSelected, day.isSelected);
|
59
|
+
const left = weeks[weekIndex][dayIndex - 1] && isInSameHoverRange(weeks[weekIndex][dayIndex - 1].originalDate, day.originalDate, weeks[weekIndex][dayIndex - 1].isSelected, day.isSelected);
|
60
|
+
const right = weeks[weekIndex][dayIndex + 1] && isInSameHoverRange(weeks[weekIndex][dayIndex + 1].originalDate, day.originalDate, weeks[weekIndex][dayIndex + 1].isSelected, day.isSelected);
|
61
|
+
weekCornersStyled[weekIndex + '_' + dayIndex] = calculateRoundedStyles(above, below, left, right);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
return weekCornersStyled;
|
65
|
+
};
|
66
|
+
const calculateRoundedStyles = (above, below, left, right)=>{
|
67
|
+
const style = [];
|
68
|
+
const roundedTopLeft = !above && !left;
|
69
|
+
const roundedTopRight = !above && !right;
|
70
|
+
const roundedBottomLeft = !below && !left;
|
71
|
+
const roundedBottomRight = !below && !right;
|
72
|
+
if (roundedTopLeft) {
|
73
|
+
style.push(dir === 'rtl' ? weekCornersClassNames.topRightCornerDate : weekCornersClassNames.topLeftCornerDate);
|
74
|
+
}
|
75
|
+
if (roundedTopRight) {
|
76
|
+
style.push(dir === 'rtl' ? weekCornersClassNames.topLeftCornerDate : weekCornersClassNames.topRightCornerDate);
|
77
|
+
}
|
78
|
+
if (roundedBottomLeft) {
|
79
|
+
style.push(dir === 'rtl' ? weekCornersClassNames.bottomRightCornerDate : weekCornersClassNames.bottomLeftCornerDate);
|
80
|
+
}
|
81
|
+
if (roundedBottomRight) {
|
82
|
+
style.push(dir === 'rtl' ? weekCornersClassNames.bottomLeftCornerDate : weekCornersClassNames.bottomRightCornerDate);
|
83
|
+
}
|
84
|
+
return (0, _react.mergeClasses)(...style);
|
85
|
+
};
|
86
|
+
const isInSameHoverRange = (date1, date2, date1Selected, date2Selected)=>{
|
87
|
+
const { dateRangeType, firstDayOfWeek, workWeekDays } = props;
|
88
|
+
// The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state
|
89
|
+
const dateRangeHoverType = dateRangeType === _constants.DateRangeType.WorkWeek ? _constants.DateRangeType.Week : dateRangeType;
|
90
|
+
// we do not pass daysToSelectInDayView because we handle setting those styles dyanamically in onMouseOver
|
91
|
+
const dateRange = (0, _index.getDateRangeArray)(date1, dateRangeHoverType, firstDayOfWeek, workWeekDays);
|
92
|
+
if (date1Selected !== date2Selected) {
|
93
|
+
// if one is selected and the other is not, they can't be in the same range
|
94
|
+
return false;
|
95
|
+
} else if (date1Selected && date2Selected) {
|
96
|
+
// if they're both selected at the same time they must be in the same range
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
// otherwise, both must be unselected, so check the dateRange
|
100
|
+
return dateRange.filter((date)=>date.getTime() === date2.getTime()).length > 0;
|
101
|
+
};
|
102
|
+
return [
|
103
|
+
getWeekCornerStyles,
|
104
|
+
calculateRoundedStyles
|
105
|
+
];
|
106
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/useWeekCornerStyles.styles.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { DateRangeType } from '../../utils/constants';\nimport { getDateRangeArray } from '../../utils/index';\nimport { DayInfo } from './CalendarDayGrid';\nimport { CalendarDayGridProps } from './CalendarDayGrid.types';\n\n/**\n * @internal\n */\nexport const weekCornersClassNames = {\n topRightCornerDate: 'fui-CalendarDayGrid__topRightCornerDate',\n topLeftCornerDate: 'fui-CalendarDayGrid__topLeftCornerDate',\n bottomRightCornerDate: 'fui-CalendarDayGrid__bottomRightCornerDate',\n bottomLeftCornerDate: 'fui-CalendarDayGrid__bottomLeftCornerDate',\n};\n\n/**\n * @internal\n */\nexport interface WeekCorners {\n [key: string]: string;\n}\n\n/**\n * @internal\n */\nexport function useWeekCornerStyles(props: CalendarDayGridProps) {\n const { dir } = useFluent_unstable();\n\n /**\n *\n * Section for setting the rounded corner styles on individual day cells. Individual day cells need different\n * corners to be rounded depending on which date range type and where the cell is located in the current grid.\n * If we just round all of the corners, there isn't a good overlap and we get gaps between contiguous day boxes\n * in Edge browser.\n *\n */\n const getWeekCornerStyles = (initialWeeks: DayInfo[][]): WeekCorners => {\n const weekCornersStyled: { [key: string]: string } = {};\n /* need to handle setting all of the corners on arbitrarily shaped blobs\n __\n __|A |\n |B |C |__\n |D |E |F |\n\n in this case, A needs top left rounded, top right rounded\n B needs top left rounded\n C doesn't need any rounding\n D needs bottom left rounded\n E doesn't need any rounding\n F needs top right rounding\n */\n\n // cut off the animation transition weeks\n const weeks = initialWeeks.slice(1, initialWeeks.length - 1);\n\n // if there's an item above, lose both top corners. Item below, lose both bottom corners, etc.\n weeks.forEach((week: DayInfo[], weekIndex: number) => {\n week.forEach((day: DayInfo, dayIndex: number) => {\n const above =\n weeks[weekIndex - 1] &&\n weeks[weekIndex - 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex - 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex - 1][dayIndex].isSelected,\n day.isSelected,\n );\n const below =\n weeks[weekIndex + 1] &&\n weeks[weekIndex + 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex + 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex + 1][dayIndex].isSelected,\n day.isSelected,\n );\n const left =\n weeks[weekIndex][dayIndex - 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex - 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex - 1].isSelected,\n day.isSelected,\n );\n const right =\n weeks[weekIndex][dayIndex + 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex + 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex + 1].isSelected,\n day.isSelected,\n );\n\n weekCornersStyled[weekIndex + '_' + dayIndex] = calculateRoundedStyles(above, below, left, right);\n });\n });\n\n return weekCornersStyled;\n };\n\n const calculateRoundedStyles = (above: boolean, below: boolean, left: boolean, right: boolean): string => {\n const style = [];\n const roundedTopLeft = !above && !left;\n const roundedTopRight = !above && !right;\n const roundedBottomLeft = !below && !left;\n const roundedBottomRight = !below && !right;\n\n if (roundedTopLeft) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topRightCornerDate : weekCornersClassNames.topLeftCornerDate);\n }\n if (roundedTopRight) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topLeftCornerDate : weekCornersClassNames.topRightCornerDate);\n }\n if (roundedBottomLeft) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomRightCornerDate : weekCornersClassNames.bottomLeftCornerDate,\n );\n }\n if (roundedBottomRight) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomLeftCornerDate : weekCornersClassNames.bottomRightCornerDate,\n );\n }\n\n return mergeClasses(...style);\n };\n\n const isInSameHoverRange = (date1: Date, date2: Date, date1Selected: boolean, date2Selected: boolean): boolean => {\n const { dateRangeType, firstDayOfWeek, workWeekDays } = props;\n\n // The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state\n const dateRangeHoverType = dateRangeType === DateRangeType.WorkWeek ? DateRangeType.Week : dateRangeType;\n\n // we do not pass daysToSelectInDayView because we handle setting those styles dyanamically in onMouseOver\n const dateRange = getDateRangeArray(date1, dateRangeHoverType, firstDayOfWeek, workWeekDays);\n\n if (date1Selected !== date2Selected) {\n // if one is selected and the other is not, they can't be in the same range\n return false;\n } else if (date1Selected && date2Selected) {\n // if they're both selected at the same time they must be in the same range\n return true;\n }\n\n // otherwise, both must be unselected, so check the dateRange\n return dateRange.filter((date: Date) => date.getTime() === date2.getTime()).length > 0;\n };\n\n return [getWeekCornerStyles, calculateRoundedStyles] as const;\n}\n"],"names":["useWeekCornerStyles","weekCornersClassNames","topRightCornerDate","topLeftCornerDate","bottomRightCornerDate","bottomLeftCornerDate","props","dir","useFluent_unstable","getWeekCornerStyles","initialWeeks","weekCornersStyled","weeks","slice","length","forEach","week","weekIndex","day","dayIndex","above","isInSameHoverRange","originalDate","isSelected","below","left","right","calculateRoundedStyles","style","roundedTopLeft","roundedTopRight","roundedBottomLeft","roundedBottomRight","push","mergeClasses","date1","date2","date1Selected","date2Selected","dateRangeType","firstDayOfWeek","workWeekDays","dateRangeHoverType","DateRangeType","WorkWeek","Week","dateRange","getDateRangeArray","filter","date","getTime"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2BgBA,mBAAAA;eAAAA;;IAjBHC,qBAAAA;eAAAA;;;qCAVsB;uBACN;2BACC;uBACI;AAO3B,MAAMA,wBAAwB;IACnCC,oBAAoB;IACpBC,mBAAmB;IACnBC,uBAAuB;IACvBC,sBAAsB;AACxB;AAYO,SAASL,oBAAoBM,KAA2B;IAC7D,MAAM,EAAEC,GAAG,EAAE,GAAGC,IAAAA,uCAAAA;IAEhB;;;;;;;GAOC,GACD,MAAMC,sBAAsB,CAACC;QAC3B,MAAMC,oBAA+C,CAAC;QACtD;;;;;;;;;;;;IAYA,GAEA,yCAAyC;QACzC,MAAMC,QAAQF,aAAaG,KAAK,CAAC,GAAGH,aAAaI,MAAM,GAAG;QAE1D,8FAA8F;QAC9FF,MAAMG,OAAO,CAAC,CAACC,MAAiBC;YAC9BD,KAAKD,OAAO,CAAC,CAACG,KAAcC;gBAC1B,MAAMC,QACJR,KAAK,CAACK,YAAY,EAAE,IACpBL,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,IAC9BE,mBACET,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,CAACG,YAAY,EAC3CJ,IAAII,YAAY,EAChBV,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,CAACI,UAAU,EACzCL,IAAIK,UAAU;gBAElB,MAAMC,QACJZ,KAAK,CAACK,YAAY,EAAE,IACpBL,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,IAC9BE,mBACET,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,CAACG,YAAY,EAC3CJ,IAAII,YAAY,EAChBV,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,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sBI,oBAAoB,GAAGJ,sBAAsBG,qBAAqB;QAE5G;QAEA,OAAO8B,IAAAA,mBAAAA,KAAgBN;IACzB;IAEA,MAAMP,qBAAqB,CAACc,OAAaC,OAAaC,eAAwBC;QAC5E,MAAM,EAAEC,aAAa,EAAEC,cAAc,EAAEC,YAAY,EAAE,GAAGnC;QAExD,8GAA8G;QAC9G,MAAMoC,qBAAqBH,kBAAkBI,wBAAAA,CAAcC,QAAQ,GAAGD,wBAAAA,CAAcE,IAAI,GAAGN;QAE3F,0GAA0G;QAC1G,MAAMO,YAAYC,IAAAA,wBAAAA,EAAkBZ,OAAOO,oBAAoBF,gBAAgBC;QAE/E,IAAIJ,kBAAkBC,eAAe;YACnC,2EAA2E;YAC3E,OAAO;QACT,OAAO,IAAID,iBAAiBC,eAAe;YACzC,2EAA2E;YAC3E,OAAO;QACT;QAEA,6DAA6D;QAC7D,OAAOQ,UAAUE,MAAM,CAAC,CAACC,OAAeA,KAAKC,OAAO,OAAOd,MAAMc,OAAO,IAAIpC,MAAM,GAAG;IACvF;IAEA,OAAO;QAACL;QAAqBkB;KAAuB;AACtD"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useCalendarMonthStyles_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return useCalendarMonthStyles_unstable;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _useCalendarPickerStylesstyles = require("../CalendarPicker/useCalendarPickerStyles.styles");
|
12
|
+
const useCalendarMonthStyles_unstable = (props)=>{
|
13
|
+
'use no memo';
|
14
|
+
return (0, _useCalendarPickerStylesstyles.useCalendarPickerStyles_unstable)(props);
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarMonth/useCalendarMonthStyles.styles.ts"],"sourcesContent":["import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles.styles';\nimport type { CalendarMonthStyleProps, CalendarMonthStyles } from './CalendarMonth.types';\n\n/**\n * @internal\n *\n * Apply styling to the CalendarMonth slots based on the state\n */\nexport const useCalendarMonthStyles_unstable = (props: CalendarMonthStyleProps): CalendarMonthStyles => {\n 'use no memo';\n\n return useCalendarPickerStyles_unstable(props);\n};\n"],"names":["useCalendarMonthStyles_unstable","props","useCalendarPickerStyles_unstable"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;+CARoC;AAQ1C,MAAMA,kCAAkC,CAACC;IAC9C;IAEA,OAAOC,IAAAA,+DAAAA,EAAiCD;AAC1C"}
|
@@ -0,0 +1,303 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
calendarPickerClassNames: function() {
|
13
|
+
return calendarPickerClassNames;
|
14
|
+
},
|
15
|
+
useCalendarPickerStyles_unstable: function() {
|
16
|
+
return useCalendarPickerStyles_unstable;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
const _reacttheme = require("@fluentui/react-theme");
|
20
|
+
const _react = require("@griffel/react");
|
21
|
+
const _animations = require("../../utils/animations");
|
22
|
+
const _Calendartypes = require("../Calendar/Calendar.types");
|
23
|
+
const calendarPickerClassNames = {
|
24
|
+
root: 'fui-CalendarPicker',
|
25
|
+
headerContainer: 'fui-CalendarPicker__headerContainer',
|
26
|
+
currentItemButton: 'fui-CalendarPicker__currentItemButton',
|
27
|
+
navigationButtonsContainer: 'fui-CalendarPicker__navigationButtonsContainer',
|
28
|
+
navigationButton: 'fui-CalendarPicker__navigationButton',
|
29
|
+
gridContainer: 'fui-CalendarPicker__gridContainer',
|
30
|
+
buttonRow: 'fui-CalendarPicker__buttonRow',
|
31
|
+
itemButton: 'fui-CalendarPicker__itemButton',
|
32
|
+
current: 'fui-CalendarPicker__current',
|
33
|
+
selected: 'fui-CalendarPicker__selected',
|
34
|
+
disabled: 'fui-CalendarPicker__disabled'
|
35
|
+
};
|
36
|
+
const useRootStyles = (0, _react.makeStyles)({
|
37
|
+
base: {
|
38
|
+
boxSizing: 'content-box',
|
39
|
+
overflow: 'hidden',
|
40
|
+
padding: '12px',
|
41
|
+
width: '196px'
|
42
|
+
},
|
43
|
+
normalize: {
|
44
|
+
boxShadow: 'none',
|
45
|
+
boxSizing: 'border-box',
|
46
|
+
margin: '0',
|
47
|
+
padding: '0'
|
48
|
+
}
|
49
|
+
});
|
50
|
+
const useHeaderContainerStyles = (0, _react.makeStyles)({
|
51
|
+
base: {
|
52
|
+
display: 'flex'
|
53
|
+
}
|
54
|
+
});
|
55
|
+
const useCurrentItemButtonStyles = (0, _react.makeStyles)({
|
56
|
+
base: {
|
57
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
58
|
+
..._react.shorthands.borderStyle('none'),
|
59
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
60
|
+
color: 'inherit',
|
61
|
+
flexGrow: 1,
|
62
|
+
fontFamily: 'inherit',
|
63
|
+
fontSize: _reacttheme.tokens.fontSizeBase300,
|
64
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold,
|
65
|
+
overflow: 'visible',
|
66
|
+
padding: '0 4px 0 10px',
|
67
|
+
textAlign: 'left'
|
68
|
+
},
|
69
|
+
animation: {
|
70
|
+
animationDuration: _animations.DURATION_2,
|
71
|
+
animationFillMode: 'both',
|
72
|
+
animationName: _animations.FADE_IN,
|
73
|
+
animationTimingFunction: _animations.EASING_FUNCTION_2
|
74
|
+
},
|
75
|
+
hasHeaderClickCallback: {
|
76
|
+
// If this is updated, make sure to update headerIsClickable in useCalendarDayStyles as well
|
77
|
+
'&:hover': {
|
78
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedHover,
|
79
|
+
color: _reacttheme.tokens.colorBrandForegroundOnLightHover,
|
80
|
+
cursor: 'pointer',
|
81
|
+
outline: `1px solid ${_reacttheme.tokens.colorTransparentStroke}`
|
82
|
+
},
|
83
|
+
'&:hover:active': {
|
84
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedPressed,
|
85
|
+
color: _reacttheme.tokens.colorBrandForegroundOnLightPressed,
|
86
|
+
cursor: 'pointer',
|
87
|
+
outline: `1px solid ${_reacttheme.tokens.colorTransparentStroke}`
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
const useNavigationButtonsContainerStyles = (0, _react.makeStyles)({
|
92
|
+
base: {
|
93
|
+
alignItems: 'center',
|
94
|
+
display: 'flex'
|
95
|
+
}
|
96
|
+
});
|
97
|
+
const useNavigationButtonStyles = (0, _react.makeStyles)({
|
98
|
+
base: {
|
99
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
100
|
+
border: 'none',
|
101
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
102
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
103
|
+
display: 'block',
|
104
|
+
fontFamily: 'inherit',
|
105
|
+
fontSize: _reacttheme.tokens.fontSizeBase200,
|
106
|
+
height: '28px',
|
107
|
+
lineHeight: '28px',
|
108
|
+
minHeight: '28px',
|
109
|
+
minWidth: '28px',
|
110
|
+
overflow: 'visible',
|
111
|
+
padding: '0',
|
112
|
+
position: 'relative',
|
113
|
+
textAlign: 'center',
|
114
|
+
width: '28px',
|
115
|
+
'&:hover': {
|
116
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedHover,
|
117
|
+
color: _reacttheme.tokens.colorBrandForegroundOnLightHover,
|
118
|
+
cursor: 'pointer',
|
119
|
+
outline: `1px solid ${_reacttheme.tokens.colorTransparentStroke}`
|
120
|
+
},
|
121
|
+
'&:hover:active': {
|
122
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedPressed,
|
123
|
+
color: _reacttheme.tokens.colorBrandForegroundOnLightPressed
|
124
|
+
}
|
125
|
+
}
|
126
|
+
});
|
127
|
+
const useGridContainerStyles = (0, _react.makeStyles)({
|
128
|
+
base: {
|
129
|
+
marginTop: '4px'
|
130
|
+
}
|
131
|
+
});
|
132
|
+
const useButtonRowStyles = (0, _react.makeStyles)({
|
133
|
+
base: {
|
134
|
+
marginBottom: '16px',
|
135
|
+
'&:last-of-type': {
|
136
|
+
marginBottom: 0
|
137
|
+
}
|
138
|
+
},
|
139
|
+
animation: {
|
140
|
+
animationDuration: _animations.DURATION_3,
|
141
|
+
animationFillMode: 'both',
|
142
|
+
animationTimingFunction: _animations.EASING_FUNCTION_1
|
143
|
+
},
|
144
|
+
horizontalBackward: {
|
145
|
+
animationName: [
|
146
|
+
_animations.FADE_IN,
|
147
|
+
_animations.SLIDE_RIGHT_IN20
|
148
|
+
]
|
149
|
+
},
|
150
|
+
horizontalForward: {
|
151
|
+
animationName: [
|
152
|
+
_animations.FADE_IN,
|
153
|
+
_animations.SLIDE_LEFT_IN20
|
154
|
+
]
|
155
|
+
},
|
156
|
+
verticalBackward: {
|
157
|
+
animationName: [
|
158
|
+
_animations.FADE_IN,
|
159
|
+
_animations.SLIDE_DOWN_IN20
|
160
|
+
]
|
161
|
+
},
|
162
|
+
verticalForward: {
|
163
|
+
animationName: [
|
164
|
+
_animations.FADE_IN,
|
165
|
+
_animations.SLIDE_UP_IN20
|
166
|
+
]
|
167
|
+
}
|
168
|
+
});
|
169
|
+
const useItemButtonStyles = (0, _react.makeStyles)({
|
170
|
+
base: {
|
171
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
172
|
+
border: 'none',
|
173
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
174
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
175
|
+
fontFamily: 'inherit',
|
176
|
+
fontSize: _reacttheme.tokens.fontSizeBase200,
|
177
|
+
height: '40px',
|
178
|
+
lineHeight: '40px',
|
179
|
+
minHeight: '40px',
|
180
|
+
minWidth: '40px',
|
181
|
+
margin: '0 12px 0 0',
|
182
|
+
overflow: 'visible',
|
183
|
+
padding: '0',
|
184
|
+
width: '40px',
|
185
|
+
'&:nth-child(4n + 4)': {
|
186
|
+
marginRight: 0
|
187
|
+
},
|
188
|
+
'&:nth-child(n + 9)': {
|
189
|
+
marginBottom: 0
|
190
|
+
},
|
191
|
+
'& div': {
|
192
|
+
fontWeight: _reacttheme.tokens.fontWeightRegular
|
193
|
+
},
|
194
|
+
'&:hover': {
|
195
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedHover,
|
196
|
+
color: _reacttheme.tokens.colorNeutralForeground1Static,
|
197
|
+
cursor: 'pointer',
|
198
|
+
outline: `1px solid ${_reacttheme.tokens.colorTransparentStroke}`,
|
199
|
+
'@media (forced-colors: active)': {
|
200
|
+
backgroundColor: 'Window',
|
201
|
+
color: 'WindowText',
|
202
|
+
forcedColorAdjust: 'none',
|
203
|
+
outline: '1px solid Highlight'
|
204
|
+
}
|
205
|
+
},
|
206
|
+
'&:hover:active': {
|
207
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedPressed,
|
208
|
+
'@media (forced-colors: active)': {
|
209
|
+
backgroundColor: 'Window',
|
210
|
+
color: 'Highlight',
|
211
|
+
forcedColorAdjust: 'none'
|
212
|
+
}
|
213
|
+
}
|
214
|
+
}
|
215
|
+
});
|
216
|
+
const useCurrentStyles = (0, _react.makeStyles)({
|
217
|
+
highlightCurrent: {
|
218
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackground,
|
219
|
+
color: _reacttheme.tokens.colorNeutralForegroundOnBrand,
|
220
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold,
|
221
|
+
'@media (forced-colors: active)': {
|
222
|
+
backgroundColor: 'WindowText',
|
223
|
+
color: 'Window',
|
224
|
+
forcedColorAdjust: 'none'
|
225
|
+
},
|
226
|
+
'&:hover, &:hover:active': {
|
227
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackground,
|
228
|
+
color: _reacttheme.tokens.colorNeutralForegroundOnBrand,
|
229
|
+
'@media (forced-colors: active)': {
|
230
|
+
backgroundColor: 'WindowText',
|
231
|
+
color: 'Window',
|
232
|
+
forcedColorAdjust: 'none'
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
});
|
237
|
+
const useSelectedStyles = (0, _react.makeStyles)({
|
238
|
+
highlightSelected: {
|
239
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedSelected,
|
240
|
+
color: _reacttheme.tokens.colorNeutralForeground1Static,
|
241
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold,
|
242
|
+
'@media (forced-colors: active)': {
|
243
|
+
backgroundColor: 'Highlight',
|
244
|
+
color: 'Window',
|
245
|
+
forcedColorAdjust: 'none'
|
246
|
+
},
|
247
|
+
'& div': {
|
248
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold
|
249
|
+
},
|
250
|
+
'&:hover': {
|
251
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedSelected,
|
252
|
+
color: _reacttheme.tokens.colorNeutralForeground1Static,
|
253
|
+
'@media (forced-colors: active)': {
|
254
|
+
backgroundColor: 'Highlight',
|
255
|
+
color: 'Window',
|
256
|
+
forcedColorAdjust: 'none'
|
257
|
+
}
|
258
|
+
},
|
259
|
+
'&:hover:active': {
|
260
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundInvertedPressed
|
261
|
+
}
|
262
|
+
}
|
263
|
+
});
|
264
|
+
const useDisabledStyles = (0, _react.makeStyles)({
|
265
|
+
base: {
|
266
|
+
'&, &:disabled, & button': {
|
267
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled,
|
268
|
+
pointerEvents: 'none'
|
269
|
+
},
|
270
|
+
'@media (forced-colors: active)': {
|
271
|
+
color: 'GrayText',
|
272
|
+
forcedColorAdjust: 'none'
|
273
|
+
}
|
274
|
+
}
|
275
|
+
});
|
276
|
+
const useCalendarPickerStyles_unstable = (props)=>{
|
277
|
+
'use no memo';
|
278
|
+
const rootStyles = useRootStyles();
|
279
|
+
const headerContainerStyles = useHeaderContainerStyles();
|
280
|
+
const currentItemButtonStyles = useCurrentItemButtonStyles();
|
281
|
+
const navigationButtonsContainerStyles = useNavigationButtonsContainerStyles();
|
282
|
+
const navigationButtonStyles = useNavigationButtonStyles();
|
283
|
+
const gridContainerStyles = useGridContainerStyles();
|
284
|
+
const buttonRowStyles = useButtonRowStyles();
|
285
|
+
const itemButtonStyles = useItemButtonStyles();
|
286
|
+
const currentStyles = useCurrentStyles();
|
287
|
+
const selectedStyles = useSelectedStyles();
|
288
|
+
const disabledStyles = useDisabledStyles();
|
289
|
+
const { animateBackwards, animationDirection, className, hasHeaderClickCallback, highlightCurrent, highlightSelected } = props;
|
290
|
+
return {
|
291
|
+
root: (0, _react.mergeClasses)(calendarPickerClassNames.root, rootStyles.normalize, rootStyles.base, className),
|
292
|
+
headerContainer: (0, _react.mergeClasses)(calendarPickerClassNames.headerContainer, headerContainerStyles.base),
|
293
|
+
currentItemButton: (0, _react.mergeClasses)(calendarPickerClassNames.currentItemButton, currentItemButtonStyles.base, animateBackwards !== undefined && currentItemButtonStyles.animation, hasHeaderClickCallback && currentItemButtonStyles.hasHeaderClickCallback),
|
294
|
+
navigationButtonsContainer: (0, _react.mergeClasses)(calendarPickerClassNames.navigationButtonsContainer, navigationButtonsContainerStyles.base),
|
295
|
+
navigationButton: (0, _react.mergeClasses)(calendarPickerClassNames.navigationButton, navigationButtonStyles.base),
|
296
|
+
gridContainer: (0, _react.mergeClasses)(calendarPickerClassNames.gridContainer, gridContainerStyles.base),
|
297
|
+
buttonRow: (0, _react.mergeClasses)(calendarPickerClassNames.buttonRow, buttonRowStyles.base, buttonRowStyles.animation, animateBackwards !== undefined && (animationDirection === _Calendartypes.AnimationDirection.Horizontal ? animateBackwards ? buttonRowStyles.horizontalBackward : buttonRowStyles.horizontalForward : animateBackwards ? buttonRowStyles.verticalBackward : buttonRowStyles.verticalForward)),
|
298
|
+
itemButton: (0, _react.mergeClasses)(calendarPickerClassNames.itemButton, itemButtonStyles.base),
|
299
|
+
selected: (0, _react.mergeClasses)(calendarPickerClassNames.selected, highlightSelected && selectedStyles.highlightSelected),
|
300
|
+
current: (0, _react.mergeClasses)(calendarPickerClassNames.current, highlightCurrent && currentStyles.highlightCurrent),
|
301
|
+
disabled: (0, _react.mergeClasses)(calendarPickerClassNames.disabled, disabledStyles.base)
|
302
|
+
};
|
303
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarPicker/useCalendarPickerStyles.styles.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport {\n DURATION_2,\n DURATION_3,\n EASING_FUNCTION_1,\n EASING_FUNCTION_2,\n FADE_IN,\n SLIDE_DOWN_IN20,\n SLIDE_LEFT_IN20,\n SLIDE_RIGHT_IN20,\n SLIDE_UP_IN20,\n} from '../../utils/animations';\nimport { AnimationDirection } from '../Calendar/Calendar.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { CalendarPickerStyles, CalendarPickerStyleProps } from './CalendarPicker.types';\n\n/**\n * @internal\n */\nexport const calendarPickerClassNames: SlotClassNames<CalendarPickerStyles> = {\n root: 'fui-CalendarPicker',\n headerContainer: 'fui-CalendarPicker__headerContainer',\n currentItemButton: 'fui-CalendarPicker__currentItemButton',\n navigationButtonsContainer: 'fui-CalendarPicker__navigationButtonsContainer',\n navigationButton: 'fui-CalendarPicker__navigationButton',\n gridContainer: 'fui-CalendarPicker__gridContainer',\n buttonRow: 'fui-CalendarPicker__buttonRow',\n itemButton: 'fui-CalendarPicker__itemButton',\n current: 'fui-CalendarPicker__current',\n selected: 'fui-CalendarPicker__selected',\n disabled: 'fui-CalendarPicker__disabled',\n};\n\nconst useRootStyles = makeStyles({\n base: {\n boxSizing: 'content-box',\n overflow: 'hidden',\n padding: '12px',\n width: '196px',\n },\n normalize: {\n boxShadow: 'none',\n boxSizing: 'border-box',\n margin: '0',\n padding: '0',\n },\n});\n\nconst useHeaderContainerStyles = makeStyles({\n base: {\n display: 'flex',\n },\n});\n\nconst useCurrentItemButtonStyles = makeStyles({\n base: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderStyle('none'),\n borderRadius: tokens.borderRadiusMedium,\n color: 'inherit',\n flexGrow: 1,\n fontFamily: 'inherit',\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightSemibold,\n overflow: 'visible',\n padding: '0 4px 0 10px',\n textAlign: 'left',\n },\n animation: {\n animationDuration: DURATION_2,\n animationFillMode: 'both',\n animationName: FADE_IN,\n animationTimingFunction: EASING_FUNCTION_2,\n },\n hasHeaderClickCallback: {\n // If this is updated, make sure to update headerIsClickable in useCalendarDayStyles as well\n '&:hover': {\n backgroundColor: tokens.colorBrandBackgroundInvertedHover,\n color: tokens.colorBrandForegroundOnLightHover,\n cursor: 'pointer',\n outline: `1px solid ${tokens.colorTransparentStroke}`,\n },\n '&:hover:active': {\n backgroundColor: tokens.colorBrandBackgroundInvertedPressed,\n color: tokens.colorBrandForegroundOnLightPressed,\n cursor: 'pointer',\n outline: `1px solid ${tokens.colorTransparentStroke}`,\n },\n },\n});\n\nconst useNavigationButtonsContainerStyles = makeStyles({\n base: {\n alignItems: 'center',\n display: 'flex',\n },\n});\n\nconst useNavigationButtonStyles = makeStyles({\n base: {\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground1,\n display: 'block',\n fontFamily: 'inherit',\n fontSize: tokens.fontSizeBase200,\n height: '28px',\n lineHeight: '28px',\n minHeight: '28px',\n minWidth: '28px',\n overflow: 'visible',\n padding: '0',\n position: 'relative',\n textAlign: 'center',\n width: '28px',\n\n '&:hover': {\n backgroundColor: tokens.colorBrandBackgroundInvertedHover,\n color: tokens.colorBrandForegroundOnLightHover,\n cursor: 'pointer',\n outline: `1px solid ${tokens.colorTransparentStroke}`,\n },\n\n '&:hover:active': {\n backgroundColor: tokens.colorBrandBackgroundInvertedPressed,\n color: tokens.colorBrandForegroundOnLightPressed,\n },\n },\n});\n\nconst useGridContainerStyles = makeStyles({\n base: {\n marginTop: '4px',\n },\n});\n\nconst useButtonRowStyles = makeStyles({\n base: {\n marginBottom: '16px',\n '&:last-of-type': {\n marginBottom: 0,\n },\n },\n animation: {\n animationDuration: DURATION_3,\n animationFillMode: 'both',\n animationTimingFunction: EASING_FUNCTION_1,\n },\n horizontalBackward: {\n animationName: [FADE_IN, SLIDE_RIGHT_IN20],\n },\n horizontalForward: {\n animationName: [FADE_IN, SLIDE_LEFT_IN20],\n },\n verticalBackward: {\n animationName: [FADE_IN, SLIDE_DOWN_IN20],\n },\n verticalForward: {\n animationName: [FADE_IN, SLIDE_UP_IN20],\n },\n});\n\nconst useItemButtonStyles = makeStyles({\n base: {\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground3,\n fontFamily: 'inherit',\n fontSize: tokens.fontSizeBase200,\n height: '40px',\n lineHeight: '40px',\n minHeight: '40px',\n minWidth: '40px',\n margin: '0 12px 0 0',\n overflow: 'visible',\n padding: '0',\n width: '40px',\n\n '&:nth-child(4n + 4)': {\n marginRight: 0,\n },\n '&:nth-child(n + 9)': {\n marginBottom: 0,\n },\n '& div': {\n fontWeight: tokens.fontWeightRegular,\n },\n '&:hover': {\n backgroundColor: tokens.colorBrandBackgroundInvertedHover,\n color: tokens.colorNeutralForeground1Static,\n cursor: 'pointer',\n outline: `1px solid ${tokens.colorTransparentStroke}`,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText',\n forcedColorAdjust: 'none',\n outline: '1px solid Highlight',\n },\n },\n '&:hover:active': {\n backgroundColor: tokens.colorBrandBackgroundInvertedPressed,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'Highlight',\n forcedColorAdjust: 'none',\n },\n },\n },\n});\n\nconst useCurrentStyles = makeStyles({\n highlightCurrent: {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\n fontWeight: tokens.fontWeightSemibold,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'WindowText',\n color: 'Window',\n forcedColorAdjust: 'none',\n },\n '&:hover, &:hover:active': {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'WindowText',\n color: 'Window',\n forcedColorAdjust: 'none',\n },\n },\n },\n});\n\nconst useSelectedStyles = makeStyles({\n highlightSelected: {\n backgroundColor: tokens.colorBrandBackgroundInvertedSelected,\n color: tokens.colorNeutralForeground1Static,\n fontWeight: tokens.fontWeightSemibold,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n color: 'Window',\n forcedColorAdjust: 'none',\n },\n '& div': {\n fontWeight: tokens.fontWeightSemibold,\n },\n '&:hover': {\n backgroundColor: tokens.colorBrandBackgroundInvertedSelected,\n color: tokens.colorNeutralForeground1Static,\n\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n color: 'Window',\n forcedColorAdjust: 'none',\n },\n },\n '&:hover:active': {\n backgroundColor: tokens.colorBrandBackgroundInvertedPressed,\n },\n },\n});\n\nconst useDisabledStyles = makeStyles({\n base: {\n '&, &:disabled, & button': {\n color: tokens.colorNeutralForegroundDisabled,\n pointerEvents: 'none',\n },\n '@media (forced-colors: active)': {\n color: 'GrayText',\n forcedColorAdjust: 'none',\n },\n },\n});\n\n/**\n * @internal\n *\n * Apply styling to the CalendarPicker slots based on the state\n */\nexport const useCalendarPickerStyles_unstable = (props: CalendarPickerStyleProps): CalendarPickerStyles => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n const headerContainerStyles = useHeaderContainerStyles();\n const currentItemButtonStyles = useCurrentItemButtonStyles();\n const navigationButtonsContainerStyles = useNavigationButtonsContainerStyles();\n const navigationButtonStyles = useNavigationButtonStyles();\n const gridContainerStyles = useGridContainerStyles();\n const buttonRowStyles = useButtonRowStyles();\n const itemButtonStyles = useItemButtonStyles();\n const currentStyles = useCurrentStyles();\n const selectedStyles = useSelectedStyles();\n const disabledStyles = useDisabledStyles();\n\n const {\n animateBackwards,\n animationDirection,\n className,\n hasHeaderClickCallback,\n highlightCurrent,\n highlightSelected,\n } = props;\n\n return {\n root: mergeClasses(calendarPickerClassNames.root, rootStyles.normalize, rootStyles.base, className),\n headerContainer: mergeClasses(calendarPickerClassNames.headerContainer, headerContainerStyles.base),\n currentItemButton: mergeClasses(\n calendarPickerClassNames.currentItemButton,\n currentItemButtonStyles.base,\n animateBackwards !== undefined && currentItemButtonStyles.animation,\n hasHeaderClickCallback && currentItemButtonStyles.hasHeaderClickCallback,\n ),\n navigationButtonsContainer: mergeClasses(\n calendarPickerClassNames.navigationButtonsContainer,\n navigationButtonsContainerStyles.base,\n ),\n navigationButton: mergeClasses(calendarPickerClassNames.navigationButton, navigationButtonStyles.base),\n gridContainer: mergeClasses(calendarPickerClassNames.gridContainer, gridContainerStyles.base),\n buttonRow: mergeClasses(\n calendarPickerClassNames.buttonRow,\n buttonRowStyles.base,\n buttonRowStyles.animation,\n animateBackwards !== undefined &&\n (animationDirection === AnimationDirection.Horizontal\n ? animateBackwards\n ? buttonRowStyles.horizontalBackward\n : buttonRowStyles.horizontalForward\n : animateBackwards\n ? buttonRowStyles.verticalBackward\n : buttonRowStyles.verticalForward),\n ),\n itemButton: mergeClasses(calendarPickerClassNames.itemButton, itemButtonStyles.base),\n selected: mergeClasses(calendarPickerClassNames.selected, highlightSelected && selectedStyles.highlightSelected),\n current: mergeClasses(calendarPickerClassNames.current, highlightCurrent && currentStyles.highlightCurrent),\n disabled: mergeClasses(calendarPickerClassNames.disabled, disabledStyles.base),\n };\n};\n"],"names":["calendarPickerClassNames","useCalendarPickerStyles_unstable","root","headerContainer","currentItemButton","navigationButtonsContainer","navigationButton","gridContainer","buttonRow","itemButton","current","selected","disabled","useRootStyles","makeStyles","base","boxSizing","overflow","padding","width","normalize","boxShadow","margin","useHeaderContainerStyles","display","useCurrentItemButtonStyles","backgroundColor","tokens","colorTransparentBackground","shorthands","borderStyle","borderRadius","borderRadiusMedium","color","flexGrow","fontFamily","fontSize","fontSizeBase300","fontWeight","fontWeightSemibold","textAlign","animation","animationDuration","DURATION_2","animationFillMode","animationName","FADE_IN","animationTimingFunction","EASING_FUNCTION_2","hasHeaderClickCallback","colorBrandBackgroundInvertedHover","colorBrandForegroundOnLightHover","cursor","outline","colorTransparentStroke","colorBrandBackgroundInvertedPressed","colorBrandForegroundOnLightPressed","useNavigationButtonsContainerStyles","alignItems","useNavigationButtonStyles","border","colorNeutralForeground1","fontSizeBase200","height","lineHeight","minHeight","minWidth","position","useGridContainerStyles","marginTop","useButtonRowStyles","marginBottom","DURATION_3","EASING_FUNCTION_1","horizontalBackward","SLIDE_RIGHT_IN20","horizontalForward","SLIDE_LEFT_IN20","verticalBackward","SLIDE_DOWN_IN20","verticalForward","SLIDE_UP_IN20","useItemButtonStyles","colorNeutralForeground3","marginRight","fontWeightRegular","colorNeutralForeground1Static","forcedColorAdjust","useCurrentStyles","highlightCurrent","colorBrandBackground","colorNeutralForegroundOnBrand","useSelectedStyles","highlightSelected","colorBrandBackgroundInvertedSelected","useDisabledStyles","colorNeutralForegroundDisabled","pointerEvents","props","rootStyles","headerContainerStyles","currentItemButtonStyles","navigationButtonsContainerStyles","navigationButtonStyles","gridContainerStyles","buttonRowStyles","itemButtonStyles","currentStyles","selectedStyles","disabledStyles","animateBackwards","animationDirection","className","mergeClasses","undefined","AnimationDirection","Horizontal"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QAC5FP,WAAWyG,IAAAA,mBAAAA,EACTjH,yBAAyBQ,SAAS,EAClCiG,gBAAgB1F,IAAI,EACpB0F,gBAAgBhE,SAAS,EACzBqE,qBAAqBI,aAClBH,CAAAA,uBAAuBI,iCAAAA,CAAmBC,UAAU,GACjDN,mBACEL,gBAAgB/B,kBAAkB,GAClC+B,gBAAgB7B,iBAAiB,GACnCkC,mBACAL,gBAAgB3B,gBAAgB,GAChC2B,gBAAgBzB,eAAe,AAAfA;QAExBvE,YAAYwG,IAAAA,mBAAAA,EAAajH,yBAAyBS,UAAU,EAAEiG,iBAAiB3F,IAAI;QACnFJ,UAAUsG,IAAAA,mBAAAA,EAAajH,yBAAyBW,QAAQ,EAAEkF,qBAAqBe,eAAef,iBAAiB;QAC/GnF,SAASuG,IAAAA,mBAAAA,EAAajH,yBAAyBU,OAAO,EAAE+E,oBAAoBkB,cAAclB,gBAAgB;QAC1G7E,UAAUqG,IAAAA,mBAAAA,EAAajH,yBAAyBY,QAAQ,EAAEiG,eAAe9F,IAAI;IAC/E;AACF"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useCalendarYearStyles_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return useCalendarYearStyles_unstable;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _useCalendarPickerStylesstyles = require("../CalendarPicker/useCalendarPickerStyles.styles");
|
12
|
+
const useCalendarYearStyles_unstable = (props)=>{
|
13
|
+
'use no memo';
|
14
|
+
return (0, _useCalendarPickerStylesstyles.useCalendarPickerStyles_unstable)(props);
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarYear/useCalendarYearStyles.styles.ts"],"sourcesContent":["import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles.styles';\nimport type { CalendarYearStyleProps, CalendarYearStyles } from './CalendarYear.types';\n\n/**\n * @internal\n *\n * Apply styling to the CalendarYear slots based on the state\n */\nexport const useCalendarYearStyles_unstable = (props: CalendarYearStyleProps): CalendarYearStyles => {\n 'use no memo';\n\n return useCalendarPickerStyles_unstable(props);\n};\n"],"names":["useCalendarYearStyles_unstable","props","useCalendarPickerStyles_unstable"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;+CARoC;AAQ1C,MAAMA,iCAAiC,CAACC;IAC7C;IAEA,OAAOC,IAAAA,+DAAAA,EAAiCD;AAC1C"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-calendar-compat",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.4",
|
4
4
|
"description": "Calendar compat component for Fluent UI v9",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"@fluentui/react-icons": "^2.0.245",
|
23
23
|
"@fluentui/react-jsx-runtime": "^9.1.2",
|
24
24
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
25
|
-
"@fluentui/react-tabster": "^9.
|
25
|
+
"@fluentui/react-tabster": "^9.26.0",
|
26
26
|
"@fluentui/react-theme": "^9.1.24",
|
27
27
|
"@fluentui/react-utilities": "^9.22.0",
|
28
28
|
"@griffel/react": "^1.5.22",
|