@xui/form-field 2.0.0-alpha.1 → 2.0.0-alpha.12

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,152 +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/continuous-delivery.yaml/badge.svg?branch=master)
8
- [![Demo](https://img.shields.io/badge/demo-online-ed1c46)](https://xuijs.org/)
9
- [![npm](https://img.shields.io/npm/v/%40xui/components.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/org/xui)
10
- [![Downloads](https://img.shields.io/npm/dt/%40xui/components.svg)](https://www.npmjs.com/org/xui)
11
- [![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/components.svg)](https://www.npmjs.com/org/xui)
12
- [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/components)](https://bundlephobia.com/result?p=xui)
13
- [![License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](/LICENSE)
14
- [![Discord](https://img.shields.io/discord/776258487307075594.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/aPkZsFcu)
15
- [![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';
16
30
 
17
- xUI is a customizable Angular 19 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
+ ```
18
37
 
19
38
  ## Features
20
39
 
21
- - **35+ High-Quality Angular Components:** Ready to use out of the box.
22
- - **Powerful Theme Customization:** Detailed customization options with default themes.
23
- - **High Performance:** Supports Zoneless, OnPush mode, and Signals for optimized performance.
24
- - **Accessibility:** Supports WCAG 2.0 standards.
25
- - **Powerful Theme Customization:** Install each visual component and customize it according your needs
26
- - **TypeScript:** Written with predictable static types.
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
27
64
 
28
- ## Table of Contents
65
+ ```bash
66
+ ng add @xui/core
67
+ ```
29
68
 
30
- - [Storybook](https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark)
31
- - [StackBlitz Demo](https://stackblitz.com/fork/xui)
32
- - [Documentation](https://xuijs.org)
33
- - [Live Demo](https://cord.dj/r)
34
- - [Installation](#installation)
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.
35
73
 
36
- <a name="installation"></a>
74
+ Then add the components you need:
37
75
 
38
- ## Installation
76
+ ```bash
77
+ pnpm add @xui/button @xui/dialog @xui/icon
78
+ ```
39
79
 
40
- Install package with **PNPM**
80
+ ## Theming
41
81
 
42
- ```bash
43
- pnpm i @xui/core ....
82
+ To wire the styles by hand, import the token layer once after Tailwind:
83
+
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';
44
94
  ```
45
95
 
46
- ## Browser Support
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.
47
99
 
48
- xUI Supports most recent browsers according to Angular [support](https://angular.io/guide/browser-support).
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:
49
102
 
50
- ## Development
103
+ ```css
104
+ :root {
105
+ --primary: var(--color-violet-600);
106
+ --surface-inset: var(--color-zinc-50);
107
+ }
108
+ ```
51
109
 
52
- The project uses `NX` and `Angular` to build the package.
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.
53
112
 
54
- To start docs page use
113
+ The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
55
114
 
56
- ```bash
57
- pnpm start
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/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>
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
+ }
58
159
  ```
59
160
 
60
- 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.
61
177
 
62
178
  ```bash
63
- 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
64
186
  ```
65
187
 
66
- ## Issues
67
-
68
- 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).
69
-
70
- ## Roadmap (12/42)
71
-
72
- - [ ] Accordion
73
- - [ ] Alert
74
- - [ ] Alert Dialog
75
- - [ ] Avatar
76
- - [x] Badge
77
- - [x] Breadcrumb
78
- - [x] Button
79
- - [x] Button Group
80
- - [ ] Calendar
81
- - [ ] Card
82
- - [ ] Carousel
83
- - [x] Checkbox
84
- - [ ] Collapsible
85
- - [ ] Combobox
86
- - [ ] Command
87
- - [ ] Date Picker
88
- - [ ] Date Range Picker
89
- - [ ] Dialog
90
- - [x] Form Field
91
- - [ ] Hover Card
92
- - [x] Icon
93
- - [x] Input
94
- - [x] Label
95
- - [ ] Menu
96
- - [ ] Pagination
97
- - [ ] Popover
98
- - [ ] Progress
99
- - [ ] Radio Group
100
- - [ ] Scroll Area
101
- - [ ] Select
102
- - [ ] Separator
103
- - [ ] Sheet
104
- - [x] Skeleton
105
- - [ ] Slider
106
- - [x] Sonner
107
- - [ ] Spinner
108
- - [x] Status
109
- - [ ] Switch
110
- - [ ] Table
111
- - [ ] Tabs
112
- - [ ] Toggle
113
- - [ ] Tooltip
114
- - [ ] Typography
115
-
116
- ### Additional
117
-
118
- - [ ] Decagram
119
- - [ ] Settings
120
- - [ ] Drawer
121
- - [ ] Panel Bar
122
- - [ ] Textarea
123
- - [ ] Time Picker
124
- - [ ] Image Upload
125
- - [ ] Banner
126
- - [ ] Snack bar
127
-
128
- ## Opinionated "components"
129
-
130
- - [ ] Graph View (Nodes)
131
- - [ ] Analysis
132
- - [ ] Charts (NG Charts?)
133
-
134
- ## CLI
135
-
136
- Make cli to install the components
137
-
138
- ## TODO
139
-
140
- - Button
141
-
142
- - Icon
143
- - Shine
144
-
145
- - Breadcrumb
146
-
147
- - fix styling issues
148
- - on hover stuff
149
- - data driven component
150
-
151
- - Sonner
152
- - Colors
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,102 +1,233 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, contentChild, contentChildren, computed, effect, NgModule } from '@angular/core';
3
- import { XCoreFormFieldControl } from '@xui/core/form-field';
2
+ import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, contentChild, ElementRef, contentChildren, booleanAttribute, effect } from '@angular/core';
3
+ import { xui, createXConfigToken } from '@xui/core';
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: "19.2.3", ngImport: i0, type: XuiErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: XuiErrorComponent, isStandalone: true, selector: "xui-error", host: { classAttribute: "block text-error text-sm font-medium" }, ngImport: i0, template: '<ng-content />', isInline: true });
7
+ class XuiError {
8
+ class = input('', /* @ts-ignore */
9
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
10
+ computedClass = computed(() => xui('block text-error text-sm font-medium', this.class()), /* @ts-ignore */
11
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
12
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiError, deps: [], target: i0.ɵɵFactoryTarget.Component });
13
+ /** @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
14
  }
9
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiErrorComponent, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiError, decorators: [{
10
16
  type: Component,
11
17
  args: [{
12
18
  selector: 'xui-error',
19
+ changeDetection: ChangeDetectionStrategy.OnPush,
20
+ encapsulation: ViewEncapsulation.None,
13
21
  template: '<ng-content />',
14
22
  host: {
15
- class: 'block text-error text-sm font-medium'
23
+ '[class]': 'computedClass()'
16
24
  }
17
25
  }]
18
- }] });
26
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
19
27
 
20
- class XuiFormFieldComponent {
21
- control = contentChild(XCoreFormFieldControl);
22
- errorChildren = contentChildren(XuiErrorComponent);
23
- hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint');
28
+ const [injectXuiFormFieldConfig, provideXuiFormFieldConfig] = createXConfigToken('XuiFormFieldConfig', {
29
+ color: 'none',
30
+ inline: false
31
+ });
32
+
33
+ let nextId = 0;
34
+ const formFieldRootVariants = cva('', {
35
+ variants: {
36
+ inline: {
37
+ false: 'block space-y-2',
38
+ true: 'flex items-baseline gap-3'
39
+ }
40
+ },
41
+ defaultVariants: { inline: false }
42
+ });
43
+ /** `color` tints the label and helper text with a deliberate accent. */
44
+ const formFieldColorText = cva('', {
45
+ variants: {
46
+ color: {
47
+ none: '',
48
+ primary: 'text-primary',
49
+ success: 'text-success',
50
+ warning: 'text-warning',
51
+ error: 'text-error'
52
+ }
53
+ },
54
+ defaultVariants: { color: 'none' }
55
+ });
56
+ class XuiFormField {
57
+ config = injectXuiFormFieldConfig();
58
+ control = contentChild(XFormFieldControl, /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
60
+ controlEl = contentChild(XFormFieldControl, { ...(ngDevMode ? { debugName: "controlEl" } : /* istanbul ignore next */ {}), read: ElementRef });
61
+ errorChildren = contentChildren(XuiError, /* @ts-ignore */
62
+ ...(ngDevMode ? [{ debugName: "errorChildren" }] : /* istanbul ignore next */ []));
63
+ class = input('', /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
65
+ /** The primary label rendered above (or beside, when `inline`) the control. */
66
+ label = input('', /* @ts-ignore */
67
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
68
+ /** Secondary text shown next to the label, e.g. "(optional)". */
69
+ labelInfo = input('', /* @ts-ignore */
70
+ ...(ngDevMode ? [{ debugName: "labelInfo" }] : /* istanbul ignore next */ []));
71
+ /** A smaller description under the label. */
72
+ subLabel = input('', /* @ts-ignore */
73
+ ...(ngDevMode ? [{ debugName: "subLabel" }] : /* istanbul ignore next */ []));
74
+ /** Muted helper text under the control, hidden while an error is shown. */
75
+ helperText = input('', /* @ts-ignore */
76
+ ...(ngDevMode ? [{ debugName: "helperText" }] : /* istanbul ignore next */ []));
77
+ /** A deliberate accent for the label and helper text. */
78
+ color = input(this.config.color, /* @ts-ignore */
79
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
80
+ /** Lay the label beside the control rather than above it. */
81
+ inline = input(this.config.inline, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
82
+ generatedId = `xui-form-field-${nextId++}`;
83
+ computedClass = computed(() => xui(formFieldRootVariants({ inline: this.inline() }), this.class()), /* @ts-ignore */
84
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
85
+ labelClass = computed(() => xui('text-foreground block text-sm font-medium', formFieldColorText({ color: this.color() })), /* @ts-ignore */
86
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
87
+ helperClass = computed(() => xui('block text-sm text-foreground-subtle', formFieldColorText({ color: this.color() })), /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "helperClass" }] : /* istanbul ignore next */ []));
89
+ /**
90
+ * The id the `<label>` points at — the control's declared `controlId` when it
91
+ * has one (the focusable element inside a wrapping component), else the host
92
+ * element's own id, else the id we assign below. The fallback branches agree
93
+ * with the effect's assignment.
94
+ */
95
+ labelFor = computed(() => {
96
+ if (!this.label()) {
97
+ return null;
98
+ }
99
+ const providedId = this.control()?.controlId?.();
100
+ if (providedId) {
101
+ return providedId;
102
+ }
103
+ const el = this.controlEl()?.nativeElement;
104
+ return el?.id || this.generatedId;
105
+ }, /* @ts-ignore */
106
+ ...(ngDevMode ? [{ debugName: "labelFor" }] : /* istanbul ignore next */ []));
107
+ hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint', /* @ts-ignore */
108
+ ...(ngDevMode ? [{ debugName: "hasDisplayedMessage" }] : /* istanbul ignore next */ []));
24
109
  constructor() {
25
110
  effect(() => {
26
111
  if (!this.control()) {
27
- throw new Error('xui-form-field must contain an XCoreFormFieldControl.');
112
+ throw new Error('xui-form-field must contain an XFormFieldControl.');
113
+ }
114
+ });
115
+ // Give the projected control our generated id (unless it already has one, or
116
+ // it points the label at an inner element via `controlId`) so the rendered
117
+ // <label for> genuinely points at it.
118
+ effect(() => {
119
+ const el = this.controlEl()?.nativeElement;
120
+ if (this.label() && el && !el.id && !this.control()?.controlId?.()) {
121
+ el.id = this.generatedId;
28
122
  }
29
123
  });
30
124
  }
31
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
32
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: XuiFormFieldComponent, isStandalone: true, selector: "xui-form-field", host: { classAttribute: "block space-y-2" }, queries: [{ propertyName: "control", first: true, predicate: XCoreFormFieldControl, descendants: true, isSignal: true }, { propertyName: "errorChildren", predicate: XuiErrorComponent, isSignal: true }], ngImport: i0, template: `
33
- <ng-content></ng-content>
125
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiFormField, deps: [], target: i0.ɵɵFactoryTarget.Component });
126
+ /** @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: `
127
+ @if (label() || subLabel()) {
128
+ <div [class]="inline() ? 'shrink-0' : ''">
129
+ @if (label()) {
130
+ <label [attr.for]="labelFor()" [class]="labelClass()">
131
+ {{ label() }}
132
+ @if (labelInfo()) {
133
+ <span class="text-foreground-subtle font-normal">{{ labelInfo() }}</span>
134
+ }
135
+ </label>
136
+ }
137
+ @if (subLabel()) {
138
+ <span class="text-foreground-muted block text-xs">{{ subLabel() }}</span>
139
+ }
140
+ </div>
141
+ }
34
142
 
35
- @switch (hasDisplayedMessage()) {
36
- @case ('error') {
37
- <ng-content select="xui-error"></ng-content>
38
- }
39
- @default {
40
- <ng-content select="xui-hint"></ng-content>
143
+ <div [class]="inline() ? 'flex-1 space-y-1.5' : 'space-y-1.5'">
144
+ <ng-content />
145
+
146
+ @switch (hasDisplayedMessage()) {
147
+ @case ('error') {
148
+ <ng-content select="xui-error" />
149
+ }
150
+ @default {
151
+ <ng-content select="xui-hint" />
152
+ @if (helperText()) {
153
+ <span [class]="helperClass()">{{ helperText() }}</span>
154
+ }
155
+ }
41
156
  }
42
- }
43
- `, isInline: true });
157
+ </div>
158
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
44
159
  }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldComponent, decorators: [{
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiFormField, decorators: [{
46
161
  type: Component,
47
162
  args: [{
48
163
  selector: 'xui-form-field',
49
- imports: [],
164
+ changeDetection: ChangeDetectionStrategy.OnPush,
165
+ encapsulation: ViewEncapsulation.None,
50
166
  template: `
51
- <ng-content></ng-content>
167
+ @if (label() || subLabel()) {
168
+ <div [class]="inline() ? 'shrink-0' : ''">
169
+ @if (label()) {
170
+ <label [attr.for]="labelFor()" [class]="labelClass()">
171
+ {{ label() }}
172
+ @if (labelInfo()) {
173
+ <span class="text-foreground-subtle font-normal">{{ labelInfo() }}</span>
174
+ }
175
+ </label>
176
+ }
177
+ @if (subLabel()) {
178
+ <span class="text-foreground-muted block text-xs">{{ subLabel() }}</span>
179
+ }
180
+ </div>
181
+ }
52
182
 
53
- @switch (hasDisplayedMessage()) {
54
- @case ('error') {
55
- <ng-content select="xui-error"></ng-content>
56
- }
57
- @default {
58
- <ng-content select="xui-hint"></ng-content>
183
+ <div [class]="inline() ? 'flex-1 space-y-1.5' : 'space-y-1.5'">
184
+ <ng-content />
185
+
186
+ @switch (hasDisplayedMessage()) {
187
+ @case ('error') {
188
+ <ng-content select="xui-error" />
189
+ }
190
+ @default {
191
+ <ng-content select="xui-hint" />
192
+ @if (helperText()) {
193
+ <span [class]="helperClass()">{{ helperText() }}</span>
194
+ }
195
+ }
59
196
  }
60
- }
197
+ </div>
61
198
  `,
62
199
  host: {
63
- class: 'block space-y-2'
200
+ '[class]': 'computedClass()'
64
201
  }
65
202
  }]
66
- }], ctorParameters: () => [] });
203
+ }], 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 }] }] } });
67
204
 
68
- class XuiHintComponent {
69
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
70
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: XuiHintComponent, isStandalone: true, selector: "xui-hint", host: { classAttribute: "block text-sm text-foreground/50" }, ngImport: i0, template: '<ng-content />', isInline: true });
205
+ class XuiHint {
206
+ class = input('', /* @ts-ignore */
207
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
208
+ computedClass = computed(() => xui('block text-sm text-foreground-subtle', this.class()), /* @ts-ignore */
209
+ ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
210
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiHint, deps: [], target: i0.ɵɵFactoryTarget.Component });
211
+ /** @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 });
71
212
  }
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiHintComponent, decorators: [{
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiHint, decorators: [{
73
214
  type: Component,
74
215
  args: [{
75
216
  selector: 'xui-hint',
217
+ changeDetection: ChangeDetectionStrategy.OnPush,
218
+ encapsulation: ViewEncapsulation.None,
76
219
  template: '<ng-content />',
77
220
  host: {
78
- class: 'block text-sm text-foreground/50'
221
+ '[class]': 'computedClass()'
79
222
  }
80
223
  }]
81
- }] });
224
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
82
225
 
83
- const XuiFormFieldImports = [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent];
84
- class XuiFormFieldModule {
85
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
86
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldModule, imports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent], exports: [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent] });
87
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldModule });
88
- }
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldModule, decorators: [{
90
- type: NgModule,
91
- args: [{
92
- imports: [...XuiFormFieldImports],
93
- exports: [...XuiFormFieldImports]
94
- }]
95
- }] });
226
+ const XuiFormFieldImports = [XuiFormField, XuiError, XuiHint];
96
227
 
97
228
  /**
98
229
  * Generated bundle index. Do not edit.
99
230
  */
100
231
 
101
- export { XuiErrorComponent, XuiFormFieldComponent, XuiFormFieldImports, XuiFormFieldModule, XuiHintComponent };
232
+ export { XuiError, XuiFormField, XuiFormFieldImports, XuiHint, formFieldColorText, formFieldRootVariants, injectXuiFormFieldConfig, provideXuiFormFieldConfig };
102
233
  //# sourceMappingURL=xui-form-field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"xui-form-field.mjs","sources":["../../../../../../libs/ui/form-field/xui/src/lib/error.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/form-field.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/hint.component.ts","../../../../../../libs/ui/form-field/xui/src/index.ts","../../../../../../libs/ui/form-field/xui/src/xui-form-field.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n@Component({\n selector: 'xui-error',\n template: '<ng-content />',\n host: {\n class: 'block text-error text-sm font-medium'\n }\n})\nexport class XuiErrorComponent {}\n","import { Component, computed, contentChild, contentChildren, effect } from '@angular/core';\nimport { XCoreFormFieldControl } from '@xui/core/form-field';\nimport { XuiErrorComponent } from './error.component';\n\n@Component({\n selector: 'xui-form-field',\n imports: [],\n template: `\n <ng-content></ng-content>\n\n @switch (hasDisplayedMessage()) {\n @case ('error') {\n <ng-content select=\"xui-error\"></ng-content>\n }\n @default {\n <ng-content select=\"xui-hint\"></ng-content>\n }\n }\n `,\n host: {\n class: 'block space-y-2'\n }\n})\nexport class XuiFormFieldComponent {\n readonly control = contentChild(XCoreFormFieldControl);\n readonly errorChildren = contentChildren(XuiErrorComponent);\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 XCoreFormFieldControl.');\n }\n });\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'xui-hint',\n template: '<ng-content />',\n host: {\n class: 'block text-sm text-foreground/50'\n }\n})\nexport class XuiHintComponent {}\n","import { NgModule } from '@angular/core';\nimport { XuiErrorComponent } from './lib/error.component';\nimport { XuiFormFieldComponent } from './lib/form-field.component';\nimport { XuiHintComponent } from './lib/hint.component';\nexport * from './lib/error.component';\nexport * from './lib/form-field.component';\nexport * from './lib/hint.component';\n\nexport const XuiFormFieldImports = [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent] as const;\n\n@NgModule({\n imports: [...XuiFormFieldImports],\n exports: [...XuiFormFieldImports]\n})\nexport class XuiFormFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MASa,iBAAiB,CAAA;0HAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAjB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,iBAAiB,uIALlB,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAKf,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAP7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,QAAQ,EA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B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB;AACjC,iBAAA;;;ACbD;;AAEG;;;;"}
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@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 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@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 readonly control = contentChild(XFormFieldControl);\n private readonly controlEl = contentChild(XFormFieldControl, { read: ElementRef });\n readonly errorChildren = contentChildren(XuiError);\n\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@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 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":";;;;;;MAaa,QAAQ,CAAA;IACV,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;AAE5B,IAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,sCAAsC,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;sFAAC;0HAHxF,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAR,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAQ,+PALT,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAKf,QAAQ,EAAA,UAAA,EAAA,CAAA;kBATpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;oBACrB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,QAAQ,E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,CAAA,SAAA,EAAA,CAAA;AAAP,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,OAAO,8PALR,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAKf,OAAO,EAAA,UAAA,EAAA,CAAA;kBATnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,UAAU;oBACpB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ;AACF,iBAAA;;;ACJM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO;;ACRnE;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,44 +1,48 @@
1
1
  {
2
2
  "name": "@xui/form-field",
3
- "version": "2.0.0-alpha.1",
4
- "description": "Angular UI Library",
3
+ "version": "2.0.0-alpha.12",
4
+ "description": "Modern Angular 22 UI Library based on TailwindCSS",
5
5
  "keywords": [
6
6
  "angular",
7
- "ui"
7
+ "ui",
8
+ "components",
9
+ "tailwindcss"
8
10
  ],
9
11
  "homepage": "https://xuijs.org",
10
12
  "bugs": {
11
13
  "url": "https://github.com/rikarin/xui/issues"
12
14
  },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/rikarin/xui.git"
16
- },
15
+ "repository": "https://github.com/Rikarin/xui",
17
16
  "license": "MIT",
18
- "author": "Rene Cincura",
17
+ "author": "Jiu",
19
18
  "maintainers": [
20
- "Rene Cincura"
19
+ "Jiu",
20
+ "Rikarin"
21
21
  ],
22
22
  "sideEffects": false,
23
- "peerDependencies": {
24
- "@angular/core": "19",
25
- "@xui/core": "2"
26
- },
27
- "publishConfig": {
28
- "access": "public"
29
- },
30
- "module": "fesm2022/xui-form-field.mjs",
31
- "typings": "index.d.ts",
23
+ "type": "module",
32
24
  "exports": {
33
25
  "./package.json": {
34
26
  "default": "./package.json"
35
27
  },
36
28
  ".": {
37
- "types": "./index.d.ts",
29
+ "types": "./types/xui-form-field.d.ts",
38
30
  "default": "./fesm2022/xui-form-field.mjs"
39
31
  }
40
32
  },
33
+ "module": "fesm2022/xui-form-field.mjs",
34
+ "typings": "types/xui-form-field.d.ts",
41
35
  "dependencies": {
42
36
  "tslib": "^2.3.0"
37
+ },
38
+ "peerDependencies": {
39
+ "@angular/cdk": "22",
40
+ "@angular/core": "22",
41
+ "@xui/core": "2.0.0-alpha.12",
42
+ "class-variance-authority": "^0.7.1",
43
+ "clsx": "^2.1.1"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
43
47
  }
44
48
  }
@@ -0,0 +1,75 @@
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
+ declare class XuiError {
9
+ readonly class: _angular_core.InputSignal<ClassValue>;
10
+ protected computedClass: _angular_core.Signal<string>;
11
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiError, never>;
12
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiError, "xui-error", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
13
+ }
14
+
15
+ declare const formFieldRootVariants: (props?: ({
16
+ inline?: boolean | null | undefined;
17
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
18
+ /** `color` tints the label and helper text with a deliberate accent. */
19
+ declare const formFieldColorText: (props?: ({
20
+ color?: "none" | "primary" | "success" | "warning" | "error" | null | undefined;
21
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
22
+ type XuiFormFieldColor = NonNullable<VariantProps<typeof formFieldColorText>['color']>;
23
+ declare class XuiFormField {
24
+ private readonly config;
25
+ readonly control: _angular_core.Signal<XFormFieldControl | undefined>;
26
+ private readonly controlEl;
27
+ readonly errorChildren: _angular_core.Signal<readonly XuiError[]>;
28
+ readonly class: _angular_core.InputSignal<ClassValue>;
29
+ /** The primary label rendered above (or beside, when `inline`) the control. */
30
+ readonly label: _angular_core.InputSignal<string>;
31
+ /** Secondary text shown next to the label, e.g. "(optional)". */
32
+ readonly labelInfo: _angular_core.InputSignal<string>;
33
+ /** A smaller description under the label. */
34
+ readonly subLabel: _angular_core.InputSignal<string>;
35
+ /** Muted helper text under the control, hidden while an error is shown. */
36
+ readonly helperText: _angular_core.InputSignal<string>;
37
+ /** A deliberate accent for the label and helper text. */
38
+ readonly color: _angular_core.InputSignal<XuiFormFieldColor>;
39
+ /** Lay the label beside the control rather than above it. */
40
+ readonly inline: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
41
+ private readonly generatedId;
42
+ protected readonly computedClass: _angular_core.Signal<string>;
43
+ protected readonly labelClass: _angular_core.Signal<string>;
44
+ protected readonly helperClass: _angular_core.Signal<string>;
45
+ /**
46
+ * The id the `<label>` points at — the control's declared `controlId` when it
47
+ * has one (the focusable element inside a wrapping component), else the host
48
+ * element's own id, else the id we assign below. The fallback branches agree
49
+ * with the effect's assignment.
50
+ */
51
+ protected readonly labelFor: _angular_core.Signal<string | null>;
52
+ protected readonly hasDisplayedMessage: _angular_core.Signal<"error" | "hint">;
53
+ constructor();
54
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiFormField, never>;
55
+ 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>;
56
+ }
57
+
58
+ declare class XuiHint {
59
+ readonly class: _angular_core.InputSignal<ClassValue>;
60
+ protected computedClass: _angular_core.Signal<string>;
61
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiHint, never>;
62
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiHint, "xui-hint", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
63
+ }
64
+
65
+ interface XuiFormFieldConfig {
66
+ color: XuiFormFieldColor;
67
+ inline: boolean;
68
+ }
69
+ declare const injectXuiFormFieldConfig: () => XuiFormFieldConfig;
70
+ declare const provideXuiFormFieldConfig: (config: Partial<XuiFormFieldConfig>) => _angular_core.ValueProvider;
71
+
72
+ declare const XuiFormFieldImports: readonly [typeof XuiFormField, typeof XuiError, typeof XuiHint];
73
+
74
+ export { XuiError, XuiFormField, XuiFormFieldImports, XuiHint, formFieldColorText, formFieldRootVariants, injectXuiFormFieldConfig, provideXuiFormFieldConfig };
75
+ export type { XuiFormFieldColor, XuiFormFieldConfig };
package/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { XuiErrorComponent } from './lib/error.component';
2
- import { XuiFormFieldComponent } from './lib/form-field.component';
3
- import { XuiHintComponent } from './lib/hint.component';
4
- import * as i0 from "@angular/core";
5
- import * as i1 from "./lib/form-field.component";
6
- import * as i2 from "./lib/error.component";
7
- import * as i3 from "./lib/hint.component";
8
- export * from './lib/error.component';
9
- export * from './lib/form-field.component';
10
- export * from './lib/hint.component';
11
- export declare const XuiFormFieldImports: readonly [typeof XuiFormFieldComponent, typeof XuiErrorComponent, typeof XuiHintComponent];
12
- export declare class XuiFormFieldModule {
13
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiFormFieldModule, never>;
14
- static ɵmod: i0.ɵɵNgModuleDeclaration<XuiFormFieldModule, never, [typeof i1.XuiFormFieldComponent, typeof i2.XuiErrorComponent, typeof i3.XuiHintComponent], [typeof i1.XuiFormFieldComponent, typeof i2.XuiErrorComponent, typeof i3.XuiHintComponent]>;
15
- static ɵinj: i0.ɵɵInjectorDeclaration<XuiFormFieldModule>;
16
- }
@@ -1,5 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class XuiErrorComponent {
3
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiErrorComponent, never>;
4
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiErrorComponent, "xui-error", never, {}, {}, never, ["*"], true, never>;
5
- }
@@ -1,11 +0,0 @@
1
- import { XCoreFormFieldControl } from '@xui/core/form-field';
2
- import { XuiErrorComponent } from './error.component';
3
- import * as i0 from "@angular/core";
4
- export declare class XuiFormFieldComponent {
5
- readonly control: import("@angular/core").Signal<XCoreFormFieldControl | undefined>;
6
- readonly errorChildren: import("@angular/core").Signal<readonly XuiErrorComponent[]>;
7
- protected readonly hasDisplayedMessage: import("@angular/core").Signal<"error" | "hint">;
8
- constructor();
9
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiFormFieldComponent, never>;
10
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiFormFieldComponent, "xui-form-field", never, {}, {}, ["control", "errorChildren"], ["*", "xui-error", "xui-hint"], true, never>;
11
- }
@@ -1,5 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class XuiHintComponent {
3
- static ɵfac: i0.ɵɵFactoryDeclaration<XuiHintComponent, never>;
4
- static ɵcmp: i0.ɵɵComponentDeclaration<XuiHintComponent, "xui-hint", never, {}, {}, never, ["*"], true, never>;
5
- }