@remit/ui 0.0.196 → 0.0.198
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/package.json +1 -1
- package/src/components/account-service-change-dialog.stories.tsx +1 -0
- package/src/components/account-service-choice.stories.tsx +1 -0
- package/src/components/calendar-list.stories.tsx +1 -0
- package/src/components/category-badge.stories.tsx +1 -0
- package/src/components/custom-recurrence.stories.tsx +1 -0
- package/src/components/event-editor.render.test.ts +24 -1
- package/src/components/event-editor.stories.tsx +23 -0
- package/src/components/event-editor.tsx +10 -0
- package/src/components/event-quick-entry.stories.tsx +1 -0
- package/src/components/intelligence-panel-calendar.stories.tsx +1 -2
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import { AccountServiceChangeDialog } from "./account-service-change-dialog.js";
|
|
|
8
8
|
*/
|
|
9
9
|
const meta: Meta<typeof AccountServiceChangeDialog> = {
|
|
10
10
|
title: "Design System/Settings/AccountServiceChangeDialog",
|
|
11
|
+
tags: ["proposed"],
|
|
11
12
|
component: AccountServiceChangeDialog,
|
|
12
13
|
parameters: { layout: "fullscreen" },
|
|
13
14
|
args: {
|
|
@@ -14,6 +14,7 @@ import { Button } from "./button.js";
|
|
|
14
14
|
*/
|
|
15
15
|
const meta: Meta<typeof AccountServiceChoice> = {
|
|
16
16
|
title: "Design System/Settings/AccountServiceChoice",
|
|
17
|
+
tags: ["proposed"],
|
|
17
18
|
component: AccountServiceChoice,
|
|
18
19
|
parameters: { layout: "padded" },
|
|
19
20
|
decorators: [
|
|
@@ -11,6 +11,7 @@ import type { CalendarDescriptor } from "./calendar-types.js";
|
|
|
11
11
|
*/
|
|
12
12
|
const meta: Meta<typeof CalendarList> = {
|
|
13
13
|
title: "Design System/Calendar/Calendar list",
|
|
14
|
+
tags: ["proposed"],
|
|
14
15
|
component: CalendarList,
|
|
15
16
|
parameters: { layout: "padded" },
|
|
16
17
|
decorators: [
|
|
@@ -4,7 +4,7 @@ import { describe, it } from "node:test";
|
|
|
4
4
|
import { createElement } from "react";
|
|
5
5
|
import { renderToString } from "react-dom/server";
|
|
6
6
|
import type { CalendarDescriptor, EventDraft } from "./calendar-types.js";
|
|
7
|
-
import { EventEditor } from "./event-editor.js";
|
|
7
|
+
import { EventEditor, withAllDay } from "./event-editor.js";
|
|
8
8
|
|
|
9
9
|
const calendars: CalendarDescriptor[] = [
|
|
10
10
|
{
|
|
@@ -170,4 +170,27 @@ describe("EventEditor", () => {
|
|
|
170
170
|
assert.equal(alertText(dom), "");
|
|
171
171
|
assert.equal(saveControl(dom)?.disabled, false);
|
|
172
172
|
});
|
|
173
|
+
|
|
174
|
+
it("restores the overnight end when all day is ticked then unticked", () => {
|
|
175
|
+
const overnight: EventDraft = {
|
|
176
|
+
...draft,
|
|
177
|
+
startTime: "22:00",
|
|
178
|
+
endDate: "2026-06-13",
|
|
179
|
+
endTime: "01:00",
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const ticked = withAllDay(overnight, true);
|
|
183
|
+
assert.equal(ticked.allDay, true);
|
|
184
|
+
assert.equal(ticked.endDate, overnight.date);
|
|
185
|
+
|
|
186
|
+
const unticked = withAllDay(ticked, false);
|
|
187
|
+
assert.equal(unticked.allDay, false);
|
|
188
|
+
assert.equal(unticked.endDate, overnight.endDate);
|
|
189
|
+
assert.equal(unticked.startTime, overnight.startTime);
|
|
190
|
+
assert.equal(unticked.endTime, overnight.endTime);
|
|
191
|
+
|
|
192
|
+
const dom = parse({ draft: unticked });
|
|
193
|
+
assert.equal(alertText(dom), "");
|
|
194
|
+
assert.equal(saveControl(dom)?.disabled, false);
|
|
195
|
+
});
|
|
173
196
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { expect, userEvent, within } from "storybook/test";
|
|
3
4
|
import type { CalendarDescriptor, EventDraft } from "./calendar-types.js";
|
|
4
5
|
import { EventEditor } from "./event-editor.js";
|
|
5
6
|
|
|
@@ -157,6 +158,28 @@ export const AllDay: Story = {
|
|
|
157
158
|
),
|
|
158
159
|
};
|
|
159
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Ticking All day on a night, then unticking it, gives the night back rather
|
|
163
|
+
* than collapsing the end onto the start day.
|
|
164
|
+
*/
|
|
165
|
+
export const AllDayRoundTrip: Story = {
|
|
166
|
+
render: () => <Live startExpanded={false} seed={overnight} />,
|
|
167
|
+
play: async ({ canvasElement }) => {
|
|
168
|
+
const canvas = within(canvasElement);
|
|
169
|
+
const allDay = canvas.getByLabelText("All day");
|
|
170
|
+
|
|
171
|
+
await userEvent.click(allDay);
|
|
172
|
+
await expect(canvas.getByLabelText("End date")).toHaveValue("2026-06-12");
|
|
173
|
+
|
|
174
|
+
await userEvent.click(allDay);
|
|
175
|
+
await expect(canvas.getByLabelText("End date")).toHaveValue("2026-06-13");
|
|
176
|
+
await expect(canvas.getByLabelText("End time")).toHaveValue("01:00");
|
|
177
|
+
await expect(
|
|
178
|
+
canvas.queryByText(/Ends before it starts/),
|
|
179
|
+
).not.toBeInTheDocument();
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
160
183
|
/** The same form sized for a bottom sheet: every control a thumb target. */
|
|
161
184
|
export const Touch: Story = {
|
|
162
185
|
render: () => {
|
|
@@ -106,6 +106,16 @@ export function withAllDay(draft: EventDraft, allDay: boolean): EventDraft {
|
|
|
106
106
|
draft.endTime !== "" &&
|
|
107
107
|
draft.endTime < draft.startTime;
|
|
108
108
|
if (allDay && overnight) return { ...draft, allDay, endDate: draft.date };
|
|
109
|
+
const collapsedOvernight =
|
|
110
|
+
!allDay &&
|
|
111
|
+
draft.date !== "" &&
|
|
112
|
+
draft.endDate === draft.date &&
|
|
113
|
+
draft.startTime !== "" &&
|
|
114
|
+
draft.endTime !== "" &&
|
|
115
|
+
draft.endTime < draft.startTime;
|
|
116
|
+
if (collapsedOvernight) {
|
|
117
|
+
return { ...draft, allDay, endDate: addDays(draft.date, 1) };
|
|
118
|
+
}
|
|
109
119
|
return { ...draft, allDay };
|
|
110
120
|
}
|
|
111
121
|
|
|
@@ -36,8 +36,7 @@ import { IntelligencePanel } from "./intelligence-panel.js";
|
|
|
36
36
|
* sends no reply, so the card says so where the press happens.
|
|
37
37
|
*/
|
|
38
38
|
const meta: Meta = {
|
|
39
|
-
title: "
|
|
40
|
-
tags: ["proposed"],
|
|
39
|
+
title: "Design System/Calendar/Intelligence panel calendar tab",
|
|
41
40
|
parameters: { layout: "centered" },
|
|
42
41
|
};
|
|
43
42
|
export default meta;
|