@ember-formwright/power-calendar 0.0.0-stage → 1.3.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.md +20 -0
- package/LICENSE.md +9 -0
- package/README.md +85 -2
- package/addon-main.cjs +4 -0
- package/declarations/date-library.d.ts +5 -0
- package/declarations/date-library.d.ts.map +1 -0
- package/declarations/dates.d.ts +37 -0
- package/declarations/dates.d.ts.map +1 -0
- package/declarations/index.d.ts +94 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +45 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/dist/index.js +488 -0
- package/dist/index.js.map +1 -0
- package/dist/test-support/index.js +112 -0
- package/dist/test-support/index.js.map +1 -0
- package/dist/theme.css +228 -0
- package/package.json +109 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { click, triggerKeyEvent } from '@ember/test-helpers';
|
|
2
|
+
import { FieldHarness } from '@ember-formwright/test-support';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Drives a `date-picker` or `date-range` field the way a user would: open the calendar,
|
|
6
|
+
* page to the month, click the day.
|
|
7
|
+
*
|
|
8
|
+
* class TripForm extends FormHarness {
|
|
9
|
+
* @field(DatePickerHarness) declare departure: DatePickerHarness
|
|
10
|
+
* @field(DatePickerHarness) declare stay: DatePickerHarness
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* await trip.departure.select('2026-03-04')
|
|
14
|
+
* await trip.stay.selectRange('2026-03-04', '2026-03-09')
|
|
15
|
+
* assert.strictEqual(trip.departure.text, 'Mar 4, 2026')
|
|
16
|
+
*/
|
|
17
|
+
class DatePickerHarness extends FieldHarness {
|
|
18
|
+
static controls = ['date-picker', 'date-range'];
|
|
19
|
+
|
|
20
|
+
/** The button the field's label points at. */
|
|
21
|
+
get trigger() {
|
|
22
|
+
return this.control;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The value as the trigger shows it, e.g. "Mar 4, 2026"; empty when there is none. */
|
|
26
|
+
get text() {
|
|
27
|
+
return this.trigger.querySelector('[data-test-fw-date-value]')?.textContent?.replace(/\s+/g, ' ').trim() ?? '';
|
|
28
|
+
}
|
|
29
|
+
get isOpen() {
|
|
30
|
+
return this.trigger.getAttribute('aria-expanded') === 'true';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The open calendar, which renders outside the field (or in place, in a callout). */
|
|
34
|
+
get calendar() {
|
|
35
|
+
const id = this.trigger.getAttribute('aria-controls');
|
|
36
|
+
return id ? document.getElementById(id) : null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The month shown, e.g. "March 2026". */
|
|
40
|
+
get month() {
|
|
41
|
+
return this.requireCalendar().querySelector('.ember-power-calendar-nav-title').textContent.trim();
|
|
42
|
+
}
|
|
43
|
+
async open() {
|
|
44
|
+
if (!this.isOpen) await click(this.trigger);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Closes the calendar with Escape, as a keyboard user would. */
|
|
48
|
+
async close() {
|
|
49
|
+
if (this.isOpen) await triggerKeyEvent(this.trigger, 'keydown', 'Escape');
|
|
50
|
+
}
|
|
51
|
+
async nextMonth() {
|
|
52
|
+
await click(this.navButton('next'));
|
|
53
|
+
}
|
|
54
|
+
async previousMonth() {
|
|
55
|
+
await click(this.navButton('previous'));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Opens the calendar and pages to the month of `date` (`YYYY-MM-DD`). */
|
|
59
|
+
async goTo(date) {
|
|
60
|
+
await this.open();
|
|
61
|
+
for (let i = 0; i < 1200; i++) {
|
|
62
|
+
const shown = this.shownMonth();
|
|
63
|
+
const wanted = date.slice(0, 7);
|
|
64
|
+
if (shown === wanted) return;
|
|
65
|
+
await (wanted < shown ? this.previousMonth() : this.nextMonth());
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Formwright harness: "${this.path}" never showed the month of ${date}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The day button for `date` (`YYYY-MM-DD`) in the month shown, if it is there. */
|
|
71
|
+
day(date) {
|
|
72
|
+
return this.requireCalendar().querySelector(`.ember-power-calendar-day--current-month[data-date="${date}"]`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Whether `date` can't be chosen (before `@min`, after `@max`, or in `@disabledDates`). */
|
|
76
|
+
async isDayDisabled(date) {
|
|
77
|
+
await this.goTo(date);
|
|
78
|
+
return Boolean(this.day(date)?.disabled);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Opens the calendar, pages to `date` (`YYYY-MM-DD`) and clicks it. */
|
|
82
|
+
async select(date) {
|
|
83
|
+
await this.goTo(date);
|
|
84
|
+
const day = this.day(date);
|
|
85
|
+
if (!day) throw new Error(`Formwright harness: no day ${date} in "${this.path}"`);
|
|
86
|
+
if (day.disabled) throw new Error(`Formwright harness: day ${date} in "${this.path}" is disabled`);
|
|
87
|
+
await click(day);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** date-range: chooses both ends. */
|
|
91
|
+
async selectRange(start, end) {
|
|
92
|
+
await this.select(start);
|
|
93
|
+
await this.select(end);
|
|
94
|
+
}
|
|
95
|
+
shownMonth() {
|
|
96
|
+
const day = this.requireCalendar().querySelector('.ember-power-calendar-day--current-month');
|
|
97
|
+
return day.getAttribute('data-date').slice(0, 7);
|
|
98
|
+
}
|
|
99
|
+
navButton(which) {
|
|
100
|
+
const button = this.requireCalendar().querySelector(`.ember-power-calendar-nav-control--${which}`);
|
|
101
|
+
if (!button) throw new Error(`Formwright harness: no ${which}-month button in "${this.path}"`);
|
|
102
|
+
return button;
|
|
103
|
+
}
|
|
104
|
+
requireCalendar() {
|
|
105
|
+
const calendar = this.isOpen ? this.calendar : null;
|
|
106
|
+
if (!calendar) throw new Error(`Formwright harness: the calendar of "${this.path}" is not open`);
|
|
107
|
+
return calendar;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { DatePickerHarness };
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import { click, triggerKeyEvent } from '@ember/test-helpers'\nimport { FieldHarness } from '@ember-formwright/test-support'\n\n/**\n * Drives a `date-picker` or `date-range` field the way a user would: open the calendar,\n * page to the month, click the day.\n *\n * class TripForm extends FormHarness {\n * @field(DatePickerHarness) declare departure: DatePickerHarness\n * @field(DatePickerHarness) declare stay: DatePickerHarness\n * }\n *\n * await trip.departure.select('2026-03-04')\n * await trip.stay.selectRange('2026-03-04', '2026-03-09')\n * assert.strictEqual(trip.departure.text, 'Mar 4, 2026')\n */\nexport class DatePickerHarness extends FieldHarness {\n static override controls = ['date-picker', 'date-range']\n\n /** The button the field's label points at. */\n get trigger(): HTMLButtonElement {\n return this.control as HTMLButtonElement\n }\n\n /** The value as the trigger shows it, e.g. \"Mar 4, 2026\"; empty when there is none. */\n get text(): string {\n return (\n this.trigger\n .querySelector('[data-test-fw-date-value]')\n ?.textContent?.replace(/\\s+/g, ' ')\n .trim() ?? ''\n )\n }\n\n get isOpen(): boolean {\n return this.trigger.getAttribute('aria-expanded') === 'true'\n }\n\n /** The open calendar, which renders outside the field (or in place, in a callout). */\n get calendar(): HTMLElement | null {\n const id = this.trigger.getAttribute('aria-controls')\n return id ? document.getElementById(id) : null\n }\n\n /** The month shown, e.g. \"March 2026\". */\n get month(): string {\n return this.requireCalendar()\n .querySelector('.ember-power-calendar-nav-title')!\n .textContent!.trim()\n }\n\n async open(): Promise<void> {\n if (!this.isOpen) await click(this.trigger)\n }\n\n /** Closes the calendar with Escape, as a keyboard user would. */\n async close(): Promise<void> {\n if (this.isOpen) await triggerKeyEvent(this.trigger, 'keydown', 'Escape')\n }\n\n async nextMonth(): Promise<void> {\n await click(this.navButton('next'))\n }\n\n async previousMonth(): Promise<void> {\n await click(this.navButton('previous'))\n }\n\n /** Opens the calendar and pages to the month of `date` (`YYYY-MM-DD`). */\n async goTo(date: string): Promise<void> {\n await this.open()\n for (let i = 0; i < 1200; i++) {\n const shown = this.shownMonth()\n const wanted = date.slice(0, 7)\n if (shown === wanted) return\n await (wanted < shown ? this.previousMonth() : this.nextMonth())\n }\n throw new Error(`Formwright harness: \"${this.path}\" never showed the month of ${date}`)\n }\n\n /** The day button for `date` (`YYYY-MM-DD`) in the month shown, if it is there. */\n day(date: string): HTMLButtonElement | null {\n return this.requireCalendar().querySelector<HTMLButtonElement>(\n `.ember-power-calendar-day--current-month[data-date=\"${date}\"]`,\n )\n }\n\n /** Whether `date` can't be chosen (before `@min`, after `@max`, or in `@disabledDates`). */\n async isDayDisabled(date: string): Promise<boolean> {\n await this.goTo(date)\n return Boolean(this.day(date)?.disabled)\n }\n\n /** Opens the calendar, pages to `date` (`YYYY-MM-DD`) and clicks it. */\n async select(date: string): Promise<void> {\n await this.goTo(date)\n const day = this.day(date)\n if (!day) throw new Error(`Formwright harness: no day ${date} in \"${this.path}\"`)\n if (day.disabled)\n throw new Error(`Formwright harness: day ${date} in \"${this.path}\" is disabled`)\n await click(day)\n }\n\n /** date-range: chooses both ends. */\n async selectRange(start: string, end: string): Promise<void> {\n await this.select(start)\n await this.select(end)\n }\n\n private shownMonth(): string {\n const day = this.requireCalendar().querySelector('.ember-power-calendar-day--current-month')\n return day!.getAttribute('data-date')!.slice(0, 7)\n }\n\n private navButton(which: 'next' | 'previous'): Element {\n const button = this.requireCalendar().querySelector(\n `.ember-power-calendar-nav-control--${which}`,\n )\n if (!button) throw new Error(`Formwright harness: no ${which}-month button in \"${this.path}\"`)\n return button\n }\n\n private requireCalendar(): HTMLElement {\n const calendar = this.isOpen ? this.calendar : null\n if (!calendar) throw new Error(`Formwright harness: the calendar of \"${this.path}\" is not open`)\n return calendar\n }\n}\n"],"names":["DatePickerHarness","FieldHarness","controls","trigger","control","text","querySelector","textContent","replace","trim","isOpen","getAttribute","calendar","id","document","getElementById","month","requireCalendar","open","click","close","triggerKeyEvent","nextMonth","navButton","previousMonth","goTo","date","i","shown","shownMonth","wanted","slice","Error","path","day","isDayDisabled","Boolean","disabled","select","selectRange","start","end","which","button"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,SAASC,YAAY,CAAC;AAClD,EAAA,OAAgBC,QAAQ,GAAG,CAAC,aAAa,EAAE,YAAY,CAAC;;AAExD;EACA,IAAIC,OAAOA,GAAsB;IAC/B,OAAO,IAAI,CAACC,OAAO;AACrB,EAAA;;AAEA;EACA,IAAIC,IAAIA,GAAW;IACjB,OACE,IAAI,CAACF,OAAO,CACTG,aAAa,CAAC,2BAA2B,CAAC,EACzCC,WAAW,EAAEC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAClCC,IAAI,EAAE,IAAI,EAAE;AAEnB,EAAA;EAEA,IAAIC,MAAMA,GAAY;IACpB,OAAO,IAAI,CAACP,OAAO,CAACQ,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM;AAC9D,EAAA;;AAEA;EACA,IAAIC,QAAQA,GAAuB;IACjC,MAAMC,EAAE,GAAG,IAAI,CAACV,OAAO,CAACQ,YAAY,CAAC,eAAe,CAAC;IACrD,OAAOE,EAAE,GAAGC,QAAQ,CAACC,cAAc,CAACF,EAAE,CAAC,GAAG,IAAI;AAChD,EAAA;;AAEA;EACA,IAAIG,KAAKA,GAAW;AAClB,IAAA,OAAO,IAAI,CAACC,eAAe,EAAE,CAC1BX,aAAa,CAAC,iCAAiC,CAAC,CAChDC,WAAW,CAAEE,IAAI,EAAE;AACxB,EAAA;EAEA,MAAMS,IAAIA,GAAkB;IAC1B,IAAI,CAAC,IAAI,CAACR,MAAM,EAAE,MAAMS,KAAK,CAAC,IAAI,CAAChB,OAAO,CAAC;AAC7C,EAAA;;AAEA;EACA,MAAMiB,KAAKA,GAAkB;AAC3B,IAAA,IAAI,IAA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,GAAG,CAAC;AAC9F,IAAA,OAAOU,MAAM;AACf,EAAA;AAEQ1B,EAAAA,eAAeA,GAAgB;IACrC,MAAML,QAAQ,GAAG,IAAI,CAACF,MAAM,GAAG,IAAI,CAACE,QAAQ,GAAG,IAAI;AACnD,IAAA,IAAI,CAACA,QAAQ,EAAE,MAAM,IAAIoB,KAAK,CAAC,CAAA,qCAAA,EAAwC,IAAI,CAACC,IAAI,CAAA,aAAA,CAAe,CAAC;AAChG,IAAA,OAAOrB,QAAQ;AACjB,EAAA;AACF;;"}
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Formwright's theme for the date-picker and date-range controls. Import it after
|
|
3
|
+
* ember-basic-dropdown's styles and the Formwright theme:
|
|
4
|
+
*
|
|
5
|
+
* import 'ember-basic-dropdown/styles'
|
|
6
|
+
* import '@ember-formwright/ember/theme.css'
|
|
7
|
+
* import '@ember-formwright/power-calendar/theme.css'
|
|
8
|
+
*
|
|
9
|
+
* It styles the trigger like the other controls and the calendar from the Formwright theme's
|
|
10
|
+
* custom properties, so ember-power-calendar's own stylesheet isn't needed. Size the calendar
|
|
11
|
+
* with --fw-calendar-cell (default 2.25rem).
|
|
12
|
+
*/
|
|
13
|
+
.fw-date-picker-control {
|
|
14
|
+
flex: 1;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
display: grid;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ---- trigger ------------------------------------------------------------------------- */
|
|
21
|
+
|
|
22
|
+
.fw-date-picker {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
gap: 0.5rem;
|
|
27
|
+
width: 100%;
|
|
28
|
+
min-height: 2.4rem;
|
|
29
|
+
font: inherit;
|
|
30
|
+
text-align: start;
|
|
31
|
+
color: var(--fw-fg);
|
|
32
|
+
background: var(--fw-bg);
|
|
33
|
+
border: 1px solid var(--fw-border);
|
|
34
|
+
border-radius: var(--fw-radius);
|
|
35
|
+
padding: 0.5rem 0.7rem;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.fw-date-picker[aria-expanded='true'] {
|
|
40
|
+
border-color: var(--fw-border-focus);
|
|
41
|
+
box-shadow: var(--fw-ring);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fw-date-picker:disabled {
|
|
45
|
+
opacity: 0.6;
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.fw-date-picker-placeholder {
|
|
50
|
+
color: var(--fw-muted);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.fw-date-picker-icon {
|
|
54
|
+
flex: none;
|
|
55
|
+
fill: none;
|
|
56
|
+
stroke: var(--fw-muted);
|
|
57
|
+
stroke-width: 1.8;
|
|
58
|
+
stroke-linecap: round;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.fw-date-picker[aria-expanded='true'] .fw-date-picker-icon {
|
|
62
|
+
stroke: var(--fw-accent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ---- dropdown ------------------------------------------------------------------------ */
|
|
66
|
+
|
|
67
|
+
.fw-date-picker-dropdown.ember-basic-dropdown-content {
|
|
68
|
+
margin-block: 0.35rem;
|
|
69
|
+
padding: 0.75rem;
|
|
70
|
+
color: var(--fw-fg);
|
|
71
|
+
background: var(--fw-bg);
|
|
72
|
+
border: 1px solid var(--fw-border);
|
|
73
|
+
border-radius: calc(var(--fw-radius) + 4px);
|
|
74
|
+
box-shadow:
|
|
75
|
+
0 12px 32px rgb(0 0 0 / 14%),
|
|
76
|
+
0 2px 6px rgb(0 0 0 / 6%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* A dropdown rendered in place inside a callout must not be clipped by the popover. */
|
|
80
|
+
.fw-callout:has(.fw-date-picker-dropdown) {
|
|
81
|
+
overflow: visible;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ---- calendar ------------------------------------------------------------------------ */
|
|
85
|
+
|
|
86
|
+
.fw-calendar {
|
|
87
|
+
--fw-calendar-cell-size: var(--fw-calendar-cell, 2.25rem);
|
|
88
|
+
width: calc(var(--fw-calendar-cell-size) * 7);
|
|
89
|
+
font-size: 0.875rem;
|
|
90
|
+
line-height: 1.4;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.fw-calendar * {
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.fw-calendar .ember-power-calendar-nav {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: space-between;
|
|
102
|
+
margin-bottom: 0.4rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.fw-calendar .ember-power-calendar-nav-title {
|
|
106
|
+
flex: 1;
|
|
107
|
+
text-align: center;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.fw-calendar .ember-power-calendar-nav-control {
|
|
112
|
+
appearance: none;
|
|
113
|
+
display: grid;
|
|
114
|
+
place-items: center;
|
|
115
|
+
width: 2rem;
|
|
116
|
+
height: 2rem;
|
|
117
|
+
padding: 0;
|
|
118
|
+
font: inherit;
|
|
119
|
+
font-size: 1.15rem;
|
|
120
|
+
line-height: 1;
|
|
121
|
+
color: var(--fw-muted);
|
|
122
|
+
background: transparent;
|
|
123
|
+
border: 1px solid transparent;
|
|
124
|
+
border-radius: var(--fw-radius);
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fw-calendar .ember-power-calendar-nav-control:hover {
|
|
129
|
+
color: var(--fw-fg);
|
|
130
|
+
background: color-mix(in srgb, var(--fw-fg) 7%, transparent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.fw-calendar .ember-power-calendar-row {
|
|
134
|
+
display: flex;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.fw-calendar .ember-power-calendar-weekday {
|
|
138
|
+
display: grid;
|
|
139
|
+
place-items: center;
|
|
140
|
+
width: var(--fw-calendar-cell-size);
|
|
141
|
+
height: 1.75rem;
|
|
142
|
+
font-size: 0.75rem;
|
|
143
|
+
font-weight: 600;
|
|
144
|
+
text-transform: uppercase;
|
|
145
|
+
color: var(--fw-muted);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.fw-calendar .ember-power-calendar-day {
|
|
149
|
+
appearance: none;
|
|
150
|
+
display: grid;
|
|
151
|
+
place-items: center;
|
|
152
|
+
width: var(--fw-calendar-cell-size);
|
|
153
|
+
height: var(--fw-calendar-cell-size);
|
|
154
|
+
padding: 0;
|
|
155
|
+
font: inherit;
|
|
156
|
+
font-variant-numeric: tabular-nums;
|
|
157
|
+
color: var(--fw-fg);
|
|
158
|
+
background: transparent;
|
|
159
|
+
border: 0;
|
|
160
|
+
border-radius: var(--fw-radius);
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.fw-calendar .ember-power-calendar-day--other-month {
|
|
165
|
+
color: var(--fw-muted);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.fw-calendar .ember-power-calendar-day:not([disabled]):hover {
|
|
169
|
+
background: color-mix(in srgb, var(--fw-accent) 12%, transparent);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.fw-calendar .ember-power-calendar-day--today {
|
|
173
|
+
font-weight: 700;
|
|
174
|
+
box-shadow: inset 0 0 0 1px var(--fw-accent);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.fw-calendar .ember-power-calendar-day[disabled] {
|
|
178
|
+
color: var(--fw-muted);
|
|
179
|
+
opacity: 0.45;
|
|
180
|
+
text-decoration: line-through;
|
|
181
|
+
cursor: not-allowed;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.fw-calendar .ember-power-calendar-day:focus-visible,
|
|
185
|
+
.fw-calendar .ember-power-calendar-nav-control:focus-visible {
|
|
186
|
+
outline: none;
|
|
187
|
+
box-shadow: var(--fw-ring);
|
|
188
|
+
position: relative;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* A range: the days between its ends get a band, the ends a solid fill. */
|
|
192
|
+
.fw-calendar .ember-power-calendar-day--selected {
|
|
193
|
+
color: var(--fw-fg);
|
|
194
|
+
background: color-mix(in srgb, var(--fw-accent) 16%, transparent);
|
|
195
|
+
border-radius: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.fw-calendar .ember-power-calendar-day--selected:not([disabled]):hover {
|
|
199
|
+
background: color-mix(in srgb, var(--fw-accent) 26%, transparent);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.fw-calendar .ember-power-calendar-day--range-start {
|
|
203
|
+
border-start-start-radius: var(--fw-radius);
|
|
204
|
+
border-end-start-radius: var(--fw-radius);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.fw-calendar .ember-power-calendar-day--range-end {
|
|
208
|
+
border-start-end-radius: var(--fw-radius);
|
|
209
|
+
border-end-end-radius: var(--fw-radius);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* A single date, and a range's ends. */
|
|
213
|
+
.fw-calendar:not(.fw-calendar--range) .ember-power-calendar-day--selected,
|
|
214
|
+
.fw-calendar .ember-power-calendar-day--range-start,
|
|
215
|
+
.fw-calendar .ember-power-calendar-day--range-end,
|
|
216
|
+
.fw-calendar
|
|
217
|
+
.ember-power-calendar-day--selected:is(
|
|
218
|
+
.ember-power-calendar-day--range-start,
|
|
219
|
+
.ember-power-calendar-day--range-end
|
|
220
|
+
):not([disabled]):hover {
|
|
221
|
+
color: var(--fw-accent-fg);
|
|
222
|
+
background: var(--fw-accent);
|
|
223
|
+
font-weight: 600;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.fw-calendar:not(.fw-calendar--range) .ember-power-calendar-day--selected {
|
|
227
|
+
border-radius: var(--fw-radius);
|
|
228
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-formwright/power-calendar",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Date and date-range pickers for Formwright, powered by ember-power-calendar.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"ember",
|
|
8
|
+
"forms",
|
|
9
|
+
"formwright",
|
|
10
|
+
"date-picker",
|
|
11
|
+
"calendar",
|
|
12
|
+
"power-calendar"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Joe Gaudet <joe@joegaudet.com>",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/joegaudet/ember-formwright.git",
|
|
19
|
+
"directory": "packages/power-calendar"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://joegaudet.com/ember-formwright/",
|
|
22
|
+
"bugs": "https://github.com/joegaudet/ember-formwright/issues",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./declarations/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./test-support": {
|
|
29
|
+
"types": "./declarations/test-support/index.d.ts",
|
|
30
|
+
"default": "./dist/test-support/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./theme.css": "./dist/theme.css",
|
|
33
|
+
"./addon-main.js": "./addon-main.cjs"
|
|
34
|
+
},
|
|
35
|
+
"typesVersions": {
|
|
36
|
+
"*": {
|
|
37
|
+
"*": [
|
|
38
|
+
"declarations/*"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"addon-main.cjs",
|
|
44
|
+
"declarations",
|
|
45
|
+
"dist",
|
|
46
|
+
"README.md",
|
|
47
|
+
"CHANGELOG.md"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@embroider/addon-shim": "^1.10.3",
|
|
51
|
+
"decorator-transforms": "^2.4.0",
|
|
52
|
+
"ember-modifier": "^4.3.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@ember/test-helpers": ">= 5.0.0",
|
|
56
|
+
"ember-basic-dropdown": ">= 9.0.0",
|
|
57
|
+
"ember-power-calendar": ">= 2.0.0",
|
|
58
|
+
"ember-source": ">= 6.12.0",
|
|
59
|
+
"@ember-formwright/test-support": "^1.3.0",
|
|
60
|
+
"@ember-formwright/ember": "^1.3.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@ember-formwright/test-support": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@ember/test-helpers": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@babel/core": "^7.29.7",
|
|
72
|
+
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
73
|
+
"@babel/runtime": "^7.29.7",
|
|
74
|
+
"@ember/library-tsconfig": "^3.0.0",
|
|
75
|
+
"@ember/test-helpers": "^5.7.0",
|
|
76
|
+
"@embroider/addon-dev": "^8.4.2",
|
|
77
|
+
"@embroider/macros": "^1.21.1",
|
|
78
|
+
"@glimmer/component": "^2.1.1",
|
|
79
|
+
"@glimmer/tracking": "^1.1.2",
|
|
80
|
+
"@glint/ember-tsc": "^1.11.6",
|
|
81
|
+
"@glint/template": "^1.9.0",
|
|
82
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
83
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
84
|
+
"ember-basic-dropdown": "^9.0.1",
|
|
85
|
+
"ember-concurrency": "^5.3.0",
|
|
86
|
+
"ember-power-calendar": "^2.0.1",
|
|
87
|
+
"ember-source": "~7.3.0",
|
|
88
|
+
"rollup": "^4.64.6",
|
|
89
|
+
"typescript": "~6.0.3",
|
|
90
|
+
"@ember-formwright/ember": "1.3.0",
|
|
91
|
+
"@ember-formwright/test-support": "1.3.0"
|
|
92
|
+
},
|
|
93
|
+
"publishConfig": {
|
|
94
|
+
"access": "public"
|
|
95
|
+
},
|
|
96
|
+
"engines": {
|
|
97
|
+
"node": ">=22.12.0"
|
|
98
|
+
},
|
|
99
|
+
"ember": {
|
|
100
|
+
"edition": "octane"
|
|
101
|
+
},
|
|
102
|
+
"ember-addon": {
|
|
103
|
+
"version": 2,
|
|
104
|
+
"type": "addon",
|
|
105
|
+
"main": "addon-main.cjs"
|
|
106
|
+
},
|
|
107
|
+
"scripts": {
|
|
108
|
+
"build": "rollup --config",
|
|
109
|
+
"start": "rollup --config --watch",
|
|
110
|
+
"typecheck": "ember-tsc --noEmit"
|
|
111
|
+
}
|
|
6
112
|
}
|