@42-central/ui-react 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -175
- package/dist/{chunk-ACE7FBWE.js → chunk-EVVMHTCL.js} +3 -3
- package/dist/chunk-EVVMHTCL.js.map +1 -0
- package/dist/{chunk-TMMEJKLI.js → chunk-NSOA3GMZ.js} +16 -3
- package/dist/chunk-NSOA3GMZ.js.map +1 -0
- package/dist/{chunk-PJL4ZL5V.js → chunk-YON5Y336.js} +3 -3
- package/dist/{chunk-PJL4ZL5V.js.map → chunk-YON5Y336.js.map} +1 -1
- package/dist/components/alert/alert.d.ts +17 -9
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +2 -2
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/date-picker/index.js +3 -3
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +4 -4
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/schedule/index.d.ts +3 -3
- package/dist/components/schedule/index.js +163 -89
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-create-draft.d.ts +3 -2
- package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-days-view.d.ts +1 -1
- package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-drag-ghost.d.ts +12 -5
- package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +16 -0
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +29 -6
- package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-next-up.d.ts +1 -1
- package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
- package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +3 -3
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +4 -1
- package/dist/components/schedule/schedule-types.d.ts.map +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule.d.ts.map +1 -1
- package/dist/components/schedule/use-event-create.d.ts.map +1 -1
- package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
- package/dist/theme.css +9 -3
- package/package.json +1 -1
- package/src/components/alert/alert.test.tsx +8 -2
- package/src/components/alert/alert.tsx +18 -11
- package/src/components/calendar/calendar-body.tsx +8 -1
- package/src/components/notification/create-notifier.tsx +6 -5
- package/src/components/notification/notification.test.tsx +15 -0
- package/src/components/notification/notification.tsx +4 -4
- package/src/components/schedule/now-cursor-line.tsx +1 -1
- package/src/components/schedule/schedule-agenda-view.tsx +6 -4
- package/src/components/schedule/schedule-all-day-row.tsx +1 -1
- package/src/components/schedule/schedule-create-draft.tsx +14 -5
- package/src/components/schedule/schedule-dates.ts +3 -2
- package/src/components/schedule/schedule-days-view.tsx +6 -4
- package/src/components/schedule/schedule-drag-ghost.tsx +27 -12
- package/src/components/schedule/schedule-event-chip.tsx +9 -2
- package/src/components/schedule/schedule-event-list-popover-content.tsx +1 -1
- package/src/components/schedule/schedule-geometry.ts +21 -0
- package/src/components/schedule/schedule-grid-gesture.test.ts +83 -1
- package/src/components/schedule/schedule-grid-gesture.ts +67 -28
- package/src/components/schedule/schedule-month-view.tsx +7 -5
- package/src/components/schedule/schedule-next-up.tsx +5 -3
- package/src/components/schedule/schedule-timed-grid.tsx +41 -3
- package/src/components/schedule/schedule-toolbar.tsx +23 -17
- package/src/components/schedule/schedule-types.ts +4 -1
- package/src/components/schedule/schedule-year-view.tsx +7 -5
- package/src/components/schedule/schedule.test.tsx +132 -14
- package/src/components/schedule/schedule.tsx +6 -4
- package/src/components/schedule/use-event-create.ts +7 -6
- package/src/components/schedule/use-event-drag.ts +10 -4
- package/src/components/schedule/use-event-resize.ts +4 -2
- package/src/theme.css +9 -3
- package/dist/chunk-ACE7FBWE.js.map +0 -1
- package/dist/chunk-TMMEJKLI.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="@42-central/ui-react" src="https://shieldcn.dev/header/dots.svg?title=UI+React&subtitle=Code-themed+React+UI+kit+for+42%27s+apps&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAMgAAADIBAMAAABfdrOtAAAAMFBMVEUAAAD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F87TQQwAAAAD3RSTlMAAw4fKzNGVm%2BMn73c6vz7344aAAACqklEQVR42u3ZMWsUQRjG8ed9jaA2N5fWQswnEMVG1I9gpXZKvsGdnVZ3VpdClBQi2KlgI5b2fgobI3baOXOI3mJgx5Bb8Hb21tkwN2%2BMef%2BQIrs7PPyyaY6DpmmapmmapmmHnUH%2BiDbCMG89vH4xvHC%2BM%2BTqp6APNL%2FxOLzxKLzwlQBGPPr%2BaiPoeQ%2F7hcSzjScNuo30rpzz1ju4%2Bc9es22Hee7Pde%2B929p7cvGa9egWnfhs%2FWKl3zTYzzyxtRsFrvt65YwA7gQxWGxavHBY1nTLYFnc4Y28nGIxbx70sCx%2F%2BiFiI90h222QXnwkHeJaRgQgYAEIWAACFoCABSBgAQhYAAIWgIAFIGABCFgAAhaAgAUgYAEIWAACFoCABSDgdMiZGAScDnkWg4DTIfdcdEQAAhaAgBMh1AECToOgCwScBkEIMS0jKZDdEOLQMXOt9LXsjLC8C%2BHRgQ2O%2FqCun0eGBp2ik7Z5NBUSZu42jirkH4P8lIBsKkQhhwwpJCBjhShEIX%2BDWAHIN4Xov9YRfiMSEF9QP1IKpGqIlUFMC6T8dflWpJvV0Rvh3%2BBLACGqnhyFkNLH2qXgm6Aq%2Bz6ETKjtIzYiebRFrv7rbAiAkbXefWQfodmoGskOAeeFjF01khPiTe4RKsZT5B7pTbzJPULFcA4BC0DAAhCwAAQsAAHng1iTe4SKASEYyQBxJhjJCwELQMACELAABCwAAQtAwAIQcDZIOOJtrCQI1gCgv1rIaGrQkHx8E%2ButPxDEoDHiXt%2BOdedAb2QKNCXUj7SOJAg4%2Bb3HIWCsuGKA7CN%2B4gzC1rDSzKkhsOIR9%2FQd6pFHvdInS3Z20CFGUtSPZZAs8VZAAuiIjuiIjuiIjuiIjhyfEVvLIUN8KQxHtX6QgaZpmqZpmqZpmvbf9xsJbA7rTAka4wAAAABJRU5ErkJggg%3D%3D&mode=dark&font=fira-code">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@42-central/ui-react"><img src="https://shieldcn.dev/npm/v/@42-central/ui-react.svg" alt="npm version" /></a>
|
|
7
|
+
<a href="https://react.dev"><img src="https://shieldcn.dev/badge/React-19-58c4dc.svg?logo=react" alt="React 19" /></a>
|
|
8
|
+
<a href="https://tailwindcss.com"><img src="https://shieldcn.dev/badge/Tailwind-v4-00bcff.svg?logo=tailwindcss" alt="Tailwind v4" /></a>
|
|
9
|
+
<a href="https://ark-ui.com"><img src="https://shieldcn.dev/badge/Ark_UI-5-7C3AED.svg" alt="Ark UI 5" /></a>
|
|
10
|
+
<img src="https://shieldcn.dev/badge/module-ESM--only-F7DF1E.svg" alt="ESM only" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="#install">Install</a> ·
|
|
15
|
+
<a href="#wire-up-the-styles">Styles</a> ·
|
|
16
|
+
<a href="#theme-lightdarksystem">Theme</a> ·
|
|
17
|
+
<a href="#subpath-imports">Imports</a> ·
|
|
18
|
+
<a href="https://42kit.dev"><strong>Live docs ↗</strong></a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
2
22
|
|
|
3
23
|
Code-themed, RSC-friendly, **ESM-only** UI kit for 42 Intra-Next.
|
|
4
24
|
|
|
@@ -19,169 +39,8 @@ peer dependencies.
|
|
|
19
39
|
|
|
20
40
|
> Consumer `tsconfig.json` must use `"moduleResolution": "Bundler"` (or `"NodeNext"`).
|
|
21
41
|
|
|
22
|
-
|
|
23
|
-
[Vite](#vite-client-only-spa)).
|
|
24
|
-
|
|
25
|
-
### From Nexus
|
|
26
|
-
|
|
27
|
-
Existing consumers can keep installing `@42/ui-react` from the private Nexus
|
|
28
|
-
registry (`nexus.tooling.42.tech`). Every release is published there too, at
|
|
29
|
-
the same versions, under the `@42` names: use the `@42` scope wherever this
|
|
30
|
-
README says `@42-central`. You'll need credentials, set up once below.
|
|
31
|
-
|
|
32
|
-
One-time setup: point the `@42` scope at Nexus. This half isn't secret, so
|
|
33
|
-
it's safe to commit to your project's `.npmrc`:
|
|
34
|
-
|
|
35
|
-
```ini
|
|
36
|
-
@42:registry=https://nexus.tooling.42.tech/repository/npm-hosted/
|
|
37
|
-
always-auth=true
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Modern pnpm (≥10.34.2 / ≥11.5.3) no longer expands `${VAR}` placeholders for
|
|
41
|
-
_credentials_ that come from a project-level `.npmrc` — that file is
|
|
42
|
-
committed, and a malicious repo could otherwise use the same trick to
|
|
43
|
-
exfiltrate env secrets to an attacker-controlled registry
|
|
44
|
-
([GHSA-3qhv-2rgh-x77r](https://github.com/pnpm/pnpm/security/advisories/GHSA-3qhv-2rgh-x77r)).
|
|
45
|
-
So the token never goes in a file that's part of the repo — set it once at
|
|
46
|
-
the user level instead, where pnpm still trusts it:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
NEXUS_NPM_AUTH="$(echo "<nexus-username>:<nexus-password>" | base64)"
|
|
50
|
-
pnpm config set "//nexus.tooling.42.tech/repository/npm-hosted/:_auth" "$NEXUS_NPM_AUTH"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can get these crendentials on the company 1password.
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm add @42/ui-react @ark-ui/react react react-dom tailwindcss
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
> Using npm instead of pnpm? It doesn't enforce the restriction above, so the
|
|
60
|
-
> original single-`.npmrc`-with-`${NEXUS_NPM_AUTH}` approach still works —
|
|
61
|
-
> see the git history of this file for that version.
|
|
62
|
-
|
|
63
|
-
#### In a pipeline
|
|
64
|
-
|
|
65
|
-
Commit the same registry mapping (above) to the consuming repo — it's the
|
|
66
|
-
non-secret half, and `nexus.tooling.42.tech` is reachable over the public
|
|
67
|
-
internet, so any CI runner works, hosted or self-hosted. For the credential,
|
|
68
|
-
skip writing a file at all: pass it as a URL-scoped, `pnpm_config_`-prefixed
|
|
69
|
-
environment variable for just the one `install` invocation that needs it
|
|
70
|
-
(pnpm ≥11.6):
|
|
71
|
-
|
|
72
|
-
```yaml
|
|
73
|
-
# .npmrc (committed to the consuming repo, alongside package.json)
|
|
74
|
-
# @42:registry=https://nexus.tooling.42.tech/repository/npm-hosted/
|
|
75
|
-
# always-auth=true
|
|
76
|
-
|
|
77
|
-
jobs:
|
|
78
|
-
build:
|
|
79
|
-
runs-on: "node-22-small" # or your org's lightweight Node runner (e.g. a wolfi-based one)
|
|
80
|
-
steps:
|
|
81
|
-
- uses: "actions/checkout@v4"
|
|
82
|
-
- uses: "pnpm/action-setup@v4"
|
|
83
|
-
- uses: "actions/setup-node@v4"
|
|
84
|
-
with:
|
|
85
|
-
node-version: "22"
|
|
86
|
-
cache: "pnpm"
|
|
87
|
-
- name: "Install dependencies"
|
|
88
|
-
env:
|
|
89
|
-
NEXUS_NPM_AUTH: "${{ secrets.NEXUS_NPM_AUTH }}"
|
|
90
|
-
# pnpm won't expand ${VAR} auth fields read from a committed/project .npmrc —
|
|
91
|
-
# https://pnpm.io/blog/2026/06/11/env-variables-in-repository-npmrc — so the
|
|
92
|
-
# resolved credential has to be written into the user-level .npmrc instead.
|
|
93
|
-
run: >
|
|
94
|
-
echo "//nexus.tooling.42.tech/repository/npm-hosted/:_auth=${NEXUS_NPM_AUTH}" >> "$HOME/.npmrc"
|
|
95
|
-
pnpm install --frozen-lockfile
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Set `NEXUS_NPM_AUTH` as a repository secret (Settings → Secrets and variables
|
|
99
|
-
→ Actions) holding the same base64 value from the local setup above — a
|
|
100
|
-
different Nexus account than the one used to publish, scoped to read only.
|
|
101
|
-
|
|
102
|
-
On pnpm <11.6, or any runner where inlining the env var isn't convenient,
|
|
103
|
-
write the resolved value into a _runtime-generated_ `.npmrc` instead of a
|
|
104
|
-
committed one — the same pattern this repo's own
|
|
105
|
-
[publish workflow](../../.github/workflows/publish.yml) uses to authenticate
|
|
106
|
-
`npm publish`:
|
|
107
|
-
|
|
108
|
-
```yaml
|
|
109
|
-
- name: "Install dependencies"
|
|
110
|
-
env:
|
|
111
|
-
NEXUS_NPM_AUTH: "${{ secrets.NEXUS_NPM_AUTH }}"
|
|
112
|
-
run: |
|
|
113
|
-
echo "//nexus.tooling.42.tech/repository/npm-hosted/:_auth=${NEXUS_NPM_AUTH}" >> .npmrc
|
|
114
|
-
pnpm install --frozen-lockfile
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### In a container
|
|
118
|
-
|
|
119
|
-
Same non-secret registry mapping in the committed `.npmrc`. Keep the token
|
|
120
|
-
out of the image with a
|
|
121
|
-
[BuildKit secret mount](https://docs.docker.com/build/building/secrets/)
|
|
122
|
-
instead of a build `ARG`/`ENV` — those get baked into `docker history` even if
|
|
123
|
-
a later layer never references them again:
|
|
124
|
-
|
|
125
|
-
```dockerfile
|
|
126
|
-
# syntax=docker/dockerfile:1
|
|
127
|
-
FROM node:22-slim AS deps
|
|
128
|
-
WORKDIR /app
|
|
129
|
-
RUN corepack enable
|
|
130
|
-
|
|
131
|
-
COPY package.json pnpm-lock.yaml .npmrc ./
|
|
132
|
-
# .npmrc (committed alongside package.json):
|
|
133
|
-
# @42:registry=https://nexus.tooling.42.tech/repository/npm-hosted/
|
|
134
|
-
# always-auth=true
|
|
135
|
-
RUN --mount=type=secret,id=nexus_npm_auth \
|
|
136
|
-
env "pnpm_config_//nexus.tooling.42.tech/repository/npm-hosted/:_auth=$(cat /run/secrets/nexus_npm_auth)" \
|
|
137
|
-
pnpm install --frozen-lockfile
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Supply the secret at build time, not as `--build-arg`:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
NEXUS_NPM_AUTH="$(printf '%s' "<nexus-username>:<nexus-password>" | base64)"
|
|
144
|
-
docker build --secret id=nexus_npm_auth,env=NEXUS_NPM_AUTH -t your-image .
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
In CI, source it from the pipeline's own secret store, e.g.
|
|
148
|
-
[`docker/build-push-action`](https://github.com/docker/build-push-action):
|
|
149
|
-
|
|
150
|
-
```yaml
|
|
151
|
-
- uses: "docker/build-push-action@v6"
|
|
152
|
-
with:
|
|
153
|
-
secrets: |
|
|
154
|
-
"nexus_npm_auth=${{ secrets.NEXUS_NPM_AUTH }}"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
#### With Docker Compose
|
|
158
|
-
|
|
159
|
-
Same Dockerfile as above — Compose just supplies the build secret instead of
|
|
160
|
-
a raw `docker build --secret` flag. Define it once at the top level, sourced
|
|
161
|
-
straight from your shell's environment (no secret file needed), and grant the
|
|
162
|
-
service's build access to it explicitly:
|
|
163
|
-
|
|
164
|
-
```yaml
|
|
165
|
-
# compose.yaml
|
|
166
|
-
services:
|
|
167
|
-
app:
|
|
168
|
-
build:
|
|
169
|
-
context: .
|
|
170
|
-
secrets:
|
|
171
|
-
- nexus_npm_auth
|
|
172
|
-
|
|
173
|
-
secrets:
|
|
174
|
-
nexus_npm_auth:
|
|
175
|
-
environment: "NEXUS_NPM_AUTH"
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
export NEXUS_NPM_AUTH="$(printf '%s' "<nexus-username>:<nexus-password>" | base64)"
|
|
180
|
-
docker compose build
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Environment-sourced secrets are a Compose-only convenience — they don't carry
|
|
184
|
-
over to `docker stack deploy`/Swarm, which needs `file:` or `external:` instead.
|
|
42
|
+
Using Vite? Add `@42-central/vite-plugin-theme` too, for flash-free theme
|
|
43
|
+
loading (see [Vite](#vite-client-only-spa)).
|
|
185
44
|
|
|
186
45
|
## Wire up the styles
|
|
187
46
|
|
|
@@ -269,16 +128,9 @@ The script needs to land in `index.html` itself, genuinely blocking (not
|
|
|
269
128
|
`type="module"`, which Vite treats as deferred). Three ways to get it there,
|
|
270
129
|
in order of preference:
|
|
271
130
|
|
|
272
|
-
**1. `@42-central/vite-plugin-theme` (recommended).**
|
|
273
|
-
`index.html`
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
npm install -D @42-central/vite-plugin-theme
|
|
278
|
-
pnpm add -D @42-central/vite-plugin-theme
|
|
279
|
-
yarn add --dev @42-central/vite-plugin-theme
|
|
280
|
-
bun add --dev @42-central/vite-plugin-theme
|
|
281
|
-
```
|
|
131
|
+
**1. [`@42-central/vite-plugin-theme`](https://www.npmjs.com/package/@42-central/vite-plugin-theme) (recommended).**
|
|
132
|
+
Injects the script into `index.html` at both `vite dev` and `vite build` time,
|
|
133
|
+
so you never edit the HTML by hand:
|
|
282
134
|
|
|
283
135
|
```ts
|
|
284
136
|
// vite.config.ts
|
|
@@ -286,10 +138,13 @@ import { defineConfig } from "vite";
|
|
|
286
138
|
import { themeInitPlugin } from "@42-central/vite-plugin-theme";
|
|
287
139
|
|
|
288
140
|
export default defineConfig({
|
|
289
|
-
plugins: [themeInitPlugin()],
|
|
141
|
+
plugins: [themeInitPlugin()],
|
|
290
142
|
});
|
|
291
143
|
```
|
|
292
144
|
|
|
145
|
+
Install and options are in the
|
|
146
|
+
[plugin README](https://github.com/42staff/kit/blob/main/packages/vite-plugin-theme/README.md).
|
|
147
|
+
|
|
293
148
|
**2. The static asset, copied into `public/`.** `@42-central/ui-react/theme-init.js` is
|
|
294
149
|
a prebuilt, dependency-free script. A hardcoded `<script src="/node_modules/...">`
|
|
295
150
|
only works in `vite dev` — Vite's dev server serves `node_modules` directly,
|
|
@@ -453,3 +308,9 @@ The package root (`@42-central/ui-react`) only re-exports shared utilities and t
|
|
|
453
308
|
`cn`, `COLORS` / `Color`, `SIZES` / `Size`, `FormControlProps`, `useLogger`, and
|
|
454
309
|
`useTheme` / `ThemeMode` / `ResolvedTheme`. Components live at their own
|
|
455
310
|
subpaths so bundlers never pull in the whole kit.
|
|
311
|
+
|
|
312
|
+
## Links
|
|
313
|
+
|
|
314
|
+
- [Live docs and component reference](https://42kit.dev)
|
|
315
|
+
- [Changelog](https://42kit.dev/docs/changelog)
|
|
316
|
+
- [Source on GitHub](https://github.com/42staff/kit)
|
|
@@ -211,6 +211,6 @@ var Notification = Object.assign(NotificationComponent, {
|
|
|
211
211
|
CollapseTrigger
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
export { ActionTrigger, CloseTrigger, Description, Icon, Notification, TOAST_STATUS, Title, notificationRoot
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
export { ActionTrigger, CloseTrigger, Description, Icon, Notification, TOAST_STATUS, Title, notificationRoot };
|
|
215
|
+
//# sourceMappingURL=chunk-EVVMHTCL.js.map
|
|
216
|
+
//# sourceMappingURL=chunk-EVVMHTCL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/notification/notification.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAgDO,IAAM,mBAAA,GAAsB;AAAA,EACjC,qCAAA;AAAA,EACA;AACF,CAAA;AAMO,IAAM,mBAAmB,GAAA,CAAI;AAAA,EAClC,0EAAA;AAAA,EACA,iEAAA;AAAA;AAAA,EAEA,mCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA,EAGA,oBAAA;AAAA,EACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,EAC7B,8CAAA;AAAA,EACA,4DAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,YAAA,GAAqE;AAAA,EAChF,SAAS,EAAE,KAAA,EAAO,SAAS,IAAA,kBAAM,GAAA,CAAC,mBAAgB,CAAA,EAAG;AAAA,EACrD,OAAO,EAAE,KAAA,EAAO,OAAO,IAAA,kBAAM,GAAA,CAAC,mBAAgB,CAAA,EAAG;AAAA,EACjD,SAAS,EAAE,KAAA,EAAO,UAAU,IAAA,kBAAM,GAAA,CAAC,qBAAkB,CAAA,EAAG;AAAA,EACxD,MAAM,EAAE,KAAA,EAAO,WAAW,IAAA,kBAAM,GAAA,CAAC,YAAS,CAAA,EAAG;AAAA,EAC7C,OAAA,EAAS,EAAE,KAAA,EAAO,SAAA,EAAW,IAAA,kBA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ChB,CAAA;AAAA,oBAEA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,WAAA,IAAe,IAAA,IAAQ,IAAA,EACrC,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAa,QAAA,EAAA,WAAA,IAAe,eAAA,CAAgB,OAAA,EAAQ,CAAA,EACvD,CAAA;AAAA,oBACA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,MAAA,IAAU,IAAA,IAAQ,IAAA,EAChC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wCAAA,EAA0C,QAAA,EAAA,MAAA,IAAU,UAAA,CAAW,SAAQ,CAAA,EACxF;AAAA,GAAA,EACF,CAAA;AAEJ;AAOO,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAC","file":"chunk-EVVMHTCL.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n AlertCircleIcon,\n CheckCircleIcon,\n ChevronDownIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, type Ref, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { Spinner } from \"../spinner/spinner\"\nimport type { ToastFields, ToastHue, ToastType } from \"./types\"\n\n/**\n * Notification — the kit's **toast**: transient, non-blocking feedback spawned\n * imperatively from anywhere (`notify.success(\"Saved\")`) via `createNotifier`.\n *\n * This module holds the *visual* compound (`Notification.Root` / `Icon` /\n * `Title` / `Description` / `ActionTrigger` / `CloseTrigger` /\n * `CollapseTrigger`) and the ready-made `Notification` card composed from a\n * toast-shaped object (`type` → hue + icon, `title` / `description` /\n * `action`). It is deliberately dumb: the toaster behavior that drives it —\n * store, presence, height measurement, swipe-to-dismiss, stacking — lives in\n * `store.ts` / `create-notifier.tsx`, so the card is equally usable on its own\n * (e.g. a page-level alert).\n *\n * The surface is a single outline recipe; `color` (a `data-color` attribute\n * resolved to the `--c-*` slot vars) is the only styling axis. Status presets\n * map a `type` onto a hue + a leading icon.\n * Enter/exit is driven by Ark Presence → `data-state` → the `toast-in/out`\n * keyframes (like modal/drawer/popover).\n */\n\n/** The outline surface. Deliberately opaque and blurred: a toast floats over\n * arbitrary content. `Alert` (the inline sibling) shares the parts but not\n * this surface — it sits on the page and takes a translucent tint instead.\n * `color` tints the border, text and icon through `--c-solid`. */\nexport const notificationSurface = [\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"text-(--c-solid) border-(--c-solid) backdrop-blur-lg\",\n]\n\n/** The toast card. Enter/exit via `data-state` keyframes (Ark Presence sets\n * `data-state`); stacking position via the `[data-scope=notifications]` rules\n * in theme.css (driven by the `--index`/`--offset`/`--height` vars the toaster\n * sets on each card — see create-notifier). */\nexport const notificationRoot = cva([\n \"data-[state=open]:animate-toast-in data-[state=closed]:animate-toast-out\",\n \"pointer-events-auto flex flex-col w-88 max-w-[calc(100vw-2rem)]\",\n // Phones (< xs): fill the full-bleed bottom region (see createNotifier).\n \"max-xs:w-full! max-xs:max-w-none!\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"shadow-2xl shadow-gray-light-100 dark:shadow-gray-dark-900\",\n \"overflow-clip\",\n notificationSurface,\n])\n\n/** `type` → hue + default leading icon. There are no status color *tokens* in\n * the kit — status maps onto existing hues, reusing the same `--c-*` slots as\n * Badge/Button. `loading` uses the kit Spinner. Exported so `Alert` (which\n * drops the toast-only `loading` type) resolves the same presets. */\nexport const TOAST_STATUS: Record<ToastType, { color: Color; icon: ReactNode }> = {\n success: { color: \"green\", icon: <CheckCircleIcon /> },\n error: { color: \"red\", icon: <AlertCircleIcon /> },\n warning: { color: \"orange\", icon: <TriangleAlertIcon /> },\n info: { color: \"neutral\", icon: <InfoIcon /> },\n loading: { color: \"neutral\", icon: <Spinner size=\"md\" label={null} /> },\n}\n\nexport type NotificationRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole toast. */\n color?: Color\n /** Forwarded to the underlying element (used by Presence for enter/exit). */\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: NotificationRootProps) => (\n <ark.div\n data-color={color}\n className={cn(notificationRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** Leading-glyph slot. Inherits the Root's text color (the `color` hue) and\n * sizes any child svg to match the text.\n * Exported (like the parts below) so `Alert` reuses it as-is — these are\n * width-agnostic, so nothing about them is toast-specific. */\nexport const Icon = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"span\"> & WithTestId) => (\n <span\n className={cn(\"inline-flex [&_svg]:size-5\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Title = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\"text-sm font-bold text-gray-light-950 dark:text-gray-dark-25\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Description = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\n \"mt-1 text-sm font-normal text-gray-light-700 opacity-90 dark:text-gray-dark-300\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const ActionTrigger = ({\n className,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n className={cn(\n \"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium\",\n \"border border-current/30 hover:bg-current/10\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/50\",\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const CloseTrigger = ({\n className,\n children,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n aria-label=\"Dismiss\"\n className={cn(\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/50\",\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? <CloseIcon />}\n </button>\n)\n\n/**\n * The chevron that folds the card's description and action rows away — the\n * collapse counterpart to `CloseTrigger`, and what the ready-made card renders\n * for `withCollapse`.\n *\n * It is presentational only: `open` drives the label, `aria-expanded` and the\n * chevron's rotation, but the state itself belongs to the caller. The button\n * owns the layout, the opacity and any `className`; the default icon carries\n * nothing but its rotation, so passing a `className` tints or spaces the\n * control once rather than twice.\n */\nexport const CollapseTrigger = ({\n className,\n children,\n type,\n open,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId & { open: boolean }) => (\n <button\n type={type ?? \"button\"}\n aria-label={open ? \"Collapse\" : \"Expand\"}\n aria-expanded={open}\n className={cn(\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/50\",\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? (\n <ChevronDownIcon\n data-open={open}\n className=\"data-[open=true]:rotate-0 data-[open=false]:rotate-180 transition-transform\"\n />\n )}\n </button>\n)\n\n/**\n * Props for the ready-made `Notification` card. The presentational fields it\n * shares with a spawned toast (`type` / `title` / `description` / `action` /\n * `color` / `icon` / `withCloseButton`) plus its own collapse controls;\n * the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a\n * standalone card is just `<Notification type=\"success\" title=\"Saved\" />`.\n */\nexport type NotificationProps = Omit<NotificationRootProps, \"title\" | \"color\"> &\n Omit<ToastFields, \"id\" | \"status\" | \"duration\"> &\n Partial<Pick<ToastFields, \"id\" | \"status\" | \"duration\">> &\n ToastHue & {\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n /** Swap the close (×) button for a chevron that folds the description and\n * action rows away. `withCloseButton` takes precedence over this. */\n withCollapse?: boolean\n /** Uncontrolled initial open state — collapsed by default when `withCollapse`,\n * open otherwise. Pair with `withCollapse`. */\n defaultOpen?: boolean\n /** Controlled open state — pair with `onOpenChange`. */\n open?: boolean\n /** Fired when the collapse toggle is pressed. */\n onOpenChange?: (open: boolean) => void\n }\n\n/**\n * The ready-made **`Notification` card** — the presentational body composed from\n * a toast-shaped object: resolves `type` → `TOAST_STATUS` (hue + leading icon), lets\n * an explicit `color`/`icon` override (`icon={null}` hides the glyph),\n * and lays out the icon/title/close row plus the independently-collapsing\n * description and action sections.\n *\n * Owns no store, presence or gesture state — the Notifier's render body drives\n * it by forwarding a `ref`, stacking style vars, pointer handlers and `onClose`\n * straight through to the `Root`. Rendered on its own it is just a status card\n * (e.g. a page-level alert). For a bespoke layout, compose the parts directly:\n * `Notification.Root`, `.Icon`, `.Title`, `.Description`, `.ActionTrigger`,\n * `.CloseTrigger`.\n */\nfunction NotificationComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = true,\n withCollapse = false,\n defaultOpen,\n open: _open,\n onOpenChange,\n onClose,\n // Notifier-managed plumbing — not rendered onto the card.\n status: _status,\n duration: _duration,\n ...rest\n}: NotificationProps) {\n const preset = type ? TOAST_STATUS[type] : undefined\n // `type` and `color` are exclusive (see `ToastHue`); the preset wins\n // should a JS caller pass both anyway.\n const color = preset ? preset.color : (_color as Color | undefined)\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? preset?.icon : _icon\n\n const [open, setOpen] = useUncontrolled({\n defaultValue: defaultOpen,\n value: _open,\n finalValue: match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => true)\n .with({ withCollapse: true }, () => false)\n .with({ withCollapse: false }, () => true)\n .exhaustive(),\n onChange: onOpenChange,\n })\n\n // Keep the last-present description / action mounted through their collapse so\n // each reveal has content to animate *out* (removed content unmounts instantly\n // otherwise). Cached independently so the two sections animate separately.\n const lastDescription = useRef(description)\n if (description != null) lastDescription.current = description\n const lastAction = useRef(action)\n if (action != null) lastAction.current = action\n\n return (\n <Root color={color} {...rest}>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null && <Title>{title}</Title>}\n {match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => <CloseTrigger onClick={onClose} />)\n .with({ withCollapse: true }, () => (\n <CollapseTrigger open={open} onClick={() => setOpen(!open)} />\n ))\n .with({ withCollapse: false }, () => null)\n .exhaustive()}\n </div>\n {/* Description and action are independent Collapse sections. */}\n <Collapse open={description != null && open}>\n <Description>{description ?? lastDescription.current}</Description>\n </Collapse>\n <Collapse open={action != null && open}>\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action ?? lastAction.current}</div>\n </Collapse>\n </Root>\n )\n}\n\n/**\n * `Notification` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Tooltip`/`Modal`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Notification = Object.assign(NotificationComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n CollapseTrigger,\n})\n"]}
|
|
@@ -101,7 +101,20 @@ var weekdayHeader = "pb-1 text-center text-xs font-medium text-gray-light-500 da
|
|
|
101
101
|
var weekNumberCell = cn(
|
|
102
102
|
"p-1 align-top text-center text-xs font-medium text-gray-light-500 dark:text-gray-dark-400 h-full"
|
|
103
103
|
);
|
|
104
|
-
var navIcon = (direction, size, className) =>
|
|
104
|
+
var navIcon = (direction, size, className) => (
|
|
105
|
+
// The glyphs are physical; prev sits on the inline-start edge, which is the
|
|
106
|
+
// right one under RTL, so both chevrons mirror to keep pointing outward.
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
ActionIcon,
|
|
109
|
+
{
|
|
110
|
+
variant: "subtle",
|
|
111
|
+
color: "neutral",
|
|
112
|
+
size,
|
|
113
|
+
className: cn("rtl:[&_svg]:rotate-180", className),
|
|
114
|
+
children: direction === "prev" ? /* @__PURE__ */ jsx(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
);
|
|
105
118
|
var NAV_ICON_SIZE = { xs: 28, sm: 32, md: 36, lg: 40, xl: 48 };
|
|
106
119
|
var CalendarBody = ({
|
|
107
120
|
numOfMonths = 1,
|
|
@@ -359,5 +372,5 @@ var Calendar = ({
|
|
|
359
372
|
};
|
|
360
373
|
|
|
361
374
|
export { Calendar, CalendarBody, calendarGridWidth, resolveCalendarTranslations };
|
|
362
|
-
//# sourceMappingURL=chunk-
|
|
363
|
-
//# sourceMappingURL=chunk-
|
|
375
|
+
//# sourceMappingURL=chunk-NSOA3GMZ.js.map
|
|
376
|
+
//# sourceMappingURL=chunk-NSOA3GMZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/calendar/calendar-body.tsx","../src/components/calendar/calendar.tsx"],"names":["Ark","jsx"],"mappings":";;;;;;;;;;;;;AAsDA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,gEAAA;AAAA,IACA,kEAAA;AAAA,IACA,0DAAA;AAAA,IACA,oBAAA;AAAA,IACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,IAC7B,oDAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,uNAAA;AAAA,IACA,qGAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsBA,oDAAA;AAAA,IACA,kDAAA;AAAA,IACA,8DAAA;AAAA,IACA,8DAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,yDAAA;AAAA,IACA,mFAAA;AAAA,IACA,+GAAA;AAAA,IACA,kJAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,gBAAA;AAAA,QACJ,EAAA,EAAI,gBAAA;AAAA,QACJ,EAAA,EAAI,gBAAA;AAAA,QACJ,EAAA,EAAI,mBAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,IAAA,EAAM,IAAA;AAAK;AAElC,CAAA;AAUA,IAAM,aAAA,GAAsC,EAAE,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAG;AAErF,IAAM,SAAA,GAAY,EAAA;AAEX,IAAM,iBAAA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A,CAAQ,KAAA,EAAO,OAAA,EAAS,gBAAgB;AAAA;AAGxD,UACF,MAAA;AAAA,MAEN,MAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MAGA,eAAA,EAAiB,eAAA;AAAA,MACjB,iBAAA,EACE,iBAAA,GACI,CAAC,SAAA,KACC,iBAAA,CAAkB,oBAAoB,SAAA,EAAW,gBAAgB,CAAA,EAAG,gBAAgB,CAAA,GACtF,MAAA;AAAA,MAEN,GAAA,EAAK,GAAA,GAAM,mBAAA,CAAoB,GAAA,EAAK,gBAAgB,CAAA,GAAI,MAAA;AAAA,MACxD,GAAA,EAAK,GAAA,GAAM,mBAAA,CAAoB,GAAA,EAAK,gBAAgB,CAAA,GAAI,MAAA;AAAA,MACxD,OAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,sBAAA,EAAwB,SAAA,EAAW,YAAY,IAAI,CAAA;AAAA,MAChE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MASnC,QAAA,kBAAAC,GAAAA,CAACD,UAAAA,CAAI,OAAA,EAAJ,EACC,QAAA,kBAAAC,GAAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,eAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA,EAAU,gBAAA;AAAA,UACV;AAAA;AAAA,OACF,EACF;AAAA;AAAA,GACF;AAEJ","file":"chunk-NSOA3GMZ.js","sourcesContent":["import { DatePicker as Ark } from \"@ark-ui/react/date-picker\"\nimport { cva } from \"class-variance-authority\"\nimport type { ReactNode } from \"react\"\nimport { match } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { calendarValueToDate } from \"../../lib/date-value\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport type { Size } from \"../../lib/sizes\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../popover/icons\"\n\n/**\n * CalendarBody — the shared grid module behind both `Calendar` (inline) and, later,\n * `DatePicker` (popover): the RFC §3 \"one implementation, not two\" module. It renders only the\n * grid anatomy (`View` / `ViewControl` / nav triggers / `Table*` / `MonthSelect` / `YearSelect`)\n * — deliberately **not** `Control` / `Content` / `Positioner` / `Trigger` / `ClearTrigger`, the\n * popover-only chrome that belongs to `DatePicker`, not here.\n *\n * Every part below self-connects to the nearest ancestor `Ark.Root` via Ark's own React\n * context, so this module needs no `api` prop threaded in — both `Calendar` and `DatePicker`\n * just mount it as a plain child inside their own differently-configured `Ark.Root`.\n *\n * Not barrel-exported (no export from `calendar/index.ts`) — `DatePicker` reaches it directly\n * via `import { CalendarBody } from \"../calendar/calendar-body\"`, the established cross-folder\n * pattern for a shared internal part (`multi-select.tsx` → `../combobox/combobox`,\n * `drawer.tsx` → `../action-icon/action-icon`).\n */\n\nexport type CalendarBodyClassNames = {\n /** The prev/label/next navigation row. */\n header?: string\n /** Each rendered `<table>` (one per visible month in the day view). */\n table?: string\n /** Each day cell's clickable trigger. */\n day?: string\n}\n\nexport type CalendarBodyProps = {\n /** Months shown side by side in the day view. */\n numOfMonths?: number\n withWeekNumbers?: boolean\n /** Per-day decoration slot (RFC §9's \"event dot\"). Receives a native `Date` — converted from\n * Ark's `DateValue` at the point of the call, via the same `timeZone` the root was configured\n * with — and the day's live selection state. */\n renderDay?: (date: Date, ctx: { isUnavailable: boolean; isSelected: boolean }) => ReactNode\n size?: Size\n /** The time zone the nearest `Ark.Root` was configured with. Required (not read from Ark's\n * own api, which exposes no public `timeZone` getter) so `renderDay`'s Date conversion uses\n * the exact same boundary `Calendar`/`DatePicker` used to build the root's own value —\n * see `lib/date-value.ts`'s module doc on why this one conversion point matters. */\n timeZone: string\n classNames?: CalendarBodyClassNames\n}\n\nconst dayCellTrigger = cva(\n [\n \"relative flex size-full items-center justify-center rounded-xs\",\n \"cursor-pointer select-none tabular-nums transition-colors-radius\",\n \"hover:bg-gray-light-950/20 dark:hover:bg-gray-dark-50/20\",\n \"focus-visible:z-10\",\n focusStyles({ offset: false }),\n \"data-today:font-semibold data-today:text-brand-500\",\n // `!` (important) on bg/text: a day can be `data-today` *and* `data-selected` at once (e.g.\n // the default `new Date()` value), or a range endpoint is simultaneously `data-selected` *and*\n // `data-in-range` (the closed interval includes its own ends) — without `!`, these rules fight\n // over the same `background-color`/`color` and Tailwind's variant ordering (not this class\n // list's order) can win the wrong one, e.g. leaving the selected cell's text the same color\n // as its own solid-fill background, invisible. `data-selected` — the solid highlight — always\n // wins over both.\n \"data-selected:bg-gray-light-950! dark:data-selected:bg-gray-dark-50! data-selected:text-(--c-on-solid)! data-selected:font-semibold data-selected:hover:bg-gray-light-700! dark:data-selected:hover:bg-gray-dark-300!\",\n \"data-in-range:rounded-none data-in-range:bg-gray-light-950/10 dark:data-in-range:bg-gray-dark-50/10\",\n // Pill-cap rounding, split into two independently-true conditions rather than reacting to\n // `data-range-start`/`data-range-end` alone: a lone click (before any second day exists)\n // still carries `data-range-start`, and capping on that alone made the first pick look like\n // an already-established range extending rightward.\n //\n // 1. A genuinely *committed* range exists — `data-range-committed` is set from\n // `api.value.length === 2` in JS, not from the DOM. An earlier version checked whether the\n // *other* endpoint's `data-range-start`/`data-range-end` was present anywhere among the\n // visible months instead — that broke as soon as only one endpoint's month was in view\n // (e.g. the range was set, then the calendar paged away from one end): the other endpoint\n // was never rendered at all, so its attribute could never be found, and the cap silently\n // stopped applying to the *visible* endpoint too, even though the range was still fully\n // committed. `api.value` reflects the committed selection regardless of what's currently\n // paged into view, so this doesn't have that failure mode.\n // 2. A genuine *live hover preview* toward a different day — self-contained on this cell's\n // own attributes, no group lookup needed: `hoveredRangeValue` is `[start, hoveredValue]`\n // sorted chronologically, so the anchor cell gets exactly one of `data-hover-range-start` /\n // `data-hover-range-end` when truly hovering elsewhere (direction decides which), but\n // *both* simultaneously when the pointer is merely resting on the same cell it just\n // clicked (a zero-width hover range) — requiring the other one be *absent* rules out that\n // degenerate, \"changes before you've moved anywhere\" case.\n \"data-range-start:data-range-committed:rounded-s-xs\",\n \"data-range-end:data-range-committed:rounded-e-xs\",\n \"data-hover-range-start:not-data-hover-range-end:rounded-s-xs\",\n \"data-hover-range-end:not-data-hover-range-start:rounded-e-xs\",\n // The degenerate case above (pointer resting on the just-clicked day, `data-hover-range-start`\n // and `data-hover-range-end` both present on this same cell) still falls into `data-in-range`\n // (a zero-width range trivially contains itself), which would otherwise render it\n // `rounded-none` — sharp corners, reading as broken rather than \"just this one day, nothing\n // decided yet.\" Round it fully instead, `!` to beat that `data-in-range:rounded-none`\n // regardless of Tailwind's variant ordering.\n \"data-hover-range-start:data-hover-range-end:rounded-xs!\",\n \"data-outside-range:text-gray-light-500 dark:data-outside-range:text-gray-dark-700\",\n \"data-in-range:data-outside-range:text-gray-light-700 dark:data-in-range:data-outside-range:text-gray-dark-400\",\n \"data-unavailable:pointer-events-none data-unavailable:text-gray-light-300 data-unavailable:line-through dark:data-unavailable:text-gray-dark-700\",\n \"data-disabled:pointer-events-none data-disabled:opacity-40\",\n ],\n {\n variants: {\n size: {\n xs: \"size-7 text-xs\",\n sm: \"size-8 text-xs\",\n md: \"size-9 text-sm\",\n lg: \"size-10 text-base\",\n xl: \"size-11 text-base\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** Day-cell pixel size per `size`, matching `dayCellTrigger`'s `size-*` variants (`size-7`..\n * `size-11`) — the day view's own total width. The month/year grids below are plain `<table>`s\n * that would otherwise size to their own (longer) text content instead, so at `numOfMonths ===\n * 1` a month grid comes out *wider* than the day view (overflowing a fixed-width ancestor, e.g.\n * `DatePicker`'s popover column, which is sized off this same geometry via `calendarGridWidth`)\n * and a year grid comes out *narrower* (leaving unfilled space instead of stretching to match).\n * Pinning both to this exact width — `table-fixed` divides it evenly across columns — keeps\n * every view the same footprint. */\nconst DAY_CELL_SIZE: Record<Size, number> = { xs: 28, sm: 32, md: 36, lg: 40, xl: 44 }\n/** Gap between adjacent months in the day view (`gap-6`). */\nconst MONTH_GAP = 24\n\nexport const calendarGridWidth = (size: Size, numOfMonths: number): number =>\n DAY_CELL_SIZE[size] * 7 * numOfMonths + MONTH_GAP * (numOfMonths - 1)\n\nconst gridCellTrigger = cva(\n [\n \"flex w-full items-center justify-center truncate rounded-sm px-2 py-2.5\",\n \"cursor-pointer transition-colors\",\n \"hover:bg-gray-light-100 dark:hover:bg-gray-dark-800\",\n focusStyles({ offset: false }),\n \"data-selected:bg-(--c-solid) data-selected:text-(--c-on-solid) data-selected:hover:bg-(--c-solid-hover)\",\n \"data-disabled:pointer-events-none data-disabled:opacity-40\",\n ],\n {\n variants: {\n size: { xs: \"text-xs\", sm: \"text-xs\", md: \"text-sm\", lg: \"text-base\", xl: \"text-base\" },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst weekdayHeader =\n \"pb-1 text-center text-xs font-medium text-gray-light-500 dark:text-gray-dark-400\"\n\nconst weekNumberCell = cn(\n \"p-1 align-top text-center text-xs font-medium text-gray-light-500 dark:text-gray-dark-400 h-full\",\n)\n\nconst navIcon = (direction: \"prev\" | \"next\", size: Size | undefined, className?: string) => (\n // The glyphs are physical; prev sits on the inline-start edge, which is the\n // right one under RTL, so both chevrons mirror to keep pointing outward.\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size={size}\n className={cn(\"rtl:[&_svg]:rotate-180\", className)}\n >\n {direction === \"prev\" ? <ChevronLeftIcon /> : <ChevronRightIcon />}\n </ActionIcon>\n)\n\n/** `ActionIcon`'s own rendered height per `size` (its `h-7`..`h-12` variants) — the day view's\n * nav row is pinned to this so the prev/next icons and the view-trigger control are the same\n * height, instead of the icons (overlaid on the control, see below) poking out top and bottom of\n * a shorter, text-sized row. */\nconst NAV_ICON_SIZE: Record<Size, number> = { xs: 28, sm: 32, md: 36, lg: 40, xl: 48 }\n\nexport const CalendarBody = ({\n numOfMonths = 1,\n withWeekNumbers,\n renderDay,\n size = \"md\",\n timeZone,\n classNames,\n}: CalendarBodyProps) => (\n <Ark.Context>\n {(api) => {\n const nav = (\n <Ark.ViewControl\n className={cn(\"mb-2 flex items-strech justify-between gap-1\", classNames?.header)}\n >\n <Ark.PrevTrigger asChild>{navIcon(\"prev\", size)}</Ark.PrevTrigger>\n <Ark.ViewTrigger\n className={cn(\n \"transition-colors\",\n \"min-w-0 flex-1 cursor-pointer truncate rounded-sm px-2 py-1 text-center text-sm font-medium\",\n \"hover:bg-gray-light-100 dark:hover:bg-gray-dark-800\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n {api.visibleRange.end.month === api.visibleRange.start.month\n ? api.visibleRangeText.start\n : api.visibleRangeText.formatted}\n </Ark.ViewTrigger>\n <Ark.NextTrigger asChild>{navIcon(\"next\", size)}</Ark.NextTrigger>\n </Ark.ViewControl>\n )\n\n // A real, two-endpoint committed range — read off the machine's own value, not the DOM, so\n // it stays true regardless of whether either endpoint's month is currently paged into view\n // (see the pill-cap rounding comment in `dayCellTrigger` above).\n const isCommittedRange = api.value.length === 2\n\n return match(api.view)\n .with(\"day\", () => (\n <Ark.View view=\"day\">\n <div\n className=\"grid items-center justify-center\"\n style={{\n gridTemplateColumns: `repeat(${numOfMonths}, auto)`,\n columnGap: MONTH_GAP,\n rowGap: 8,\n }}\n >\n {/* The prev/next icons are overlaid on the control (`absolute`), not given their\n * own grid columns — this row's total width must stay exactly the width of the\n * day tables below (the columns this grid actually has), because `DatePicker`\n * sizes its popover to that exact figure (`calendarGridWidth`, `date-picker.tsx`).\n * Extra icon columns would push this row wider than that budget and force the\n * popover to scroll. */}\n <div\n className={cn(\"relative\", classNames?.header)}\n style={{\n gridColumn: `1 / span ${numOfMonths}`,\n gridRow: 1,\n height: NAV_ICON_SIZE[size],\n }}\n >\n <Ark.PrevTrigger asChild>\n {navIcon(\"prev\", size, \"absolute start-0 top-1/2 z-10 -translate-y-1/2\")}\n </Ark.PrevTrigger>\n {/* One button, not one per month — Ark's month/year view is a single shared grid\n * (confirmed below), so every month's label leads to the exact same destination;\n * splitting it into N `Ark.ViewTrigger`s would only duplicate the same generated\n * `id`/`aria-label` across them. Its own `repeat(numOfMonths, 1fr)` columns land\n * on the exact same boundaries as the day-table columns below (both divide the\n * same total width, with the same gap, into the same number of equal shares —\n * true because every month always renders at the same cell size) — so no width\n * formula is duplicated between this row and the tables, and it degenerates to\n * the `numOfMonths === 1` case for free.\n *\n * The button itself stays full width (so its grid tracks — and hence its click\n * target — line up with the tables below), but its *visible* hover pill is a\n * separate, inset layer (`group-hover`) that stops short of the prev/next icons\n * instead of running the full width underneath them. */}\n <Ark.ViewTrigger\n className={cn(\n \"group relative grid size-full cursor-pointer items-center rounded-sm text-sm font-medium transition-colors\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n style={{\n gridTemplateColumns: `repeat(${numOfMonths}, 1fr)`,\n columnGap: MONTH_GAP,\n }}\n >\n <span\n aria-hidden\n className=\"pointer-events-none absolute inset-y-0 rounded-sm transition-colors group-hover:bg-gray-light-100 dark:group-hover:bg-gray-dark-800\"\n style={{\n insetInlineStart: NAV_ICON_SIZE[size],\n insetInlineEnd: NAV_ICON_SIZE[size],\n }}\n />\n {Array.from({ length: numOfMonths }, (_, monthIndex) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length run of adjacent months, never reordered.\n <span key={monthIndex} className=\"relative min-w-0 truncate text-center\">\n {api.getOffset({ months: monthIndex }).visibleRangeText.start}\n </span>\n ))}\n </Ark.ViewTrigger>\n <Ark.NextTrigger asChild>\n {navIcon(\"next\", size, \"absolute end-0 top-1/2 z-10 -translate-y-1/2\")}\n </Ark.NextTrigger>\n </div>\n\n {Array.from({ length: numOfMonths }, (_, monthIndex) => {\n const offset = api.getOffset({ months: monthIndex })\n return (\n <Ark.Table\n // biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length run of adjacent months, never reordered.\n key={monthIndex}\n style={{ gridColumn: monthIndex + 1, gridRow: 2 }}\n className={cn(\"border-separate border-spacing-0\", classNames?.table)}\n >\n <Ark.TableHead>\n <Ark.TableRow>\n {withWeekNumbers && <Ark.WeekNumberHeaderCell className={weekdayHeader} />}\n {api.weekDays.map((weekDay) => (\n <Ark.TableHeader key={weekDay.long} className={weekdayHeader}>\n {weekDay.narrow}\n </Ark.TableHeader>\n ))}\n </Ark.TableRow>\n </Ark.TableHead>\n <Ark.TableBody>\n {offset.weeks.map((week, weekIndex) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length run of consecutive weeks, never reordered.\n <Ark.TableRow key={weekIndex}>\n {withWeekNumbers && (\n <Ark.WeekNumberCell weekIndex={weekIndex} week={week}>\n <span className={weekNumberCell}>{api.getWeekNumber(week)}</span>\n </Ark.WeekNumberCell>\n )}\n {week.map((value) => {\n const cellState = renderDay\n ? api.getDayTableCellState({\n value,\n visibleRange: offset.visibleRange,\n })\n : undefined\n return (\n <Ark.TableCell\n key={value.toString()}\n value={value}\n visibleRange={offset.visibleRange}\n >\n <Ark.TableCellTrigger\n data-range-committed={isCommittedRange || undefined}\n className={cn(dayCellTrigger({ size }), classNames?.day)}\n >\n {value.day}\n {cellState &&\n renderDay?.(calendarValueToDate(value, timeZone), {\n isUnavailable: cellState.unavailable,\n isSelected: cellState.selected,\n })}\n </Ark.TableCellTrigger>\n </Ark.TableCell>\n )\n })}\n </Ark.TableRow>\n ))}\n </Ark.TableBody>\n </Ark.Table>\n )\n })}\n </div>\n </Ark.View>\n ))\n .with(\"month\", () => (\n <Ark.View view=\"month\">\n {nav}\n <Ark.Table\n className={cn(\"mx-auto table-fixed\", classNames?.table)}\n style={{ width: calendarGridWidth(size, numOfMonths) }}\n >\n <Ark.TableBody>\n {/* \"short\" (e.g. \"Jan\"), not the default \"long\" (\"January\") — the grid's width is\n * pinned to the day view's (see `calendarGridWidth` above), which at a single\n * narrow month can be too tight for full month names across 4 columns. */}\n {api.getMonthsGrid({ columns: 4, format: \"short\" }).map((row, rowIndex) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length grid chunked at render time, never reordered.\n <Ark.TableRow key={rowIndex}>\n {row.map((month) => (\n <Ark.TableCell key={month.value} value={month.value}>\n <Ark.TableCellTrigger className={gridCellTrigger({ size })}>\n {month.label}\n </Ark.TableCellTrigger>\n </Ark.TableCell>\n ))}\n </Ark.TableRow>\n ))}\n </Ark.TableBody>\n </Ark.Table>\n </Ark.View>\n ))\n .with(\"year\", () => (\n <Ark.View view=\"year\">\n {nav}\n <Ark.Table\n columns={5}\n className={cn(\"mx-auto table-fixed\", classNames?.table)}\n style={{ width: calendarGridWidth(size, numOfMonths) }}\n >\n <Ark.TableBody>\n {api.getYearsGrid({ columns: 5 }).map((row, rowIndex) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length grid chunked at render time, never reordered.\n <Ark.TableRow key={rowIndex}>\n {row.map((year) => (\n <Ark.TableCell key={year.value} value={year.value}>\n <Ark.TableCellTrigger className={gridCellTrigger({ size })}>\n {year.label}\n </Ark.TableCellTrigger>\n </Ark.TableCell>\n ))}\n </Ark.TableRow>\n ))}\n </Ark.TableBody>\n </Ark.Table>\n </Ark.View>\n ))\n .exhaustive()\n }}\n </Ark.Context>\n)\n","\"use client\"\n\nimport { DatePicker as Ark, type DatePickerDateView as DateView } from \"@ark-ui/react/date-picker\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport type { ComponentProps, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { DatePredicate } from \"../../lib/date-predicates\"\nimport {\n calendarValueToDate,\n type DateRangeValue,\n dateToCalendarValue,\n fromArkValues,\n toArkValues,\n} from \"../../lib/date-value\"\nimport type { FormControlProps } from \"../../lib/form-control\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { CalendarBody, type CalendarBodyClassNames } from \"./calendar-body\"\n\n/**\n * Calendar — the inline month grid (RFC §9, `docs/rfcs/date-picker.md`): Ark's `date-picker`\n * machine rendered `inline` (no trigger/popover), wrapping the shared `CalendarBody` grid that\n * `DatePicker` will later reuse verbatim inside its own popover.\n *\n * - Value is a native `Date | null` (or `{ start, end }` under `range`) — the machine's\n * `DateValue` array contract never leaks out; `lib/date-value.ts` is the one conversion\n * boundary both directions go through.\n * - Controlled/uncontrolled `value` / `defaultValue` / `onChange` go straight to Ark's own\n * machine, which supports both natively — no `useUncontrolled` needed here.\n * - `isDateUnavailable` / `min` / `max` take native `Date`s and are adapted to Ark's\n * `DateValue`-based signature at this boundary; pair with the `lib/date-predicates.ts`\n * helpers (`disablePast()`, `disableWeekends()`, …).\n * - No `label` / `description` / `error` / `FieldShell` wrap — `Calendar` is a bare widget\n * (like `Table`), not a form field. A `DatePicker` popover is where a field wrapper belongs.\n *\n * <Calendar value={date} onChange={setDate} isDateUnavailable={disableWeekends()} />\n */\n\nexport type CalendarClassNames = CalendarBodyClassNames & {\n /** The outermost `Ark.Root` element. */\n root?: string\n}\n\n/** Ark's own `translations` prop type, derived structurally rather than imported by name —\n * `IntlTranslations` lives in `@zag-js/date-picker`, a transitive dependency of the\n * `@ark-ui/react` peer dep, not one this package declares itself. */\ntype ArkTranslations = NonNullable<ComponentProps<typeof Ark.Root>[\"translations\"]>\n\n/** The subset `CalendarBody`'s rendered anatomy actually exercises — `trigger`/`clearTrigger`\n * only apply when composed under `DatePicker` (a bare `Calendar` never renders a trigger/clear\n * button; harmless no-op keys there). Unset keys fall back to Ark's own English text. */\nexport type CalendarTranslations = Pick<\n ArkTranslations,\n | \"dayCell\"\n | \"trigger\"\n | \"viewTrigger\"\n | \"prevTrigger\"\n | \"nextTrigger\"\n | \"clearTrigger\"\n | \"content\"\n | \"weekColumnHeader\"\n | \"weekNumberCell\"\n>\n\n/** Passes a partial override straight through to `Ark.Root`. Ark's `translations` prop is\n * itself all-optional (since @ark-ui/react 5.38.2), so unset keys fall back to Ark's own\n * English defaults and this kit no longer keeps a copy of them to merge over. That copy was\n * load-bearing when the prop demanded every key at once; keeping it now would only let a\n * stale duplicate override Ark's upstream fixes — which is exactly what happened to\n * `viewTrigger`, whose day-view label named the wrong target view until Ark corrected it. */\nexport const resolveCalendarTranslations = (\n overrides?: Partial<CalendarTranslations>,\n): ArkTranslations | undefined => overrides\n\nexport type CalendarProps<Range extends boolean = false> = FormControlProps<\n Range extends true ? DateRangeValue : Date | null,\n HTMLDivElement\n> &\n WithTestId & {\n /** Select a `{ start, end }` range instead of a single date. */\n range?: Range\n /** Months shown side by side. Default 1. */\n numOfMonths?: number\n /** Restriction predicate over a native `Date`. Compose with `lib/date-predicates.ts`'s helpers.\n * Called with this component's own resolved `timeZone` as its second argument, so a predicate\n * reads the candidate day in the same zone the grid renders it in. */\n isDateUnavailable?: DatePredicate\n min?: Date\n max?: Date\n /** Bounds the view levels reachable via navigation (e.g. `minView=\"month\"` for a month-only\n * picker that never drills into individual days). */\n minView?: DateView\n maxView?: DateView\n /** Per-day decoration slot — the \"event dot\" (RFC §9). */\n renderDay?: (date: Date, ctx: { isUnavailable: boolean; isSelected: boolean }) => ReactNode\n /** Always render 6 week rows (padding with adjacent-month days) instead of however many the\n * visible month(s) actually span (4–6) — keeps the grid's height constant while navigating\n * between months. */\n fixedWeeks?: boolean\n withWeekNumbers?: boolean\n /** Overrides the active locale context. Drives month/day names and first-day-of-week. */\n locale?: string\n /** Overrides the local time zone for every `Date ↔ DateValue` conversion. Default\n * `getLocalTimeZone()` — **not** Ark's own machine default (`\"UTC\"`), which is why this is\n * forwarded to `Ark.Root` explicitly rather than only used in this component's own\n * conversions (see `lib/date-value.ts`'s module doc). */\n timeZone?: string\n /** Overrides Ark's own built-in aria-label/accessible-name strings (day cells, prev/next, the\n * view-cycling header, week numbers) — English by default. Unlike `locale`, nothing here\n * auto-derives; supply your own translated strings. Partial — unset keys keep Ark's default. */\n translations?: Partial<CalendarTranslations>\n size?: Size\n className?: string\n classNames?: CalendarClassNames\n }\n\nexport const Calendar = <Range extends boolean = false>({\n range,\n value,\n defaultValue,\n onChange,\n onBlur,\n numOfMonths = 1,\n isDateUnavailable,\n min,\n max,\n minView,\n maxView,\n renderDay,\n fixedWeeks,\n withWeekNumbers,\n locale,\n timeZone,\n translations,\n size = \"md\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n id,\n ref,\n className,\n classNames,\n testId,\n}: CalendarProps<Range>) => {\n const { locale: contextLocale } = useLocaleContext()\n const resolvedLocale = locale ?? contextLocale\n const resolvedTimeZone = timeZone ?? getLocalTimeZone()\n const isRange = Boolean(range)\n\n return (\n <Ark.Root\n inline\n ref={ref}\n id={id}\n selectionMode={isRange ? \"range\" : \"single\"}\n locale={resolvedLocale}\n timeZone={resolvedTimeZone}\n translations={resolveCalendarTranslations(translations)}\n value={toArkValues(value, resolvedTimeZone)}\n defaultValue={toArkValues(defaultValue, resolvedTimeZone)}\n onValueChange={\n onChange\n ? // The machine's value is a plain DateValue[]; `range` is a runtime flag here, so\n // narrow the result back to the caller's declared shape.\n (details) =>\n onChange(\n fromArkValues(details.value, isRange, resolvedTimeZone) as Range extends true\n ? DateRangeValue\n : Date | null,\n )\n : undefined\n }\n onBlur={onBlur}\n numOfMonths={numOfMonths}\n fixedWeeks={fixedWeeks}\n // Ark's own prop — its name doesn't follow this kit's `withX` convention, so it stays\n // `showWeekNumbers` even though our public prop is `withWeekNumbers`.\n showWeekNumbers={withWeekNumbers}\n isDateUnavailable={\n isDateUnavailable\n ? (dateValue) =>\n isDateUnavailable(calendarValueToDate(dateValue, resolvedTimeZone), resolvedTimeZone)\n : undefined\n }\n min={min ? dateToCalendarValue(min, resolvedTimeZone) : undefined}\n max={max ? dateToCalendarValue(max, resolvedTimeZone) : undefined}\n minView={minView}\n maxView={maxView}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={invalid}\n name={name}\n className={cn(\"inline-flex flex-col\", className, classNames?.root)}\n {...props({ \"data-testid\": testId })}\n >\n {/* The machine looks up the currently-focused cell by querying inside the `Content` part\n * (`getFocusedCell` scopes its DOM query to `getContentEl`) to call `.focus()` on it after\n * every arrow-key/Home/End/PageUp/PageDown press — even though `inline` never opens a real\n * popover, that lookup still runs, and with no `Content` element in the DOM at all it\n * always finds nothing, so keyboard navigation updates the machine's internal focus state\n * (visible via `data-focus`) but never moves real DOM focus. `inline` implies `open` (the\n * machine treats it as permanently open), so `Content`'s `hidden={!open}` never hides this. */}\n <Ark.Content>\n <CalendarBody\n numOfMonths={numOfMonths}\n withWeekNumbers={withWeekNumbers}\n renderDay={renderDay}\n size={size}\n timeZone={resolvedTimeZone}\n classNames={classNames}\n />\n </Ark.Content>\n </Ark.Root>\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeRow, resolveHourCycle, timeRowMinWidth, is12Hour, to12Hour, to24Hour, dayPeriodLabels } from './chunk-FUWSTUDM.js';
|
|
2
|
-
import { CalendarBody, calendarGridWidth, resolveCalendarTranslations } from './chunk-
|
|
2
|
+
import { CalendarBody, calendarGridWidth, resolveCalendarTranslations } from './chunk-NSOA3GMZ.js';
|
|
3
3
|
import { calendarValueToDate, dateToCalendarValue, fromArkValues, toArkValues } from './chunk-TCWYBVIL.js';
|
|
4
4
|
import { mergeRefs } from './chunk-UVYTJQTJ.js';
|
|
5
5
|
import { controlOpenProps } from './chunk-5FDOOG4J.js';
|
|
@@ -635,5 +635,5 @@ var DatePicker = Object.assign(DatePickerImpl, {
|
|
|
635
635
|
});
|
|
636
636
|
|
|
637
637
|
export { DatePicker, serializeDateValue };
|
|
638
|
-
//# sourceMappingURL=chunk-
|
|
639
|
-
//# sourceMappingURL=chunk-
|
|
638
|
+
//# sourceMappingURL=chunk-YON5Y336.js.map
|
|
639
|
+
//# sourceMappingURL=chunk-YON5Y336.js.map
|