@xui/form-field 2.0.0-alpha.8 → 2.1.0-alpha.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Rikarin
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,162 +1,203 @@
1
- <p style="font-size: 5rem; font-weight: 700; text-align: center">
2
- <span style="color: #1f75cb">x</span>UI
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
- ![Build Status](https://github.com/rikarin/xui/actions/workflows/publish.yaml/badge.svg?branch=develop)
8
- [![Demo](https://img.shields.io/badge/demo-online-ed1c46)](https://xuijs.org/)
9
- [![npm](https://img.shields.io/npm/v/%40xui/core.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/org/xui)
10
- [![License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](/LICENSE)
11
- [![Netlify Status](https://api.netlify.com/api/v1/badges/fa0cfd14-97df-47fa-8a7c-152e6d4cfda2/deploy-status)](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.
27
+
28
+ ```ts
29
+ import { XuiButtonImports } from '@xui/button';
12
30
 
13
- xUI is a customizable Angular 20 UI Library with full support of TailwindCSS styling based on popular React library ShardCN and its Angular alternative SpartanUI.
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
- - **35+ High-Quality Angular Components:** Ready to use out of the box.
18
- - **Powerful Theme Customization:** Detailed customization options with default themes.
19
- - **High Performance:** Supports Zoneless, OnPush mode, and Signals for optimized performance.
20
- - **Accessibility:** Supports WCAG 2.0 standards.
21
- - **Powerful Theme Customization:** Install each visual component and customize it according your needs
22
- - **TypeScript:** Written with predictable static types.
23
-
24
- ## Table of Contents
25
-
26
- - [Storybook](https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark)
27
- - [StackBlitz Demo](https://stackblitz.com/fork/xui)
28
- - [Documentation](https://xuijs.org)
29
- - [Live Demo](https://cord.dj/r)
30
- - [Packages](#packages)
31
- - [Installation](#installation)
32
- - [Browser Support](#browser-support)
33
- - [Development](#development)
34
- - [Issues](#issues)
35
- - [Roadmap](#roadmap)
36
-
37
- ## Packages
38
-
39
- | Package | Usage | Description |
40
- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
41
- | Core | [![Downloads](https://img.shields.io/npm/dt/%40xui/core.svg)](https://www.npmjs.com/package/%40xui/core)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/core.svg)](https://www.npmjs.com/package/%40xui/core)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/core)](https://bundlephobia.com/result?p=%40xui/core) | Core package required by all other packages |
42
- | Badge | [![Downloads](https://img.shields.io/npm/dt/%40xui/badge.svg)](https://www.npmjs.com/package/%40xui/badge)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/badge.svg)](https://www.npmjs.com/package/%40xui/badge)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/badge)](https://bundlephobia.com/result?p=%40xui/badge) | Badge component |
43
- | Breadcrumb | [![Downloads](https://img.shields.io/npm/dt/%40xui/breadcrumb.svg)](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/breadcrumb.svg)](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/breadcrumb)](https://bundlephobia.com/result?p=%40xui/breadcrumb) | Breadcrumb component |
44
- | Button | [![Downloads](https://img.shields.io/npm/dt/%40xui/button.svg)](https://www.npmjs.com/package/%40xui/button)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/button.svg)](https://www.npmjs.com/package/%40xui/button)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/button)](https://bundlephobia.com/result?p=%40xui/button) | Button component |
45
- | Button Group | [![Downloads](https://img.shields.io/npm/dt/%40xui/button-group.svg)](https://www.npmjs.com/package/%40xui/button-group)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/button-group.svg)](https://www.npmjs.com/package/%40xui/button-group)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/button-group)](https://bundlephobia.com/result?p=%40xui/button-group) | Button Group component |
46
- | Checkbox | [![Downloads](https://img.shields.io/npm/dt/%40xui/checkbox.svg)](https://www.npmjs.com/package/%40xui/checkbox)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/checkbox.svg)](https://www.npmjs.com/package/%40xui/checkbox)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/checkbox)](https://bundlephobia.com/result?p=%40xui/checkbox) | Checkbox component |
47
- | Form Field | [![Downloads](https://img.shields.io/npm/dt/%40xui/form-field.svg)](https://www.npmjs.com/package/%40xui/form-field)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/form-field.svg)](https://www.npmjs.com/package/%40xui/form-field)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/form-field)](https://bundlephobia.com/result?p=%40xui/form-field) | Form Field component |
48
- | Icon | [![Downloads](https://img.shields.io/npm/dt/%40xui/icon.svg)](https://www.npmjs.com/package/%40xui/icon)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/icon.svg)](https://www.npmjs.com/package/%40xui/icon)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/icon)](https://bundlephobia.com/result?p=%40xui/icon) | Icon component |
49
- | Input | [![Downloads](https://img.shields.io/npm/dt/%40xui/input.svg)](https://www.npmjs.com/package/%40xui/input)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/input.svg)](https://www.npmjs.com/package/%40xui/input)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/input)](https://bundlephobia.com/result?p=%40xui/input) | Input component |
50
- | Label | [![Downloads](https://img.shields.io/npm/dt/%40xui/label.svg)](https://www.npmjs.com/package/%40xui/label)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/label.svg)](https://www.npmjs.com/package/%40xui/label)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/label)](https://bundlephobia.com/result?p=%40xui/label) | Label component |
51
- | Skeleton | [![Downloads](https://img.shields.io/npm/dt/%40xui/skeleton.svg)](https://www.npmjs.com/package/%40xui/skeleton)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/skeleton.svg)](https://www.npmjs.com/package/%40xui/skeleton)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/skeleton)](https://bundlephobia.com/result?p=%40xui/skeleton) | Skeleton component |
52
- | Sonner | [![Downloads](https://img.shields.io/npm/dt/%40xui/sonner.svg)](https://www.npmjs.com/package/%40xui/sonner)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/sonner.svg)](https://www.npmjs.com/package/%40xui/sonner)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/sonner)](https://bundlephobia.com/result?p=%40xui/sonner) | Sonner component |
53
- | Status | [![Downloads](https://img.shields.io/npm/dt/%40xui/status.svg)](https://www.npmjs.com/package/%40xui/status)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/status.svg)](https://www.npmjs.com/package/%40xui/status)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/status)](https://bundlephobia.com/result?p=%40xui/status) | Status component |
54
- | Table | [![Downloads](https://img.shields.io/npm/dt/%40xui/table.svg)](https://www.npmjs.com/package/%40xui/table)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/table.svg)](https://www.npmjs.com/package/%40xui/table)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/table)](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
59
64
 
60
65
  ```bash
61
- pnpm i @xui/core ....
66
+ ng add @xui/core
62
67
  ```
63
68
 
64
- ## Browser Support
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.
65
73
 
66
- xUI Supports most recent browsers according to Angular [support](https://angular.io/guide/browser-support).
74
+ Then add the components you need:
67
75
 
68
- ## Development
76
+ ```bash
77
+ pnpm add @xui/button @xui/dialog @xui/icon
78
+ ```
69
79
 
70
- The project uses `NX` and `Angular` to build the package.
80
+ ## Theming
71
81
 
72
- To start docs page use
82
+ To wire the styles by hand, import the token layer once after Tailwind:
73
83
 
74
- ```bash
75
- pnpm start
84
+ ```css
85
+ @import 'tailwindcss';
86
+ @import '@xui/core/styles/theme.css';
87
+
88
+ /* Only needed for an overlay surface — popover, tooltip, menu, dialog, drawer
89
+ or toast. Without it, overlays render in the document flow. */
90
+ @import '@angular/cdk/overlay-prebuilt.css';
91
+
92
+ /* Tailwind only emits utilities it can see, and it cannot see node_modules by default. */
93
+ @source '../node_modules/@xui';
94
+ ```
95
+
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.
99
+
100
+ Re-theme by overriding tokens after the import. The `darker` / `lighter` / `subtle` / `muted` /
101
+ `emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
102
+
103
+ ```css
104
+ :root {
105
+ --primary: var(--color-violet-600);
106
+ --surface-inset: var(--color-zinc-50);
107
+ }
108
+ ```
109
+
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.
112
+
113
+ The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
114
+
115
+ ## Components
116
+
117
+ <details>
118
+ <summary><strong>All 90 packages</strong>, grouped as they appear in Storybook</summary>
119
+
120
+ <br />
121
+
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)
123
+
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)
125
+
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)
127
+
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/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>
143
+
144
+ ## AI coding agents
145
+
146
+ Two pieces of tooling teach coding agents how to build with xUI.
147
+
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.
152
+
153
+ ```json
154
+ {
155
+ "mcpServers": {
156
+ "xui": { "command": "npx", "args": ["-y", "@xui/mcp"] }
157
+ }
158
+ }
76
159
  ```
77
160
 
78
- To start storybook use
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.
163
+
164
+ **Skill** — [`skills/xui`](skills/xui/SKILL.md) is the procedural knowledge: the three-layer
165
+ architecture, discovery through the MCP server, composition and styling rules, theming, the
166
+ generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
167
+ links to it for agents working in this repository.
168
+
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.
79
177
 
80
178
  ```bash
81
- pnpm storybook
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
82
186
  ```
83
187
 
84
- ## Issues
85
-
86
- If you find any issues in the library or have and idea for an improvement feel free to open an [issue](https://github.com/Rikarin/xui/issues).
87
-
88
- ## Roadmap
89
-
90
- - [ ] Accordion
91
- - [ ] Alert
92
- - [ ] Alert Dialog
93
- - [ ] Avatar
94
- - [ ] Calendar
95
- - [ ] Card
96
- - [ ] Carousel
97
- - [ ] Collapsible
98
- - [ ] Combobox
99
- - [ ] Command
100
- - [ ] Date Picker
101
- - [ ] Date Range Picker
102
- - [ ] Dialog
103
- - [ ] Hover Card
104
- - [ ] Menu
105
- - [ ] Pagination
106
- - [ ] Popover
107
- - [ ] Progress
108
- - [ ] Radio Group
109
- - [ ] Scroll Area
110
- - [ ] Select
111
- - [ ] Separator
112
- - [ ] Sheet
113
- - [ ] Slider
114
- - [ ] Spinner
115
- - [ ] Switch
116
- - [ ] Tabs
117
- - [ ] Toggle
118
- - [ ] Tooltip
119
- - [ ] Typography
120
- - [ ] Input OTP
121
- - [ ] Toggle Group
122
-
123
- ### Additional
124
-
125
- - [ ] Decagram
126
- - [ ] Settings
127
- - [ ] Drawer
128
- - [ ] Panel Bar
129
- - [ ] Textarea
130
- - [ ] Time Picker
131
- - [ ] Image Upload
132
- - [ ] Banner
133
- - [ ] Snack bar
134
-
135
- ## Opinionated "components"
136
-
137
- - [ ] Graph View (Nodes)
138
- - [ ] Analysis
139
- - [ ] Charts (NG Charts?)
140
-
141
- ## CLI
142
-
143
- Make cli to install the components
144
-
145
- ## TODO
146
-
147
- - Button
148
-
149
- - Icon
150
- - Shine
151
-
152
- - Breadcrumb
153
-
154
- - fix styling issues
155
- - on hover stuff
156
- - data driven component
157
-
158
- - Sonner
159
-
160
- - Colors
161
-
162
- - adjust generator to generate stories into the apps/storybook
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).
@@ -1,104 +1,274 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ChangeDetectionStrategy, Component, contentChild, contentChildren, computed, effect, NgModule } from '@angular/core';
2
+ import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, contentChild, ElementRef, contentChildren, booleanAttribute, effect } from '@angular/core';
3
+ import { xui, createXConfigToken } from '@xui/core';
3
4
  import { XFormFieldControl } from '@xui/core/form-field';
5
+ import { cva } from 'class-variance-authority';
4
6
 
5
- class XuiErrorComponent {
6
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: XuiErrorComponent, isStandalone: true, selector: "xui-error", host: { classAttribute: "block text-error text-sm font-medium" }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
7
+ /**
8
+ * A validation message for the control in a `xui-form-field`.
9
+ *
10
+ * ```html
11
+ * <xui-error>Enter a valid address.</xui-error>
12
+ * ```
13
+ *
14
+ * Project it into the field and it replaces the hint and helper text — but only while the control's
15
+ * error state is actually set, so it can be written unconditionally and needs no `@if`.
16
+ */
17
+ class XuiError {
18
+ /** Extra classes, merged into the component's own rather than replacing them. */
19
+ class = input('', /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
21
+ computedClass = computed(() => xui('block text-error text-sm font-medium', this.class()), /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
23
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiError, deps: [], target: i0.ɵɵFactoryTarget.Component });
24
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: XuiError, isStandalone: true, selector: "xui-error", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
8
25
  }
9
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiErrorComponent, decorators: [{
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiError, decorators: [{
10
27
  type: Component,
11
28
  args: [{
12
29
  selector: 'xui-error',
13
30
  changeDetection: ChangeDetectionStrategy.OnPush,
31
+ encapsulation: ViewEncapsulation.None,
14
32
  template: '<ng-content />',
15
33
  host: {
16
- class: 'block text-error text-sm font-medium'
34
+ '[class]': 'computedClass()'
17
35
  }
18
36
  }]
19
- }] });
37
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
38
+
39
+ const [injectXuiFormFieldConfig, provideXuiFormFieldConfig] = createXConfigToken('XuiFormFieldConfig', {
40
+ color: 'none',
41
+ inline: false
42
+ });
20
43
 
21
- class XuiFormFieldComponent {
22
- control = contentChild(XFormFieldControl);
23
- errorChildren = contentChildren(XuiErrorComponent);
24
- hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint');
44
+ let nextId = 0;
45
+ const formFieldRootVariants = cva('', {
46
+ variants: {
47
+ inline: {
48
+ false: 'block space-y-2',
49
+ true: 'flex items-baseline gap-3'
50
+ }
51
+ },
52
+ defaultVariants: { inline: false }
53
+ });
54
+ /** `color` tints the label and helper text with a deliberate accent. */
55
+ const formFieldColorText = cva('', {
56
+ variants: {
57
+ color: {
58
+ none: '',
59
+ primary: 'text-primary',
60
+ success: 'text-success',
61
+ warning: 'text-warning',
62
+ error: 'text-error'
63
+ }
64
+ },
65
+ defaultVariants: { color: 'none' }
66
+ });
67
+ /**
68
+ * Wraps a control with its label, helper text and validation message, and wires the three together.
69
+ *
70
+ * ```html
71
+ * <xui-form-field label="Email" labelInfo="(required)" helperText="We never share it.">
72
+ * <input xuiInput [formControl]="email" />
73
+ * <xui-error>Enter a valid address.</xui-error>
74
+ * </xui-form-field>
75
+ * ```
76
+ *
77
+ * It finds the projected control through `XFormFieldControl`, so any xUI control registered under that
78
+ * token works — input, textarea, select, numeric-input, file-input, html-select. The `<label for>` is
79
+ * pointed at the real focusable element (the control's `controlId` when it wraps an inner input, else
80
+ * its host, which the field gives an id if it has none), and the projected `xui-error` replaces the
81
+ * hint only while the control actually reports an error. Throws if it contains no control.
82
+ */
83
+ class XuiFormField {
84
+ config = injectXuiFormFieldConfig();
85
+ /** The projected control, found through `XFormFieldControl`. Read-only; the field throws if there is none. */
86
+ control = contentChild(XFormFieldControl, /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
88
+ controlEl = contentChild(XFormFieldControl, { ...(ngDevMode ? { debugName: "controlEl" } : /* istanbul ignore next */ {}), read: ElementRef });
89
+ /** The projected `xui-error` messages. Shown in place of the hint while the control reports an error. */
90
+ errorChildren = contentChildren(XuiError, /* @ts-ignore */
91
+ ...(ngDevMode ? [{ debugName: "errorChildren" }] : /* istanbul ignore next */ []));
92
+ /** Extra classes, merged into the component's own rather than replacing them. */
93
+ class = input('', /* @ts-ignore */
94
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
95
+ /** The primary label rendered above (or beside, when `inline`) the control. */
96
+ label = input('', /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
98
+ /** Secondary text shown next to the label, e.g. "(optional)". */
99
+ labelInfo = input('', /* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "labelInfo" }] : /* istanbul ignore next */ []));
101
+ /** A smaller description under the label. */
102
+ subLabel = input('', /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "subLabel" }] : /* istanbul ignore next */ []));
104
+ /** Muted helper text under the control, hidden while an error is shown. */
105
+ helperText = input('', /* @ts-ignore */
106
+ ...(ngDevMode ? [{ debugName: "helperText" }] : /* istanbul ignore next */ []));
107
+ /** A deliberate accent for the label and helper text. */
108
+ color = input(this.config.color, /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
110
+ /** Lay the label beside the control rather than above it. */
111
+ inline = input(this.config.inline, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
112
+ generatedId = `xui-form-field-${nextId++}`;
113
+ computedClass = computed(() => xui(formFieldRootVariants({ inline: this.inline() }), this.class()), /* @ts-ignore */
114
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
115
+ labelClass = computed(() => xui('text-foreground block text-sm font-medium', formFieldColorText({ color: this.color() })), /* @ts-ignore */
116
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
117
+ helperClass = computed(() => xui('block text-sm text-foreground-subtle', formFieldColorText({ color: this.color() })), /* @ts-ignore */
118
+ ...(ngDevMode ? [{ debugName: "helperClass" }] : /* istanbul ignore next */ []));
119
+ /**
120
+ * The id the `<label>` points at — the control's declared `controlId` when it
121
+ * has one (the focusable element inside a wrapping component), else the host
122
+ * element's own id, else the id we assign below. The fallback branches agree
123
+ * with the effect's assignment.
124
+ */
125
+ labelFor = computed(() => {
126
+ if (!this.label()) {
127
+ return null;
128
+ }
129
+ const providedId = this.control()?.controlId?.();
130
+ if (providedId) {
131
+ return providedId;
132
+ }
133
+ const el = this.controlEl()?.nativeElement;
134
+ return el?.id || this.generatedId;
135
+ }, /* @ts-ignore */
136
+ ...(ngDevMode ? [{ debugName: "labelFor" }] : /* istanbul ignore next */ []));
137
+ hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint', /* @ts-ignore */
138
+ ...(ngDevMode ? [{ debugName: "hasDisplayedMessage" }] : /* istanbul ignore next */ []));
25
139
  constructor() {
26
140
  effect(() => {
27
141
  if (!this.control()) {
28
142
  throw new Error('xui-form-field must contain an XFormFieldControl.');
29
143
  }
30
144
  });
145
+ // Give the projected control our generated id (unless it already has one, or
146
+ // it points the label at an inner element via `controlId`) so the rendered
147
+ // <label for> genuinely points at it.
148
+ effect(() => {
149
+ const el = this.controlEl()?.nativeElement;
150
+ if (this.label() && el && !el.id && !this.control()?.controlId?.()) {
151
+ el.id = this.generatedId;
152
+ }
153
+ });
154
+ }
155
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiFormField, deps: [], target: i0.ɵɵFactoryTarget.Component });
156
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiFormField, isStandalone: true, selector: "xui-form-field", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelInfo: { classPropertyName: "labelInfo", publicName: "labelInfo", isSignal: true, isRequired: false, transformFunction: null }, subLabel: { classPropertyName: "subLabel", publicName: "subLabel", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, queries: [{ propertyName: "control", first: true, predicate: XFormFieldControl, descendants: true, isSignal: true }, { propertyName: "controlEl", first: true, predicate: XFormFieldControl, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "errorChildren", predicate: XuiError, isSignal: true }], ngImport: i0, template: `
157
+ @if (label() || subLabel()) {
158
+ <div [class]="inline() ? 'shrink-0' : ''">
159
+ @if (label()) {
160
+ <label [attr.for]="labelFor()" [class]="labelClass()">
161
+ {{ label() }}
162
+ @if (labelInfo()) {
163
+ <span class="text-foreground-subtle font-normal">{{ labelInfo() }}</span>
164
+ }
165
+ </label>
166
+ }
167
+ @if (subLabel()) {
168
+ <span class="text-foreground-muted block text-xs">{{ subLabel() }}</span>
169
+ }
170
+ </div>
31
171
  }
32
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
33
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.3", type: XuiFormFieldComponent, isStandalone: true, selector: "xui-form-field", host: { classAttribute: "block space-y-2" }, queries: [{ propertyName: "control", first: true, predicate: XFormFieldControl, descendants: true, isSignal: true }, { propertyName: "errorChildren", predicate: XuiErrorComponent, isSignal: true }], ngImport: i0, template: `
34
- <ng-content />
35
172
 
36
- @switch (hasDisplayedMessage()) {
37
- @case ('error') {
38
- <ng-content select="xui-error" />
39
- }
40
- @default {
41
- <ng-content select="xui-hint" />
173
+ <div [class]="inline() ? 'flex-1 space-y-1.5' : 'space-y-1.5'">
174
+ <ng-content />
175
+
176
+ @switch (hasDisplayedMessage()) {
177
+ @case ('error') {
178
+ <ng-content select="xui-error" />
179
+ }
180
+ @default {
181
+ <ng-content select="xui-hint" />
182
+ @if (helperText()) {
183
+ <span [class]="helperClass()">{{ helperText() }}</span>
184
+ }
185
+ }
42
186
  }
43
- }
44
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
187
+ </div>
188
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
45
189
  }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldComponent, decorators: [{
190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiFormField, decorators: [{
47
191
  type: Component,
48
192
  args: [{
49
193
  selector: 'xui-form-field',
50
194
  changeDetection: ChangeDetectionStrategy.OnPush,
195
+ encapsulation: ViewEncapsulation.None,
51
196
  template: `
52
- <ng-content />
197
+ @if (label() || subLabel()) {
198
+ <div [class]="inline() ? 'shrink-0' : ''">
199
+ @if (label()) {
200
+ <label [attr.for]="labelFor()" [class]="labelClass()">
201
+ {{ label() }}
202
+ @if (labelInfo()) {
203
+ <span class="text-foreground-subtle font-normal">{{ labelInfo() }}</span>
204
+ }
205
+ </label>
206
+ }
207
+ @if (subLabel()) {
208
+ <span class="text-foreground-muted block text-xs">{{ subLabel() }}</span>
209
+ }
210
+ </div>
211
+ }
53
212
 
54
- @switch (hasDisplayedMessage()) {
55
- @case ('error') {
56
- <ng-content select="xui-error" />
57
- }
58
- @default {
59
- <ng-content select="xui-hint" />
213
+ <div [class]="inline() ? 'flex-1 space-y-1.5' : 'space-y-1.5'">
214
+ <ng-content />
215
+
216
+ @switch (hasDisplayedMessage()) {
217
+ @case ('error') {
218
+ <ng-content select="xui-error" />
219
+ }
220
+ @default {
221
+ <ng-content select="xui-hint" />
222
+ @if (helperText()) {
223
+ <span [class]="helperClass()">{{ helperText() }}</span>
224
+ }
225
+ }
60
226
  }
61
- }
227
+ </div>
62
228
  `,
63
229
  host: {
64
- class: 'block space-y-2'
230
+ '[class]': 'computedClass()'
65
231
  }
66
232
  }]
67
- }], ctorParameters: () => [] });
233
+ }], ctorParameters: () => [], propDecorators: { control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => XFormFieldControl), { isSignal: true }] }], controlEl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => XFormFieldControl), { ...{ read: ElementRef }, isSignal: true }] }], errorChildren: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XuiError), { isSignal: true }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelInfo", required: false }] }], subLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "subLabel", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }] } });
68
234
 
