Skip to content

Commit

Permalink
feat: adding initial layout with customized labels
Browse files Browse the repository at this point in the history
  • Loading branch information
motss committed May 8, 2021
1 parent bc0f6c5 commit aca077f
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 25 deletions.
163 changes: 163 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
},
"dependencies": {
"@material/mwc-base": "^0.21.0",
"@material/mwc-icon-button": "^0.21.0",
"lit": "^2.0.0-rc.1",
"nodemod": "^2.8.1",
"tslib": "^2.2.0"
Expand Down
4 changes: 3 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ export const DateTimeFormat = Intl.DateTimeFormat;

export const defaultLocale = 'en-US';

export const MAX_DATE = toResolvedDate('2100-12-31');
export const MAX_DATE = toResolvedDate('2100-12-31');

export const ONE_DAY_IN_SECONDS = 864e5;
14 changes: 13 additions & 1 deletion src/date-picker-mixin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { LitElement } from 'lit';
import type { CalendarView, Constructor, DatePickerElementInterface, MixinReturnType } from './typings.js';

import { property } from 'lit/decorators.js';
import type { WeekNumberType } from 'nodemod/dist/calendar/calendar_typing';
Expand All @@ -8,6 +7,7 @@ import { nullishAttributeConverter } from './helpers/nullish-attribute-converter
import { toDateString } from './helpers/to-date-string.js';
import { toResolvedDate } from './helpers/to-resolved-date.js';
import { toResolvedLocale } from './helpers/to-resolved-locale.js';
import type { CalendarView, Constructor, DatePickerElementInterface, MixinReturnType } from './typings.js';

export const DatePickerMixin = <BaseConstructor extends Constructor<LitElement>>(
SuperClass: BaseConstructor
Expand Down Expand Up @@ -40,6 +40,15 @@ export const DatePickerMixin = <BaseConstructor extends Constructor<LitElement>>
@property({ reflect: true, converter: { toAttribute: nullishAttributeConverter } })
public min?: string;

@property()
public nextMonthLabel = 'Next month';

@property()
public previousMonthLabel = 'Previous month';

@property()
public selectedDateLabel = 'Selected date';

@property({ type: Boolean, reflect: true })
public showWeekNumber = false;

Expand All @@ -54,6 +63,9 @@ export const DatePickerMixin = <BaseConstructor extends Constructor<LitElement>>

@property({ reflect: true, converter: { toAttribute: nullishAttributeConverter } })
public weekNumberType: WeekNumberType = 'first-4-day-week';

@property()
public yearDropdownLabel = 'Choose year and month';
}

return DatePickerElement as unknown as MixinReturnType<
Expand Down
Loading

0 comments on commit aca077f

Please sign in to comment.