mirror of
https://github.com/bitbaum/whenkit.git
synced 2026-12-05 06:38:27 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad4c1ed6f6 |
No files matched your search
@@ -5,7 +5,7 @@ length chips, a readable date field over the native picker, and a booking
|
||||
request that resolves to `{ startsAt, endsAt }` in the provider's time zone.
|
||||
|
||||
```bash
|
||||
pnpm add github:bitbaum/whenkit#v0.2.0
|
||||
pnpm add github:bitbaum/whenkit#v0.2.1
|
||||
```
|
||||
|
||||
```tsx
|
||||
|
||||
@@ -34,3 +34,12 @@ function Field() {
|
||||
createRoot(document.getElementById("hourly")!).render(<Booking unit="hour" id="hourly" />);
|
||||
createRoot(document.getElementById("daily")!).render(<Booking unit="day" id="daily" />);
|
||||
createRoot(document.getElementById("field")!).render(<Field />);
|
||||
createRoot(document.getElementById("dialog")!).render(
|
||||
<>
|
||||
<strong>Book a long studio name that goes on and on</strong>
|
||||
<Booking unit="day" id="dialog" />
|
||||
<button type="button" id="dialog-send">
|
||||
Send booking request
|
||||
</button>
|
||||
</>,
|
||||
);
|
||||
+16
-3
@@ -26,15 +26,27 @@
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.grid > section {
|
||||
min-width: 0;
|
||||
}
|
||||
h2 {
|
||||
font-size: 14px;
|
||||
margin: 0 0 12px;
|
||||
opacity: 0.6;
|
||||
font-weight: 500;
|
||||
}
|
||||
/* Shaped like a modal dialog (shadcn/Radix DialogContent): a grid whose
|
||||
column is sized by its content. A picker that props this open
|
||||
pushes the dialog's buttons off-screen. */
|
||||
.dialog-like {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
width: calc(100% - 32px);
|
||||
max-width: 28rem;
|
||||
margin: 32px auto 0;
|
||||
padding: 24px;
|
||||
border: 1px solid hsl(var(--border-default, 0 0% 82%));
|
||||
border-radius: 12px;
|
||||
background: hsl(var(--surface-base, 0 0% 100%));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.resolved {
|
||||
font-size: 11px;
|
||||
opacity: 0.5;
|
||||
@@ -59,6 +71,7 @@
|
||||
<div id="field"></div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="dialog-like" id="dialog"></div>
|
||||
</main>
|
||||
<script src="./dist/demo.js"></script>
|
||||
</body>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bitbaum/whenkit",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "Dates and times people can pick without typing: day chips, time chips, length chips, a readable date field over the native picker, and a low-friction booking request that resolves to {startsAt, endsAt} in the provider's zone.",
|
||||
"license": "MIT",
|
||||
"author": "Cato",
|
||||
|
||||
@@ -126,6 +126,12 @@
|
||||
/* ---- the day strip ---- */
|
||||
|
||||
.wk-strip {
|
||||
/* Claim no width of its own: fourteen chips side by side must scroll inside
|
||||
whatever space the strip is given, not prop open a grid or dialog column
|
||||
(a CSS grid item's min-width is its content's). Found in OrangeCat's
|
||||
booking dialog, where it pushed Send off-screen at 390px. */
|
||||
contain: inline-size;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
overflow-x: auto;
|
||||
|
||||
@@ -115,6 +115,23 @@ try {
|
||||
await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
|
||||
`${name}: still no horizontal scroll after picking`,
|
||||
);
|
||||
// Nothing may be wider than its column: a grid cell (like a dialog's) must
|
||||
// not be propped open by the day strip.
|
||||
const wider = await page.evaluate(
|
||||
() =>
|
||||
[...document.querySelectorAll(".grid > section, #dialog")].filter(
|
||||
(s) =>
|
||||
s.scrollWidth > s.clientWidth + 1 ||
|
||||
s.getBoundingClientRect().right > window.innerWidth + 1,
|
||||
).length,
|
||||
);
|
||||
check(wider === 0, `${name}: no column or dialog propped open by the picker (${wider})`);
|
||||
const sendVisible = await page.evaluate(() => {
|
||||
const r = document.getElementById("dialog-send").getBoundingClientRect();
|
||||
return r.right <= window.innerWidth + 1;
|
||||
});
|
||||
check(sendVisible, `${name}: the dialog's button stays on screen`);
|
||||
|
||||
check(errors.length === 0, `${name}: no page errors ${errors.join(" | ")}`);
|
||||
// Let chip colour transitions finish so the screenshot shows real states.
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
Reference in new issue
Block a user