69
- class XuiHintComponent {
70
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
71
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: XuiHintComponent, isStandalone: true, selector: "xui-hint", host: { classAttribute: "block text-sm text-foreground/50" }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
235
+ /**
236
+ * Supporting text under the control in a `xui-form-field`.
237
+ *
238
+ * ```html
239
+ * <xui-hint>Use the address you signed up with.</xui-hint>
240
+ * ```
241
+ *
242
+ * The projected form of the field's `helperText` input, for hints that need markup rather than a plain
243
+ * string. Hidden while a `xui-error` is showing.
244
+ */
245
+ class XuiHint {
246
+ /** Extra classes, merged into the component's own rather than replacing them. */
247
+ class = input('', /* @ts-ignore */
248
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
249
+ computedClass = computed(() => xui('block text-sm text-foreground-subtle', this.class()), /* @ts-ignore */
250
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
251
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiHint, deps: [], target: i0.ɵɵFactoryTarget.Component });
252
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: XuiHint, isStandalone: true, selector: "xui-hint", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
72
253
  }
73
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiHintComponent, decorators: [{
254
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiHint, decorators: [{
74
255
  type: Component,
75
256
  args: [{
76
257
  selector: 'xui-hint',
77
258
  changeDetection: ChangeDetectionStrategy.OnPush,
259
+ encapsulation: ViewEncapsulation.None,
78
260
  template: '<ng-content />',
79
261
  host: {
80
- class: 'block text-sm text-foreground/50'
262
+ '[class]': 'computedClass()'
81
263
  }
82
264
  }]
83
- }] });
265
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
84
266
 
85
- const XuiFormFieldImports = [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent];
86
- class XuiFormFieldModule {
87
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
88
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldModule, imports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent], exports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent] });
89
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldModule });
90
- }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: XuiFormFieldModule, decorators: [{
92
- type: NgModule,
93
- args: [{
94
- imports: [...XuiFormFieldImports],
95
- exports: [...XuiFormFieldImports]
96
- }]
97
- }] });
267
+ const XuiFormFieldImports = [XuiFormField, XuiError, XuiHint];
98
268
 
