@xui/date-range-input 2.0.0-alpha.11 → 2.0.0-alpha.13
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 +142 -156
- package/fesm2022/xui-date-range-input.mjs +61 -35
- package/fesm2022/xui-date-range-input.mjs.map +1 -1
- package/package.json +6 -5
- package/types/xui-date-range-input.d.ts +17 -5
package/README.md
CHANGED
|
@@ -1,89 +1,103 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
1
|
+
<h1 align="center">xUI</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>90 Angular components, one npm package each, themed from a single token layer.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://xuijs.org">Documentation</a> ·
|
|
9
|
+
<a href="https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark">Storybook</a> ·
|
|
10
|
+
<a href="https://stackblitz.com/fork/xui">StackBlitz</a> ·
|
|
11
|
+
<a href="#components">Components</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://github.com/rikarin/xui/actions/workflows/release.yml"><img src="https://github.com/rikarin/xui/actions/workflows/release.yml/badge.svg?branch=master" alt="Build status" /></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@xui/core"><img src="https://img.shields.io/npm/v/%40xui/core.svg" alt="npm version" /></a>
|
|
17
|
+
<a href="https://www.npmjs.com/org/xui"><img src="https://img.shields.io/npm/dm/%40xui/core.svg" alt="Downloads" /></a>
|
|
18
|
+
<a href="https://app.netlify.com/sites/xui/deploys"><img src="https://api.netlify.com/api/v1/badges/fa0cfd14-97df-47fa-8a7c-152e6d4cfda2/deploy-status" alt="Netlify status" /></a>
|
|
3
19
|
</p>
|
|
4
20
|
|
|
5
21
|
---
|
|
6
22
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[](https://app.netlify.com/sites/xui/deploys)
|
|
23
|
+
xUI is an Angular 22 component library styled with Tailwind CSS 4. You compose it from directives and
|
|
24
|
+
standalone components rather than configuring one monolith, and the set goes well past the
|
|
25
|
+
primitives: data tables, dock managers, omnibars, node graphs and date ranges are packages here, not
|
|
26
|
+
things you are left to build.
|
|
12
27
|
|
|
13
|
-
|
|
28
|
+
```ts
|
|
29
|
+
import { XuiButtonImports } from '@xui/button';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
imports: [XuiButtonImports],
|
|
33
|
+
template: `<button xuiButton color="primary">Save changes</button>`
|
|
34
|
+
})
|
|
35
|
+
export class Example {}
|
|
36
|
+
```
|
|
14
37
|
|
|
15
38
|
## Features
|
|
16
39
|
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| Spinner | [](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://bundlephobia.com/result?p=%40xui/spinner) | Spinner component |
|
|
53
|
-
| Status | [](https://www.npmjs.com/package/%40xui/status)<br />[](https://www.npmjs.com/package/%40xui/status)<br />[](https://bundlephobia.com/result?p=%40xui/status) | Status component |
|
|
54
|
-
| Table | [](https://www.npmjs.com/package/%40xui/table)<br />[](https://www.npmjs.com/package/%40xui/table)<br />[](https://bundlephobia.com/result?p=%40xui/table) | Table component |
|
|
55
|
-
|
|
56
|
-
## Installation
|
|
57
|
-
|
|
58
|
-
Install package with **PNPM**
|
|
40
|
+
- **One package per component.** Install `@xui/button` and you ship a button, not a library. Each
|
|
41
|
+
package exports an imports barrel for standalone components.
|
|
42
|
+
- **Signals throughout.** Signal inputs, `OnPush` and zoneless change detection; no `zone.js`
|
|
43
|
+
required.
|
|
44
|
+
- **Themed by tokens, not overrides.** Components style themselves with `bg-surface`,
|
|
45
|
+
`text-foreground-muted`, `border-error-muted`. Light and dark both work without a single `dark:`
|
|
46
|
+
class, and re-colouring an intent is one CSS variable.
|
|
47
|
+
- **Typed variants.** Every visual axis is a typed input backed by
|
|
48
|
+
[CVA](https://cva.style), and the `class` input merges through `tailwind-merge` — your utility
|
|
49
|
+
wins instead of fighting the component's.
|
|
50
|
+
- **Angular CDK underneath.** Overlays, focus traps, roving tabindex, typeahead, drag and drop and
|
|
51
|
+
bidi come from `@angular/cdk`, so keyboard behaviour and RTL are not reimplemented per component.
|
|
52
|
+
- **Built for coding agents.** An MCP server and an agent skill expose the real API of every
|
|
53
|
+
package — see [AI coding agents](#ai-coding-agents).
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
| | |
|
|
58
|
+
| ----------------------- | --- |
|
|
59
|
+
| Angular | 22 |
|
|
60
|
+
| Tailwind CSS | 4 |
|
|
61
|
+
| Node (development only) | 24 |
|
|
62
|
+
|
|
63
|
+
## Getting started
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
ng add @xui/core
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
That installs the core package and wires your global stylesheet: the theme import, the CDK overlay
|
|
70
|
+
stylesheet, and a `@source` glob pointing at the published packages. It is idempotent, so running it
|
|
71
|
+
again only adds what is missing. Use `nx add @xui/core` in an Nx workspace, and `--skip-overlay` if
|
|
72
|
+
you will not use dialogs, drawers, popovers, tooltips, menus or toasts.
|
|
73
|
+
|
|
74
|
+
Then add the components you need:
|
|
59
75
|
|
|
60
76
|
```bash
|
|
61
|
-
pnpm
|
|
77
|
+
pnpm add @xui/button @xui/dialog @xui/icon
|
|
62
78
|
```
|
|
63
79
|
|
|
64
80
|
## Theming
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
`text-foreground-muted`, `border-error-muted` — that resolve through the token layer shipped with
|
|
68
|
-
`@xui/core`. Import it once, after Tailwind:
|
|
82
|
+
To wire the styles by hand, import the token layer once after Tailwind:
|
|
69
83
|
|
|
70
84
|
```css
|
|
71
85
|
@import 'tailwindcss';
|
|
72
86
|
@import '@xui/core/styles/theme.css';
|
|
73
87
|
|
|
74
|
-
/* Only needed
|
|
75
|
-
|
|
88
|
+
/* Only needed for an overlay surface — popover, tooltip, menu, dialog, drawer
|
|
89
|
+
or toast. Without it, overlays render in the document flow. */
|
|
76
90
|
@import '@angular/cdk/overlay-prebuilt.css';
|
|
77
91
|
|
|
78
|
-
/*
|
|
92
|
+
/* Tailwind only emits utilities it can see, and it cannot see node_modules by default. */
|
|
79
93
|
@source '../node_modules/@xui';
|
|
80
94
|
```
|
|
81
95
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
Put `.dark` (or `[data-theme='dark']`) on `<html>` to switch themes; with neither present the theme
|
|
97
|
+
follows `prefers-color-scheme`. Both selectors work on any element, so a subtree can render in the
|
|
98
|
+
opposite theme.
|
|
85
99
|
|
|
86
|
-
Re-theme by overriding tokens after the import
|
|
100
|
+
Re-theme by overriding tokens after the import. The `darker` / `lighter` / `subtle` / `muted` /
|
|
87
101
|
`emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
|
|
88
102
|
|
|
89
103
|
```css
|
|
@@ -93,37 +107,48 @@ Re-theme by overriding tokens after the import — the `darker` / `lighter` / `s
|
|
|
93
107
|
}
|
|
94
108
|
```
|
|
95
109
|
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
Controls share one density scale — 24 / 30 / 40px for `sm` / default / `lg` — so a button, an input
|
|
111
|
+
and a date field on the same row line up. Override `--control-height-md` to re-tune the library.
|
|
98
112
|
|
|
99
|
-
|
|
113
|
+
The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
|
|
100
114
|
|
|
101
|
-
|
|
115
|
+
## Components
|
|
102
116
|
|
|
103
|
-
|
|
117
|
+
<details>
|
|
118
|
+
<summary><strong>All 90 packages</strong>, grouped as they appear in Storybook</summary>
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
<br />
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
**Foundations** — [`@xui/icon`](https://www.npmjs.com/package/@xui/icon) · [`@xui/link`](https://www.npmjs.com/package/@xui/link) · [`@xui/text`](https://www.npmjs.com/package/@xui/text)
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
pnpm start
|
|
111
|
-
```
|
|
124
|
+
**Actions** — [`@xui/button`](https://www.npmjs.com/package/@xui/button) · [`@xui/button-group`](https://www.npmjs.com/package/@xui/button-group) · [`@xui/hotkeys`](https://www.npmjs.com/package/@xui/hotkeys)
|
|
112
125
|
|
|
113
|
-
|
|
126
|
+
**Forms** — [`@xui/cascader`](https://www.npmjs.com/package/@xui/cascader) · [`@xui/checkbox`](https://www.npmjs.com/package/@xui/checkbox) · [`@xui/color-picker`](https://www.npmjs.com/package/@xui/color-picker) · [`@xui/control-card`](https://www.npmjs.com/package/@xui/control-card) · [`@xui/control-group`](https://www.npmjs.com/package/@xui/control-group) · [`@xui/editable-text`](https://www.npmjs.com/package/@xui/editable-text) · [`@xui/file-input`](https://www.npmjs.com/package/@xui/file-input) · [`@xui/form-field`](https://www.npmjs.com/package/@xui/form-field) · [`@xui/html-select`](https://www.npmjs.com/package/@xui/html-select) · [`@xui/input`](https://www.npmjs.com/package/@xui/input) · [`@xui/input-otp`](https://www.npmjs.com/package/@xui/input-otp) · [`@xui/label`](https://www.npmjs.com/package/@xui/label) · [`@xui/multi-select`](https://www.npmjs.com/package/@xui/multi-select) · [`@xui/numeric-input`](https://www.npmjs.com/package/@xui/numeric-input) · [`@xui/radio`](https://www.npmjs.com/package/@xui/radio) · [`@xui/rate`](https://www.npmjs.com/package/@xui/rate) · [`@xui/rich-text-editor`](https://www.npmjs.com/package/@xui/rich-text-editor) · [`@xui/segmented-control`](https://www.npmjs.com/package/@xui/segmented-control) · [`@xui/select`](https://www.npmjs.com/package/@xui/select) · [`@xui/slider`](https://www.npmjs.com/package/@xui/slider) · [`@xui/suggest`](https://www.npmjs.com/package/@xui/suggest) · [`@xui/switch`](https://www.npmjs.com/package/@xui/switch) · [`@xui/tag-input`](https://www.npmjs.com/package/@xui/tag-input) · [`@xui/textarea`](https://www.npmjs.com/package/@xui/textarea) · [`@xui/transfer`](https://www.npmjs.com/package/@xui/transfer) · [`@xui/tree-select`](https://www.npmjs.com/package/@xui/tree-select) · [`@xui/upload`](https://www.npmjs.com/package/@xui/upload)
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
**Date & time** — [`@xui/date-input`](https://www.npmjs.com/package/@xui/date-input) · [`@xui/date-picker`](https://www.npmjs.com/package/@xui/date-picker) · [`@xui/date-range-input`](https://www.npmjs.com/package/@xui/date-range-input) · [`@xui/date-range-picker`](https://www.npmjs.com/package/@xui/date-range-picker) · [`@xui/time-picker`](https://www.npmjs.com/package/@xui/time-picker) · [`@xui/timezone-select`](https://www.npmjs.com/package/@xui/timezone-select)
|
|
129
|
+
|
|
130
|
+
**Data display** — [`@xui/avatar`](https://www.npmjs.com/package/@xui/avatar) · [`@xui/badge`](https://www.npmjs.com/package/@xui/badge) · [`@xui/card`](https://www.npmjs.com/package/@xui/card) · [`@xui/card-list`](https://www.npmjs.com/package/@xui/card-list) · [`@xui/carousel`](https://www.npmjs.com/package/@xui/carousel) · [`@xui/data-table`](https://www.npmjs.com/package/@xui/data-table) · [`@xui/descriptions`](https://www.npmjs.com/package/@xui/descriptions) · [`@xui/entity-title`](https://www.npmjs.com/package/@xui/entity-title) · [`@xui/kbd`](https://www.npmjs.com/package/@xui/kbd) · [`@xui/statistic`](https://www.npmjs.com/package/@xui/statistic) · [`@xui/status`](https://www.npmjs.com/package/@xui/status) · [`@xui/table`](https://www.npmjs.com/package/@xui/table) · [`@xui/tag`](https://www.npmjs.com/package/@xui/tag) · [`@xui/timeline`](https://www.npmjs.com/package/@xui/timeline) · [`@xui/tree`](https://www.npmjs.com/package/@xui/tree)
|
|
131
|
+
|
|
132
|
+
**Navigation** — [`@xui/breadcrumb`](https://www.npmjs.com/package/@xui/breadcrumb) · [`@xui/menubar`](https://www.npmjs.com/package/@xui/menubar) · [`@xui/navbar`](https://www.npmjs.com/package/@xui/navbar) · [`@xui/navigation-menu`](https://www.npmjs.com/package/@xui/navigation-menu) · [`@xui/pagination`](https://www.npmjs.com/package/@xui/pagination) · [`@xui/panel-stack`](https://www.npmjs.com/package/@xui/panel-stack) · [`@xui/steps`](https://www.npmjs.com/package/@xui/steps) · [`@xui/tabs`](https://www.npmjs.com/package/@xui/tabs)
|
|
133
|
+
|
|
134
|
+
**Overlays** — [`@xui/alert`](https://www.npmjs.com/package/@xui/alert) · [`@xui/alert-dialog`](https://www.npmjs.com/package/@xui/alert-dialog) · [`@xui/context-menu`](https://www.npmjs.com/package/@xui/context-menu) · [`@xui/dialog`](https://www.npmjs.com/package/@xui/dialog) · [`@xui/drawer`](https://www.npmjs.com/package/@xui/drawer) · [`@xui/menu`](https://www.npmjs.com/package/@xui/menu) · [`@xui/omnibar`](https://www.npmjs.com/package/@xui/omnibar) · [`@xui/popover`](https://www.npmjs.com/package/@xui/popover) · [`@xui/toast`](https://www.npmjs.com/package/@xui/toast) · [`@xui/tooltip`](https://www.npmjs.com/package/@xui/tooltip)
|
|
135
|
+
|
|
136
|
+
**Feedback** — [`@xui/callout`](https://www.npmjs.com/package/@xui/callout) · [`@xui/non-ideal-state`](https://www.npmjs.com/package/@xui/non-ideal-state) · [`@xui/progress-bar`](https://www.npmjs.com/package/@xui/progress-bar) · [`@xui/result`](https://www.npmjs.com/package/@xui/result) · [`@xui/skeleton`](https://www.npmjs.com/package/@xui/skeleton) · [`@xui/spinner`](https://www.npmjs.com/package/@xui/spinner)
|
|
137
|
+
|
|
138
|
+
**Layout** — [`@xui/accordion`](https://www.npmjs.com/package/@xui/accordion) · [`@xui/aspect-ratio`](https://www.npmjs.com/package/@xui/aspect-ratio) · [`@xui/collapse`](https://www.npmjs.com/package/@xui/collapse) · [`@xui/divider`](https://www.npmjs.com/package/@xui/divider) · [`@xui/dock-manager`](https://www.npmjs.com/package/@xui/dock-manager) · [`@xui/overflow-list`](https://www.npmjs.com/package/@xui/overflow-list) · [`@xui/scroll-area`](https://www.npmjs.com/package/@xui/scroll-area) · [`@xui/section`](https://www.npmjs.com/package/@xui/section) · [`@xui/splitter`](https://www.npmjs.com/package/@xui/splitter)
|
|
139
|
+
|
|
140
|
+
**Visualisation** — [`@xui/echarts`](https://www.npmjs.com/package/@xui/echarts) · [`@xui/konva`](https://www.npmjs.com/package/@xui/konva) · [`@xui/node-graph`](https://www.npmjs.com/package/@xui/node-graph)
|
|
141
|
+
|
|
142
|
+
</details>
|
|
118
143
|
|
|
119
144
|
## AI coding agents
|
|
120
145
|
|
|
121
146
|
Two pieces of tooling teach coding agents how to build with xUI.
|
|
122
147
|
|
|
123
|
-
**MCP server** — [`@xui/mcp`](
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
**MCP server** — [`@xui/mcp`](libs/mcp/README.md) exposes every package's real API (selectors, signal
|
|
149
|
+
inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as MCP tools.
|
|
150
|
+
It extracts them from the library sources, so every package is covered and the answers match the
|
|
151
|
+
installed version.
|
|
127
152
|
|
|
128
153
|
```json
|
|
129
154
|
{
|
|
@@ -133,85 +158,46 @@ answers match the installed version.
|
|
|
133
158
|
}
|
|
134
159
|
```
|
|
135
160
|
|
|
136
|
-
In this
|
|
137
|
-
once so it exists.
|
|
161
|
+
In this repository `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run
|
|
162
|
+
`pnpm nx build mcp` once so it exists.
|
|
138
163
|
|
|
139
|
-
**Skill** — [`skills/xui`](
|
|
164
|
+
**Skill** — [`skills/xui`](skills/xui/SKILL.md) is the procedural knowledge: the three-layer
|
|
140
165
|
architecture, discovery through the MCP server, composition and styling rules, theming, the
|
|
141
166
|
generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
|
|
142
167
|
links to it for agents working in this repository.
|
|
143
168
|
|
|
144
|
-
##
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
- [ ] Input OTP
|
|
180
|
-
- [ ] Toggle Group
|
|
181
|
-
|
|
182
|
-
### Additional
|
|
183
|
-
|
|
184
|
-
- [ ] Decagram
|
|
185
|
-
- [ ] Settings
|
|
186
|
-
- [ ] Drawer
|
|
187
|
-
- [ ] Panel Bar
|
|
188
|
-
- [ ] Textarea
|
|
189
|
-
- [ ] Time Picker
|
|
190
|
-
- [ ] Image Upload
|
|
191
|
-
- [ ] Banner
|
|
192
|
-
- [ ] Snack bar
|
|
193
|
-
|
|
194
|
-
## Opinionated "components"
|
|
195
|
-
|
|
196
|
-
- [ ] Graph View (Nodes)
|
|
197
|
-
- [ ] Analysis
|
|
198
|
-
- [ ] Charts (NG Charts?)
|
|
199
|
-
|
|
200
|
-
## CLI
|
|
201
|
-
|
|
202
|
-
Make cli to install the components
|
|
203
|
-
|
|
204
|
-
## TODO
|
|
205
|
-
|
|
206
|
-
- Button
|
|
207
|
-
|
|
208
|
-
- Icon
|
|
209
|
-
- Shine
|
|
210
|
-
|
|
211
|
-
- Breadcrumb
|
|
212
|
-
|
|
213
|
-
- fix styling issues
|
|
214
|
-
- on hover stuff
|
|
215
|
-
- data driven component
|
|
216
|
-
|
|
217
|
-
- adjust generator to generate stories into the apps/storybook
|
|
169
|
+
## Browser support
|
|
170
|
+
|
|
171
|
+
The browsers Angular itself supports — see the
|
|
172
|
+
[Angular browser support policy](https://angular.dev/reference/versions#browser-support).
|
|
173
|
+
|
|
174
|
+
## Development
|
|
175
|
+
|
|
176
|
+
The workspace is [Nx](https://nx.dev) + pnpm.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
pnpm install
|
|
180
|
+
pnpm start # documentation site on :4200
|
|
181
|
+
pnpm storybook # component gallery on :4400
|
|
182
|
+
pnpm nx serve admin # the example admin application
|
|
183
|
+
pnpm test # unit tests
|
|
184
|
+
pnpm nx test-storybook ui-storybook # render every story in headless Chromium
|
|
185
|
+
pnpm build # build every package
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Commits follow [Conventional Commits](https://www.conventionalcommits.org) and are linted — the
|
|
189
|
+
release is cut from them. See [docs/releasing.md](docs/releasing.md) for how a version is published,
|
|
190
|
+
[apps/ui-storybook/README.md](apps/ui-storybook/README.md) before writing stories, and
|
|
191
|
+
[apps/app/README.md](apps/app/README.md) for the documentation site, whose component pages are
|
|
192
|
+
generated from those same stories, and [apps/admin/README.md](apps/admin/README.md) for the example
|
|
193
|
+
admin application — a full app built from these packages, which is the fastest way to see how they
|
|
194
|
+
fit together.
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Bugs and ideas are welcome in [issues](https://github.com/Rikarin/xui/issues). For a change of any
|
|
199
|
+
size, open an issue first so the API can be agreed before the code exists.
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
See [LICENSE](LICENSE).
|
|
@@ -3,8 +3,8 @@ import { input, model, booleanAttribute, signal, computed, ViewEncapsulation, Ch
|
|
|
3
3
|
import { provideIcons, NgIcon } from '@ng-icons/core';
|
|
4
4
|
import { matArrowForwardRound } from '@ng-icons/material-icons/round';
|
|
5
5
|
import { xui } from '@xui/core';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { injectXDateAdapter, defaultXDateFormat, defaultXDateParse } from '@xui/core/date-time';
|
|
7
|
+
import { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';
|
|
8
8
|
import * as i2 from '@xui/date-range-picker';
|
|
9
9
|
import { XuiDateRangePickerImports } from '@xui/date-range-picker';
|
|
10
10
|
import { XuiIcon } from '@xui/icon';
|
|
@@ -14,15 +14,16 @@ import { XuiPopoverImports } from '@xui/popover';
|
|
|
14
14
|
/**
|
|
15
15
|
* A date-range field: two text inputs (start → end) that share one popover
|
|
16
16
|
* calendar. Focusing either field opens the range picker; typing a boundary
|
|
17
|
-
* parses just that end. `[(
|
|
17
|
+
* parses just that end. `[(value)]` two-way binding. It is a full
|
|
18
|
+
* `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.
|
|
18
19
|
*/
|
|
19
20
|
class XuiDateRangeInput {
|
|
20
|
-
adapter =
|
|
21
|
+
adapter = injectXDateAdapter();
|
|
21
22
|
class = input('', /* @ts-ignore */
|
|
22
23
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
23
|
-
/** The chosen range. Two-way bindable with `[(
|
|
24
|
-
|
|
25
|
-
...(ngDevMode ? [{ debugName: "
|
|
24
|
+
/** The chosen range. Two-way bindable with `[(value)]`. */
|
|
25
|
+
value = model({ start: null, end: null }, /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
26
27
|
min = input(null, /* @ts-ignore */
|
|
27
28
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
28
29
|
max = input(null, /* @ts-ignore */
|
|
@@ -35,20 +36,26 @@ class XuiDateRangeInput {
|
|
|
35
36
|
...(ngDevMode ? [{ debugName: "endPlaceholder" }] : /* istanbul ignore next */ []));
|
|
36
37
|
locale = input(undefined, /* @ts-ignore */
|
|
37
38
|
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
38
|
-
formatDate = input((
|
|
39
|
+
formatDate = input(defaultXDateFormat(this.adapter), /* @ts-ignore */
|
|
39
40
|
...(ngDevMode ? [{ debugName: "formatDate" }] : /* istanbul ignore next */ []));
|
|
40
|
-
parseDate = input(
|
|
41
|
-
const ms = Date.parse(text);
|
|
42
|
-
return Number.isNaN(ms) ? null : new Date(ms);
|
|
43
|
-
}, /* @ts-ignore */
|
|
41
|
+
parseDate = input(defaultXDateParse, /* @ts-ignore */
|
|
44
42
|
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
45
43
|
open = model(false, /* @ts-ignore */
|
|
46
44
|
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
47
45
|
typed = signal({ start: null, end: null }, /* @ts-ignore */
|
|
48
46
|
...(ngDevMode ? [{ debugName: "typed" }] : /* istanbul ignore next */ []));
|
|
47
|
+
cva = createXValueAccessor({
|
|
48
|
+
onWrite: range => {
|
|
49
|
+
// A form write replaces any half-typed text — the display must show it.
|
|
50
|
+
this.typed.set({ start: null, end: null });
|
|
51
|
+
this.value.set(range ?? { start: null, end: null });
|
|
52
|
+
},
|
|
53
|
+
disabled: this.disabled
|
|
54
|
+
});
|
|
55
|
+
isDisabled = this.cva.disabled;
|
|
49
56
|
computedClass = computed(() => xui('inline-block', this.class()), /* @ts-ignore */
|
|
50
57
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
51
|
-
groupClass = computed(() => xui('border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-72 items-center gap-2 rounded-lg border px-(--control-padding-md) text-sm', 'focus-within:border-focus transition-colors', this.
|
|
58
|
+
groupClass = computed(() => xui('border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-72 items-center gap-2 rounded-lg border px-(--control-padding-md) text-sm', 'focus-within:border-focus transition-colors', this.isDisabled() && 'cursor-not-allowed opacity-50'), /* @ts-ignore */
|
|
52
59
|
...(ngDevMode ? [{ debugName: "groupClass" }] : /* istanbul ignore next */ []));
|
|
53
60
|
fieldClass = computed(() => xui('text-foreground placeholder:text-foreground-subtle w-28 flex-1 bg-transparent text-center outline-none'), /* @ts-ignore */
|
|
54
61
|
...(ngDevMode ? [{ debugName: "fieldClass" }] : /* istanbul ignore next */ []));
|
|
@@ -57,12 +64,22 @@ class XuiDateRangeInput {
|
|
|
57
64
|
if (typed !== null) {
|
|
58
65
|
return typed;
|
|
59
66
|
}
|
|
60
|
-
const value = this.
|
|
67
|
+
const value = this.value()[boundary];
|
|
61
68
|
return value == null ? '' : this.formatDate()(value, this.locale());
|
|
62
69
|
}
|
|
63
70
|
onType(boundary, event) {
|
|
64
71
|
this.typed.update(state => ({ ...state, [boundary]: event.target.value }));
|
|
65
72
|
}
|
|
73
|
+
onBlur(boundary) {
|
|
74
|
+
this.commitTyped(boundary);
|
|
75
|
+
this.cva.markTouched();
|
|
76
|
+
}
|
|
77
|
+
onOpenChange(open) {
|
|
78
|
+
this.open.set(open);
|
|
79
|
+
if (!open) {
|
|
80
|
+
this.cva.markTouched();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
66
83
|
commitTyped(boundary) {
|
|
67
84
|
const text = this.typed()[boundary];
|
|
68
85
|
if (text === null) {
|
|
@@ -74,34 +91,41 @@ class XuiDateRangeInput {
|
|
|
74
91
|
if (text.trim() !== '' && next == null) {
|
|
75
92
|
return;
|
|
76
93
|
}
|
|
77
|
-
this.commit({ ...this.
|
|
94
|
+
this.commit({ ...this.value(), [boundary]: next });
|
|
78
95
|
}
|
|
79
96
|
onPick(range) {
|
|
80
97
|
this.typed.set({ start: null, end: null });
|
|
81
98
|
this.commit(range);
|
|
82
99
|
}
|
|
100
|
+
/** The single write path for user edits — typed boundaries or a calendar pick. */
|
|
83
101
|
commit(range) {
|
|
84
|
-
this.
|
|
102
|
+
this.value.set(range);
|
|
103
|
+
this.cva.notifyChange(range);
|
|
85
104
|
}
|
|
105
|
+
writeValue = this.cva.writeValue;
|
|
106
|
+
registerOnChange = this.cva.registerOnChange;
|
|
107
|
+
registerOnTouched = this.cva.registerOnTouched;
|
|
108
|
+
setDisabledState = this.cva.setDisabledState;
|
|
86
109
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiDateRangeInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
87
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: XuiDateRangeInput, isStandalone: true, selector: "xui-date-range-input", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null },
|
|
110
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: XuiDateRangeInput, isStandalone: true, selector: "xui-date-range-input", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, allowSingleDayRange: { classPropertyName: "allowSingleDayRange", publicName: "allowSingleDayRange", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, startPlaceholder: { classPropertyName: "startPlaceholder", publicName: "startPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, endPlaceholder: { classPropertyName: "endPlaceholder", publicName: "endPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, formatDate: { classPropertyName: "formatDate", publicName: "formatDate", isSignal: true, isRequired: false, transformFunction: null }, parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", open: "openChange" }, host: { properties: { "class": "computedClass()" } }, providers: [provideXValueAccessor((() => XuiDateRangeInput))], ngImport: i0, template: `
|
|
88
111
|
<div
|
|
89
112
|
[class]="groupClass()"
|
|
90
113
|
[xuiPopover]="panel"
|
|
91
|
-
[
|
|
114
|
+
[open]="open()"
|
|
115
|
+
(openChange)="onOpenChange($event)"
|
|
92
116
|
[role]="'dialog'"
|
|
93
117
|
[minimal]="true"
|
|
94
|
-
[disabled]="
|
|
118
|
+
[disabled]="isDisabled()"
|
|
95
119
|
placement="bottom-start"
|
|
96
120
|
>
|
|
97
121
|
<input
|
|
98
122
|
type="text"
|
|
99
123
|
[class]="fieldClass()"
|
|
100
124
|
[placeholder]="startPlaceholder()"
|
|
101
|
-
[disabled]="
|
|
125
|
+
[disabled]="isDisabled()"
|
|
102
126
|
[value]="displayValue('start')"
|
|
103
127
|
(input)="onType('start', $event)"
|
|
104
|
-
(blur)="
|
|
128
|
+
(blur)="onBlur('start')"
|
|
105
129
|
(keydown.enter)="commitTyped('start')"
|
|
106
130
|
/>
|
|
107
131
|
<ng-icon xui name="matArrowForwardRound" size="sm" class="text-foreground-muted shrink-0" />
|
|
@@ -109,48 +133,50 @@ class XuiDateRangeInput {
|
|
|
109
133
|
type="text"
|
|
110
134
|
[class]="fieldClass()"
|
|
111
135
|
[placeholder]="endPlaceholder()"
|
|
112
|
-
[disabled]="
|
|
136
|
+
[disabled]="isDisabled()"
|
|
113
137
|
[value]="displayValue('end')"
|
|
114
138
|
(input)="onType('end', $event)"
|
|
115
|
-
(blur)="
|
|
139
|
+
(blur)="onBlur('end')"
|
|
116
140
|
(keydown.enter)="commitTyped('end')"
|
|
117
141
|
/>
|
|
118
142
|
</div>
|
|
119
143
|
|
|
120
144
|
<ng-template #panel>
|
|
121
145
|
<xui-date-range-picker
|
|
122
|
-
[
|
|
146
|
+
[value]="value()"
|
|
123
147
|
[min]="min()"
|
|
124
148
|
[max]="max()"
|
|
125
149
|
[allowSingleDayRange]="allowSingleDayRange()"
|
|
126
|
-
(
|
|
150
|
+
(valueChange)="onPick($event)"
|
|
127
151
|
/>
|
|
128
152
|
</ng-template>
|
|
129
|
-
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "
|
|
153
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "label"], exportAs: ["xuiIcon"] }, { kind: "directive", type: i1.XuiPopover, selector: "[xuiPopover]", inputs: ["xuiPopover", "context", "interactionKind", "placement", "offset", "hoverOpenDelay", "hoverCloseDelay", "minimal", "matchTargetWidth", "disabled", "panelClass", "role", "ariaLabel", "open"], outputs: ["openChange", "opened", "closed"], exportAs: ["xuiPopover"] }, { kind: "component", type: i2.XuiDateRangePicker, selector: "xui-date-range-picker", inputs: ["class", "value", "min", "max", "dateFilter", "firstDayOfWeek", "locale", "months", "allowSingleDayRange", "disabled"], outputs: ["valueChange"] }], viewProviders: [provideIcons({ matArrowForwardRound })], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
130
154
|
}
|
|
131
155
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiDateRangeInput, decorators: [{
|
|
132
156
|
type: Component,
|
|
133
157
|
args: [{
|
|
134
158
|
selector: 'xui-date-range-input',
|
|
135
159
|
imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDateRangePickerImports],
|
|
160
|
+
providers: [provideXValueAccessor((() => XuiDateRangeInput))],
|
|
136
161
|
template: `
|
|
137
162
|
<div
|
|
138
163
|
[class]="groupClass()"
|
|
139
164
|
[xuiPopover]="panel"
|
|
140
|
-
[
|
|
165
|
+
[open]="open()"
|
|
166
|
+
(openChange)="onOpenChange($event)"
|
|
141
167
|
[role]="'dialog'"
|
|
142
168
|
[minimal]="true"
|
|
143
|
-
[disabled]="
|
|
169
|
+
[disabled]="isDisabled()"
|
|
144
170
|
placement="bottom-start"
|
|
145
171
|
>
|
|
146
172
|
<input
|
|
147
173
|
type="text"
|
|
148
174
|
[class]="fieldClass()"
|
|
149
175
|
[placeholder]="startPlaceholder()"
|
|
150
|
-
[disabled]="
|
|
176
|
+
[disabled]="isDisabled()"
|
|
151
177
|
[value]="displayValue('start')"
|
|
152
178
|
(input)="onType('start', $event)"
|
|
153
|
-
(blur)="
|
|
179
|
+
(blur)="onBlur('start')"
|
|
154
180
|
(keydown.enter)="commitTyped('start')"
|
|
155
181
|
/>
|
|
156
182
|
<ng-icon xui name="matArrowForwardRound" size="sm" class="text-foreground-muted shrink-0" />
|
|
@@ -158,21 +184,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
158
184
|
type="text"
|
|
159
185
|
[class]="fieldClass()"
|
|
160
186
|
[placeholder]="endPlaceholder()"
|
|
161
|
-
[disabled]="
|
|
187
|
+
[disabled]="isDisabled()"
|
|
162
188
|
[value]="displayValue('end')"
|
|
163
189
|
(input)="onType('end', $event)"
|
|
164
|
-
(blur)="
|
|
190
|
+
(blur)="onBlur('end')"
|
|
165
191
|
(keydown.enter)="commitTyped('end')"
|
|
166
192
|
/>
|
|
167
193
|
</div>
|
|
168
194
|
|
|
169
195
|
<ng-template #panel>
|
|
170
196
|
<xui-date-range-picker
|
|
171
|
-
[
|
|
197
|
+
[value]="value()"
|
|
172
198
|
[min]="min()"
|
|
173
199
|
[max]="max()"
|
|
174
200
|
[allowSingleDayRange]="allowSingleDayRange()"
|
|
175
|
-
(
|
|
201
|
+
(valueChange)="onPick($event)"
|
|
176
202
|
/>
|
|
177
203
|
</ng-template>
|
|
178
204
|
`,
|
|
@@ -183,7 +209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
183
209
|
encapsulation: ViewEncapsulation.None,
|
|
184
210
|
viewProviders: [provideIcons({ matArrowForwardRound })]
|
|
185
211
|
}]
|
|
186
|
-
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }],
|
|
212
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], allowSingleDayRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowSingleDayRange", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], startPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "startPlaceholder", required: false }] }], endPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "endPlaceholder", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], formatDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDate", required: false }] }], parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }] } });
|
|
187
213
|
|
|
188
214
|
const XuiDateRangeInputImports = [XuiDateRangeInput];
|
|
189
215
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-date-range-input.mjs","sources":["../../../../../../libs/ui/date-range-input/xui/src/lib/date-range-input.ts","../../../../../../libs/ui/date-range-input/xui/src/index.ts","../../../../../../libs/ui/date-range-input/xui/src/xui-date-range-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matArrowForwardRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { toJsDate } from '@xui/core/calendar';\nimport { injectDateAdapter } from '@xui/core/date-time';\nimport { XuiDateRangePickerImports, type XuiDateRange } from '@xui/date-range-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\ntype Boundary = 'start' | 'end';\n\n/**\n * A date-range field: two text inputs (start → end) that share one popover\n * calendar. Focusing either field opens the range picker; typing a boundary\n * parses just that end. `[(range)]` two-way binding.\n */\n@Component({\n selector: 'xui-date-range-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDateRangePickerImports],\n template: `\n <div\n [class]=\"groupClass()\"\n [xuiPopover]=\"panel\"\n [(isOpen)]=\"open\"\n [role]=\"'dialog'\"\n [minimal]=\"true\"\n [disabled]=\"disabled()\"\n placement=\"bottom-start\"\n >\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"disabled()\"\n [value]=\"displayValue('start')\"\n (input)=\"onType('start', $event)\"\n (blur)=\"commitTyped('start')\"\n (keydown.enter)=\"commitTyped('start')\"\n />\n <ng-icon xui name=\"matArrowForwardRound\" size=\"sm\" class=\"text-foreground-muted shrink-0\" />\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"disabled()\"\n [value]=\"displayValue('end')\"\n (input)=\"onType('end', $event)\"\n (blur)=\"commitTyped('end')\"\n (keydown.enter)=\"commitTyped('end')\"\n />\n </div>\n\n <ng-template #panel>\n <xui-date-range-picker\n [range]=\"range()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [allowSingleDayRange]=\"allowSingleDayRange()\"\n (rangeChange)=\"onPick($event)\"\n />\n </ng-template>\n `,\n host: {\n '[class]': 'computedClass()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [provideIcons({ matArrowForwardRound })]\n})\nexport class XuiDateRangeInput<T = Date> {\n private readonly adapter = injectDateAdapter<T>();\n\n readonly class = input<ClassValue>('');\n\n /** The chosen range. Two-way bindable with `[(range)]`. */\n readonly range = model<XuiDateRange<T>>({ start: null, end: null });\n\n readonly min = input<T | null>(null);\n readonly max = input<T | null>(null);\n readonly allowSingleDayRange = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly startPlaceholder = input<string>('Start date');\n readonly endPlaceholder = input<string>('End date');\n readonly locale = input<string | undefined>(undefined);\n\n readonly formatDate = input<(date: T, locale?: string) => string>((date, locale) =>\n new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(\n toJsDate(this.adapter, date)\n )\n );\n\n readonly parseDate = input<(text: string) => T | null>(text => {\n const ms = Date.parse(text);\n return Number.isNaN(ms) ? null : (new Date(ms) as unknown as T);\n });\n\n protected readonly open = model(false);\n private readonly typed = signal<{ start: string | null; end: string | null }>({ start: null, end: null });\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-72 items-center gap-2 rounded-lg border px-(--control-padding-md) text-sm',\n 'focus-within:border-focus transition-colors',\n this.disabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground placeholder:text-foreground-subtle w-28 flex-1 bg-transparent text-center outline-none')\n );\n\n protected displayValue(boundary: Boundary): string {\n const typed = this.typed()[boundary];\n if (typed !== null) {\n return typed;\n }\n\n const value = this.range()[boundary];\n return value == null ? '' : this.formatDate()(value, this.locale());\n }\n\n protected onType(boundary: Boundary, event: Event): void {\n this.typed.update(state => ({ ...state, [boundary]: (event.target as HTMLInputElement).value }));\n }\n\n protected commitTyped(boundary: Boundary): void {\n const text = this.typed()[boundary];\n if (text === null) {\n return;\n }\n\n this.typed.update(state => ({ ...state, [boundary]: null }));\n\n const next = text.trim() === '' ? null : this.parseDate()(text);\n // An unparseable value leaves the boundary as-is (display resets to it).\n if (text.trim() !== '' && next == null) {\n return;\n }\n\n this.commit({ ...this.range(), [boundary]: next });\n }\n\n protected onPick(range: XuiDateRange<T>): void {\n this.typed.set({ start: null, end: null });\n this.commit(range);\n }\n\n private commit(range: XuiDateRange<T>): void {\n this.range.set(range);\n }\n}\n","import { XuiDateRangeInput } from './lib/date-range-input';\n\nexport * from './lib/date-range-input';\n\nexport const XuiDateRangeInputImports = [XuiDateRangeInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;AAIG;MAsDU,iBAAiB,CAAA;IACX,OAAO,GAAG,iBAAiB,EAAK;IAExC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;8EAAC;IAE1D,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,mBAAmB,GAAG,KAAK,CAAwB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,EAAE,CAAC,CAAC,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAE5C,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBArD7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;oBAChC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,CAAC;AACxE,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,aAAa,EAAE,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;AACvD,iBAAA;;;AC5EM,MAAM,wBAAwB,GAAG,CAAC,iBAAiB;;ACJ1D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-date-range-input.mjs","sources":["../../../../../../libs/ui/date-range-input/xui/src/lib/date-range-input.ts","../../../../../../libs/ui/date-range-input/xui/src/index.ts","../../../../../../libs/ui/date-range-input/xui/src/xui-date-range-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matArrowForwardRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { defaultXDateFormat, defaultXDateParse, injectXDateAdapter } from '@xui/core/date-time';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiDateRangePickerImports, type XuiDateRange } from '@xui/date-range-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\ntype Boundary = 'start' | 'end';\n\n/**\n * A date-range field: two text inputs (start → end) that share one popover\n * calendar. Focusing either field opens the range picker; typing a boundary\n * parses just that end. `[(value)]` two-way binding. It is a full\n * `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.\n */\n@Component({\n selector: 'xui-date-range-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDateRangePickerImports],\n providers: [provideXValueAccessor(() => XuiDateRangeInput)],\n template: `\n <div\n [class]=\"groupClass()\"\n [xuiPopover]=\"panel\"\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [role]=\"'dialog'\"\n [minimal]=\"true\"\n [disabled]=\"isDisabled()\"\n placement=\"bottom-start\"\n >\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('start')\"\n (input)=\"onType('start', $event)\"\n (blur)=\"onBlur('start')\"\n (keydown.enter)=\"commitTyped('start')\"\n />\n <ng-icon xui name=\"matArrowForwardRound\" size=\"sm\" class=\"text-foreground-muted shrink-0\" />\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('end')\"\n (input)=\"onType('end', $event)\"\n (blur)=\"onBlur('end')\"\n (keydown.enter)=\"commitTyped('end')\"\n />\n </div>\n\n <ng-template #panel>\n <xui-date-range-picker\n [value]=\"value()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [allowSingleDayRange]=\"allowSingleDayRange()\"\n (valueChange)=\"onPick($event)\"\n />\n </ng-template>\n `,\n host: {\n '[class]': 'computedClass()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [provideIcons({ matArrowForwardRound })]\n})\nexport class XuiDateRangeInput<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n\n readonly class = input<ClassValue>('');\n\n /** The chosen range. Two-way bindable with `[(value)]`. */\n readonly value = model<XuiDateRange<T>>({ start: null, end: null });\n\n readonly min = input<T | null>(null);\n readonly max = input<T | null>(null);\n readonly allowSingleDayRange = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly startPlaceholder = input<string>('Start date');\n readonly endPlaceholder = input<string>('End date');\n readonly locale = input<string | undefined>(undefined);\n\n readonly formatDate = input<(date: T, locale?: string) => string>(defaultXDateFormat(this.adapter));\n\n readonly parseDate = input<(text: string) => T | null>(defaultXDateParse);\n\n protected readonly open = model(false);\n private readonly typed = signal<{ start: string | null; end: string | null }>({ start: null, end: null });\n\n protected readonly cva = createXValueAccessor<XuiDateRange<T> | null>({\n onWrite: range => {\n // A form write replaces any half-typed text — the display must show it.\n this.typed.set({ start: null, end: null });\n this.value.set(range ?? { start: null, end: null });\n },\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-72 items-center gap-2 rounded-lg border px-(--control-padding-md) text-sm',\n 'focus-within:border-focus transition-colors',\n this.isDisabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground placeholder:text-foreground-subtle w-28 flex-1 bg-transparent text-center outline-none')\n );\n\n protected displayValue(boundary: Boundary): string {\n const typed = this.typed()[boundary];\n if (typed !== null) {\n return typed;\n }\n\n const value = this.value()[boundary];\n return value == null ? '' : this.formatDate()(value, this.locale());\n }\n\n protected onType(boundary: Boundary, event: Event): void {\n this.typed.update(state => ({ ...state, [boundary]: (event.target as HTMLInputElement).value }));\n }\n\n protected onBlur(boundary: Boundary): void {\n this.commitTyped(boundary);\n this.cva.markTouched();\n }\n\n protected onOpenChange(open: boolean): void {\n this.open.set(open);\n if (!open) {\n this.cva.markTouched();\n }\n }\n\n protected commitTyped(boundary: Boundary): void {\n const text = this.typed()[boundary];\n if (text === null) {\n return;\n }\n\n this.typed.update(state => ({ ...state, [boundary]: null }));\n\n const next = text.trim() === '' ? null : this.parseDate()(text);\n // An unparseable value leaves the boundary as-is (display resets to it).\n if (text.trim() !== '' && next == null) {\n return;\n }\n\n this.commit({ ...this.value(), [boundary]: next });\n }\n\n protected onPick(range: XuiDateRange<T>): void {\n this.typed.set({ start: null, end: null });\n this.commit(range);\n }\n\n /** The single write path for user edits — typed boundaries or a calendar pick. */\n private commit(range: XuiDateRange<T>): void {\n this.value.set(range);\n this.cva.notifyChange(range);\n }\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiDateRangeInput } from './lib/date-range-input';\n\nexport * from './lib/date-range-input';\n\nexport const XuiDateRangeInputImports = [XuiDateRangeInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA;;;;;AAKG;MAwDU,iBAAiB,CAAA;IACX,OAAO,GAAG,kBAAkB,EAAK;IAEzC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;8EAAC;IAE1D,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,mBAAmB,GAAG,KAAK,CAAwB,KAAK,2FAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC1F,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAA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FM,MAAM,wBAAwB,GAAG,CAAC,iBAAiB;;ACJ1D;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xui/date-range-input",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@angular/cdk": "22",
|
|
40
40
|
"@angular/core": "22",
|
|
41
|
+
"@angular/forms": "22",
|
|
41
42
|
"@ng-icons/core": "34",
|
|
42
43
|
"@ng-icons/material-icons": "34",
|
|
43
|
-
"@xui/core": "2.0.0-alpha.
|
|
44
|
-
"@xui/date-range-picker": "2.0.0-alpha.
|
|
45
|
-
"@xui/icon": "2.0.0-alpha.
|
|
46
|
-
"@xui/popover": "2.0.0-alpha.
|
|
44
|
+
"@xui/core": "2.0.0-alpha.13",
|
|
45
|
+
"@xui/date-range-picker": "2.0.0-alpha.13",
|
|
46
|
+
"@xui/icon": "2.0.0-alpha.13",
|
|
47
|
+
"@xui/popover": "2.0.0-alpha.13",
|
|
47
48
|
"clsx": "^2.1.1"
|
|
48
49
|
},
|
|
49
50
|
"publishConfig": {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import * as _xui_core_forms from '@xui/core/forms';
|
|
1
2
|
import * as _angular_core from '@angular/core';
|
|
2
3
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
4
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
5
|
import { XuiDateRange } from '@xui/date-range-picker';
|
|
4
6
|
import { ClassValue } from 'clsx';
|
|
5
7
|
|
|
@@ -7,13 +9,14 @@ type Boundary = 'start' | 'end';
|
|
|
7
9
|
/**
|
|
8
10
|
* A date-range field: two text inputs (start → end) that share one popover
|
|
9
11
|
* calendar. Focusing either field opens the range picker; typing a boundary
|
|
10
|
-
* parses just that end. `[(
|
|
12
|
+
* parses just that end. `[(value)]` two-way binding. It is a full
|
|
13
|
+
* `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.
|
|
11
14
|
*/
|
|
12
|
-
declare class XuiDateRangeInput<T = Date> {
|
|
15
|
+
declare class XuiDateRangeInput<T = Date> implements ControlValueAccessor {
|
|
13
16
|
private readonly adapter;
|
|
14
17
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
15
|
-
/** The chosen range. Two-way bindable with `[(
|
|
16
|
-
readonly
|
|
18
|
+
/** The chosen range. Two-way bindable with `[(value)]`. */
|
|
19
|
+
readonly value: _angular_core.ModelSignal<XuiDateRange<T>>;
|
|
17
20
|
readonly min: _angular_core.InputSignal<T | null>;
|
|
18
21
|
readonly max: _angular_core.InputSignal<T | null>;
|
|
19
22
|
readonly allowSingleDayRange: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
@@ -25,16 +28,25 @@ declare class XuiDateRangeInput<T = Date> {
|
|
|
25
28
|
readonly parseDate: _angular_core.InputSignal<(text: string) => T | null>;
|
|
26
29
|
protected readonly open: _angular_core.ModelSignal<boolean>;
|
|
27
30
|
private readonly typed;
|
|
31
|
+
protected readonly cva: _xui_core_forms.XValueAccessor<XuiDateRange<T> | null>;
|
|
32
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
28
33
|
protected readonly computedClass: _angular_core.Signal<string>;
|
|
29
34
|
protected readonly groupClass: _angular_core.Signal<string>;
|
|
30
35
|
protected readonly fieldClass: _angular_core.Signal<string>;
|
|
31
36
|
protected displayValue(boundary: Boundary): string;
|
|
32
37
|
protected onType(boundary: Boundary, event: Event): void;
|
|
38
|
+
protected onBlur(boundary: Boundary): void;
|
|
39
|
+
protected onOpenChange(open: boolean): void;
|
|
33
40
|
protected commitTyped(boundary: Boundary): void;
|
|
34
41
|
protected onPick(range: XuiDateRange<T>): void;
|
|
42
|
+
/** The single write path for user edits — typed boundaries or a calendar pick. */
|
|
35
43
|
private commit;
|
|
44
|
+
readonly writeValue: (value: XuiDateRange<T> | null) => void;
|
|
45
|
+
readonly registerOnChange: (fn: _xui_core_forms.XChangeFn<XuiDateRange<T> | null>) => void;
|
|
46
|
+
readonly registerOnTouched: (fn: _xui_core_forms.XTouchFn) => void;
|
|
47
|
+
readonly setDisabledState: (isDisabled: boolean) => void;
|
|
36
48
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiDateRangeInput<any>, never>;
|
|
37
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiDateRangeInput<any>, "xui-date-range-input", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "
|
|
49
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiDateRangeInput<any>, "xui-date-range-input", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "allowSingleDayRange": { "alias": "allowSingleDayRange"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "startPlaceholder": { "alias": "startPlaceholder"; "required": false; "isSignal": true; }; "endPlaceholder": { "alias": "endPlaceholder"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "formatDate": { "alias": "formatDate"; "required": false; "isSignal": true; }; "parseDate": { "alias": "parseDate"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "open": "openChange"; }, never, never, true, never>;
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
declare const XuiDateRangeInputImports: readonly [typeof XuiDateRangeInput];
|