first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
@@ -0,0 +1,32 @@
import { IDateGridStrings, IDateFormatting, ICalendarStrings } from './dateFormatting.types';
/**
* Format date to a day string representation
* @param date - input date to format
*/
export declare const formatDay: (date: Date) => string;
/**
* Format date to a month-day-year string
* @param date - input date to format
* @param strings - localized strings
*/
export declare const formatMonthDayYear: (date: Date, strings: IDateGridStrings) => string;
/**
* Format date to a month-year string
* @param date - input date to format
* @param strings - localized strings
*/
export declare const formatMonthYear: (date: Date, strings: IDateGridStrings) => string;
/**
* Format date to a month string
* @param date - input date to format
* @param strings - localized strings
*/
export declare const formatMonth: (date: Date, strings: IDateGridStrings) => string;
/**
* Format date to a year string representation
* @param date - input date to format
*/
export declare const formatYear: (date: Date) => string;
export declare const DEFAULT_DATE_GRID_STRINGS: IDateGridStrings;
export declare const DEFAULT_DATE_FORMATTING: IDateFormatting;
export declare const DEFAULT_CALENDAR_STRINGS: ICalendarStrings;
@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_CALENDAR_STRINGS = exports.DEFAULT_DATE_FORMATTING = exports.DEFAULT_DATE_GRID_STRINGS = exports.formatYear = exports.formatMonth = exports.formatMonthYear = exports.formatMonthDayYear = exports.formatDay = void 0;
var tslib_1 = require("tslib");
/**
* Format date to a day string representation
* @param date - input date to format
*/
var formatDay = function (date) { return date.getDate().toString(); };
exports.formatDay = formatDay;
/**
* Format date to a month-day-year string
* @param date - input date to format
* @param strings - localized strings
*/
var formatMonthDayYear = function (date, strings) {
return strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();
};
exports.formatMonthDayYear = formatMonthDayYear;
/**
* Format date to a month-year string
* @param date - input date to format
* @param strings - localized strings
*/
var formatMonthYear = function (date, strings) {
return strings.months[date.getMonth()] + ' ' + date.getFullYear();
};
exports.formatMonthYear = formatMonthYear;
/**
* Format date to a month string
* @param date - input date to format
* @param strings - localized strings
*/
var formatMonth = function (date, strings) { return strings.months[date.getMonth()]; };
exports.formatMonth = formatMonth;
/**
* Format date to a year string representation
* @param date - input date to format
*/
var formatYear = function (date) { return date.getFullYear().toString(); };
exports.formatYear = formatYear;
exports.DEFAULT_DATE_GRID_STRINGS = {
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
],
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
};
exports.DEFAULT_DATE_FORMATTING = {
formatDay: exports.formatDay,
formatMonth: exports.formatMonth,
formatYear: exports.formatYear,
formatMonthDayYear: exports.formatMonthDayYear,
formatMonthYear: exports.formatMonthYear,
};
exports.DEFAULT_CALENDAR_STRINGS = tslib_1.__assign(tslib_1.__assign({}, exports.DEFAULT_DATE_GRID_STRINGS), { goToToday: 'Go to today', weekNumberFormatString: 'Week number {0}', prevMonthAriaLabel: 'Previous month', nextMonthAriaLabel: 'Next month', prevYearAriaLabel: 'Previous year', nextYearAriaLabel: 'Next year', prevYearRangeAriaLabel: 'Previous year range', nextYearRangeAriaLabel: 'Next year range', closeButtonAriaLabel: 'Close', selectedDateFormatString: 'Selected date {0}', todayDateFormatString: "Today's date {0}", monthPickerHeaderAriaLabel: '{0}, change year', yearPickerHeaderAriaLabel: '{0}, change month', dayMarkedAriaLabel: 'marked' });
//# sourceMappingURL=dateFormatting.defaults.js.map
@@ -0,0 +1 @@
{"version":3,"file":"dateFormatting.defaults.js","sourceRoot":"../src/","sources":["dateFormatting/dateFormatting.defaults.ts"],"names":[],"mappings":";;;;AAEA;;;GAGG;AACI,IAAM,SAAS,GAAG,UAAC,IAAU,IAAa,OAAA,IAAI,CAAC,OAAO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AK,CAAC;IACjG,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IACpF,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;CAC/C,CAAC;AAEW,QAAA,uBAAuB,GAAoB;IACtD,SAAS,mBAAA;IACT,WAAW,qBAAA;IACX,UAAU,oBAAA;IACV,kBAAkB,4BAAA;IAClB,eAAe,yBAAA;CAChB,CAAC;AAEW,QAAA,wBAAwB,yCAChC,iCAAyB,KAE5B,SAAS,EAAE,aAAa,EACxB,sBAAsB,EAAE,iBAAiB,EACzC,kBAAkB,EAAE,gBAAgB,EACpC,kBAAkB,EAAE,YAAY,EAChC,iBAAiB,EAAE,eAAe,EAClC,iBAAiB,EAAE,WAAW,EAC9B,sBAAsB,EAAE,qBAAqB,EAC7C,sBAAsB,EAAE,iBAAiB,EACzC,oBAAoB,EAAE,OAAO,EAC7B,wBAAwB,EAAE,mBAAmB,EAC7C,qBAAqB,EAAE,kBAAkB,EACzC,0BAA0B,EAAE,kBAAkB,EAC9C,yBAAyB,EAAE,mBAAmB,EAC9C,kBAAkB,EAAE,QAAQ,IAC5B","sourcesContent":["import { IDateGridStrings, IDateFormatting, ICalendarStrings } from './dateFormatting.types';\n\n/**\n * Format date to a day string representation\n * @param date - input date to format\n */\nexport const formatDay = (date: Date): string => date.getDate().toString();\n\n/**\n * Format date to a month-day-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthDayYear = (date: Date, strings: IDateGridStrings): string =>\n strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();\n\n/**\n * Format date to a month-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthYear = (date: Date, strings: IDateGridStrings): string =>\n strings.months[date.getMonth()] + ' ' + date.getFullYear();\n\n/**\n * Format date to a month string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonth = (date: Date, strings: IDateGridStrings): string => strings.months[date.getMonth()];\n\n/**\n * Format date to a year string representation\n * @param date - input date to format\n */\nexport const formatYear = (date: Date): string => date.getFullYear().toString();\n\nexport const DEFAULT_DATE_GRID_STRINGS: IDateGridStrings = {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n};\n\nexport const DEFAULT_DATE_FORMATTING: IDateFormatting = {\n formatDay,\n formatMonth,\n formatYear,\n formatMonthDayYear,\n formatMonthYear,\n};\n\nexport const DEFAULT_CALENDAR_STRINGS: ICalendarStrings = {\n ...DEFAULT_DATE_GRID_STRINGS,\n\n goToToday: 'Go to today',\n weekNumberFormatString: 'Week number {0}',\n prevMonthAriaLabel: 'Previous month',\n nextMonthAriaLabel: 'Next month',\n prevYearAriaLabel: 'Previous year',\n nextYearAriaLabel: 'Next year',\n prevYearRangeAriaLabel: 'Previous year range',\n nextYearRangeAriaLabel: 'Next year range',\n closeButtonAriaLabel: 'Close',\n selectedDateFormatString: 'Selected date {0}',\n todayDateFormatString: \"Today's date {0}\",\n monthPickerHeaderAriaLabel: '{0}, change year',\n yearPickerHeaderAriaLabel: '{0}, change month',\n dayMarkedAriaLabel: 'marked',\n};\n"]}
@@ -0,0 +1,114 @@
/**
* {@docCategory DateTimeUtilities}
*/
export interface IDateGridStrings {
/**
* An array of strings for the full names of months.
* The array is 0-based, so months[0] should be the full name of January.
*/
months: string[];
/**
* An array of strings for the short names of months.
* The array is 0-based, so shortMonths[0] should be the short name of January.
*/
shortMonths: string[];
/**
* An array of strings for the full names of days of the week.
* The array is 0-based, so days[0] should be the full name of Sunday.
*/
days: string[];
/**
* An array of strings for the initials of the days of the week.
* The array is 0-based, so days[0] should be the initial of Sunday.
*/
shortDays: string[];
}
/**
* {@docCategory DateTimeUtilities}
*/
export interface IDateFormatting {
/**
* Get a localized string for a day.
*/
formatDay: (date: Date) => string;
/**
* Get a localized string for a month.
*/
formatMonth: (date: Date, strings: IDateGridStrings) => string;
/**
* Get a localized string for a year.
*/
formatYear: (date: Date) => string;
/**
* Get a localized string for a month, day, and year.
*/
formatMonthDayYear: (date: Date, strings: IDateGridStrings) => string;
/**
* Get a localized string for a month and year.
*/
formatMonthYear: (date: Date, strings: IDateGridStrings) => string;
}
/**
* {@docCategory DateTimeUtilities}
*/
export interface ICalendarStrings extends IDateGridStrings {
/**
* String to render for button to direct the user to today's date.
*/
goToToday: string;
/**
* Aria-label for the "previous month" button in day picker.
*/
prevMonthAriaLabel?: string;
/**
* Aria-label for the "next month" button in day picker.
*/
nextMonthAriaLabel?: string;
/**
* Aria-label for the "previous year" button in month picker.
*/
prevYearAriaLabel?: string;
/**
* Aria-label for the "next year" button in month picker.
*/
nextYearAriaLabel?: string;
/**
* Aria-label for the "previous year range" button in year picker.
*/
prevYearRangeAriaLabel?: string;
/**
* Aria-label for the "next year range" button in year picker.
*/
nextYearRangeAriaLabel?: string;
/**
* Aria-label format string for the header button in the month picker. Should have 1 string param, e.g. "`{0}`,
* select to change the year". This aria-label will only be applied if the year picker is enabled; otherwise
* the label will default to the header string, e.g. "2019".
*/
monthPickerHeaderAriaLabel?: string;
/**
* Aria-label format string for the header button in the year picker.
* Should have 1 string param, e.g. "`{0}`, select to change the month"
*/
yearPickerHeaderAriaLabel?: string;
/**
* Aria-label for the "close" button.
*/
closeButtonAriaLabel?: string;
/**
* Aria-label format string for the week number header. Should have 1 string param, e.g. "week number `{0}`"
*/
weekNumberFormatString?: string;
/**
* Aria-label format string for the currently selected date. Should have 1 string param, e.g. "Selected date `{0}`"
*/
selectedDateFormatString?: string;
/**
* Aria-label format string for today's date. Should have 1 string param, e.g. "Today's date `{0}`"
*/
todayDateFormatString?: string;
/**
* Aria-label for when a date is marked
*/
dayMarkedAriaLabel?: string;
}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=dateFormatting.types.js.map
@@ -0,0 +1 @@
{"version":3,"file":"dateFormatting.types.js","sourceRoot":"../src/","sources":["dateFormatting/dateFormatting.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * {@docCategory DateTimeUtilities}\n */\nexport interface IDateGridStrings {\n /**\n * An array of strings for the full names of months.\n * The array is 0-based, so months[0] should be the full name of January.\n */\n months: string[];\n\n /**\n * An array of strings for the short names of months.\n * The array is 0-based, so shortMonths[0] should be the short name of January.\n */\n shortMonths: string[];\n\n /**\n * An array of strings for the full names of days of the week.\n * The array is 0-based, so days[0] should be the full name of Sunday.\n */\n days: string[];\n\n /**\n * An array of strings for the initials of the days of the week.\n * The array is 0-based, so days[0] should be the initial of Sunday.\n */\n shortDays: string[];\n}\n\n/**\n * {@docCategory DateTimeUtilities}\n */\nexport interface IDateFormatting {\n /**\n * Get a localized string for a day.\n */\n formatDay: (date: Date) => string;\n\n /**\n * Get a localized string for a month.\n */\n formatMonth: (date: Date, strings: IDateGridStrings) => string;\n\n /**\n * Get a localized string for a year.\n */\n formatYear: (date: Date) => string;\n\n /**\n * Get a localized string for a month, day, and year.\n */\n formatMonthDayYear: (date: Date, strings: IDateGridStrings) => string;\n\n /**\n * Get a localized string for a month and year.\n */\n formatMonthYear: (date: Date, strings: IDateGridStrings) => string;\n}\n\n/**\n * {@docCategory DateTimeUtilities}\n */\nexport interface ICalendarStrings extends IDateGridStrings {\n /**\n * String to render for button to direct the user to today's date.\n */\n goToToday: string;\n\n /**\n * Aria-label for the \"previous month\" button in day picker.\n */\n prevMonthAriaLabel?: string;\n\n /**\n * Aria-label for the \"next month\" button in day picker.\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Aria-label for the \"previous year\" button in month picker.\n */\n prevYearAriaLabel?: string;\n\n /**\n * Aria-label for the \"next year\" button in month picker.\n */\n nextYearAriaLabel?: string;\n\n /**\n * Aria-label for the \"previous year range\" button in year picker.\n */\n prevYearRangeAriaLabel?: string;\n\n /**\n * Aria-label for the \"next year range\" button in year picker.\n */\n nextYearRangeAriaLabel?: string;\n\n /**\n * Aria-label format string for the header button in the month picker. Should have 1 string param, e.g. \"`{0}`,\n * select to change the year\". This aria-label will only be applied if the year picker is enabled; otherwise\n * the label will default to the header string, e.g. \"2019\".\n */\n monthPickerHeaderAriaLabel?: string;\n\n /**\n * Aria-label format string for the header button in the year picker.\n * Should have 1 string param, e.g. \"`{0}`, select to change the month\"\n */\n yearPickerHeaderAriaLabel?: string;\n\n /**\n * Aria-label for the \"close\" button.\n */\n closeButtonAriaLabel?: string;\n\n /**\n * Aria-label format string for the week number header. Should have 1 string param, e.g. \"week number `{0}`\"\n */\n weekNumberFormatString?: string;\n\n /**\n * Aria-label format string for the currently selected date. Should have 1 string param, e.g. \"Selected date `{0}`\"\n */\n selectedDateFormatString?: string;\n\n /**\n * Aria-label format string for today's date. Should have 1 string param, e.g. \"Today's date `{0}`\"\n */\n todayDateFormatString?: string;\n\n /**\n * Aria-label for when a date is marked\n */\n dayMarkedAriaLabel?: string;\n}\n"]}
@@ -0,0 +1,2 @@
export * from './dateFormatting.types';
export * from './dateFormatting.defaults';
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./dateFormatting.types"), exports);
tslib_1.__exportStar(require("./dateFormatting.defaults"), exports);
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["dateFormatting/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,oEAA0C","sourcesContent":["export * from './dateFormatting.types';\nexport * from './dateFormatting.defaults';\n"]}