99
269
  /**
100
270
  * Generated bundle index. Do not edit.
101
271
  */
102
272
 
103
- export { XuiErrorComponent, XuiFormFieldComponent, XuiFormFieldImports, XuiFormFieldModule, XuiHintComponent };
273
+ export { XuiError, XuiFormField, XuiFormFieldImports, XuiHint, formFieldColorText, formFieldRootVariants, injectXuiFormFieldConfig, provideXuiFormFieldConfig };
104
274
  //# sourceMappingURL=xui-form-field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"xui-form-field.mjs","sources":["../tmp-esm2022/lib/error.component.js","../tmp-esm2022/lib/form-field.component.js","../tmp-esm2022/lib/hint.component.js","../tmp-esm2022/index.js","../tmp-esm2022/xui-form-field.js"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nexport class XuiErrorComponent {\n /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });\n /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"20.0.3\", type: XuiErrorComponent, isStandalone: true, selector: \"xui-error\", host: { classAttribute: \"block text-error text-sm font-medium\" }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiErrorComponent, decorators: [{\n type: Component,\n args: [{\n selector: 'xui-error',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '<ng-content />',\n host: {\n class: 'block text-error text-sm font-medium'\n }\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3IuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy91aS9mb3JtLWZpZWxkL3h1aS9zcmMvbGliL2Vycm9yLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQVVuRSxNQUFNLE9BQU8saUJBQWlCOzBIQUFqQixpQkFBaUI7OEdBQWpCLGlCQUFpQix1SUFMbEIsZ0JBQWdCOzsyRkFLZixpQkFBaUI7a0JBUjdCLFNBQVM7bUJBQUM7b0JBQ1QsUUFBUSxFQUFFLFdBQVc7b0JBQ3JCLGVBQWUsRUFBRSx1QkFBdUIsQ0FBQyxNQUFNO29CQUMvQyxRQUFRLEVBQUUsZ0JBQWdCO29CQUMxQixJQUFJLEVBQUU7d0JBQ0osS0FBSyxFQUFFLHNDQUFzQztxQkFDOUM7aUJBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDaGFuZ2VEZXRlY3Rpb25TdHJhdGVneSwgQ29tcG9uZW50IH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBDb21wb25lbnQoe1xuICBzZWxlY3RvcjogJ3h1aS1lcnJvcicsXG4gIGNoYW5nZURldGVjdGlvbjogQ2hhbmdlRGV0ZWN0aW9uU3RyYXRlZ3kuT25QdXNoLFxuICB0ZW1wbGF0ZTogJzxuZy1jb250ZW50IC8+JyxcbiAgaG9zdDoge1xuICAgIGNsYXNzOiAnYmxvY2sgdGV4dC1lcnJvciB0ZXh0LXNtIGZvbnQtbWVkaXVtJ1xuICB9XG59KVxuZXhwb3J0IGNsYXNzIFh1aUVycm9yQ29tcG9uZW50IHt9XG4iXX0=","import { ChangeDetectionStrategy, Component, computed, contentChild, contentChildren, effect } from '@angular/core';\nimport { XFormFieldControl } from '@xui/core/form-field';\nimport { XuiErrorComponent } from './error.component';\nimport * as i0 from \"@angular/core\";\nexport class XuiFormFieldComponent {\n control = contentChild(XFormFieldControl);\n errorChildren = contentChildren(XuiErrorComponent);\n hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint');\n constructor() {\n effect(() => {\n if (!this.control()) {\n throw new Error('xui-form-field must contain an XFormFieldControl.');\n }\n });\n }\n /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });\n /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"17.0.0\", version: \"20.0.3\", type: XuiFormFieldComponent, isStandalone: true, selector: \"xui-form-field\", host: { classAttribute: \"block space-y-2\" }, queries: [{ propertyName: \"control\", first: true, predicate: XFormFieldControl, descendants: true, isSignal: true }, { propertyName: \"errorChildren\", predicate: XuiErrorComponent, isSignal: true }], ngImport: i0, template: `\n <ng-content />\n\n @switch (hasDisplayedMessage()) {\n @case ('error') {\n <ng-content select=\"xui-error\" />\n }\n @default {\n <ng-content select=\"xui-hint\" />\n }\n }\n `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldComponent, decorators: [{\n type: Component,\n args: [{\n selector: 'xui-form-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <ng-content />\n\n @switch (hasDisplayedMessage()) {\n @case ('error') {\n <ng-content select=\"xui-error\" />\n }\n @default {\n <ng-content select=\"xui-hint\" />\n }\n }\n `,\n host: {\n class: 'block space-y-2'\n }\n }]\n }], ctorParameters: () => [] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1maWVsZC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL3VpL2Zvcm0tZmllbGQveHVpL3NyYy9saWIvZm9ybS1maWVsZC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHVCQUF1QixFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsWUFBWSxFQUFFLGVBQWUsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDcEgsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDekQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sbUJB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lxuICAgIHRoaXMuZXJyb3JDaGlsZHJlbigpICYmIHRoaXMuZXJyb3JDaGlsZHJlbigpLmxlbmd0aCA+IDAgJiYgdGhpcy5jb250cm9sKCk/LmVycm9yU3RhdGUoKSA/ICdlcnJvcicgOiAnaGludCdcbiAgKTtcblxuICBjb25zdHJ1Y3RvcigpIHtcbiAgICBlZmZlY3QoKCkgPT4ge1xuICAgICAgaWYgKCF0aGlzLmNvbnRyb2woKSkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3h1aS1mb3JtLWZpZWxkIG11c3QgY29udGFpbiBhbiBYRm9ybUZpZWxkQ29udHJvbC4nKTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuIl19","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nexport class XuiHintComponent {\n /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });\n /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"20.0.3\", type: XuiHintComponent, isStandalone: true, selector: \"xui-hint\", host: { classAttribute: \"block text-sm text-foreground/50\" }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiHintComponent, decorators: [{\n type: Component,\n args: [{\n selector: 'xui-hint',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '<ng-content />',\n host: {\n class: 'block text-sm text-foreground/50'\n }\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGludC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL3VpL2Zvcm0tZmllbGQveHVpL3NyYy9saWIvaGludC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHVCQUF1QixFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFVbkUsTUFBTSxPQUFPLGdCQUFnQjswSEFBaEIsZ0JBQWdCOzhHQUFoQixnQkFBZ0Isa0lBTGpCLGdCQUFnQjs7MkZBS2YsZ0JBQWdCO2tCQVI1QixTQUFTO21CQUFDO29CQUNULFFBQVEsRUFBRSxVQUFVO29CQUNwQixlQUFlLEVBQUUsdUJBQXVCLENBQUMsTUFBTTtvQkFDL0MsUUFBUSxFQUFFLGdCQUFnQjtvQkFDMUIsSUFBSSxFQUFFO3dCQUNKLEtBQUssRUFBRSxrQ0FBa0M7cUJBQzFDO2lCQUNGIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ2hhbmdlRGV0ZWN0aW9uU3RyYXRlZ3ksIENvbXBvbmVudCB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5AQ29tcG9uZW50KHtcbiAgc2VsZWN0b3I6ICd4dWktaGludCcsXG4gIGNoYW5nZURldGVjdGlvbjogQ2hhbmdlRGV0ZWN0aW9uU3RyYXRlZ3kuT25QdXNoLFxuICB0ZW1wbGF0ZTogJzxuZy1jb250ZW50IC8+JyxcbiAgaG9zdDoge1xuICAgIGNsYXNzOiAnYmxvY2sgdGV4dC1zbSB0ZXh0LWZvcmVncm91bmQvNTAnXG4gIH1cbn0pXG5leHBvcnQgY2xhc3MgWHVpSGludENvbXBvbmVudCB7fVxuIl19","import { NgModule } from '@angular/core';\nimport { XuiErrorComponent } from './lib/error.component';\nimport { XuiFormFieldComponent } from './lib/form-field.component';\nimport { XuiHintComponent } from './lib/hint.component';\nimport * as i0 from \"@angular/core\";\nexport * from './lib/error.component';\nexport * from './lib/form-field.component';\nexport * from './lib/hint.component';\nexport const XuiFormFieldImports = [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent];\nexport class XuiFormFieldModule {\n /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });\n /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldModule, imports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent], exports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent] });\n /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldModule });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.0.3\", ngImport: i0, type: XuiFormFieldModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [...XuiFormFieldImports],\n exports: [...XuiFormFieldImports]\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL3VpL2Zvcm0tZmllbGQveHVpL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQzFELE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQ25FLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDOztBQUN4RCxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsNEJBQTRCLEN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JDb21wb25lbnQsIFh1aUhpbnRDb21wb25lbnRdIGFzIGNvbnN0O1xuXG5ATmdNb2R1bGUoe1xuICBpbXBvcnRzOiBbLi4uWHVpRm9ybUZpZWxkSW1wb3J0c10sXG4gIGV4cG9ydHM6IFsuLi5YdWlGb3JtRmllbGRJbXBvcnRzXVxufSlcbmV4cG9ydCBjbGFzcyBYdWlGb3JtRmllbGRNb2R1bGUge31cbiJdfQ==","/**\n * Generated bundle index. Do not edit.\n */\nexport * from './index';\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieHVpLWZvcm0tZmllbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL3VpL2Zvcm0tZmllbGQveHVpL3NyYy94dWktZm9ybS1maWVsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ=="],"names":[],"mappings":";;;;AAEO,MAAM,iBAAiB,CAAC;AAC/B,uBAAuB,OAAO,IAAI,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;AAC9L,uBAAuB,OAAO,IAAI,GAAG,EAAE,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,Q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AS,CAAC,EAAE,CAAC;;ACpBb;AACA;AACA;;;;"}
