mirror of
https://github.com/bitbaum/whenkit.git
synced 2026-12-05 08:22:32 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
705e0c8c8c | ||
|
|
4d21cc90e9 | ||
|
|
477707acb1 | ||
|
|
b46eb35cae | ||
|
|
9458b73969 | ||
|
|
3155746649 | ||
|
|
a2e23e9fd5 | ||
|
|
87e5507884 | ||
|
|
ef78514857 | ||
|
|
d446fbf45e | ||
|
|
62682e703a | ||
|
|
c519fd1598 | ||
|
|
dde85ed6ab | ||
|
|
3a88acb525 | ||
|
|
bbcea2ec3c | ||
|
|
2674d02f59 | ||
|
|
1c8cebad06 | ||
|
|
d9cf48db67 | ||
|
|
5d54a255fe | ||
|
|
93d00d526f | ||
|
|
2cdc2c3c33 | ||
|
|
43127a8dd9 | ||
|
|
38567ad912 | ||
|
|
884f2f7f3c | ||
|
|
75db86da92 | ||
|
|
3831a8da08 | ||
|
|
f629b49444 | ||
|
|
592a184755 | ||
|
|
f204f35f0c | ||
|
|
f5e0a24208 | ||
|
|
0072fe68aa | ||
|
|
9fd8b3b11d | ||
|
|
0173ac305c | ||
|
|
ad4c1ed6f6 |
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
ignore:
|
||||||
|
# typescript-eslint does not support TypeScript 7 yet (CI: "typescript-eslint
|
||||||
|
# does not support TS 7.0"), so every dev-dependency PR that carries it is red.
|
||||||
|
# Take it when typescript-eslint does.
|
||||||
|
- dependency-name: typescript
|
||||||
|
update-types: ["version-update:semver-major"]
|
||||||
|
groups:
|
||||||
|
dev:
|
||||||
|
dependency-type: development
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 3
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
name: Verified Git release
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [CI]
|
||||||
|
types: [completed]
|
||||||
|
branches: [main]
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
concurrency:
|
||||||
|
group: verified-git-release
|
||||||
|
cancel-in-progress: false
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
if: >-
|
||||||
|
github.event.workflow_run.conclusion == 'success' &&
|
||||||
|
github.event.workflow_run.head_repository.full_name == github.repository &&
|
||||||
|
github.event.workflow_run.head_branch == 'main' &&
|
||||||
|
github.event.workflow_run.event != 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Tag the verified immutable artifact, even before npm bootstrap
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
VERIFIED_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
version=$(node -p "require('./package.json').version")
|
||||||
|
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "Only stable package versions get a Git release" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
tag="v$version"
|
||||||
|
if git show-ref --verify --quiet "refs/tags/$tag"; then
|
||||||
|
echo "$tag already exists; immutable tags are never moved."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git tag "$tag" "$VERIFIED_SHA"
|
||||||
|
git push origin "refs/tags/$tag"
|
||||||
|
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
|
||||||
|
--verify-tag --title "$tag" --generate-notes
|
||||||
+131
-50
@@ -1,30 +1,45 @@
|
|||||||
|
# prettier-ignore
|
||||||
name: Publish
|
name: Publish
|
||||||
|
|
||||||
# Publishing is driven by a version tag, so the released artifact is always
|
# The same file in every @bitbaum package. A merged version bump releases
|
||||||
# traceable to a commit. `npm version` creates the tag; pushing it ships.
|
# itself; so does a pushed v* tag, and "Run workflow" re-tries by hand.
|
||||||
#
|
#
|
||||||
# Auth is npm Trusted Publishing (OIDC): npmjs.com trusts exactly THIS
|
# Two ways to npm, picked per run:
|
||||||
# workflow in THIS repo. No token exists anywhere — nothing to store, leak, or
|
|
||||||
# rotate — and provenance is attested on the registry. `npm publish`
|
|
||||||
# (npm >= 11.5) exchanges the id-token itself. Copied from chatkit (which copied speechkit and ai-kit).
|
|
||||||
#
|
#
|
||||||
# NOT YET BOOTSTRAPPED. npm cannot trust a publisher for a package that does
|
# - The package is already on npm → tokenless. npmjs.com trusts exactly THIS
|
||||||
# not exist, and the account's second factor is a passkey only a human holds,
|
# workflow in THIS repo (Trusted Publishing, OIDC): no token exists, nothing
|
||||||
# so the FIRST publish is manual (see README → "npm"). Until then every tag
|
# to leak or rotate, and every release carries a signed provenance statement.
|
||||||
# would fail here — a red run that means nothing is wrong. So the job checks
|
#
|
||||||
# the repo variable NPM_PUBLISHING and skips GREEN, saying why, unless it is
|
# - The package is NOT on npm yet → npm will not trust a publisher for a
|
||||||
# "on". Set it after the bootstrap: gh variable set NPM_PUBLISHING -b on
|
# package that does not exist, so the first version needs the account once.
|
||||||
|
# Put a short-lived npm token in the org secret NPM_BOOTSTRAP_TOKEN (made on
|
||||||
|
# npmjs.com from a phone; see docs in bitbaum/fleet) and this job publishes
|
||||||
|
# the first version with it. Without the token it skips GREEN and says so, so
|
||||||
|
# a new package never paints CI red.
|
||||||
|
# NOTE (npm docs, `npm trust`): trust commands do NOT accept a granular token,
|
||||||
|
# not even one with "bypass 2FA" — they need the account's interactive 2FA.
|
||||||
|
# So the auto-link step below is best-effort and is EXPECTED to fall through
|
||||||
|
# to the printed fallback. The human step is then ONE form per package on
|
||||||
|
# npmjs.com (repo + "publish.yml"), or one local `npm trust` loop
|
||||||
|
# (bootstrap-local.sh, step 2). After that, every release is tokenless.
|
||||||
|
#
|
||||||
|
# Publishing is idempotent: a version already on the registry is a green
|
||||||
|
# no-op, so re-runs and repeat merges are harmless.
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
|
branches: [main]
|
||||||
|
# The auto-merge sweep re-arms this after a GITHUB_TOKEN merge, which
|
||||||
|
# starts no push workflow on its own (rearm_workflows in auto-merge.yml).
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
diagnose_auth:
|
||||||
|
description: Test the npm trusted-publisher link without publishing anything.
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
# Publishing is idempotent: the job first asks the registry whether
|
# Never two at once, never cancelled: a cancelled publish is a half-shipped
|
||||||
# package.json's version already exists and skips (green) if it does. A
|
# release.
|
||||||
# re-pushed tag, a re-run, or two runs for the same version cannot paint a
|
|
||||||
# spurious E403 red — a red run that means "nothing is wrong" trains everyone
|
|
||||||
# to ignore the workflow (bip-kit 0.2.6 and 0.2.7, 2026-09-11). Runs are also
|
|
||||||
# serialised so two cannot race past the check; never cancelled, because a
|
|
||||||
# cancelled publish is a half-shipped release.
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: publish
|
group: publish
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
@@ -32,11 +47,11 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: vars.NPM_PUBLISHING == 'on'
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
# write: tag the released commit v<version> when the release came from
|
||||||
# Required for npm provenance — proves on the registry that this tarball
|
# main rather than from a pushed tag.
|
||||||
# was built by this workflow from this commit.
|
contents: write
|
||||||
|
# Required for OIDC publishing and npm provenance.
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
@@ -44,33 +59,78 @@ jobs:
|
|||||||
# pnpm version comes from "packageManager" in package.json (SSOT).
|
# pnpm version comes from "packageManager" in package.json (SSOT).
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
|
|
||||||
|
# No registry-url: setup-node would write an _authToken line that makes
|
||||||
|
# npm skip the OIDC exchange whenever no token is set.
|
||||||
- uses: actions/setup-node@v7
|
- uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
registry-url: "https://registry.npmjs.org"
|
|
||||||
|
|
||||||
- name: Is this version already on the registry?
|
# Trusted publishing and `npm trust` need npm >= 11.10; do not trust
|
||||||
|
# whatever the runner's Node happens to bundle.
|
||||||
|
- run: npm install -g npm@11
|
||||||
|
|
||||||
|
# "Run workflow" with diagnose_auth ticked asks npm whether it trusts
|
||||||
|
# THIS workflow for this package, and publishes nothing. HTTP 200 =
|
||||||
|
# linked; 404 = the one form on npmjs.com is still to be filled in. The
|
||||||
|
# response body holds a short-lived token, so it is never printed.
|
||||||
|
- name: Is the npm trusted publisher linked? (no publish)
|
||||||
|
if: inputs.diagnose_auth == true
|
||||||
|
run: |
|
||||||
|
node --input-type=module <<'NODE'
|
||||||
|
const url = new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);
|
||||||
|
url.searchParams.set('audience', 'npm:registry.npmjs.org');
|
||||||
|
const identity = await fetch(url, {
|
||||||
|
headers: { authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}` },
|
||||||
|
signal: AbortSignal.timeout(30000),
|
||||||
|
});
|
||||||
|
if (!identity.ok) throw new Error(`GitHub OIDC request failed: HTTP ${identity.status}`);
|
||||||
|
const { value: jwt } = await identity.json();
|
||||||
|
const claims = JSON.parse(Buffer.from(jwt.split('.')[1], 'base64url'));
|
||||||
|
console.log('Publisher identity:', JSON.stringify({ repository: claims.repository, workflow_ref: claims.workflow_ref, ref: claims.ref }));
|
||||||
|
const name = JSON.parse(await (await import('node:fs/promises')).readFile('package.json', 'utf8')).name;
|
||||||
|
const exchange = await fetch(`https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(name)}`, {
|
||||||
|
method: 'POST', headers: { authorization: `Bearer ${jwt}` },
|
||||||
|
signal: AbortSignal.timeout(30000),
|
||||||
|
});
|
||||||
|
console.log(`npm trust exchange for ${name}: HTTP ${exchange.status}`);
|
||||||
|
await exchange.body?.cancel();
|
||||||
|
if (!exchange.ok) throw new Error('npm does not trust this workflow for this package yet');
|
||||||
|
NODE
|
||||||
|
|
||||||
|
- name: What does npm have?
|
||||||
id: check
|
id: check
|
||||||
|
if: inputs.diagnose_auth != true
|
||||||
|
env:
|
||||||
|
BOOTSTRAP: ${{ secrets.NPM_BOOTSTRAP_TOKEN != '' }}
|
||||||
run: |
|
run: |
|
||||||
name=$(node -p "require('./package.json').name")
|
name=$(node -p "require('./package.json').name")
|
||||||
version=$(node -p "require('./package.json').version")
|
version=$(node -p "require('./package.json').version")
|
||||||
echo "name=$name" >> "$GITHUB_OUTPUT"
|
echo "name=$name" >> "$GITHUB_OUTPUT"
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
if npm view "$name@$version" version >/dev/null 2>&1; then
|
if npm view "$name@$version" version >/dev/null 2>&1; then
|
||||||
echo "→ $name@$version is already published; nothing to do."
|
|
||||||
echo "publish=false" >> "$GITHUB_OUTPUT"
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
||||||
echo "✅ \`$name@$version\` is already published — nothing to do." >> "$GITHUB_STEP_SUMMARY"
|
echo "✅ \`$name@$version\` is already on npm — nothing to do." >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
elif npm view "$name" version >/dev/null 2>&1; then
|
||||||
echo "→ $name@$version is not on the registry; releasing it."
|
|
||||||
echo "publish=true" >> "$GITHUB_OUTPUT"
|
echo "publish=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "mode=oidc" >> "$GITHUB_OUTPUT"
|
||||||
|
elif [ "$BOOTSTRAP" = "true" ]; then
|
||||||
|
echo "publish=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "mode=first" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
||||||
|
{
|
||||||
|
echo "⏸ \`$name\` is not on npm yet, and its first version needs the account once."
|
||||||
|
echo "Add the org secret NPM_BOOTSTRAP_TOKEN (a short-lived npm token) and run this workflow again."
|
||||||
|
echo "Meanwhile it installs from GitHub: \`pnpm add github:${GITHUB_REPOSITORY}\`"
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- if: steps.check.outputs.publish == 'true'
|
- if: steps.check.outputs.publish == 'true'
|
||||||
run: pnpm install --frozen-lockfile --ignore-scripts
|
run: pnpm install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
# verify includes the real-browser test (test/browser.mjs), as in ci.yml;
|
# verify includes the real-browser test (test/browser.mjs) where a
|
||||||
# without the browser the v0.2.1 publish failed before reaching npm.
|
# package has one; without the browser it fails before reaching npm.
|
||||||
- if: steps.check.outputs.publish == 'true'
|
- if: steps.check.outputs.publish == 'true' && hashFiles('test/browser.mjs') != ''
|
||||||
run: pnpm exec playwright install --with-deps chromium
|
run: pnpm exec playwright install --with-deps chromium
|
||||||
|
|
||||||
# Never publish something that would not have passed CI.
|
# Never publish something that would not have passed CI.
|
||||||
@@ -80,7 +140,7 @@ jobs:
|
|||||||
# Refuse to publish a tag whose version does not match package.json,
|
# Refuse to publish a tag whose version does not match package.json,
|
||||||
# rather than silently shipping the wrong number.
|
# rather than silently shipping the wrong number.
|
||||||
- name: Check tag matches package version
|
- name: Check tag matches package version
|
||||||
if: steps.check.outputs.publish == 'true'
|
if: steps.check.outputs.publish == 'true' && github.ref_type == 'tag'
|
||||||
run: |
|
run: |
|
||||||
tag="${GITHUB_REF_NAME#v}"
|
tag="${GITHUB_REF_NAME#v}"
|
||||||
pkg=$(node -p "require('./package.json').version")
|
pkg=$(node -p "require('./package.json').version")
|
||||||
@@ -89,31 +149,52 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# npm >= 11.5 exchanges the OIDC id-token itself — no secret involved.
|
- name: Publish to npm
|
||||||
- name: Publish to npm (OIDC, tokenless)
|
|
||||||
if: steps.check.outputs.publish == 'true'
|
if: steps.check.outputs.publish == 'true'
|
||||||
env:
|
env:
|
||||||
NAME: ${{ steps.check.outputs.name }}
|
NAME: ${{ steps.check.outputs.name }}
|
||||||
VERSION: ${{ steps.check.outputs.version }}
|
VERSION: ${{ steps.check.outputs.version }}
|
||||||
|
MODE: ${{ steps.check.outputs.mode }}
|
||||||
|
FIRST_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
if npm publish; then
|
if [ "$MODE" = "first" ]; then
|
||||||
|
# The one token-based publish in a package's life.
|
||||||
|
echo "//registry.npmjs.org/:_authToken=${FIRST_TOKEN}" > "$RUNNER_TEMP/.npmrc"
|
||||||
|
export NPM_CONFIG_USERCONFIG="$RUNNER_TEMP/.npmrc"
|
||||||
|
fi
|
||||||
|
if npm publish --access public --provenance; then
|
||||||
echo "🚀 Published \`$NAME@$VERSION\`." >> "$GITHUB_STEP_SUMMARY"
|
echo "🚀 Published \`$NAME@$VERSION\`." >> "$GITHUB_STEP_SUMMARY"
|
||||||
elif npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
|
elif npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
|
||||||
# The check above and this publish are not atomic. If another run
|
# Another run slipped in between the check and this publish: the
|
||||||
# slipped between them, the version is on the registry — which is
|
# version is on the registry, which is the goal state.
|
||||||
# the goal state, not an error.
|
echo "✅ \`$NAME@$VERSION\` was published by a concurrent run." >> "$GITHUB_STEP_SUMMARY"
|
||||||
echo "→ $NAME@$VERSION was published by a concurrent run; nothing to do."
|
|
||||||
echo "✅ \`$NAME@$VERSION\` was published by a concurrent run — nothing to do." >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$MODE" = "first" ]; then
|
||||||
|
# From now on this workflow publishes without any token.
|
||||||
|
if npm trust github "$NAME" --file publish.yml --repo "$GITHUB_REPOSITORY" --allow-publish --yes; then
|
||||||
|
echo "🔗 Linked \`$NAME\` to this workflow — later releases need no token." >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "⚠️ Published. npm does not let a token link the workflow (expected)."
|
||||||
|
echo "Link it once on https://www.npmjs.com/package/$NAME/access → Trusted Publisher → GitHub Actions:"
|
||||||
|
echo "repository \`$GITHUB_REPOSITORY\`, workflow \`publish.yml\`, tick *Allow npm publish*."
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f "$RUNNER_TEMP/.npmrc"
|
||||||
|
|
||||||
# Present only so a tag before the bootstrap reads as a decision, not a
|
# A release from main gets its tag here, so every published version is
|
||||||
# silent no-op: the run is green and its summary says what to do.
|
# still traceable to a commit by name.
|
||||||
not-yet:
|
- name: Tag the released commit
|
||||||
runs-on: ubuntu-latest
|
if: steps.check.outputs.publish == 'true' && github.ref_type != 'tag'
|
||||||
if: vars.NPM_PUBLISHING != 'on'
|
env:
|
||||||
steps:
|
VERSION: ${{ steps.check.outputs.version }}
|
||||||
- run: |
|
run: |
|
||||||
echo "npm publishing is not bootstrapped for this repo yet — nothing published." >> "$GITHUB_STEP_SUMMARY"
|
if git ls-remote --exit-code --tags origin "refs/tags/v$VERSION" >/dev/null; then
|
||||||
echo "Consumers install from git meanwhile: pnpm add github:bitbaum/whenkit#${GITHUB_REF_NAME}" >> "$GITHUB_STEP_SUMMARY"
|
echo "→ v$VERSION already tagged."
|
||||||
|
else
|
||||||
|
git tag "v$VERSION" "$GITHUB_SHA"
|
||||||
|
git push origin "v$VERSION"
|
||||||
|
fi
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
# The release a package merged is told to the fleet once its tag exists.
|
||||||
|
#
|
||||||
|
# release-notify.yml asks on CI's completion. When a version bump is merged
|
||||||
|
# by pull request (how ai-kit and chatkit ship), git-release.yml starts on
|
||||||
|
# that same completion and creates the tag a few seconds later, so the notice
|
||||||
|
# found no tag and stood down. Publish, which finishes after the tag, cannot
|
||||||
|
# repeat it: a run started by GITHUB_TOKEN chains no further. ai-kit 1.26,
|
||||||
|
# 1.27 and 1.28 (12-13 Nov 2026) all reached the fleet only on its six-hourly
|
||||||
|
# schedule. This file asks again when the tag workflow finishes: by then the
|
||||||
|
# tag exists. CI -> Verified Git release -> this is three levels, which
|
||||||
|
# GitHub allows. The step below is release-notify.yml's, byte for byte
|
||||||
|
# (scripts/packages/test-release-notify.mjs holds them equal); a release the
|
||||||
|
# first notice already reported is asked twice, and the fleet resolves
|
||||||
|
# releases itself rather than trusting either notice.
|
||||||
|
# No checkout or execution of the completed workflow's code: metadata only.
|
||||||
|
# prettier-ignore
|
||||||
|
name: Notify Fleet once the release is tagged
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [Verified Git release]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: release-notify
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.full_name == github.repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- name: Resolve a verified immutable release before requesting reconciliation
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
FLEET_TOKEN: ${{ secrets.FLEET_PAT }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
manifest="$(gh api "repos/$GH_REPO/contents/package.json?ref=$SHA" --jq .content | base64 --decode)"
|
||||||
|
version="$(jq -r .version <<< "$manifest")"
|
||||||
|
if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||||
|
echo 'No stable version; no reconciliation requested.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Source commits with no matching release tag are not releases.
|
||||||
|
if ! tagged="$(gh api "repos/$GH_REPO/commits/v$version" --jq .sha 2>/dev/null)" || [ "$tagged" != "$SHA" ]; then
|
||||||
|
echo 'This commit is not the versioned release; no reconciliation requested.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
ci="$(gh api "repos/$GH_REPO/actions/runs?head_sha=$SHA&per_page=100" --jq '[.workflow_runs[] | select(.path == ".github/workflows/ci.yml" and (.event == "push" or .event == "workflow_dispatch"))] | first | .conclusion')"
|
||||||
|
if [ "$ci" != success ]; then
|
||||||
|
echo 'Release CI is not successful yet; its completion will retry notification.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ -z "$FLEET_TOKEN" ]; then
|
||||||
|
echo '::error::FLEET_PAT is required to notify Fleet; scheduled reconciliation remains the fallback.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
payload="$(jq -n --arg repository "$GH_REPO" --arg version "$version" --arg commit "$SHA" '{event_type:"shared-package-release",client_payload:{repository:$repository,version:$version,commit:$commit}}')"
|
||||||
|
GH_TOKEN="$FLEET_TOKEN" gh api --method POST repos/bitbaum/fleet/dispatches --input - <<< "$payload"
|
||||||
|
echo "Requested authoritative registry and consumer reconciliation for $GH_REPO v$version ($SHA)." >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# A release is useful only when the registry and consumers learn about it.
|
||||||
|
# No checkout or execution of the completed workflow's code: metadata only.
|
||||||
|
name: Notify Fleet of verified release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [CI, Release, Publish]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: release-notify
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' && github.event.workflow_run.head_repository.full_name == github.repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- name: Resolve a verified immutable release before requesting reconciliation
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
FLEET_TOKEN: ${{ secrets.FLEET_PAT }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
manifest="$(gh api "repos/$GH_REPO/contents/package.json?ref=$SHA" --jq .content | base64 --decode)"
|
||||||
|
version="$(jq -r .version <<< "$manifest")"
|
||||||
|
if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||||
|
echo 'No stable version; no reconciliation requested.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Source commits with no matching release tag are not releases.
|
||||||
|
if ! tagged="$(gh api "repos/$GH_REPO/commits/v$version" --jq .sha 2>/dev/null)" || [ "$tagged" != "$SHA" ]; then
|
||||||
|
echo 'This commit is not the versioned release; no reconciliation requested.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
ci="$(gh api "repos/$GH_REPO/actions/runs?head_sha=$SHA&per_page=100" --jq '[.workflow_runs[] | select(.path == ".github/workflows/ci.yml" and (.event == "push" or .event == "workflow_dispatch"))] | first | .conclusion')"
|
||||||
|
if [ "$ci" != success ]; then
|
||||||
|
echo 'Release CI is not successful yet; its completion will retry notification.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ -z "$FLEET_TOKEN" ]; then
|
||||||
|
echo '::error::FLEET_PAT is required to notify Fleet; scheduled reconciliation remains the fallback.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
payload="$(jq -n --arg repository "$GH_REPO" --arg version "$version" --arg commit "$SHA" '{event_type:"shared-package-release",client_payload:{repository:$repository,version:$version,commit:$commit}}')"
|
||||||
|
GH_TOKEN="$FLEET_TOKEN" gh api --method POST repos/bitbaum/fleet/dispatches --input - <<< "$payload"
|
||||||
|
echo "Requested authoritative registry and consumer reconciliation for $GH_REPO v$version ($SHA)." >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
# Release — a new version of this package, from one button.
|
||||||
|
#
|
||||||
|
# Rendered from bitbaum/fleet templates/package. Loki's package page starts it
|
||||||
|
# ("Release vX.Y.Z"), and so can anyone from the Actions tab. It:
|
||||||
|
#
|
||||||
|
# 1. refuses unless main's CI is green on the exact commit it starts from,
|
||||||
|
# 2. raises the version in package.json (the bump, or the exact version
|
||||||
|
# asked for) — `npm version --no-git-tag-version`, so npm makes no commit
|
||||||
|
# and no tag of its own,
|
||||||
|
# 3. runs the package's own `verify`, which rebuilds the committed dist/,
|
||||||
|
# 4. commits "release vX.Y.Z" with the rebuilt dist/, tags vX.Y.Z, and pushes
|
||||||
|
# both in one atomic push,
|
||||||
|
# 5. creates a GitHub release with generated notes.
|
||||||
|
#
|
||||||
|
# Consumers pick the tag up through Dependabot (`github:bitbaum/whenkit#vX.Y.Z`),
|
||||||
|
# and publish.yml ships it to npm once npm publishing is switched on.
|
||||||
|
#
|
||||||
|
# WHY THE PUSH USES FLEET_PAT. A push made with GITHUB_TOKEN starts no workflow.
|
||||||
|
# publish.yml listens for the tag push, and CI must run on the release commit
|
||||||
|
# (the auto-merge sweep merges nothing onto a main whose CI it cannot see). So
|
||||||
|
# the release commit and tag are pushed with FLEET_PAT, the org secret every
|
||||||
|
# bitbaum repo already has (auto-merge.yml passes it to the sweep), and both
|
||||||
|
# workflows fire exactly as they would for a person's push. Calling publish.yml
|
||||||
|
# from here instead was the other option and is not the honest one: package
|
||||||
|
# repos keep the publish.yml they were created with (the template sync adds
|
||||||
|
# missing files and never rewrites one), so the tag push is the only path every
|
||||||
|
# repo's publish.yml is guaranteed to answer. No FLEET_PAT → no release, said
|
||||||
|
# plainly, rather than a tag that silently publishes nothing.
|
||||||
|
#
|
||||||
|
# If main is ever protected against direct pushes, FLEET_PAT's identity must be
|
||||||
|
# allowed to bypass it, or this fails at the push — after verify, before any
|
||||||
|
# tag exists, so nothing half-ships.
|
||||||
|
name: Release
|
||||||
|
run-name: Release ${{ inputs.version != '' && format('v{0}', inputs.version) || inputs.bump }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
bump:
|
||||||
|
description: Which part of the version to raise (ignored when an exact version is given)
|
||||||
|
type: choice
|
||||||
|
options: [patch, minor, major]
|
||||||
|
default: patch
|
||||||
|
version:
|
||||||
|
description: Exact version to release, e.g. 0.3.0 (optional — wins over bump)
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
# One release at a time, never cancelled: a cancelled release is a commit
|
||||||
|
# without its tag, or a tag without its notes.
|
||||||
|
concurrency:
|
||||||
|
group: release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write # the GitHub release (the push itself uses FLEET_PAT)
|
||||||
|
actions: read # main's CI runs
|
||||||
|
checks: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
steps:
|
||||||
|
- name: Only from main
|
||||||
|
run: |
|
||||||
|
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
|
||||||
|
echo "::error::A release starts from main, not $GITHUB_REF."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: FLEET_PAT is available
|
||||||
|
env:
|
||||||
|
PAT: ${{ secrets.FLEET_PAT }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$PAT" ]; then
|
||||||
|
echo "::error::FLEET_PAT is not available to this repo. A tag pushed without it starts no workflow, so publish.yml would never run — refusing instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The commit this run would release is github.sha: main's head when the
|
||||||
|
# run was started. Its CI must have FINISHED green — running is not green,
|
||||||
|
# and no run at all is not green either.
|
||||||
|
- name: Main's CI is green on this commit
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
SHA: ${{ github.sha }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
run="$(gh run list --workflow ci.yml --branch main --commit "$SHA" --limit 1 \
|
||||||
|
--json status,conclusion,url --jq '.[0] // empty')"
|
||||||
|
if [ -z "$run" ]; then
|
||||||
|
echo "::error::CI has not run on main at ${SHA:0:7}. Nothing proves this commit works, so it is not released."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
status="$(jq -r .status <<<"$run")"
|
||||||
|
conclusion="$(jq -r .conclusion <<<"$run")"
|
||||||
|
url="$(jq -r .url <<<"$run")"
|
||||||
|
if [ "$status" != "completed" ]; then
|
||||||
|
echo "::error::CI is still running on ${SHA:0:7} ($url). Start the release again when it finishes."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$conclusion" != "success" ]; then
|
||||||
|
echo "::error::CI on ${SHA:0:7} ended '$conclusion' ($url). Fix main first; a red commit is not released."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "CI on ${SHA:0:7} is green: $url"
|
||||||
|
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
token: ${{ secrets.FLEET_PAT }}
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
# pnpm version comes from "packageManager" in package.json (SSOT).
|
||||||
|
- uses: pnpm/action-setup@v6
|
||||||
|
- uses: actions/setup-node@v7
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Install Chromium when the package uses Playwright
|
||||||
|
run: |
|
||||||
|
if node -e 'const p = require("./package.json"); const d = { ...p.dependencies, ...p.devDependencies }; process.exit(d.playwright || d["@playwright/test"] ? 0 : 1)'; then
|
||||||
|
pnpm exec playwright install --with-deps chromium
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Inputs reach the shell as environment variables, never pasted into the
|
||||||
|
# script: a `version` is free text typed by whoever started the run.
|
||||||
|
- name: Decide the version
|
||||||
|
id: version
|
||||||
|
env:
|
||||||
|
BUMP: ${{ inputs.bump }}
|
||||||
|
EXACT: ${{ inputs.version }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
next="$(node -e '
|
||||||
|
const cur = require("./package.json").version;
|
||||||
|
const bump = process.env.BUMP, exact = process.env.EXACT.trim().replace(/^v/, "");
|
||||||
|
const parse = (v) => /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(v)?.slice(1).map(Number);
|
||||||
|
const c = parse(cur);
|
||||||
|
if (!c) { console.error(`package.json version "${cur}" is not x.y.z`); process.exit(1); }
|
||||||
|
let n;
|
||||||
|
if (exact) {
|
||||||
|
n = parse(exact);
|
||||||
|
if (!n) { console.error(`"${exact}" is not a version like 0.3.0`); process.exit(1); }
|
||||||
|
} else if (bump === "major") n = [c[0] + 1, 0, 0];
|
||||||
|
else if (bump === "minor") n = [c[0], c[1] + 1, 0];
|
||||||
|
else if (bump === "patch") n = [c[0], c[1], c[2] + 1];
|
||||||
|
else { console.error(`bump must be patch, minor or major, not "${bump}"`); process.exit(1); }
|
||||||
|
const cmp = n[0] - c[0] || n[1] - c[1] || n[2] - c[2];
|
||||||
|
if (cmp <= 0) { console.error(`${n.join(".")} is not newer than ${cur}`); process.exit(1); }
|
||||||
|
console.log(n.join("."));
|
||||||
|
')"
|
||||||
|
if git rev-parse -q --verify "refs/tags/v$next" >/dev/null \
|
||||||
|
|| [ -n "$(git ls-remote --tags origin "refs/tags/v$next")" ]; then
|
||||||
|
echo "::error::v$next is already tagged. Nothing to do — Loki shows it on the next read."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "next=$next" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Releasing v$next (package.json was $(node -p 'require("./package.json").version'))."
|
||||||
|
|
||||||
|
- name: Raise the version
|
||||||
|
env:
|
||||||
|
NEXT: ${{ steps.version.outputs.next }}
|
||||||
|
run: npm version "$NEXT" --no-git-tag-version
|
||||||
|
|
||||||
|
# The package's own gate. It rebuilds dist/, which is committed so a
|
||||||
|
# `github:` install needs no build step.
|
||||||
|
- run: pnpm run verify
|
||||||
|
|
||||||
|
- name: Commit, tag and push
|
||||||
|
env:
|
||||||
|
NEXT: ${{ steps.version.outputs.next }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
# Only the version and the build it implies may change. Anything else
|
||||||
|
# means verify rewrote source, and that is a change to review, not to
|
||||||
|
# release.
|
||||||
|
stray="$(git status --porcelain --untracked-files=all | awk '{print $2}' | grep -v -E '^(package\.json|dist/)' || true)"
|
||||||
|
if [ -n "$stray" ]; then
|
||||||
|
echo "::error::verify changed files outside package.json and dist/: $stray"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git config user.name "bitbaum-fleet"
|
||||||
|
git config user.email "fleet@bitbaum.invalid"
|
||||||
|
git add package.json dist
|
||||||
|
git commit -q -m "release v$NEXT"
|
||||||
|
git tag -a "v$NEXT" -m "v$NEXT"
|
||||||
|
# Atomic: the commit and the tag land together or not at all. A main
|
||||||
|
# that moved since this run started refuses the push (not a fast
|
||||||
|
# forward), and the release is simply started again.
|
||||||
|
git push --atomic origin "HEAD:refs/heads/main" "refs/tags/v$NEXT"
|
||||||
|
|
||||||
|
- name: GitHub release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
NEXT: ${{ steps.version.outputs.next }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
gh release create "v$NEXT" --verify-tag --title "v$NEXT" --generate-notes
|
||||||
|
{
|
||||||
|
echo "## Released v$NEXT"
|
||||||
|
echo
|
||||||
|
echo "Install: \`github:$GITHUB_REPOSITORY#v$NEXT\`. Dependabot proposes it to every project that uses this package."
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# Agents
|
||||||
|
|
||||||
|
<!-- fleet:rules:begin — generated from bitbaum/fleet templates/agent-rules.md; edit it there, not here -->
|
||||||
|
|
||||||
|
## Org rules
|
||||||
|
|
||||||
|
Read `bitbaum/fleet` `AGENTS.md`, `SHARED.md` and the registers it names before
|
||||||
|
inventing a host, a name, a page or a shared behaviour. Do not copy their facts
|
||||||
|
into this file.
|
||||||
|
|
||||||
|
- **Packages first.** If a `@bitbaum/*` package (or `bip-kit`, `limitkit`,
|
||||||
|
`threadkit`, `ai-forms`) already does it, use it and fix a defect in the
|
||||||
|
package, not in this app. Every chat is `@bitbaum/chatkit`, every search box
|
||||||
|
`@bitbaum/searchkit`, every chart `@bitbaum/chartkit`, accounts
|
||||||
|
`@bitbaum/accountkit`, model calls `@bitbaum/ai-kit`. Review this product's
|
||||||
|
`package-plan.json` before building anything. When a second product needs
|
||||||
|
what one product built (a map, a globe, a calculator), extract it into a
|
||||||
|
package before writing the second copy.
|
||||||
|
- **The experience belongs to the package.** Anywhere a person types words
|
||||||
|
there is a microphone (`@bitbaum/chatkit`: `Composer`, `DictationField`);
|
||||||
|
articles are `@bitbaum/writingkit/react`, comments are chatkit's
|
||||||
|
`CommentThread`, header, menu, tab bar and footer are `@bitbaum/sitekit`.
|
||||||
|
Apps own brand, words and backend, not the behaviour or the layout. If a
|
||||||
|
component cannot do what the product needs, extend the package in the same
|
||||||
|
session (fleet `AGENTS.md`, "The experience belongs to the package").
|
||||||
|
- **A gap is a task, not an answer.** Never end the work, or a reply, at "not
|
||||||
|
supported" or "not available". When a source cannot be read or a case does
|
||||||
|
not fit the model, find another way (another format or publisher, the
|
||||||
|
official tool measured, the model extended) and do it. What truly cannot be
|
||||||
|
done yet is tracked with its plan, never presented as a limit of the product.
|
||||||
|
- **Every page leads to an action.** What a reader learns, they can act on
|
||||||
|
from the same screen: file, pay, apply, compare, ask, contact.
|
||||||
|
- **One shape per kind.** Things of the same kind look the same and sit in the
|
||||||
|
same place (fleet `AGENTS.md`, "One shape per kind").
|
||||||
|
- **Finished work ships by itself.** Open a non-draft pull request; the fleet
|
||||||
|
auto-merge sweep is the only merge path. Never merge by hand, through the
|
||||||
|
merge API, with `--auto` or with an admin bypass, and never force-push a
|
||||||
|
shared branch.
|
||||||
|
- **Nothing made up.** A fact on a page or in a doc needs a source that was
|
||||||
|
opened; where there is none, the line is removed or softened. A gap is
|
||||||
|
filled with sourced data, never with a guess.
|
||||||
|
- **Bitcoin orange is for Bitcoin and top-of-funnel actions only.**
|
||||||
|
- **No model identifier** in anything pushed to a repository.
|
||||||
|
- Before you finish, run `node <fleet>/scripts/ci/docs-truth-audit.mjs --dir .`:
|
||||||
|
the same check the sweep runs on every pull request.
|
||||||
|
|
||||||
|
<!-- fleet:rules:end -->
|
||||||
|
|
||||||
|
Read `bitbaum/fleet` `AGENTS.md` and `SHARED.md` for shared-package ownership,
|
||||||
|
release and merge policy. Repository-specific instructions belong below.
|
||||||
|
|
||||||
|
This repository owns a reusable package. Fix shared defects here, verify the
|
||||||
|
package's public exports and affected consumer behavior, release through its
|
||||||
|
verified release workflow, then update consumers. Preserve product-specific
|
||||||
|
roles, tenancy, provider configuration and domain behavior in app adapters.
|
||||||
|
|
||||||
|
Before adding another implementation, inspect Fleet's package registry for an
|
||||||
|
existing owner. Shared authentication belongs to `@bitbaum/accountkit`, chat
|
||||||
|
behavior to `@bitbaum/chatkit`, and model/provider transport to `@bitbaum/ai-kit`.
|
||||||
|
|
||||||
|
Read `package.json` for this package's verification command and run it before
|
||||||
|
publishing changes. Use Fleet's auto-merge sweep; do not bypass its required
|
||||||
|
checks or rollout holds with manual merging or built-in `--auto`.
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
This retrospective record was added on 2026-10-27 from the immutable sources
|
||||||
|
linked below. Git commit dates are source dates, not inferred npm publication
|
||||||
|
dates. A GitHub release does not itself establish npm publication.
|
||||||
|
Application adoption and deployment evidence are tracked separately.
|
||||||
|
|
||||||
|
## 0.3.2
|
||||||
|
|
||||||
|
- [Tagged source `v0.3.2`](https://github.com/bitbaum/whenkit/tree/f5e0a24208187091c2ca792008cdd7695a19910f)
|
||||||
|
- [Source commit](https://github.com/bitbaum/whenkit/commit/f5e0a24208187091c2ca792008cdd7695a19910f), dated 2026-10-08.
|
||||||
|
|
||||||
|
No authored release notes were found for this tag when this record was made.
|
||||||
|
The links identify the verified source; missing feature history is not invented.
|
||||||
@@ -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.
|
request that resolves to `{ startsAt, endsAt }` in the provider's time zone.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm add github:bitbaum/whenkit#v0.2.0
|
pnpm add @bitbaum/whenkit
|
||||||
```
|
```
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
@@ -48,6 +48,42 @@ rented by the day. Three decisions replace that:
|
|||||||
autofill, a11y) transparent on top of a display that reads "Sat, 11 Oct ·
|
autofill, a11y) transparent on top of a display that reads "Sat, 11 Oct ·
|
||||||
14:00", and opens the picker on tap.
|
14:00", and opens the picker on tap.
|
||||||
|
|
||||||
|
## Replacing the date inputs you already have
|
||||||
|
|
||||||
|
`DateInput` is a drop-in for `<input type="date">` / `type="datetime-local"`:
|
||||||
|
same props, same `onChange(event)`, so a call site changes its tag and nothing
|
||||||
|
else.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { DateInput } from "@bitbaum/whenkit/react";
|
||||||
|
import "@bitbaum/whenkit/styles.css";
|
||||||
|
|
||||||
|
// before: <input type="date" value={due} onChange={(e) => setDue(e.target.value)} className="input" />
|
||||||
|
<DateInput value={due} onChange={(e) => setDue(e.target.value)} className="input" />;
|
||||||
|
```
|
||||||
|
|
||||||
|
Your own `className` lands on the visible box, and it wins: whenkit's look sits
|
||||||
|
in `@layer base`, below Tailwind utilities and plain app CSS. The real input
|
||||||
|
stays on top, invisible, so the picker, keyboard entry, autofill, `required`
|
||||||
|
validation and form submission all keep working. Controlled (`value`) or
|
||||||
|
uncontrolled (`defaultValue` + `name`, e.g. a server-action form). The empty
|
||||||
|
state and weekday/month words follow `<html lang>` (or pass `locale` /
|
||||||
|
`placeholder`).
|
||||||
|
|
||||||
|
### Migrating a repo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# one re-export per app: components/ui/date-input.tsx
|
||||||
|
# "use client"; import "@bitbaum/whenkit/styles.css"; export { DateInput } from "@bitbaum/whenkit/react";
|
||||||
|
node node_modules/@bitbaum/whenkit/scripts/migrate-date-inputs.mjs src --import "@/components/ui/date-input" # dry run
|
||||||
|
node node_modules/@bitbaum/whenkit/scripts/migrate-date-inputs.mjs src --import "@/components/ui/date-input" --write # apply
|
||||||
|
```
|
||||||
|
|
||||||
|
It changes the tag and adds one import — nothing else — and lists what it will
|
||||||
|
not guess (spread props, a dynamic `type={…}`). `--from Input` converts an
|
||||||
|
app's own wrapper component instead of the raw `<input>`. Tested on tricky
|
||||||
|
fixtures (`test/codemod.test.js`); a second run changes nothing.
|
||||||
|
|
||||||
## Rules it enforces
|
## Rules it enforces
|
||||||
|
|
||||||
- Dates are `YYYY-MM-DD`, times `HH:MM` — wall-clock strings. They become an
|
- Dates are `YYYY-MM-DD`, times `HH:MM` — wall-clock strings. They become an
|
||||||
@@ -71,7 +107,7 @@ rented by the day. Three decisions replace that:
|
|||||||
`type BookingChoice`.
|
`type BookingChoice`.
|
||||||
|
|
||||||
**React** (`@bitbaum/whenkit/react`): `BookingRequestPicker`, `DayStrip`,
|
**React** (`@bitbaum/whenkit/react`): `BookingRequestPicker`, `DayStrip`,
|
||||||
`ChipGroup`, `DateField`.
|
`ChipGroup`, `DateInput`, `DateField` (a `DateInput` with its own label).
|
||||||
|
|
||||||
**Look** (`@bitbaum/whenkit/styles.css`): `--wk-*` variables default to
|
**Look** (`@bitbaum/whenkit/styles.css`): `--wk-*` variables default to
|
||||||
`@bitbaum/design-tokens`; set them once to match any other app.
|
`@bitbaum/design-tokens`; set them once to match any other app.
|
||||||
|
|||||||
+26
-1
@@ -1,7 +1,7 @@
|
|||||||
// Visual + browser check page. Not shipped.
|
// Visual + browser check page. Not shipped.
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { createRoot } from "react-dom/client";
|
import { createRoot } from "react-dom/client";
|
||||||
import { BookingRequestPicker, DateField } from "../src/react/index.js";
|
import { BookingRequestPicker, DateField, DateInput } from "../src/react/index.js";
|
||||||
import { resolveRequest, todayIn, type BookingChoice } from "../src/index.js";
|
import { resolveRequest, todayIn, type BookingChoice } from "../src/index.js";
|
||||||
|
|
||||||
const ZONE = "Europe/Zurich";
|
const ZONE = "Europe/Zurich";
|
||||||
@@ -34,3 +34,28 @@ function Field() {
|
|||||||
createRoot(document.getElementById("hourly")!).render(<Booking unit="hour" id="hourly" />);
|
createRoot(document.getElementById("hourly")!).render(<Booking unit="hour" id="hourly" />);
|
||||||
createRoot(document.getElementById("daily")!).render(<Booking unit="day" id="daily" />);
|
createRoot(document.getElementById("daily")!).render(<Booking unit="day" id="daily" />);
|
||||||
createRoot(document.getElementById("field")!).render(<Field />);
|
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>
|
||||||
|
</>,
|
||||||
|
);
|
||||||
|
|
||||||
|
createRoot(document.getElementById("own-class")!).render(
|
||||||
|
<DateInput className="app-input" defaultValue="2026-10-11" id="own" />,
|
||||||
|
);
|
||||||
|
createRoot(document.getElementById("match-date")!).render(
|
||||||
|
<DateInput className="match-input" defaultValue="2026-10-11" id="match" />,
|
||||||
|
);
|
||||||
|
createRoot(document.getElementById("block-class")!).render(
|
||||||
|
<DateInput className="block-input" defaultValue="2026-10-11" id="blocked" />,
|
||||||
|
);
|
||||||
|
createRoot(document.getElementById("compact-class")!).render(
|
||||||
|
<DateInput className="compact-input" defaultValue="2026-10-11" id="compact" />,
|
||||||
|
);
|
||||||
|
createRoot(document.getElementById("util-class")!).render(
|
||||||
|
<DateInput className="util-input" defaultValue="2026-10-11" id="util" />,
|
||||||
|
);
|
||||||
+61
-3
@@ -26,15 +26,62 @@
|
|||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
.grid > section {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 0 0 12px;
|
margin: 0 0 12px;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
font-weight: 500;
|
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;
|
||||||
|
}
|
||||||
|
/* An app's OWN input class, unlayered plain CSS and a layered utility: both
|
||||||
|
must beat whenkit's defaults (they live in @layer base). */
|
||||||
|
.app-input {
|
||||||
|
padding: 2px 6px;
|
||||||
|
border: 3px solid rgb(255, 0, 0);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
/* A dense app input: 12px text, tight padding (e.g. Loki's ui-input-tight). */
|
||||||
|
.compact-input {
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
@layer utilities {
|
||||||
|
.util-input {
|
||||||
|
border-width: 5px;
|
||||||
|
border-style: dashed;
|
||||||
|
border-color: rgb(0, 0, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* An app's input, applied to a native input AND to DateInput: they must end up
|
||||||
|
the same height (a serif so its natural line height differs from 1.3). */
|
||||||
|
.match-input {
|
||||||
|
font-family: Georgia, serif;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1.5px solid rgb(150, 150, 150);
|
||||||
|
border-radius: 10px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
/* A hostile app class: display:block on the same element (unlayered, later). */
|
||||||
|
.block-input {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
.resolved {
|
.resolved {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
@@ -59,6 +106,17 @@
|
|||||||
<div id="field"></div>
|
<div id="field"></div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid" style="margin-top: 24px">
|
||||||
|
<section><div id="own-class"></div></section>
|
||||||
|
<section><div id="util-class"></div></section>
|
||||||
|
<section><div id="compact-class"></div></section>
|
||||||
|
<section>
|
||||||
|
<input id="match-native" class="match-input" value="Bello" />
|
||||||
|
<div id="match-date" style="margin-top: 8px"></div>
|
||||||
|
</section>
|
||||||
|
<section><div id="block-class"></div></section>
|
||||||
|
</div>
|
||||||
|
<div class="dialog-like" id="dialog"></div>
|
||||||
</main>
|
</main>
|
||||||
<script src="./dist/demo.js"></script>
|
<script src="./dist/demo.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Vendored
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import { describeValue } from "./DateInput.js";
|
||||||
export interface DateFieldProps {
|
export interface DateFieldProps {
|
||||||
label: string;
|
label: string;
|
||||||
/** `YYYY-MM-DD` (date) or `YYYY-MM-DDTHH:MM` (withTime), or "" when empty. */
|
/** `YYYY-MM-DD` (date) or `YYYY-MM-DDTHH:MM` (withTime), or "" when empty. */
|
||||||
@@ -13,6 +14,7 @@ export interface DateFieldProps {
|
|||||||
hint?: string;
|
hint?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
export declare function describeFieldValue(value: string, withTime: boolean, locale?: string): string;
|
/** Kept for callers of 0.1–0.2: the words for a value, or "" if invalid. */
|
||||||
|
export declare const describeFieldValue: typeof describeValue;
|
||||||
export declare function DateField({ label, value, onChange, withTime, min, max, required, name, placeholder, locale, hint, className, }: DateFieldProps): import("react").JSX.Element;
|
export declare function DateField({ label, value, onChange, withTime, min, max, required, name, placeholder, locale, hint, className, }: DateFieldProps): import("react").JSX.Element;
|
||||||
//# sourceMappingURL=DateField.d.ts.map
|
//# sourceMappingURL=DateField.d.ts.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../src/react/DateField.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAO,GAAG,MAAM,CAa1F;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,MAAa,EACb,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,+BA0DhB"}
|
{"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../src/react/DateField.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAa,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,sBAAgB,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,+BA2BhB"}
|
||||||
Vendored
+8
-37
@@ -1,48 +1,19 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||||
/**
|
/**
|
||||||
* A date (or date + time) field that reads like a sentence and picks like the
|
* A labelled date (or date + time) field: `DateInput` with its own label and
|
||||||
* phone does.
|
* an optional hint, for places that do not already have a form-field wrapper.
|
||||||
*
|
* Apps that do (most) use `DateInput` directly.
|
||||||
* The native picker is the best one there is on a phone — what looked bad
|
|
||||||
* across the fleet was the raw field around it: the browser's locale
|
|
||||||
* placeholder ("tt.mm.jjjj, --:--"), unstyled, different in every browser.
|
|
||||||
* So the native input stays (keyboard entry, a11y, autofill all keep
|
|
||||||
* working) and sits transparently over a display that says "Sat, 11 Oct ·
|
|
||||||
* 14:00". A tap anywhere opens the platform picker via `showPicker()`.
|
|
||||||
*
|
*
|
||||||
* Values are `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` wall-clock strings — exactly
|
* Values are `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` wall-clock strings — exactly
|
||||||
* what the native input speaks — never instants.
|
* what the native input speaks — never instants.
|
||||||
*/
|
*/
|
||||||
import { useId } from "react";
|
import { useId } from "react";
|
||||||
import { dayLabel, formatTime } from "../labels.js";
|
import { DateInput, describeValue } from "./DateInput.js";
|
||||||
import { isISODate, isWallTime } from "../calendar.js";
|
/** Kept for callers of 0.1–0.2: the words for a value, or "" if invalid. */
|
||||||
export function describeFieldValue(value, withTime, locale = "en") {
|
export const describeFieldValue = describeValue;
|
||||||
const [date, time] = value.split("T");
|
export function DateField({ label, value, onChange, withTime = false, min, max, required, name, placeholder, locale, hint, className, }) {
|
||||||
if (!isISODate(date))
|
|
||||||
return "";
|
|
||||||
const day = dayLabel(date, { locale });
|
|
||||||
const dayText = new Intl.DateTimeFormat(locale, {
|
|
||||||
timeZone: "UTC",
|
|
||||||
weekday: "short",
|
|
||||||
day: "numeric",
|
|
||||||
month: "short",
|
|
||||||
year: "numeric",
|
|
||||||
}).format(new Date(`${date}T00:00:00Z`));
|
|
||||||
if (withTime && isWallTime(time))
|
|
||||||
return `${dayText} · ${formatTime(time, locale)}`;
|
|
||||||
return dayText || day.short;
|
|
||||||
}
|
|
||||||
export function DateField({ label, value, onChange, withTime = false, min, max, required, name, placeholder, locale = "en", hint, className, }) {
|
|
||||||
const id = useId();
|
const id = useId();
|
||||||
const shown = value ? describeFieldValue(value, withTime, locale) : "";
|
return (_jsxs("div", { className: ["wk-field", className].filter(Boolean).join(" "), children: [_jsx("label", { className: "wk-label", htmlFor: id, children: label }), _jsx(DateInput, { id: id, type: withTime ? "datetime-local" : "date", value: value, onChange: (e) => onChange(e.target.value), min: min, max: max, required: required, name: name, placeholder: placeholder, locale: locale, "aria-describedby": hint ? `${id}-hint` : undefined }), hint && (_jsx("p", { className: "wk-hint", id: `${id}-hint`, children: hint }))] }));
|
||||||
return (_jsxs("div", { className: ["wk-field", className].filter(Boolean).join(" "), children: [_jsx("label", { className: "wk-label", htmlFor: id, children: label }), _jsxs("div", { className: "wk-field-box", "data-empty": shown ? undefined : true, children: [_jsx("span", { className: "wk-field-text", "aria-hidden": "true", children: shown || placeholder || (withTime ? "Pick a day and time" : "Pick a day") }), _jsxs("svg", { className: "wk-field-icon", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [_jsx("rect", { x: "3.5", y: "5", width: "17", height: "15", rx: "2.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6" }), _jsx("path", { d: "M3.5 9.5h17M8 3v4M16 3v4", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })] }), _jsx("input", { id: id, className: "wk-field-input", type: withTime ? "datetime-local" : "date", value: value, min: min, max: max, required: required, name: name, "aria-describedby": hint ? `${id}-hint` : undefined, onChange: (e) => onChange(e.target.value), onClick: (e) => {
|
|
||||||
try {
|
|
||||||
e.currentTarget.showPicker?.();
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// Not allowed (e.g. cross-origin iframe): native focus still works.
|
|
||||||
}
|
|
||||||
} })] }), hint && (_jsx("p", { className: "wk-hint", id: `${id}-hint`, children: hint }))] }));
|
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=DateField.js.map
|
//# sourceMappingURL=DateField.js.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../src/react/DateField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkBvD,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAE,QAAiB,EAAE,MAAM,GAAG,IAAI;IAChF,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC9C,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC;IACzC,IAAI,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,OAAO,MAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;IACpF,OAAO,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,MAAM,GAAG,IAAI,EACb,IAAI,EACJ,SAAS,GACM;IACf,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,OAAO,CACL,eAAK,SAAS,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAC/D,gBAAO,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,EAAE,YACpC,KAAK,GACA,EACR,eAAK,SAAS,EAAC,cAAc,gBAAa,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAChE,eAAM,SAAS,EAAC,eAAe,iBAAa,MAAM,YAC/C,KAAK,IAAI,WAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,GACrE,EACP,eAAK,SAAS,EAAC,eAAe,EAAC,OAAO,EAAC,WAAW,iBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,aACrF,eACE,CAAC,EAAC,KAAK,EACP,CAAC,EAAC,GAAG,EACL,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,GACjB,EACF,eACE,CAAC,EAAC,0BAA0B,EAC5B,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,IACE,EACN,gBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAC,gBAAgB,EAC1B,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAC1C,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,sBACQ,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;4BACb,IAAI,CAAC;gCACH,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC;4BACjC,CAAC;4BAAC,MAAM,CAAC;gCACP,oEAAoE;4BACtE,CAAC;wBACH,CAAC,GACD,IACE,EACL,IAAI,IAAI,CACP,YAAG,SAAS,EAAC,SAAS,EAAC,EAAE,EAAE,GAAG,EAAE,OAAO,YACpC,IAAI,GACH,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
{"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../src/react/DateField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAkB1D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,GACM;IACf,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,OAAO,CACL,eAAK,SAAS,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAC/D,gBAAO,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,EAAE,YACpC,KAAK,GACA,EACR,KAAC,SAAS,IACR,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAC1C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,sBACI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,GACjD,EACD,IAAI,IAAI,CACP,YAAG,SAAS,EAAC,SAAS,EAAC,EAAE,EAAE,GAAG,EAAE,OAAO,YACpC,IAAI,GACH,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
||||||
Vendored
+34
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* A drop-in for `<input type="date">` and `<input type="datetime-local">`.
|
||||||
|
*
|
||||||
|
* Same props, same `onChange(event)` — a call site changes its tag and
|
||||||
|
* nothing else. What changes is what a person sees: the browser's bare field
|
||||||
|
* ("tt.mm.jjjj, --:--", different in every browser) is replaced by the value
|
||||||
|
* in words ("Sat, 11 Oct 2026 · 14:00") in the app's OWN input styling (its
|
||||||
|
* `className` lands on the visible box), while the real input stays on top,
|
||||||
|
* transparent, so the platform picker, keyboard entry, autofill, validation
|
||||||
|
* bubbles and form submission all keep working.
|
||||||
|
*
|
||||||
|
* Controlled (`value`) or uncontrolled (`defaultValue`, e.g. a server-action
|
||||||
|
* form): the visible text follows whichever the app uses.
|
||||||
|
*/
|
||||||
|
import { type ChangeEvent, type InputHTMLAttributes } from "react";
|
||||||
|
export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "value" | "defaultValue"> {
|
||||||
|
/** `date` (default) or `datetime-local`. */
|
||||||
|
type?: "date" | "datetime-local";
|
||||||
|
/** `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`. */
|
||||||
|
value?: string;
|
||||||
|
defaultValue?: string;
|
||||||
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
/** Words shown while empty. Defaults to a short phrase in the page language. */
|
||||||
|
placeholder?: string;
|
||||||
|
/** BCP 47 tag. Defaults to the page's `<html lang>` (read after mount). */
|
||||||
|
locale?: string;
|
||||||
|
/** Applied to the visible box — give it the same classes as the app's inputs. */
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
export declare function emptyWords(locale: string, withTime: boolean): string;
|
||||||
|
/** "Sat, 11 Oct 2026" or "Sat, 11 Oct 2026 · 14:00"; "" when not a valid value. */
|
||||||
|
export declare function describeValue(value: string, withTime: boolean, locale?: string): string;
|
||||||
|
export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
||||||
|
//# sourceMappingURL=DateInput.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/react/DateInput.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAEzB,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,cAAc,CAC/C;IACC,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACjC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAGpE;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAO,GAAG,MAAM,CAWrF;AAWD,eAAO,MAAM,SAAS,6GAiFpB,CAAC"}
|
||||||
Vendored
+83
@@ -0,0 +1,83 @@
|
|||||||
|
"use client";
|
||||||
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||||
|
/**
|
||||||
|
* A drop-in for `<input type="date">` and `<input type="datetime-local">`.
|
||||||
|
*
|
||||||
|
* Same props, same `onChange(event)` — a call site changes its tag and
|
||||||
|
* nothing else. What changes is what a person sees: the browser's bare field
|
||||||
|
* ("tt.mm.jjjj, --:--", different in every browser) is replaced by the value
|
||||||
|
* in words ("Sat, 11 Oct 2026 · 14:00") in the app's OWN input styling (its
|
||||||
|
* `className` lands on the visible box), while the real input stays on top,
|
||||||
|
* transparent, so the platform picker, keyboard entry, autofill, validation
|
||||||
|
* bubbles and form submission all keep working.
|
||||||
|
*
|
||||||
|
* Controlled (`value`) or uncontrolled (`defaultValue`, e.g. a server-action
|
||||||
|
* form): the visible text follows whichever the app uses.
|
||||||
|
*/
|
||||||
|
import { forwardRef, useEffect, useState, } from "react";
|
||||||
|
import { isISODate, isWallTime } from "../calendar.js";
|
||||||
|
import { formatTime } from "../labels.js";
|
||||||
|
const EMPTY_WORDS = {
|
||||||
|
en: ["Pick a date", "Pick a date and time"],
|
||||||
|
de: ["Datum wählen", "Datum und Uhrzeit wählen"],
|
||||||
|
fr: ["Choisir une date", "Choisir la date et l'heure"],
|
||||||
|
it: ["Scegli una data", "Scegli data e ora"],
|
||||||
|
es: ["Elegir fecha", "Elegir fecha y hora"],
|
||||||
|
};
|
||||||
|
export function emptyWords(locale, withTime) {
|
||||||
|
const words = EMPTY_WORDS[locale.toLowerCase().split("-")[0]] ?? EMPTY_WORDS.en;
|
||||||
|
return words[withTime ? 1 : 0];
|
||||||
|
}
|
||||||
|
/** "Sat, 11 Oct 2026" or "Sat, 11 Oct 2026 · 14:00"; "" when not a valid value. */
|
||||||
|
export function describeValue(value, withTime, locale = "en") {
|
||||||
|
const [date, time] = value.split("T");
|
||||||
|
if (!isISODate(date))
|
||||||
|
return "";
|
||||||
|
const day = new Intl.DateTimeFormat(locale, {
|
||||||
|
timeZone: "UTC",
|
||||||
|
weekday: "short",
|
||||||
|
day: "numeric",
|
||||||
|
month: "short",
|
||||||
|
year: "numeric",
|
||||||
|
}).format(new Date(`${date}T00:00:00Z`));
|
||||||
|
return withTime && isWallTime(time) ? `${day} · ${formatTime(time, locale)}` : day;
|
||||||
|
}
|
||||||
|
/** An unknown tag from <html lang> must never throw during render. */
|
||||||
|
function safeDescribe(value, withTime, locale) {
|
||||||
|
try {
|
||||||
|
return describeValue(value, withTime, locale);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return describeValue(value, withTime, "en");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const DateInput = forwardRef(function DateInput({ type = "date", value, defaultValue, onChange, placeholder, locale, className, style, onClick, ...rest }, ref) {
|
||||||
|
const withTime = type === "datetime-local";
|
||||||
|
const [inner, setInner] = useState(defaultValue ?? "");
|
||||||
|
const [lang, setLang] = useState(locale ?? "en");
|
||||||
|
useEffect(() => {
|
||||||
|
if (locale)
|
||||||
|
setLang(locale);
|
||||||
|
else
|
||||||
|
setLang(document.documentElement.lang || "en");
|
||||||
|
}, [locale]);
|
||||||
|
const current = value ?? inner;
|
||||||
|
const text = current ? safeDescribe(current, withTime, lang) : "";
|
||||||
|
const empty = !text;
|
||||||
|
const handleClick = (event) => {
|
||||||
|
onClick?.(event);
|
||||||
|
if (event.defaultPrevented)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
event.currentTarget.showPicker?.();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// Not permitted here (e.g. a cross-origin frame): native focus still works.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (_jsxs("span", { className: ["wk-input", className].filter(Boolean).join(" "), "data-empty": empty || undefined, "data-disabled": rest.disabled || undefined, "data-invalid": rest["aria-invalid"] === true || rest["aria-invalid"] === "true" || undefined, style: style, children: [_jsx("span", { className: "wk-input-text", "aria-hidden": "true", children: text || placeholder || emptyWords(lang, withTime) }), _jsxs("svg", { className: "wk-input-icon", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [_jsx("rect", { x: "3.5", y: "5", width: "17", height: "15", rx: "2.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6" }), _jsx("path", { d: "M3.5 9.5h17M8 3v4M16 3v4", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })] }), _jsx("input", { ...rest, ref: ref, type: type, className: "wk-input-native", ...(value !== undefined ? { value } : { defaultValue }), onClick: handleClick, onChange: (event) => {
|
||||||
|
setInner(event.target.value);
|
||||||
|
onChange?.(event);
|
||||||
|
} })] }));
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=DateInput.js.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../src/react/DateInput.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,UAAU,EACV,SAAS,EACT,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB1C,MAAM,WAAW,GAAqC;IACpD,EAAE,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC3C,EAAE,EAAE,CAAC,cAAc,EAAE,0BAA0B,CAAC;IAChD,EAAE,EAAE,CAAC,kBAAkB,EAAE,4BAA4B,CAAC;IACtD,EAAE,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;IAC5C,EAAE,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC;CAC5C,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,QAAiB;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC;IAChF,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,QAAiB,EAAE,MAAM,GAAG,IAAI;IAC3E,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC1C,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC;IACzC,OAAO,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AACrF,CAAC;AAED,sEAAsE;AACtE,SAAS,YAAY,CAAC,KAAa,EAAE,QAAiB,EAAE,MAAc;IACpE,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAmC,SAAS,SAAS,CACtF,EACE,IAAI,GAAG,MAAM,EACb,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EACP,GAAG,IAAI,EACR,EACD,GAAG;IAEH,MAAM,QAAQ,GAAG,IAAI,KAAK,gBAAgB,CAAC;IAC3C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IACjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM;YAAE,OAAO,CAAC,MAAM,CAAC,CAAC;;YACvB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;IACtD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC;IAEpB,MAAM,WAAW,GAAG,CAAC,KAAmC,EAAE,EAAE;QAC1D,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACjB,IAAI,KAAK,CAAC,gBAAgB;YAAE,OAAO;QACnC,IAAI,CAAC;YACH,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,4EAA4E;QAC9E,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,gBACE,SAAS,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAChD,KAAK,IAAI,SAAS,mBACf,IAAI,CAAC,QAAQ,IAAI,SAAS,kBAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,SAAS,EAC3F,KAAK,EAAE,KAAK,aAEZ,eAAM,SAAS,EAAC,eAAe,iBAAa,MAAM,YAC/C,IAAI,IAAI,WAAW,IAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC7C,EACP,eAAK,SAAS,EAAC,eAAe,EAAC,OAAO,EAAC,WAAW,iBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,aACrF,eACE,CAAC,EAAC,KAAK,EACP,CAAC,EAAC,GAAG,EACL,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,GACjB,EACF,eACE,CAAC,EAAC,0BAA0B,EAC5B,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,IACE,EACN,mBACM,IAAI,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,iBAAiB,KACvB,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EACxD,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC7B,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;gBACpB,CAAC,GACD,IACG,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||||
Vendored
+1
@@ -1,5 +1,6 @@
|
|||||||
export { ChipGroup, type ChipGroupProps, type ChipOption } from "./ChipGroup.js";
|
export { ChipGroup, type ChipGroupProps, type ChipOption } from "./ChipGroup.js";
|
||||||
export { DateField, describeFieldValue, type DateFieldProps } from "./DateField.js";
|
export { DateField, describeFieldValue, type DateFieldProps } from "./DateField.js";
|
||||||
|
export { DateInput, describeValue, emptyWords, type DateInputProps } from "./DateInput.js";
|
||||||
export { DayStrip, type DayStripProps } from "./DayStrip.js";
|
export { DayStrip, type DayStripProps } from "./DayStrip.js";
|
||||||
export { BookingRequestPicker, DEFAULT_PICKER_WORDS, type BookingPickerWords, type BookingRequestPickerProps, } from "./BookingRequestPicker.js";
|
export { BookingRequestPicker, DEFAULT_PICKER_WORDS, type BookingPickerWords, type BookingRequestPickerProps, } from "./BookingRequestPicker.js";
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC"}
|
||||||
Vendored
+1
@@ -1,5 +1,6 @@
|
|||||||
export { ChipGroup } from "./ChipGroup.js";
|
export { ChipGroup } from "./ChipGroup.js";
|
||||||
export { DateField, describeFieldValue } from "./DateField.js";
|
export { DateField, describeFieldValue } from "./DateField.js";
|
||||||
|
export { DateInput, describeValue, emptyWords } from "./DateInput.js";
|
||||||
export { DayStrip } from "./DayStrip.js";
|
export { DayStrip } from "./DayStrip.js";
|
||||||
export { BookingRequestPicker, DEFAULT_PICKER_WORDS, } from "./BookingRequestPicker.js";
|
export { BookingRequestPicker, DEFAULT_PICKER_WORDS, } from "./BookingRequestPicker.js";
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwC,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAuB,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwC,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAuB,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC"}
|
||||||
+1
-1
@@ -20,7 +20,7 @@ export default tseslint.config(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Tests are plain Node running under `node --test`.
|
// Tests are plain Node running under `node --test`.
|
||||||
files: ["test/**/*.js", "test/**/*.mjs"],
|
files: ["test/**/*.js", "test/**/*.mjs", "scripts/**/*.mjs"],
|
||||||
// browser.mjs is Node driving a browser: page.evaluate bodies run there.
|
// browser.mjs is Node driving a browser: page.evaluate bodies run there.
|
||||||
languageOptions: { globals: { ...globals.node, ...globals.nodeBuiltin, ...globals.browser } },
|
languageOptions: { globals: { ...globals.node, ...globals.nodeBuiltin, ...globals.browser } },
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bitbaum/whenkit",
|
"name": "@bitbaum/whenkit",
|
||||||
"version": "0.2.0",
|
"version": "0.3.3",
|
||||||
"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.",
|
"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",
|
"license": "MIT",
|
||||||
"author": "Cato",
|
"author": "Cato",
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
"test:browser": "pnpm run demo && node test/browser.mjs"
|
"test:browser": "pnpm run demo && node test/browser.mjs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bitbaum/design-tokens": "^1.1.0",
|
"@bitbaum/design-tokens": "^1.7.1",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/node": "^26.4.0",
|
"@types/node": "^26.4.0",
|
||||||
"@types/react": "^19.2.18",
|
"@types/react": "^19.2.18",
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"esbuild": "^0.28.2",
|
"esbuild": "^0.28.2",
|
||||||
"eslint": "^10.9.1",
|
"eslint": "^10.9.1",
|
||||||
"globals": "^17.11.0",
|
"globals": "^17.11.0",
|
||||||
"playwright": "1.63.0",
|
"playwright": "1.65.0",
|
||||||
"prettier": "^3.9.6",
|
"prettier": "^3.9.6",
|
||||||
"react": "^19.2.8",
|
"react": "^19.2.8",
|
||||||
"react-dom": "^19.2.8",
|
"react-dom": "^19.2.8",
|
||||||
|
|||||||
Generated
+116
-115
@@ -9,14 +9,14 @@ importers:
|
|||||||
.:
|
.:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@bitbaum/design-tokens':
|
'@bitbaum/design-tokens':
|
||||||
specifier: ^1.1.0
|
specifier: ^1.7.1
|
||||||
version: 1.1.0
|
version: 1.7.1
|
||||||
'@eslint/js':
|
'@eslint/js':
|
||||||
specifier: ^10.0.1
|
specifier: ^10.0.1
|
||||||
version: 10.0.1(eslint@10.12.0)
|
version: 10.0.1(eslint@10.14.0)
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^26.4.0
|
specifier: ^26.4.0
|
||||||
version: 26.6.4
|
version: 26.6.6
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^19.2.18
|
specifier: ^19.2.18
|
||||||
version: 19.3.0
|
version: 19.3.0
|
||||||
@@ -28,34 +28,35 @@ importers:
|
|||||||
version: 0.28.2
|
version: 0.28.2
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^10.9.1
|
specifier: ^10.9.1
|
||||||
version: 10.12.0
|
version: 10.14.0
|
||||||
globals:
|
globals:
|
||||||
specifier: ^17.11.0
|
specifier: ^17.11.0
|
||||||
version: 17.13.0
|
version: 17.14.0
|
||||||
playwright:
|
playwright:
|
||||||
specifier: 1.63.0
|
specifier: 1.65.0
|
||||||
version: 1.63.0
|
version: 1.65.0
|
||||||
prettier:
|
prettier:
|
||||||
specifier: ^3.9.6
|
specifier: ^3.9.6
|
||||||
version: 3.9.9
|
version: 3.10.1
|
||||||
react:
|
react:
|
||||||
specifier: ^19.2.8
|
specifier: ^19.2.8
|
||||||
version: 19.3.0
|
version: 19.3.1
|
||||||
react-dom:
|
react-dom:
|
||||||
specifier: ^19.2.8
|
specifier: ^19.2.8
|
||||||
version: 19.3.0(react@19.3.0)
|
version: 19.3.1(react@19.3.1)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^6.0.3
|
specifier: ^6.0.3
|
||||||
version: 6.0.3
|
version: 6.0.3
|
||||||
typescript-eslint:
|
typescript-eslint:
|
||||||
specifier: ^8.68.0
|
specifier: ^8.68.0
|
||||||
version: 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
version: 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
'@bitbaum/design-tokens@1.1.0':
|
'@bitbaum/design-tokens@1.7.1':
|
||||||
resolution: {integrity: sha512-sDVplKP4jKe0WHCOnW7xk75RC46JsAYqUngcVlctyAs9f1TQqZqbYTfbmyYipYCOaCIHMflnzAneQTbqrQbtBw==}
|
resolution: {integrity: sha512-ejJOZyaN043LTTXkokpCR8kwU6wBt4SNxepUY0cnFX/1ilZRdZwkxnB+vlSlz75DtrMc1pF3KjyOt8C3o5rIqA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
'@cacheable/memory@2.2.0':
|
'@cacheable/memory@2.2.0':
|
||||||
resolution: {integrity: sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==}
|
resolution: {integrity: sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==}
|
||||||
@@ -296,8 +297,8 @@ packages:
|
|||||||
'@types/json-schema@7.0.15':
|
'@types/json-schema@7.0.15':
|
||||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||||
|
|
||||||
'@types/node@26.6.4':
|
'@types/node@26.6.6':
|
||||||
resolution: {integrity: sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg==}
|
resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==}
|
||||||
|
|
||||||
'@types/react-dom@19.3.0':
|
'@types/react-dom@19.3.0':
|
||||||
resolution: {integrity: sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==}
|
resolution: {integrity: sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==}
|
||||||
@@ -307,63 +308,63 @@ packages:
|
|||||||
'@types/react@19.3.0':
|
'@types/react@19.3.0':
|
||||||
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
|
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.71.1':
|
'@typescript-eslint/eslint-plugin@8.72.2':
|
||||||
resolution: {integrity: sha512-nNlBf6HuotqMgZvSkWD5hNdemiBIxQ2NmrlgfcUIeZRs+BbakjscCQRq/Hb74EFVnFiSWWdL12JruqwBy3ERDw==}
|
resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@typescript-eslint/parser': ^8.71.1
|
'@typescript-eslint/parser': ^8.72.2
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.71.1':
|
'@typescript-eslint/parser@8.72.2':
|
||||||
resolution: {integrity: sha512-oM/5sAqz/l1v/zYK1qTOPrn2+JIrBGC1V6uNYucRO5gh6eT9vWJ/RhPbGE59byvZEUQ4VP6XkLBaS5Jti5jpvw==}
|
resolution: {integrity: sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/project-service@8.71.1':
|
'@typescript-eslint/project-service@8.72.2':
|
||||||
resolution: {integrity: sha512-Oijc9RUsohHjncg6iGi7gCtjnEjYt9FWv9u6ygK8uKcHK5eLjLAkqERQ9BaytbpceOFdk6kifPCS/zAZE+A99g==}
|
resolution: {integrity: sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.71.1':
|
'@typescript-eslint/scope-manager@8.72.2':
|
||||||
resolution: {integrity: sha512-1YUDZXdTnXLlob03SFHBipdyMBsDVm7zoSz0ytTJ39dk5J1TgsTK03VlR/dLXG/RLLUrPcYbD4rp23BmHxHP0w==}
|
resolution: {integrity: sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/tsconfig-utils@8.71.1':
|
'@typescript-eslint/tsconfig-utils@8.72.2':
|
||||||
resolution: {integrity: sha512-oTvkml5SxXhgg+WWKhod5qWQICDXtOB+/Hi9VdPKFAANJ2b7YOgMffgvzXuqog7R6A/JtrzRf128dsxummyWhg==}
|
resolution: {integrity: sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.71.1':
|
'@typescript-eslint/type-utils@8.72.2':
|
||||||
resolution: {integrity: sha512-kH3t3jZCYv2PZSBEWPKTariLrCaoF1CLoPitYFBJOhAGEwWnSRAtGEifrfrpBa4K9JlwWNZotgA5w3/wLSk/FQ==}
|
resolution: {integrity: sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/types@8.71.1':
|
'@typescript-eslint/types@8.72.2':
|
||||||
resolution: {integrity: sha512-ybYnPTUwg3VQQOFEiBPLs8Jxl1ry2vXdn1kVKguomBbvxpetdu3MKTNDqFNUrlG8ylP9MpZosmXMFYlGQHk1oQ==}
|
resolution: {integrity: sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.71.1':
|
'@typescript-eslint/typescript-estree@8.72.2':
|
||||||
resolution: {integrity: sha512-pSKSEK1JJpHs6KiKVtABCE4iJK5d7FLFzDXQNBQ2oRY7LEd3UwOt3TZemTgu9syTIf56dJWlTn/pdmrO9oKUXQ==}
|
resolution: {integrity: sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.71.1':
|
'@typescript-eslint/utils@8.72.2':
|
||||||
resolution: {integrity: sha512-CBjT6gfAz3DW2j9Q4moFnqt208Aq+506sVGXfpRcyAeqn0EpayL0mjdWoCO2t3RC7GewNrFxdeehuEaPg6DMzQ==}
|
resolution: {integrity: sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.71.1':
|
'@typescript-eslint/visitor-keys@8.72.2':
|
||||||
resolution: {integrity: sha512-0GxiUGqMU0qXJt58cBsiG3DP8lUmBaFo2vChtUX+CT7PnR3v/VGLLrzVP4K9r1lNiZXjHYefMBbPunplr09v6w==}
|
resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
acorn-jsx@5.3.2:
|
acorn-jsx@5.3.2:
|
||||||
@@ -430,8 +431,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==}
|
resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==}
|
||||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||||
|
|
||||||
eslint@10.12.0:
|
eslint@10.14.0:
|
||||||
resolution: {integrity: sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA==}
|
resolution: {integrity: sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==}
|
||||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -495,8 +496,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||||
engines: {node: '>=10.13.0'}
|
engines: {node: '>=10.13.0'}
|
||||||
|
|
||||||
globals@17.13.0:
|
globals@17.14.0:
|
||||||
resolution: {integrity: sha512-RwMTC61u7hrG3ZJMkZQOK4JLJrKS8QtoTii63EmWvFXHqycY9FObBJQCbsLxSO8kjKhWE5kV1GC+Vb1g3RI0Zg==}
|
resolution: {integrity: sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
hashery@1.5.1:
|
hashery@1.5.1:
|
||||||
@@ -583,13 +584,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
|
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
playwright-core@1.63.0:
|
playwright-core@1.65.0:
|
||||||
resolution: {integrity: sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==}
|
resolution: {integrity: sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
playwright@1.63.0:
|
playwright@1.65.0:
|
||||||
resolution: {integrity: sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==}
|
resolution: {integrity: sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -597,8 +598,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
|
|
||||||
prettier@3.9.9:
|
prettier@3.10.1:
|
||||||
resolution: {integrity: sha512-Z/CJHIkdujO/OtN7nXUii0Rf3VT5SRuhjBA82Xvu2XhBUgX3nhP67T0LHceBdQLex7OOFGTox+Q5Yg8Jk2Qivg==}
|
resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -610,13 +611,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==}
|
resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
react-dom@19.3.0:
|
react-dom@19.3.1:
|
||||||
resolution: {integrity: sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==}
|
resolution: {integrity: sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^19.3.0
|
react: ^19.3.1
|
||||||
|
|
||||||
react@19.3.0:
|
react@19.3.1:
|
||||||
resolution: {integrity: sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==}
|
resolution: {integrity: sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
scheduler@0.28.0:
|
scheduler@0.28.0:
|
||||||
@@ -649,8 +650,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
|
|
||||||
typescript-eslint@8.71.1:
|
typescript-eslint@8.72.2:
|
||||||
resolution: {integrity: sha512-oiNVPC3/NbV1FpaHU07l8O6ynqG9v4PAiW2WvTrAmZdR0f2HI/gE668ElMLCK7Xbsu5k2fK5C4fXNiq05j7/nQ==}
|
resolution: {integrity: sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
@@ -682,7 +683,7 @@ packages:
|
|||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
|
||||||
'@bitbaum/design-tokens@1.1.0': {}
|
'@bitbaum/design-tokens@1.7.1': {}
|
||||||
|
|
||||||
'@cacheable/memory@2.2.0':
|
'@cacheable/memory@2.2.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -774,9 +775,9 @@ snapshots:
|
|||||||
'@esbuild/win32-x64@0.28.2':
|
'@esbuild/win32-x64@0.28.2':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@eslint-community/eslint-utils@4.10.1(eslint@10.12.0)':
|
'@eslint-community/eslint-utils@4.10.1(eslint@10.14.0)':
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
eslint-visitor-keys: 3.4.3
|
eslint-visitor-keys: 3.4.3
|
||||||
|
|
||||||
'@eslint-community/regexpp@4.12.2': {}
|
'@eslint-community/regexpp@4.12.2': {}
|
||||||
@@ -797,9 +798,9 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/json-schema': 7.0.15
|
'@types/json-schema': 7.0.15
|
||||||
|
|
||||||
'@eslint/js@10.0.1(eslint@10.12.0)':
|
'@eslint/js@10.0.1(eslint@10.14.0)':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
|
|
||||||
'@eslint/object-schema@3.0.5': {}
|
'@eslint/object-schema@3.0.5': {}
|
||||||
|
|
||||||
@@ -838,7 +839,7 @@ snapshots:
|
|||||||
|
|
||||||
'@types/json-schema@7.0.15': {}
|
'@types/json-schema@7.0.15': {}
|
||||||
|
|
||||||
'@types/node@26.6.4':
|
'@types/node@26.6.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 8.9.0
|
undici-types: 8.9.0
|
||||||
|
|
||||||
@@ -850,15 +851,15 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
csstype: 3.2.3
|
csstype: 3.2.3
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.71.1(@typescript-eslint/parser@8.71.1(eslint@10.12.0)(typescript@6.0.3))(eslint@10.12.0)(typescript@6.0.3)':
|
'@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/regexpp': 4.12.2
|
'@eslint-community/regexpp': 4.12.2
|
||||||
'@typescript-eslint/parser': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
'@typescript-eslint/scope-manager': 8.71.1
|
'@typescript-eslint/scope-manager': 8.72.2
|
||||||
'@typescript-eslint/type-utils': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/type-utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
'@typescript-eslint/utils': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
'@typescript-eslint/visitor-keys': 8.71.1
|
'@typescript-eslint/visitor-keys': 8.72.2
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
ignore: 7.0.12
|
ignore: 7.0.12
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||||
@@ -866,56 +867,56 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.71.1(eslint@10.12.0)(typescript@6.0.3)':
|
'@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/scope-manager': 8.71.1
|
'@typescript-eslint/scope-manager': 8.72.2
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
'@typescript-eslint/typescript-estree': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/visitor-keys': 8.71.1
|
'@typescript-eslint/visitor-keys': 8.72.2
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/project-service@8.71.1(typescript@6.0.3)':
|
'@typescript-eslint/project-service@8.72.2(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/tsconfig-utils': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.71.1':
|
'@typescript-eslint/scope-manager@8.72.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
'@typescript-eslint/visitor-keys': 8.71.1
|
'@typescript-eslint/visitor-keys': 8.72.2
|
||||||
|
|
||||||
'@typescript-eslint/tsconfig-utils@8.71.1(typescript@6.0.3)':
|
'@typescript-eslint/tsconfig-utils@8.72.2(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.71.1(eslint@10.12.0)(typescript@6.0.3)':
|
'@typescript-eslint/type-utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
'@typescript-eslint/typescript-estree': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/utils': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/types@8.71.1': {}
|
'@typescript-eslint/types@8.72.2': {}
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.71.1(typescript@6.0.3)':
|
'@typescript-eslint/typescript-estree@8.72.2(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/project-service': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/project-service': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/tsconfig-utils': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
'@typescript-eslint/visitor-keys': 8.71.1
|
'@typescript-eslint/visitor-keys': 8.72.2
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
minimatch: 10.2.6
|
minimatch: 10.2.6
|
||||||
semver: 7.8.5
|
semver: 7.8.5
|
||||||
@@ -925,20 +926,20 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.71.1(eslint@10.12.0)(typescript@6.0.3)':
|
'@typescript-eslint/utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.12.0)
|
'@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0)
|
||||||
'@typescript-eslint/scope-manager': 8.71.1
|
'@typescript-eslint/scope-manager': 8.72.2
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
'@typescript-eslint/typescript-estree': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3)
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.71.1':
|
'@typescript-eslint/visitor-keys@8.72.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.71.1
|
'@typescript-eslint/types': 8.72.2
|
||||||
eslint-visitor-keys: 5.0.1
|
eslint-visitor-keys: 5.0.1
|
||||||
|
|
||||||
acorn-jsx@5.3.2(acorn@8.19.0):
|
acorn-jsx@5.3.2(acorn@8.19.0):
|
||||||
@@ -1024,9 +1025,9 @@ snapshots:
|
|||||||
|
|
||||||
eslint-visitor-keys@5.0.1: {}
|
eslint-visitor-keys@5.0.1: {}
|
||||||
|
|
||||||
eslint@10.12.0:
|
eslint@10.14.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.12.0)
|
'@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0)
|
||||||
'@eslint-community/regexpp': 4.12.2
|
'@eslint-community/regexpp': 4.12.2
|
||||||
'@eslint/config-array': 0.23.5
|
'@eslint/config-array': 0.23.5
|
||||||
'@eslint/config-helpers': 0.7.0
|
'@eslint/config-helpers': 0.7.0
|
||||||
@@ -1108,7 +1109,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
|
|
||||||
globals@17.13.0: {}
|
globals@17.14.0: {}
|
||||||
|
|
||||||
hashery@1.5.1:
|
hashery@1.5.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1180,15 +1181,15 @@ snapshots:
|
|||||||
|
|
||||||
picomatch@4.0.7: {}
|
picomatch@4.0.7: {}
|
||||||
|
|
||||||
playwright-core@1.63.0: {}
|
playwright-core@1.65.0: {}
|
||||||
|
|
||||||
playwright@1.63.0:
|
playwright@1.65.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright-core: 1.63.0
|
playwright-core: 1.65.0
|
||||||
|
|
||||||
prelude-ls@1.2.1: {}
|
prelude-ls@1.2.1: {}
|
||||||
|
|
||||||
prettier@3.9.9: {}
|
prettier@3.10.1: {}
|
||||||
|
|
||||||
punycode@2.3.1: {}
|
punycode@2.3.1: {}
|
||||||
|
|
||||||
@@ -1196,12 +1197,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
hookified: 2.2.0
|
hookified: 2.2.0
|
||||||
|
|
||||||
react-dom@19.3.0(react@19.3.0):
|
react-dom@19.3.1(react@19.3.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
react: 19.3.0
|
react: 19.3.1
|
||||||
scheduler: 0.28.0
|
scheduler: 0.28.0
|
||||||
|
|
||||||
react@19.3.0: {}
|
react@19.3.1: {}
|
||||||
|
|
||||||
scheduler@0.28.0: {}
|
scheduler@0.28.0: {}
|
||||||
|
|
||||||
@@ -1226,13 +1227,13 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls: 1.2.1
|
prelude-ls: 1.2.1
|
||||||
|
|
||||||
typescript-eslint@8.71.1(eslint@10.12.0)(typescript@6.0.3):
|
typescript-eslint@8.72.2(eslint@10.14.0)(typescript@6.0.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/eslint-plugin': 8.71.1(@typescript-eslint/parser@8.71.1(eslint@10.12.0)(typescript@6.0.3))(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/eslint-plugin': 8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)
|
||||||
'@typescript-eslint/parser': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
'@typescript-eslint/typescript-estree': 8.71.1(typescript@6.0.3)
|
'@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3)
|
||||||
'@typescript-eslint/utils': 8.71.1(eslint@10.12.0)(typescript@6.0.3)
|
'@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3)
|
||||||
eslint: 10.12.0
|
eslint: 10.14.0
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
# esbuild only builds demo/ (the visual check); nothing it produces ships.
|
# esbuild only builds demo/ (the visual check); nothing it produces ships.
|
||||||
allowBuilds:
|
allowBuilds:
|
||||||
esbuild: true
|
esbuild: true
|
||||||
|
# Our own packages are published by our own tagged workflows; minimumReleaseAge
|
||||||
|
# would refuse each fresh publish until it ages. One scope glob covers every
|
||||||
|
# @bitbaum package; the four unscoped ones are named (fleet SHARED.md).
|
||||||
|
minimumReleaseAgeExclude:
|
||||||
|
- "@bitbaum/*"
|
||||||
|
- limitkit
|
||||||
|
- bip-kit
|
||||||
|
- threadkit
|
||||||
|
- ai-forms
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Replace `<input type="date">` / `<input type="datetime-local">` with whenkit's
|
||||||
|
// DateInput — a drop-in (same props, same onChange(event)), so only the TAG
|
||||||
|
// changes. Nothing else in the file is touched except one import line.
|
||||||
|
//
|
||||||
|
// node scripts/migrate-date-inputs.mjs <dir> --import "@/components/ui/date-input" [--from input] [--write]
|
||||||
|
//
|
||||||
|
// --import module that exports DateInput (a one-line re-export per app that
|
||||||
|
// also imports "@bitbaum/whenkit/styles.css" once)
|
||||||
|
// --from tag to replace: `input` (default) or a wrapper such as `Input`
|
||||||
|
// --write apply; without it, a dry run that only reports
|
||||||
|
//
|
||||||
|
// It is a tag scanner, not a regex over attributes: it walks the JSX opening
|
||||||
|
// tag honouring braces, strings and template literals, so `onChange={(e) => …}`
|
||||||
|
// and multi-line props cannot confuse it. Anything it will NOT convert safely
|
||||||
|
// is listed for a human: spread props (`{...register("x")}`) are kept (DateInput
|
||||||
|
// forwards them) but flagged, and a dynamic `type={…}` is flagged, never guessed.
|
||||||
|
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
||||||
|
import { join, relative } from "node:path";
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const root = args.find((a) => !a.startsWith("--"));
|
||||||
|
const opt = (name, fallback) => {
|
||||||
|
const i = args.indexOf(`--${name}`);
|
||||||
|
return i >= 0 ? args[i + 1] : fallback;
|
||||||
|
};
|
||||||
|
const write = args.includes("--write");
|
||||||
|
const from = opt("from", "input");
|
||||||
|
const importFrom = opt("import");
|
||||||
|
if (!root || !importFrom) {
|
||||||
|
console.error(
|
||||||
|
'usage: migrate-date-inputs.mjs <dir> --import "<module>" [--from input|Input] [--write]',
|
||||||
|
);
|
||||||
|
process.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SKIP =
|
||||||
|
/(^|\/)(node_modules|\.next|\.claude|dist|build|coverage|__tests__|tests?|e2e|cypress|\.git)(\/|$)/;
|
||||||
|
const FILE = /\.(tsx|jsx)$/;
|
||||||
|
const TEST_FILE = /\.(test|spec|stories)\.(tsx|jsx)$/;
|
||||||
|
|
||||||
|
function* walk(dir) {
|
||||||
|
for (const name of readdirSync(dir)) {
|
||||||
|
const path = join(dir, name);
|
||||||
|
if (SKIP.test(relative(root, path))) continue;
|
||||||
|
const st = statSync(path);
|
||||||
|
if (st.isDirectory()) yield* walk(path);
|
||||||
|
else if (FILE.test(name) && !TEST_FILE.test(name)) yield path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** End index (exclusive) of the JSX opening tag starting at `start` (`<tag`), or -1. */
|
||||||
|
function tagEnd(src, start) {
|
||||||
|
let depth = 0; // braces
|
||||||
|
let i = start;
|
||||||
|
while (i < src.length) {
|
||||||
|
const c = src[i];
|
||||||
|
if (depth === 0) {
|
||||||
|
if (c === '"' || c === "'") {
|
||||||
|
const close = src.indexOf(c, i + 1);
|
||||||
|
if (close < 0) return -1;
|
||||||
|
i = close + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c === "{") depth++;
|
||||||
|
else if (c === ">") return i + 1;
|
||||||
|
} else {
|
||||||
|
if (c === "{") depth++;
|
||||||
|
else if (c === "}") depth--;
|
||||||
|
else if (c === '"' || c === "'" || c === "`") {
|
||||||
|
// string inside an expression
|
||||||
|
let j = i + 1;
|
||||||
|
while (j < src.length && src[j] !== c) j += src[j] === "\\" ? 2 : 1;
|
||||||
|
i = j + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TYPE_STATIC =
|
||||||
|
/\btype=(?:"(date|datetime-local)"|'(date|datetime-local)'|\{\s*["'](date|datetime-local)["']\s*\})/;
|
||||||
|
const TYPE_ANY = /\btype=\{/;
|
||||||
|
|
||||||
|
/** `src` with comments blanked (same length, so indexes still line up). */
|
||||||
|
function maskComments(src) {
|
||||||
|
const blank = (m) => m.replace(/[^\n]/g, " ");
|
||||||
|
return src
|
||||||
|
.replace(/\/\*[\s\S]*?\*\//g, blank)
|
||||||
|
.replace(/(^|[^:"'`\\])\/\/[^\n]*/g, (m, lead) => lead + blank(m.slice(lead.length)));
|
||||||
|
}
|
||||||
|
|
||||||
|
let changedFiles = 0;
|
||||||
|
let changedTags = 0;
|
||||||
|
const review = [];
|
||||||
|
|
||||||
|
for (const file of walk(root)) {
|
||||||
|
const src = readFileSync(file, "utf8");
|
||||||
|
// The app's own re-export (and anything already on whenkit) is not a call site.
|
||||||
|
if (src.includes("@bitbaum/whenkit")) continue;
|
||||||
|
const code = maskComments(src);
|
||||||
|
const opening = new RegExp(`<${from}(?=[\\s/>])`, "g");
|
||||||
|
let out = "";
|
||||||
|
let last = 0;
|
||||||
|
let count = 0;
|
||||||
|
const alias = /\bDateInput\b/.test(src) && !src.includes(`from "${importFrom}"`);
|
||||||
|
const tag = alias ? "WhenDateInput" : "DateInput";
|
||||||
|
for (const m of code.matchAll(opening)) {
|
||||||
|
const end = tagEnd(src, m.index);
|
||||||
|
if (end < 0) continue;
|
||||||
|
const attrs = src.slice(m.index, end);
|
||||||
|
if (TYPE_STATIC.test(attrs)) {
|
||||||
|
out += src.slice(last, m.index) + `<${tag}`;
|
||||||
|
last = m.index + m[0].length;
|
||||||
|
count++;
|
||||||
|
const line = src.slice(0, m.index).split("\n").length;
|
||||||
|
// A JSX prop spread is `{...x}` at attribute level; `({ ...form, a })` inside
|
||||||
|
// an onChange arrow is an object literal and is not worth a human's time.
|
||||||
|
if (/(^|[\s"'}/])\{\s*\.\.\.[A-Za-z_$]/.test(attrs.replace(/=\{[^}]*\}/g, "=")))
|
||||||
|
review.push(`${relative(root, file)}:${line} spreads props — check they are input props`);
|
||||||
|
} else if (TYPE_ANY.test(attrs) && /date/i.test(src.slice(m.index, m.index + 400))) {
|
||||||
|
const line = src.slice(0, m.index).split("\n").length;
|
||||||
|
review.push(
|
||||||
|
`${relative(root, file)}:${line} has a dynamic type={…} near "date" — decide by hand`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count === 0) continue;
|
||||||
|
out += src.slice(last);
|
||||||
|
|
||||||
|
const importLine = alias
|
||||||
|
? `import { DateInput as WhenDateInput } from "${importFrom}";`
|
||||||
|
: `import { DateInput } from "${importFrom}";`;
|
||||||
|
if (!out.includes(`from "${importFrom}"`)) {
|
||||||
|
// after the last top-level import (or the directive, or the top)
|
||||||
|
// `[ \t]*$` ends the match at the line, so the blank line after the imports is kept.
|
||||||
|
const imports = [...out.matchAll(/^import[\s\S]*?;[ \t]*$/gm)];
|
||||||
|
const at = imports.length
|
||||||
|
? imports[imports.length - 1].index + imports[imports.length - 1][0].length
|
||||||
|
: (/^(?:["']use (?:client|server)["'];?\s*)/.exec(out)?.[0].length ?? 0);
|
||||||
|
out = out.slice(0, at) + (at ? "\n" : "") + importLine + (at ? "" : "\n") + out.slice(at);
|
||||||
|
}
|
||||||
|
changedFiles++;
|
||||||
|
changedTags += count;
|
||||||
|
console.log(
|
||||||
|
`${write ? "wrote " : "would change "}${relative(root, file)} (${count} tag${count > 1 ? "s" : ""})`,
|
||||||
|
);
|
||||||
|
if (write) writeFileSync(file, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`\n${changedTags} tag(s) in ${changedFiles} file(s)${write ? " migrated" : " (dry run — add --write)"}`,
|
||||||
|
);
|
||||||
|
if (review.length) console.log(`\nREVIEW BY HAND:\n ${review.join("\n ")}`);
|
||||||
+20
-70
@@ -1,22 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A date (or date + time) field that reads like a sentence and picks like the
|
* A labelled date (or date + time) field: `DateInput` with its own label and
|
||||||
* phone does.
|
* an optional hint, for places that do not already have a form-field wrapper.
|
||||||
*
|
* Apps that do (most) use `DateInput` directly.
|
||||||
* The native picker is the best one there is on a phone — what looked bad
|
|
||||||
* across the fleet was the raw field around it: the browser's locale
|
|
||||||
* placeholder ("tt.mm.jjjj, --:--"), unstyled, different in every browser.
|
|
||||||
* So the native input stays (keyboard entry, a11y, autofill all keep
|
|
||||||
* working) and sits transparently over a display that says "Sat, 11 Oct ·
|
|
||||||
* 14:00". A tap anywhere opens the platform picker via `showPicker()`.
|
|
||||||
*
|
*
|
||||||
* Values are `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` wall-clock strings — exactly
|
* Values are `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` wall-clock strings — exactly
|
||||||
* what the native input speaks — never instants.
|
* what the native input speaks — never instants.
|
||||||
*/
|
*/
|
||||||
import { useId } from "react";
|
import { useId } from "react";
|
||||||
import { dayLabel, formatTime } from "../labels.js";
|
import { DateInput, describeValue } from "./DateInput.js";
|
||||||
import { isISODate, isWallTime } from "../calendar.js";
|
|
||||||
|
|
||||||
export interface DateFieldProps {
|
export interface DateFieldProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -34,20 +27,8 @@ export interface DateFieldProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function describeFieldValue(value: string, withTime: boolean, locale = "en"): string {
|
/** Kept for callers of 0.1–0.2: the words for a value, or "" if invalid. */
|
||||||
const [date, time] = value.split("T");
|
export const describeFieldValue = describeValue;
|
||||||
if (!isISODate(date)) return "";
|
|
||||||
const day = dayLabel(date, { locale });
|
|
||||||
const dayText = new Intl.DateTimeFormat(locale, {
|
|
||||||
timeZone: "UTC",
|
|
||||||
weekday: "short",
|
|
||||||
day: "numeric",
|
|
||||||
month: "short",
|
|
||||||
year: "numeric",
|
|
||||||
}).format(new Date(`${date}T00:00:00Z`));
|
|
||||||
if (withTime && isWallTime(time)) return `${dayText} · ${formatTime(time, locale)}`;
|
|
||||||
return dayText || day.short;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function DateField({
|
export function DateField({
|
||||||
label,
|
label,
|
||||||
@@ -59,60 +40,29 @@ export function DateField({
|
|||||||
required,
|
required,
|
||||||
name,
|
name,
|
||||||
placeholder,
|
placeholder,
|
||||||
locale = "en",
|
locale,
|
||||||
hint,
|
hint,
|
||||||
className,
|
className,
|
||||||
}: DateFieldProps) {
|
}: DateFieldProps) {
|
||||||
const id = useId();
|
const id = useId();
|
||||||
const shown = value ? describeFieldValue(value, withTime, locale) : "";
|
|
||||||
return (
|
return (
|
||||||
<div className={["wk-field", className].filter(Boolean).join(" ")}>
|
<div className={["wk-field", className].filter(Boolean).join(" ")}>
|
||||||
<label className="wk-label" htmlFor={id}>
|
<label className="wk-label" htmlFor={id}>
|
||||||
{label}
|
{label}
|
||||||
</label>
|
</label>
|
||||||
<div className="wk-field-box" data-empty={shown ? undefined : true}>
|
<DateInput
|
||||||
<span className="wk-field-text" aria-hidden="true">
|
id={id}
|
||||||
{shown || placeholder || (withTime ? "Pick a day and time" : "Pick a day")}
|
type={withTime ? "datetime-local" : "date"}
|
||||||
</span>
|
value={value}
|
||||||
<svg className="wk-field-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
onChange={(e) => onChange(e.target.value)}
|
||||||
<rect
|
min={min}
|
||||||
x="3.5"
|
max={max}
|
||||||
y="5"
|
required={required}
|
||||||
width="17"
|
name={name}
|
||||||
height="15"
|
placeholder={placeholder}
|
||||||
rx="2.5"
|
locale={locale}
|
||||||
fill="none"
|
aria-describedby={hint ? `${id}-hint` : undefined}
|
||||||
stroke="currentColor"
|
/>
|
||||||
strokeWidth="1.6"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M3.5 9.5h17M8 3v4M16 3v4"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="1.6"
|
|
||||||
strokeLinecap="round"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<input
|
|
||||||
id={id}
|
|
||||||
className="wk-field-input"
|
|
||||||
type={withTime ? "datetime-local" : "date"}
|
|
||||||
value={value}
|
|
||||||
min={min}
|
|
||||||
max={max}
|
|
||||||
required={required}
|
|
||||||
name={name}
|
|
||||||
aria-describedby={hint ? `${id}-hint` : undefined}
|
|
||||||
onChange={(e) => onChange(e.target.value)}
|
|
||||||
onClick={(e) => {
|
|
||||||
try {
|
|
||||||
e.currentTarget.showPicker?.();
|
|
||||||
} catch {
|
|
||||||
// Not allowed (e.g. cross-origin iframe): native focus still works.
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{hint && (
|
{hint && (
|
||||||
<p className="wk-hint" id={`${id}-hint`}>
|
<p className="wk-hint" id={`${id}-hint`}>
|
||||||
{hint}
|
{hint}
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A drop-in for `<input type="date">` and `<input type="datetime-local">`.
|
||||||
|
*
|
||||||
|
* Same props, same `onChange(event)` — a call site changes its tag and
|
||||||
|
* nothing else. What changes is what a person sees: the browser's bare field
|
||||||
|
* ("tt.mm.jjjj, --:--", different in every browser) is replaced by the value
|
||||||
|
* in words ("Sat, 11 Oct 2026 · 14:00") in the app's OWN input styling (its
|
||||||
|
* `className` lands on the visible box), while the real input stays on top,
|
||||||
|
* transparent, so the platform picker, keyboard entry, autofill, validation
|
||||||
|
* bubbles and form submission all keep working.
|
||||||
|
*
|
||||||
|
* Controlled (`value`) or uncontrolled (`defaultValue`, e.g. a server-action
|
||||||
|
* form): the visible text follows whichever the app uses.
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
forwardRef,
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
type ChangeEvent,
|
||||||
|
type InputHTMLAttributes,
|
||||||
|
type MouseEvent,
|
||||||
|
} from "react";
|
||||||
|
import { isISODate, isWallTime } from "../calendar.js";
|
||||||
|
import { formatTime } from "../labels.js";
|
||||||
|
|
||||||
|
export interface DateInputProps extends Omit<
|
||||||
|
InputHTMLAttributes<HTMLInputElement>,
|
||||||
|
"type" | "onChange" | "value" | "defaultValue"
|
||||||
|
> {
|
||||||
|
/** `date` (default) or `datetime-local`. */
|
||||||
|
type?: "date" | "datetime-local";
|
||||||
|
/** `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`. */
|
||||||
|
value?: string;
|
||||||
|
defaultValue?: string;
|
||||||
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
/** Words shown while empty. Defaults to a short phrase in the page language. */
|
||||||
|
placeholder?: string;
|
||||||
|
/** BCP 47 tag. Defaults to the page's `<html lang>` (read after mount). */
|
||||||
|
locale?: string;
|
||||||
|
/** Applied to the visible box — give it the same classes as the app's inputs. */
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_WORDS: Record<string, [string, string]> = {
|
||||||
|
en: ["Pick a date", "Pick a date and time"],
|
||||||
|
de: ["Datum wählen", "Datum und Uhrzeit wählen"],
|
||||||
|
fr: ["Choisir une date", "Choisir la date et l'heure"],
|
||||||
|
it: ["Scegli una data", "Scegli data e ora"],
|
||||||
|
es: ["Elegir fecha", "Elegir fecha y hora"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function emptyWords(locale: string, withTime: boolean): string {
|
||||||
|
const words = EMPTY_WORDS[locale.toLowerCase().split("-")[0]] ?? EMPTY_WORDS.en;
|
||||||
|
return words[withTime ? 1 : 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "Sat, 11 Oct 2026" or "Sat, 11 Oct 2026 · 14:00"; "" when not a valid value. */
|
||||||
|
export function describeValue(value: string, withTime: boolean, locale = "en"): string {
|
||||||
|
const [date, time] = value.split("T");
|
||||||
|
if (!isISODate(date)) return "";
|
||||||
|
const day = new Intl.DateTimeFormat(locale, {
|
||||||
|
timeZone: "UTC",
|
||||||
|
weekday: "short",
|
||||||
|
day: "numeric",
|
||||||
|
month: "short",
|
||||||
|
year: "numeric",
|
||||||
|
}).format(new Date(`${date}T00:00:00Z`));
|
||||||
|
return withTime && isWallTime(time) ? `${day} · ${formatTime(time, locale)}` : day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An unknown tag from <html lang> must never throw during render. */
|
||||||
|
function safeDescribe(value: string, withTime: boolean, locale: string): string {
|
||||||
|
try {
|
||||||
|
return describeValue(value, withTime, locale);
|
||||||
|
} catch {
|
||||||
|
return describeValue(value, withTime, "en");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DateInput = forwardRef<HTMLInputElement, DateInputProps>(function DateInput(
|
||||||
|
{
|
||||||
|
type = "date",
|
||||||
|
value,
|
||||||
|
defaultValue,
|
||||||
|
onChange,
|
||||||
|
placeholder,
|
||||||
|
locale,
|
||||||
|
className,
|
||||||
|
style,
|
||||||
|
onClick,
|
||||||
|
...rest
|
||||||
|
},
|
||||||
|
ref,
|
||||||
|
) {
|
||||||
|
const withTime = type === "datetime-local";
|
||||||
|
const [inner, setInner] = useState(defaultValue ?? "");
|
||||||
|
const [lang, setLang] = useState(locale ?? "en");
|
||||||
|
useEffect(() => {
|
||||||
|
if (locale) setLang(locale);
|
||||||
|
else setLang(document.documentElement.lang || "en");
|
||||||
|
}, [locale]);
|
||||||
|
|
||||||
|
const current = value ?? inner;
|
||||||
|
const text = current ? safeDescribe(current, withTime, lang) : "";
|
||||||
|
const empty = !text;
|
||||||
|
|
||||||
|
const handleClick = (event: MouseEvent<HTMLInputElement>) => {
|
||||||
|
onClick?.(event);
|
||||||
|
if (event.defaultPrevented) return;
|
||||||
|
try {
|
||||||
|
event.currentTarget.showPicker?.();
|
||||||
|
} catch {
|
||||||
|
// Not permitted here (e.g. a cross-origin frame): native focus still works.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={["wk-input", className].filter(Boolean).join(" ")}
|
||||||
|
data-empty={empty || undefined}
|
||||||
|
data-disabled={rest.disabled || undefined}
|
||||||
|
data-invalid={rest["aria-invalid"] === true || rest["aria-invalid"] === "true" || undefined}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
|
<span className="wk-input-text" aria-hidden="true">
|
||||||
|
{text || placeholder || emptyWords(lang, withTime)}
|
||||||
|
</span>
|
||||||
|
<svg className="wk-input-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||||
|
<rect
|
||||||
|
x="3.5"
|
||||||
|
y="5"
|
||||||
|
width="17"
|
||||||
|
height="15"
|
||||||
|
rx="2.5"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.6"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M3.5 9.5h17M8 3v4M16 3v4"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.6"
|
||||||
|
strokeLinecap="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<input
|
||||||
|
{...rest}
|
||||||
|
ref={ref}
|
||||||
|
type={type}
|
||||||
|
className="wk-input-native"
|
||||||
|
{...(value !== undefined ? { value } : { defaultValue })}
|
||||||
|
onClick={handleClick}
|
||||||
|
onChange={(event) => {
|
||||||
|
setInner(event.target.value);
|
||||||
|
onChange?.(event);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export { ChipGroup, type ChipGroupProps, type ChipOption } from "./ChipGroup.js";
|
export { ChipGroup, type ChipGroupProps, type ChipOption } from "./ChipGroup.js";
|
||||||
export { DateField, describeFieldValue, type DateFieldProps } from "./DateField.js";
|
export { DateField, describeFieldValue, type DateFieldProps } from "./DateField.js";
|
||||||
|
export { DateInput, describeValue, emptyWords, type DateInputProps } from "./DateInput.js";
|
||||||
export { DayStrip, type DayStripProps } from "./DayStrip.js";
|
export { DayStrip, type DayStripProps } from "./DayStrip.js";
|
||||||
export {
|
export {
|
||||||
BookingRequestPicker,
|
BookingRequestPicker,
|
||||||
|
|||||||
+72
-20
@@ -26,6 +26,7 @@
|
|||||||
--wk-accent-soft: color-mix(in srgb, var(--wk-accent) 14%, transparent);
|
--wk-accent-soft: color-mix(in srgb, var(--wk-accent) 14%, transparent);
|
||||||
--wk-radius: var(--radius-control, 0.625rem);
|
--wk-radius: var(--radius-control, 0.625rem);
|
||||||
--wk-font: var(--font-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
|
--wk-font: var(--font-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
|
||||||
|
--wk-danger: hsl(var(--status-negative, 0 65% 50%));
|
||||||
--wk-text: 1rem;
|
--wk-text: 1rem;
|
||||||
--wk-small: 0.8125rem;
|
--wk-small: 0.8125rem;
|
||||||
--wk-target: 2.75rem;
|
--wk-target: 2.75rem;
|
||||||
@@ -126,6 +127,12 @@
|
|||||||
/* ---- the day strip ---- */
|
/* ---- the day strip ---- */
|
||||||
|
|
||||||
.wk-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;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -202,7 +209,7 @@
|
|||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- the readable date field over the native picker ---- */
|
/* ---- the readable date input over the native picker ---- */
|
||||||
|
|
||||||
.wk-field {
|
.wk-field {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -210,47 +217,87 @@
|
|||||||
gap: 0.375rem;
|
gap: 0.375rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-field-box {
|
/* The visible box, in two parts.
|
||||||
|
STRUCTURE (unlayered): what the stacked native input needs to work.
|
||||||
|
LOOK (@layer base): border, padding, colour, size. A named low layer, so an
|
||||||
|
app's own classes always win — Tailwind v4 utilities and component classes
|
||||||
|
sit in higher layers, plain app CSS is unlayered — and the date input then
|
||||||
|
looks like the app's other inputs, not like ours. (Unlayered defaults would
|
||||||
|
have beaten Tailwind's layered utilities.) No min-height: a compact input
|
||||||
|
stays compact; the picker sets its own 44px where it needs it. */
|
||||||
|
/* span.wk-input, not .wk-input: structure must hold even when an app's own
|
||||||
|
unlayered input class sets display:block on this same element. */
|
||||||
|
span.wk-input {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
min-height: var(--wk-target);
|
box-sizing: border-box;
|
||||||
padding: 0 0.875rem;
|
min-width: 0;
|
||||||
border: 1px solid var(--wk-line-2);
|
|
||||||
border-radius: var(--wk-radius);
|
|
||||||
background: var(--wk-bg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-field-box:focus-within {
|
@layer base {
|
||||||
|
.wk-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.7rem 0.875rem;
|
||||||
|
border: 1px solid var(--wk-line-2);
|
||||||
|
border-radius: var(--wk-radius);
|
||||||
|
background: var(--wk-bg);
|
||||||
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
font-size: var(--wk-text);
|
||||||
|
/* The font's own line height, exactly like a native input — a fixed 1.3
|
||||||
|
made the date box a different height from its neighbours. */
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.wk-field .wk-input,
|
||||||
|
.wk-other .wk-input {
|
||||||
|
min-height: var(--wk-target);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wk-input:focus-within {
|
||||||
outline: 2px solid var(--wk-accent);
|
outline: 2px solid var(--wk-accent);
|
||||||
outline-offset: 1px;
|
outline-offset: 1px;
|
||||||
border-color: var(--wk-accent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-field-text {
|
.wk-input[data-invalid] {
|
||||||
|
border-color: var(--wk-danger, #dc2626);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wk-input[data-disabled] {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wk-input-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
font-size: var(--wk-text);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-field-box[data-empty] .wk-field-text {
|
.wk-input[data-empty] .wk-input-text {
|
||||||
color: var(--wk-muted);
|
opacity: 0.55;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-field-icon {
|
.wk-input-icon {
|
||||||
width: 1.25rem;
|
/* em, not rem, and no taller than a normal line: the icon scales with the
|
||||||
height: 1.25rem;
|
field's own text, so neither a dense 12px input nor a serif-font one is made
|
||||||
|
taller than its neighbours by it. */
|
||||||
|
width: 1.1em;
|
||||||
|
height: 1.1em;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
color: var(--wk-fg-2);
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The real control: full-size, invisible, on top — taps open the native
|
/* The real control: full-size, invisible, on top — taps open the native
|
||||||
picker, keyboard entry and autofill keep working. 16px so iOS does not zoom. */
|
picker, keyboard entry, autofill and validation keep working. 16px so iOS
|
||||||
.wk-field-input {
|
does not zoom the page on focus. */
|
||||||
|
.wk-input-native {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -264,6 +311,10 @@
|
|||||||
color-scheme: light dark;
|
color-scheme: light dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wk-input-native:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
/* "Another date…" under the strip is a quiet secondary control. */
|
/* "Another date…" under the strip is a quiet secondary control. */
|
||||||
.wk-other .wk-label {
|
.wk-other .wk-label {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -273,8 +324,9 @@
|
|||||||
clip: rect(0 0 0 0);
|
clip: rect(0 0 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wk-other .wk-field-box {
|
.wk-other .wk-input {
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
width: auto;
|
||||||
border-style: dashed;
|
border-style: dashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+71
-2
@@ -97,9 +97,61 @@ try {
|
|||||||
`${name}: flexible request without a day`,
|
`${name}: flexible request without a day`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The app's own classes win over whenkit's defaults — plain CSS and a
|
||||||
|
// layered (Tailwind-style) utility alike. Without @layer base for the
|
||||||
|
// defaults, whenkit's unlayered rules would beat the layered utility.
|
||||||
|
const own = await page.evaluate(() => {
|
||||||
|
const css = (sel) => getComputedStyle(document.querySelector(sel));
|
||||||
|
return {
|
||||||
|
plainBorder: css("#own-class .wk-input").borderTopColor,
|
||||||
|
plainWidth: css("#own-class .wk-input").borderTopWidth,
|
||||||
|
utilWidth: css("#util-class .wk-input").borderTopWidth,
|
||||||
|
utilStyle: css("#util-class .wk-input").borderTopStyle,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
check(
|
||||||
|
own.plainBorder === "rgb(255, 0, 0)" && own.plainWidth === "3px",
|
||||||
|
`${name}: an app class beats whenkit's input look (${own.plainBorder} ${own.plainWidth})`,
|
||||||
|
);
|
||||||
|
check(
|
||||||
|
own.utilWidth === "5px" && own.utilStyle === "dashed",
|
||||||
|
`${name}: a layered utility beats it too (${own.utilWidth} ${own.utilStyle})`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// A dense app input stays dense: the icon scales with the text instead of
|
||||||
|
// forcing a 20px line into a 12px field.
|
||||||
|
const compactHeight = await page.evaluate(
|
||||||
|
() => document.querySelector("#compact-class .wk-input").getBoundingClientRect().height,
|
||||||
|
);
|
||||||
|
check(
|
||||||
|
compactHeight <= 32,
|
||||||
|
`${name}: a 12px compact date input stays compact (${Math.round(compactHeight)}px)`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// The date box is the same height as a native input given the same class —
|
||||||
|
// so a form row does not step when one field is a date.
|
||||||
|
const heights = await page.evaluate(() => ({
|
||||||
|
native: document.getElementById("match-native").getBoundingClientRect().height,
|
||||||
|
date: document.querySelector("#match-date .wk-input").getBoundingClientRect().height,
|
||||||
|
}));
|
||||||
|
check(
|
||||||
|
Math.abs(heights.native - heights.date) <= 1,
|
||||||
|
`${name}: date box matches a native input's height (${heights.date} vs ${heights.native})`,
|
||||||
|
);
|
||||||
|
// An app class with display:block on the same element must not break the layout.
|
||||||
|
const stacked = await page.evaluate(() => {
|
||||||
|
const box = document.querySelector("#block-class .wk-input");
|
||||||
|
return getComputedStyle(box).display;
|
||||||
|
});
|
||||||
|
check(stacked === "flex", `${name}: an app's display:block cannot break the box (${stacked})`);
|
||||||
|
|
||||||
const small = await page.evaluate(
|
const small = await page.evaluate(
|
||||||
() =>
|
() =>
|
||||||
[...document.querySelectorAll(".wk-chip, .wk-day, .wk-field-box")]
|
[
|
||||||
|
...document.querySelectorAll(
|
||||||
|
".wk-chip, .wk-day, .wk-field .wk-input, .wk-other .wk-input",
|
||||||
|
),
|
||||||
|
]
|
||||||
.filter((el) => el.getClientRects().length > 0)
|
.filter((el) => el.getClientRects().length > 0)
|
||||||
.map((el) => el.getBoundingClientRect())
|
.map((el) => el.getBoundingClientRect())
|
||||||
.filter((r) => r.height < 43.5 || r.width < 43.5).length,
|
.filter((r) => r.height < 43.5 || r.width < 43.5).length,
|
||||||
@@ -107,7 +159,7 @@ try {
|
|||||||
check(small === 0, `${name}: every chip, day and field is at least 44px (${small} too small)`);
|
check(small === 0, `${name}: every chip, day and field is at least 44px (${small} too small)`);
|
||||||
|
|
||||||
const inputSize = await page.evaluate(() =>
|
const inputSize = await page.evaluate(() =>
|
||||||
parseFloat(getComputedStyle(document.querySelector(".wk-field-input")).fontSize),
|
parseFloat(getComputedStyle(document.querySelector(".wk-input-native")).fontSize),
|
||||||
);
|
);
|
||||||
check(inputSize >= 16, `${name}: date input is ${inputSize}px (iOS zooms below 16)`);
|
check(inputSize >= 16, `${name}: date input is ${inputSize}px (iOS zooms below 16)`);
|
||||||
|
|
||||||
@@ -115,6 +167,23 @@ try {
|
|||||||
await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
|
await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
|
||||||
`${name}: still no horizontal scroll after picking`,
|
`${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(" | ")}`);
|
check(errors.length === 0, `${name}: no page errors ${errors.join(" | ")}`);
|
||||||
// Let chip colour transitions finish so the screenshot shows real states.
|
// Let chip colour transitions finish so the screenshot shows real states.
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
// The migration codemod must change the TAG and one import line — nothing else —
|
||||||
|
// and must never touch an input that is not a date.
|
||||||
|
import { test } from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const script = fileURLToPath(new URL("../scripts/migrate-date-inputs.mjs", import.meta.url));
|
||||||
|
const IMPORT = "@/components/ui/date-input";
|
||||||
|
|
||||||
|
function project(files) {
|
||||||
|
const dir = mkdtempSync(join(tmpdir(), "whenkit-codemod-"));
|
||||||
|
for (const [name, body] of Object.entries(files)) {
|
||||||
|
const path = join(dir, name);
|
||||||
|
mkdirSync(join(path, ".."), { recursive: true });
|
||||||
|
writeFileSync(path, body);
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
const run = (dir, extra = []) =>
|
||||||
|
execFileSync("node", [script, dir, "--import", IMPORT, ...extra], { encoding: "utf8" });
|
||||||
|
const read = (dir, name) => readFileSync(join(dir, name), "utf8");
|
||||||
|
|
||||||
|
test("a dry run reports and writes nothing", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => <input type="date" value={v} />;\n`,
|
||||||
|
});
|
||||||
|
const before = read(dir, "a.tsx");
|
||||||
|
const out = run(dir);
|
||||||
|
assert.match(out, /would change a\.tsx/);
|
||||||
|
assert.match(out, /dry run/);
|
||||||
|
assert.equal(read(dir, "a.tsx"), before);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("only the tag changes; props, arrows, strings and templates are untouched", () => {
|
||||||
|
const body = `"use client";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function F() {
|
||||||
|
const [d, setD] = useState("");
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
type="date"
|
||||||
|
value={d}
|
||||||
|
onChange={(e) => setD(e.target.value)}
|
||||||
|
className={\`ui-input \${d ? "set" : ""}\`}
|
||||||
|
title="a > b"
|
||||||
|
min={new Date().toISOString().slice(0, 10)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const dir = project({ "f.tsx": body });
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
const after = read(dir, "f.tsx");
|
||||||
|
assert.match(after, /<DateInput\n\s+type="date"/);
|
||||||
|
assert.match(after, /onChange=\{\(e\) => setD\(e\.target\.value\)\}/);
|
||||||
|
assert.match(after, /className=\{`ui-input \$\{d \? "set" : ""\}`\}/);
|
||||||
|
assert.match(after, /title="a > b"/);
|
||||||
|
// the import goes after the last import, below the directive
|
||||||
|
assert.match(
|
||||||
|
after,
|
||||||
|
/"use client";\nimport \{ useState \} from "react";\nimport \{ DateInput \} from "@\/components\/ui\/date-input";\n/,
|
||||||
|
);
|
||||||
|
// and the diff is exactly one tag and one import
|
||||||
|
assert.equal(
|
||||||
|
after
|
||||||
|
.replace('import { DateInput } from "@/components/ui/date-input";\n', "")
|
||||||
|
.replace("<DateInput", "<input"),
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("datetime-local, single-quoted and braced types are all converted", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => (<><input type='datetime-local' /><input type={"date"} /><input type="date"/></>);\n`,
|
||||||
|
});
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
assert.equal((read(dir, "a.tsx").match(/<DateInput/g) ?? []).length, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("inputs that are not dates are left exactly alone", () => {
|
||||||
|
const body = `import x from "x";\nexport const A = () => (<><input type="text" /><input type="time" /><input /><input type={kind} /></>);\n`;
|
||||||
|
const dir = project({ "a.tsx": body });
|
||||||
|
const out = run(dir, ["--write"]);
|
||||||
|
assert.equal(read(dir, "a.tsx"), body);
|
||||||
|
assert.match(out, /0 tag\(s\) in 0 file\(s\)/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a name clash gets an alias instead of shadowing the local DateInput", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nfunction DateInput() { return <input type="date" />; }\nexport { DateInput };\n`,
|
||||||
|
});
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
const after = read(dir, "a.tsx");
|
||||||
|
assert.match(after, /import \{ DateInput as WhenDateInput \} from/);
|
||||||
|
assert.match(after, /<WhenDateInput type="date" \/>/);
|
||||||
|
assert.match(after, /function DateInput\(\)/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("--from converts a wrapper component and leaves the raw input alone", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => (<><Input type="date" /><input type="date" /></>);\n`,
|
||||||
|
});
|
||||||
|
run(dir, ["--write", "--from", "Input"]);
|
||||||
|
const after = read(dir, "a.tsx");
|
||||||
|
assert.match(after, /<DateInput type="date" \/>/);
|
||||||
|
assert.match(after, /<input type="date" \/>/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a second run changes nothing, and tests, node_modules and non-JSX are skipped", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => <input type="date" />;\n`,
|
||||||
|
"a.test.tsx": `export const T = () => <input type="date" />;\n`,
|
||||||
|
"node_modules/p/i.tsx": `export const N = () => <input type="date" />;\n`,
|
||||||
|
"b.ts": `const s = '<input type="date" />';\n`,
|
||||||
|
});
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
const out = run(dir, ["--write"]);
|
||||||
|
assert.match(out, /0 tag\(s\) in 0 file\(s\)/);
|
||||||
|
assert.match(read(dir, "a.test.tsx"), /<input type="date"/);
|
||||||
|
assert.match(read(dir, "node_modules/p/i.tsx"), /<input type="date"/);
|
||||||
|
assert.match(read(dir, "b.ts"), /<input type="date"/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("risky shapes are listed for a human, not guessed", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => (<><input type="date" {...register("when")} /><input type={isDate ? "date" : "text"} /></>);\n`,
|
||||||
|
});
|
||||||
|
const out = run(dir);
|
||||||
|
assert.match(out, /REVIEW BY HAND/);
|
||||||
|
assert.match(out, /spreads props/);
|
||||||
|
assert.match(out, /dynamic type=/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("comments that mention an input are not call sites, and the app's own whenkit re-export is skipped", () => {
|
||||||
|
const withComments = `import x from "x";
|
||||||
|
// <input type="date"> used to be a bare field
|
||||||
|
/* and <input type="datetime-local" /> here */
|
||||||
|
export const A = () => (<>{/* <input type="date" /> */}<input type="date" /></>);
|
||||||
|
`;
|
||||||
|
const shim = `"use client";\n// the real <input type="date"> stays on top\nimport "@bitbaum/whenkit/styles.css";\nexport { DateInput } from "@bitbaum/whenkit/react";\n`;
|
||||||
|
const dir = project({ "a.tsx": withComments, "shim.tsx": shim });
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
const after = read(dir, "a.tsx");
|
||||||
|
assert.match(after, /\/\/ <input type="date"> used to be/);
|
||||||
|
assert.match(after, /\/\* and <input type="datetime-local" \/> here \*\//);
|
||||||
|
assert.match(after, /\{\/\* <input type="date" \/> \*\/\}<DateInput type="date" \/>/);
|
||||||
|
assert.equal((after.match(/<DateInput/g) ?? []).length, 1);
|
||||||
|
assert.equal(read(dir, "shim.tsx"), shim);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a URL in a string does not hide the rest of the line", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => <a href="http://x.y">go</a>;\nexport const B = () => <input type="date" />; // after\n`,
|
||||||
|
});
|
||||||
|
run(dir, ["--write"]);
|
||||||
|
assert.match(read(dir, "a.tsx"), /<DateInput type="date" \/>; \/\/ after/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("an object spread inside onChange is not flagged; a JSX prop spread still is", () => {
|
||||||
|
const dir = project({
|
||||||
|
"a.tsx": `import x from "x";\nexport const A = () => <input type="date" onChange={(e) => set({ ...form, date: e.target.value })} />;\n`,
|
||||||
|
"b.tsx": `import x from "x";\nexport const B = () => <input type="date" {...register("when")} />;\n`,
|
||||||
|
});
|
||||||
|
const out = run(dir);
|
||||||
|
assert.doesNotMatch(out, /a\.tsx:\d+ spreads props/);
|
||||||
|
assert.match(out, /b\.tsx:\d+ spreads props/);
|
||||||
|
});
|
||||||
+62
-1
@@ -5,7 +5,7 @@ import { test } from "node:test";
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { createElement as h } from "react";
|
import { createElement as h } from "react";
|
||||||
import { renderToString } from "react-dom/server";
|
import { renderToString } from "react-dom/server";
|
||||||
import { BookingRequestPicker, DateField, ChipGroup } from "../dist/react/index.js";
|
import { BookingRequestPicker, DateField, ChipGroup, DateInput } from "../dist/react/index.js";
|
||||||
|
|
||||||
const NOW = new Date("2026-10-10T08:00:00Z"); // 10:00 in Zurich, a Saturday
|
const NOW = new Date("2026-10-10T08:00:00Z"); // 10:00 in Zurich, a Saturday
|
||||||
const base = { zone: "Europe/Zurich", locale: "en-GB", now: NOW, onChange: () => {} };
|
const base = { zone: "Europe/Zurich", locale: "en-GB", now: NOW, onChange: () => {} };
|
||||||
@@ -108,3 +108,64 @@ test("a fixed duration shows no length choice and is used for the slot", () => {
|
|||||||
// 17:00 + 90 min would end after 18:00 closing, so it is not offered.
|
// 17:00 + 90 min would end after 18:00 closing, so it is not offered.
|
||||||
assert.doesNotMatch(html, />17:00</);
|
assert.doesNotMatch(html, />17:00</);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("DateInput is a drop-in: every input prop reaches the real input, className the visible box", () => {
|
||||||
|
const html = renderToString(
|
||||||
|
h(DateInput, {
|
||||||
|
id: "due",
|
||||||
|
name: "due",
|
||||||
|
required: true,
|
||||||
|
min: "2026-10-01",
|
||||||
|
disabled: true,
|
||||||
|
"aria-invalid": true,
|
||||||
|
className: "ui-input-compact",
|
||||||
|
value: "2026-10-11",
|
||||||
|
onChange: () => {},
|
||||||
|
locale: "en-GB",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
assert.match(html, /<span class="wk-input ui-input-compact"/);
|
||||||
|
assert.match(html, /<input[^>]*id="due"/);
|
||||||
|
assert.match(html, /<input[^>]*name="due"/);
|
||||||
|
assert.match(html, /<input[^>]*required/);
|
||||||
|
assert.match(html, /<input[^>]*min="2026-10-01"/);
|
||||||
|
assert.match(html, /<input[^>]*disabled/);
|
||||||
|
assert.match(html, /<input[^>]*aria-invalid="true"/);
|
||||||
|
assert.match(html, /<input[^>]*type="date"/);
|
||||||
|
assert.match(html, /Sun, 11 Oct 2026/);
|
||||||
|
assert.match(html, /data-invalid/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("DateInput works uncontrolled (a server-action form): defaultValue shows and submits", () => {
|
||||||
|
const html = renderToString(
|
||||||
|
h(DateInput, { name: "date", defaultValue: "2026-03-05", locale: "de" }),
|
||||||
|
);
|
||||||
|
assert.match(html, /Do\., 5\. März 2026|Do, 5\. März 2026/);
|
||||||
|
assert.match(html, /<input[^>]*value="2026-03-05"/);
|
||||||
|
assert.match(html, /<input[^>]*name="date"/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("DateInput datetime-local shows the time, and an empty one shows words in the page language", () => {
|
||||||
|
const withTime = renderToString(
|
||||||
|
h(DateInput, {
|
||||||
|
type: "datetime-local",
|
||||||
|
value: "2026-10-11T14:30",
|
||||||
|
onChange: () => {},
|
||||||
|
locale: "en-GB",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
assert.match(withTime, /Sun, 11 Oct 2026 · 14:30/);
|
||||||
|
const empty = renderToString(h(DateInput, { value: "", onChange: () => {}, locale: "de" }));
|
||||||
|
assert.match(empty, /Datum wählen/);
|
||||||
|
assert.match(empty, /data-empty/);
|
||||||
|
const unknown = renderToString(h(DateInput, { value: "", onChange: () => {}, locale: "xx" }));
|
||||||
|
assert.match(unknown, /Pick a date/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("DateInput never throws on a bad value or a bad locale", () => {
|
||||||
|
assert.doesNotThrow(() =>
|
||||||
|
renderToString(
|
||||||
|
h(DateInput, { value: "not-a-date", onChange: () => {}, locale: "zz-INVALID-tag-!!" }),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user