1
+ {"version":3,"file":"xui-form-field.mjs","sources":["../../../../../../libs/ui/form-field/xui/src/lib/error.ts","../../../../../../libs/ui/form-field/xui/src/lib/form-field.token.ts","../../../../../../libs/ui/form-field/xui/src/lib/form-field.ts","../../../../../../libs/ui/form-field/xui/src/lib/hint.ts","../../../../../../libs/ui/form-field/xui/src/index.ts","../../../../../../libs/ui/form-field/xui/src/xui-form-field.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation } from '@angular/core';\nimport { xui } from '@xui/core';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A validation message for the control in a `xui-form-field`.\n *\n * ```html\n * <xui-error>Enter a valid address.</xui-error>\n * ```\n *\n * Project it into the field and it replaces the hint and helper text — but only while the control's\n * error state is actually set, so it can be written unconditionally and needs no `@if`.\n */\n@Component({\n selector: 'xui-error',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: '<ng-content />',\n host: {\n '[class]': 'computedClass()'\n }\n})\nexport class XuiError {\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n protected computedClass = computed(() => xui('block text-error text-sm font-medium', this.class()));\n}\n","import { createXConfigToken } from '@xui/core';\nimport { XuiFormFieldColor } from './form-field';\n\nexport interface XuiFormFieldConfig {\n color: XuiFormFieldColor;\n inline: boolean;\n}\n\nexport const [injectXuiFormFieldConfig, provideXuiFormFieldConfig] = createXConfigToken<XuiFormFieldConfig>(\n 'XuiFormFieldConfig',\n {\n color: 'none',\n inline: false\n }\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n contentChildren,\n effect,\n ElementRef,\n input,\n ViewEncapsulation\n} from '@angular/core';\nimport { xui } from '@xui/core';\nimport { XFormFieldControl } from '@xui/core/form-field';\nimport { cva, VariantProps } from 'class-variance-authority';\nimport type { ClassValue } from 'clsx';\nimport { XuiError } from './error';\nimport { injectXuiFormFieldConfig } from './form-field.token';\n\nlet nextId = 0;\n\nexport const formFieldRootVariants = cva('', {\n variants: {\n inline: {\n false: 'block space-y-2',\n true: 'flex items-baseline gap-3'\n }\n },\n defaultVariants: { inline: false }\n});\n\n/** `color` tints the label and helper text with a deliberate accent. */\nexport const formFieldColorText = cva('', {\n variants: {\n color: {\n none: '',\n primary: 'text-primary',\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error'\n }\n },\n defaultVariants: { color: 'none' }\n});\n\nexport type XuiFormFieldColor = NonNullable<VariantProps<typeof formFieldColorText>['color']>;\n\n/**\n * Wraps a control with its label, helper text and validation message, and wires the three together.\n *\n * ```html\n * <xui-form-field label=\"Email\" labelInfo=\"(required)\" helperText=\"We never share it.\">\n * <input xuiInput [formControl]=\"email\" />\n * <xui-error>Enter a valid address.</xui-error>\n * </xui-form-field>\n * ```\n *\n * It finds the projected control through `XFormFieldControl`, so any xUI control registered under that\n * token works — input, textarea, select, numeric-input, file-input, html-select. The `<label for>` is\n * pointed at the real focusable element (the control's `controlId` when it wraps an inner input, else\n * its host, which the field gives an id if it has none), and the projected `xui-error` replaces the\n * hint only while the control actually reports an error. Throws if it contains no control.\n */\n@Component({\n selector: 'xui-form-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: `\n @if (label() || subLabel()) {\n <div [class]=\"inline() ? 'shrink-0' : ''\">\n @if (label()) {\n <label [attr.for]=\"labelFor()\" [class]=\"labelClass()\">\n {{ label() }}\n @if (labelInfo()) {\n <span class=\"text-foreground-subtle font-normal\">{{ labelInfo() }}</span>\n }\n </label>\n }\n @if (subLabel()) {\n <span class=\"text-foreground-muted block text-xs\">{{ subLabel() }}</span>\n }\n </div>\n }\n\n <div [class]=\"inline() ? 'flex-1 space-y-1.5' : 'space-y-1.5'\">\n <ng-content />\n\n @switch (hasDisplayedMessage()) {\n @case ('error') {\n <ng-content select=\"xui-error\" />\n }\n @default {\n <ng-content select=\"xui-hint\" />\n @if (helperText()) {\n <span [class]=\"helperClass()\">{{ helperText() }}</span>\n }\n }\n }\n </div>\n `,\n host: {\n '[class]': 'computedClass()'\n }\n})\nexport class XuiFormField {\n private readonly config = injectXuiFormFieldConfig();\n\n /** The projected control, found through `XFormFieldControl`. Read-only; the field throws if there is none. */\n readonly control = contentChild(XFormFieldControl);\n private readonly controlEl = contentChild(XFormFieldControl, { read: ElementRef });\n /** The projected `xui-error` messages. Shown in place of the hint while the control reports an error. */\n readonly errorChildren = contentChildren(XuiError);\n\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n /** The primary label rendered above (or beside, when `inline`) the control. */\n readonly label = input<string>('');\n\n /** Secondary text shown next to the label, e.g. \"(optional)\". */\n readonly labelInfo = input<string>('');\n\n /** A smaller description under the label. */\n readonly subLabel = input<string>('');\n\n /** Muted helper text under the control, hidden while an error is shown. */\n readonly helperText = input<string>('');\n\n /** A deliberate accent for the label and helper text. */\n readonly color = input<XuiFormFieldColor>(this.config.color);\n\n /** Lay the label beside the control rather than above it. */\n readonly inline = input<boolean, BooleanInput>(this.config.inline, { transform: booleanAttribute });\n\n private readonly generatedId = `xui-form-field-${nextId++}`;\n\n protected readonly computedClass = computed(() =>\n xui(formFieldRootVariants({ inline: this.inline() }), this.class())\n );\n\n protected readonly labelClass = computed(() =>\n xui('text-foreground block text-sm font-medium', formFieldColorText({ color: this.color() }))\n );\n\n protected readonly helperClass = computed(() =>\n xui('block text-sm text-foreground-subtle', formFieldColorText({ color: this.color() }))\n );\n\n /**\n * The id the `<label>` points at — the control's declared `controlId` when it\n * has one (the focusable element inside a wrapping component), else the host\n * element's own id, else the id we assign below. The fallback branches agree\n * with the effect's assignment.\n */\n protected readonly labelFor = computed(() => {\n if (!this.label()) {\n return null;\n }\n\n const providedId = this.control()?.controlId?.();\n\n if (providedId) {\n return providedId;\n }\n\n const el = this.controlEl()?.nativeElement as HTMLElement | undefined;\n return el?.id || this.generatedId;\n });\n\n protected readonly hasDisplayedMessage = computed<'error' | 'hint'>(() =>\n this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint'\n );\n\n constructor() {\n effect(() => {\n if (!this.control()) {\n throw new Error('xui-form-field must contain an XFormFieldControl.');\n }\n });\n\n // Give the projected control our generated id (unless it already has one, or\n // it points the label at an inner element via `controlId`) so the rendered\n // <label for> genuinely points at it.\n effect(() => {\n const el = this.controlEl()?.nativeElement as HTMLElement | undefined;\n if (this.label() && el && !el.id && !this.control()?.controlId?.()) {\n el.id = this.generatedId;\n }\n });\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation } from '@angular/core';\nimport { xui } from '@xui/core';\nimport type { ClassValue } from 'clsx';\n\n/**\n * Supporting text under the control in a `xui-form-field`.\n *\n * ```html\n * <xui-hint>Use the address you signed up with.</xui-hint>\n * ```\n *\n * The projected form of the field's `helperText` input, for hints that need markup rather than a plain\n * string. Hidden while a `xui-error` is showing.\n */\n@Component({\n selector: 'xui-hint',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: '<ng-content />',\n host: {\n '[class]': 'computedClass()'\n }\n})\nexport class XuiHint {\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n protected computedClass = computed(() => xui('block text-sm text-foreground-subtle', this.class()));\n}\n","import { XuiError } from './lib/error';\nimport { XuiFormField } from './lib/form-field';\nimport { XuiHint } from './lib/hint';\nexport * from './lib/error';\nexport * from './lib/form-field';\nexport * from './lib/form-field.token';\nexport * from './lib/hint';\n\nexport const XuiFormFieldImports = [XuiFormField, XuiError, XuiHint] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIA;;;;;;;;;AASG;MAUU,QAAQ,CAAA;;IAEV,KAAK,GAAG,KAAK,CAAa,EAAE;8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a,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ;AACF,iBAAA;;;ACdM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO;;ACRnE;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xui/form-field",
3
- "version": "2.0.0-alpha.8",
4
- "description": "Modern Angular 20 UI Library based on TailwindCSS",
3
+ "version": "2.1.0-alpha.0",
4
+ "description": "Modern Angular 22 UI Library based on TailwindCSS",
5
5
  "keywords": [
6
6
  "angular",
7
7
  "ui",
@@ -13,31 +13,36 @@
13
13
  "url": "https://github.com/rikarin/xui/issues"
14
14
  },
15
15
  "repository": "https://github.com/Rikarin/xui",
16
- "license": "MIT",
17
- "author": "Rene Cincura",
16
+ "license": "Apache-2.0",
17
+ "author": "Jiu",
18
18
  "maintainers": [
19
- "Rene Cincura"
19
+ "Jiu",
20
+ "Rikarin"
20
21
  ],
21
22
  "sideEffects": false,
22
- "peerDependencies": {
23
- "@angular/core": "20",
24
- "@xui/core": "2.0.0-alpha.8"
25
- },
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "module": "fesm2022/xui-form-field.mjs",
30
- "typings": "index.d.ts",
23
+ "type": "module",
31
24
  "exports": {
32
25
  "./package.json": {
33
26
  "default": "./package.json"
34
27
  },
35
28
  ".": {
36
- "types": "./index.d.ts",
29
+ "types": "./types/xui-form-field.d.ts",
37
30
  "default": "./fesm2022/xui-form-field.mjs"
38
31
  }
39
32
  },
33
+ "module": "fesm2022/xui-form-field.mjs",
34
+ "typings": "types/xui-form-field.d.ts",
40
35
  "dependencies": {
41
36
  "tslib": "^2.3.0"
37
+ },
38
+ "peerDependencies": {
39
+ "@angular/cdk": "22",
40
+ "@angular/core": "22",
41
+ "@xui/core": "2.1.0-alpha.0",
42
+ "class-variance-authority": "^0.7.1",
43
+ "clsx": "^2.1.1"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
42
47
  }
43
48
  }
@@ -0,0 +1,116 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ClassValue } from 'clsx';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { BooleanInput } from '@angular/cdk/coercion';
5
+ import { XFormFieldControl } from '@xui/core/form-field';
6
+ import { VariantProps } from 'class-variance-authority';
7
+
8
+ /**
9
+ * A validation message for the control in a `xui-form-field`.
10
+ *
11
+ * ```html
12
+ * <xui-error>Enter a valid address.</xui-error>
13
+ * ```
14
+ *
15
+ * Project it into the field and it replaces the hint and helper text — but only while the control's
16
+ * error state is actually set, so it can be written unconditionally and needs no `@if`.
17
+ */
18
+ declare class XuiError {
19
+ /** Extra classes, merged into the component's own rather than replacing them. */
20
+ readonly class: _angular_core.InputSignal<ClassValue>;
21
+ protected computedClass: _angular_core.Signal<string>;
22
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiError, never>;
23
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiError, "xui-error", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
24
+ }
25
+
26
+ declare const formFieldRootVariants: (props?: ({
27
+ inline?: boolean | null | undefined;
28
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
29
+ /** `color` tints the label and helper text with a deliberate accent. */
30
+ declare const formFieldColorText: (props?: ({
31
+ color?: "none" | "primary" | "success" | "warning" | "error" | null | undefined;
32
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
33
+ type XuiFormFieldColor = NonNullable<VariantProps<typeof formFieldColorText>['color']>;
34
+ /**
35
+ * Wraps a control with its label, helper text and validation message, and wires the three together.
36
+ *
37
+ * ```html
38
+ * <xui-form-field label="Email" labelInfo="(required)" helperText="We never share it.">
39
+ * <input xuiInput [formControl]="email" />
40
+ * <xui-error>Enter a valid address.</xui-error>
41
+ * </xui-form-field>
42
+ * ```
43
+ *
44
+ * It finds the projected control through `XFormFieldControl`, so any xUI control registered under that
45
+ * token works — input, textarea, select, numeric-input, file-input, html-select. The `<label for>` is
46
+ * pointed at the real focusable element (the control's `controlId` when it wraps an inner input, else
47
+ * its host, which the field gives an id if it has none), and the projected `xui-error` replaces the
48
+ * hint only while the control actually reports an error. Throws if it contains no control.
49
+ */
50
+ declare class XuiFormField {
51
+ private readonly config;
52
+ /** The projected control, found through `XFormFieldControl`. Read-only; the field throws if there is none. */
53
+ readonly control: _angular_core.Signal<XFormFieldControl | undefined>;
54
+ private readonly controlEl;
55
+ /** The projected `xui-error` messages. Shown in place of the hint while the control reports an error. */
56
+ readonly errorChildren: _angular_core.Signal<readonly XuiError[]>;
57
+ /** Extra classes, merged into the component's own rather than replacing them. */
58
+ readonly class: _angular_core.InputSignal<ClassValue>;
59
+ /** The primary label rendered above (or beside, when `inline`) the control. */
60
+ readonly label: _angular_core.InputSignal<string>;
61
+ /** Secondary text shown next to the label, e.g. "(optional)". */
62
+ readonly labelInfo: _angular_core.InputSignal<string>;
63
+ /** A smaller description under the label. */
64
+ readonly subLabel: _angular_core.InputSignal<string>;
65
+ /** Muted helper text under the control, hidden while an error is shown. */
66
+ readonly helperText: _angular_core.InputSignal<string>;
67
+ /** A deliberate accent for the label and helper text. */
68
+ readonly color: _angular_core.InputSignal<XuiFormFieldColor>;
69
+ /** Lay the label beside the control rather than above it. */
70
+ readonly inline: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
71
+ private readonly generatedId;
72
+ protected readonly computedClass: _angular_core.Signal<string>;
73
+ protected readonly labelClass: _angular_core.Signal<string>;
74
+ protected readonly helperClass: _angular_core.Signal<string>;
75
+ /**
76
+ * The id the `<label>` points at — the control's declared `controlId` when it
77
+ * has one (the focusable element inside a wrapping component), else the host
78
+ * element's own id, else the id we assign below. The fallback branches agree
79
+ * with the effect's assignment.
80
+ */
81
+ protected readonly labelFor: _angular_core.Signal<string | null>;
82
+ protected readonly hasDisplayedMessage: _angular_core.Signal<"error" | "hint">;
83
+ constructor();
84
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiFormField, never>;
85
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiFormField, "xui-form-field", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelInfo": { "alias": "labelInfo"; "required": false; "isSignal": true; }; "subLabel": { "alias": "subLabel"; "required": false; "isSignal": true; }; "helperText": { "alias": "helperText"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "inline": { "alias": "inline"; "required": false; "isSignal": true; }; }, {}, ["control", "controlEl", "errorChildren"], ["*", "xui-error", "xui-hint"], true, never>;
86
+ }
87
+
88
+ /**
89
+ * Supporting text under the control in a `xui-form-field`.
90
+ *
91
+ * ```html
92
+ * <xui-hint>Use the address you signed up with.</xui-hint>
93
+ * ```
94
+ *
95
+ * The projected form of the field's `helperText` input, for hints that need markup rather than a plain
96
+ * string. Hidden while a `xui-error` is showing.
97
+ */
98
+ declare class XuiHint {
99
+ /** Extra classes, merged into the component's own rather than replacing them. */
100
+ readonly class: _angular_core.InputSignal<ClassValue>;
101
+ protected computedClass: _angular_core.Signal<string>;
102
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiHint, never>;
103
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiHint, "xui-hint", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
104
+ }
105
+
106
+ interface XuiFormFieldConfig {
107
+ color: XuiFormFieldColor;
108
+ inline: boolean;
109
+ }
110
+ declare const injectXuiFormFieldConfig: () => XuiFormFieldConfig;
111
+ declare const provideXuiFormFieldConfig: (config: Partial<XuiFormFieldConfig>) => _angular_core.ValueProvider;
112
+
113
+ declare const XuiFormFieldImports: readonly [typeof XuiFormField, typeof XuiError, typeof XuiHint];
114
+
115
+ export { XuiError, XuiFormField, XuiFormFieldImports, XuiHint, formFieldColorText, formFieldRootVariants, injectXuiFormFieldConfig, provideXuiFormFieldConfig };
116
+ export type { XuiFormFieldColor, XuiFormFieldConfig };
package/index.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { XFormFieldControl } from '@xui/core/form-field';
3
-
4
- declare class XuiErrorComponent {
5
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiErrorComponent, never>;
6
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiErrorComponent, "xui-error", never, {}, {}, never, ["*"], true, never>;
7
- }
8
-
9
- declare class XuiFormFieldComponent {
10
- readonly control: i0.Signal<XFormFieldControl | undefined>;
11
- readonly errorChildren: i0.Signal<readonly XuiErrorComponent[]>;
12
- protected readonly hasDisplayedMessage: i0.Signal<"error" | "hint">;
13
- constructor();
14
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiFormFieldComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiFormFieldComponent, "xui-form-field", never, {}, {}, ["control", "errorChildren"], ["*", "xui-error", "xui-hint"], true, never>;
16
- }
17
-
18
- declare class XuiHintComponent {
19
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiHintComponent, never>;
20
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiHintComponent, "xui-hint", never, {}, {}, never, ["*"], true, never>;
21
- }
22
-
23
- declare const XuiFormFieldImports: readonly [typeof XuiFormFieldComponent, typeof XuiErrorComponent, typeof XuiHintComponent];
24
- declare class XuiFormFieldModule {
25
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiFormFieldModule, never>;
26
- static ɵmod: i0.ɵɵNgModuleDeclaration<XuiFormFieldModule, never, [typeof XuiFormFieldComponent, typeof XuiErrorComponent, typeof XuiHintComponent], [typeof XuiFormFieldComponent, typeof XuiErrorComponent, typeof XuiHintComponent]>;
27
- static ɵinj: i0.ɵɵInjectorDeclaration<XuiFormFieldModule>;
28
- }
29
-
30
- export { XuiErrorComponent, XuiFormFieldComponent, XuiFormFieldImports, XuiFormFieldModule, XuiHintComponent };