@xui/rate 2.0.0-alpha.11 → 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/README.md CHANGED
@@ -1,89 +1,103 @@
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.
12
27
 
13
- xUI is a customizable Angular 22 UI Library with full support of TailwindCSS styling based on popular React library ShardCN and its Angular alternative SpartanUI.
28
+ ```ts
29
+ import { XuiButtonImports } from '@xui/button';
30
+
31
+ @Component({
32
+ imports: [XuiButtonImports],
33
+ template: `<button xuiButton color="primary">Save changes</button>`
34
+ })
35
+ export class Example {}
36
+ ```
14
37
 
15
38
  ## Features
16
39
 
17
- - **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
- | Spinner | [![Downloads](https://img.shields.io/npm/dt/%40xui/spinner.svg)](https://www.npmjs.com/package/%40xui/spinner)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/spinner.svg)](https://www.npmjs.com/package/%40xui/spinner)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/spinner)](https://bundlephobia.com/result?p=%40xui/spinner) | Spinner 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
64
+
65
+ ```bash
66
+ ng add @xui/core
67
+ ```
68
+
69
+ That installs the core package and wires your global stylesheet: the theme import, the CDK overlay
70
+ stylesheet, and a `@source` glob pointing at the published packages. It is idempotent, so running it
71
+ again only adds what is missing. Use `nx add @xui/core` in an Nx workspace, and `--skip-overlay` if
72
+ you will not use dialogs, drawers, popovers, tooltips, menus or toasts.
73
+
74
+ Then add the components you need:
59
75
 
60
76
  ```bash
61
- pnpm i @xui/core ....
77
+ pnpm add @xui/button @xui/dialog @xui/icon
62
78
  ```
63
79
 
64
80
  ## Theming
65
81
 
66
- Every `@xui/*` component styles itself with semantic Tailwind utilities `bg-surface`,
67
- `text-foreground-muted`, `border-error-muted` — that resolve through the token layer shipped with
68
- `@xui/core`. Import it once, after Tailwind:
82
+ To wire the styles by hand, import the token layer once after Tailwind:
69
83
 
70
84
  ```css
71
85
  @import 'tailwindcss';
72
86
  @import '@xui/core/styles/theme.css';
73
87
 
74
- /* Only needed if you use an overlay surface — popover, tooltip, menu, dialog,
75
- drawer or toast. Without it overlays render in the document flow. */
88
+ /* Only needed for an overlay surface — popover, tooltip, menu, dialog, drawer
89
+ or toast. Without it, overlays render in the document flow. */
76
90
  @import '@angular/cdk/overlay-prebuilt.css';
77
91
 
78
- /* Tell Tailwind to scan the component sources for utility classes. */
92
+ /* Tailwind only emits utilities it can see, and it cannot see node_modules by default. */
79
93
  @source '../node_modules/@xui';
80
94
  ```
81
95
 
82
- Switch themes by putting `.dark` (or `[data-theme='dark']`) on `<html>`; with neither class
83
- present the theme follows `prefers-color-scheme`. Both selectors also work on any element, so a
84
- subtree can render in the opposite theme.
96
+ Put `.dark` (or `[data-theme='dark']`) on `<html>` to switch themes; with neither present the theme
97
+ follows `prefers-color-scheme`. Both selectors work on any element, so a subtree can render in the
98
+ opposite theme.
85
99
 
86
- Re-theme by overriding tokens after the import the `darker` / `lighter` / `subtle` / `muted` /
100
+ Re-theme by overriding tokens after the import. The `darker` / `lighter` / `subtle` / `muted` /
87
101
  `emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
88
102
 
89
103
  ```css
@@ -93,37 +107,48 @@ Re-theme by overriding tokens after the import — the `darker` / `lighter` / `s
93
107
  }
94
108
  ```
95
109
 
96
- The full token reference, rendered in both themes, is the **Design Tokens** page in
97
- [Storybook](https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark).
110
+ Controls share one density scale 24 / 30 / 40px for `sm` / default / `lg` — so a button, an input
111
+ and a date field on the same row line up. Override `--control-height-md` to re-tune the library.
98
112
 
99
- ## Browser Support
113
+ The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
100
114
 
101
- xUI Supports most recent browsers according to Angular [support](https://angular.io/guide/browser-support).
115
+ ## Components
102
116
 
103
- ## Development
117
+ <details>
118
+ <summary><strong>All 90 packages</strong>, grouped as they appear in Storybook</summary>
104
119
 
105
- The project uses `NX` and `Angular` to build the package.
120
+ <br />
106
121
 
107
- To start docs page use
122
+ **Foundations** [`@xui/icon`](https://www.npmjs.com/package/@xui/icon) · [`@xui/link`](https://www.npmjs.com/package/@xui/link) · [`@xui/text`](https://www.npmjs.com/package/@xui/text)
108
123
 
109
- ```bash
110
- pnpm start
111
- ```
124
+ **Actions** — [`@xui/button`](https://www.npmjs.com/package/@xui/button) · [`@xui/button-group`](https://www.npmjs.com/package/@xui/button-group) · [`@xui/hotkeys`](https://www.npmjs.com/package/@xui/hotkeys)
112
125
 
113
- To start storybook use
126
+ **Forms** [`@xui/cascader`](https://www.npmjs.com/package/@xui/cascader) · [`@xui/checkbox`](https://www.npmjs.com/package/@xui/checkbox) · [`@xui/color-picker`](https://www.npmjs.com/package/@xui/color-picker) · [`@xui/control-card`](https://www.npmjs.com/package/@xui/control-card) · [`@xui/control-group`](https://www.npmjs.com/package/@xui/control-group) · [`@xui/editable-text`](https://www.npmjs.com/package/@xui/editable-text) · [`@xui/file-input`](https://www.npmjs.com/package/@xui/file-input) · [`@xui/form-field`](https://www.npmjs.com/package/@xui/form-field) · [`@xui/html-select`](https://www.npmjs.com/package/@xui/html-select) · [`@xui/input`](https://www.npmjs.com/package/@xui/input) · [`@xui/input-otp`](https://www.npmjs.com/package/@xui/input-otp) · [`@xui/label`](https://www.npmjs.com/package/@xui/label) · [`@xui/multi-select`](https://www.npmjs.com/package/@xui/multi-select) · [`@xui/numeric-input`](https://www.npmjs.com/package/@xui/numeric-input) · [`@xui/radio`](https://www.npmjs.com/package/@xui/radio) · [`@xui/rate`](https://www.npmjs.com/package/@xui/rate) · [`@xui/rich-text-editor`](https://www.npmjs.com/package/@xui/rich-text-editor) · [`@xui/segmented-control`](https://www.npmjs.com/package/@xui/segmented-control) · [`@xui/select`](https://www.npmjs.com/package/@xui/select) · [`@xui/slider`](https://www.npmjs.com/package/@xui/slider) · [`@xui/suggest`](https://www.npmjs.com/package/@xui/suggest) · [`@xui/switch`](https://www.npmjs.com/package/@xui/switch) · [`@xui/tag-input`](https://www.npmjs.com/package/@xui/tag-input) · [`@xui/textarea`](https://www.npmjs.com/package/@xui/textarea) · [`@xui/transfer`](https://www.npmjs.com/package/@xui/transfer) · [`@xui/tree-select`](https://www.npmjs.com/package/@xui/tree-select) · [`@xui/upload`](https://www.npmjs.com/package/@xui/upload)
114
127
 
115
- ```bash
116
- pnpm storybook
117
- ```
128
+ **Date & time** — [`@xui/date-input`](https://www.npmjs.com/package/@xui/date-input) · [`@xui/date-picker`](https://www.npmjs.com/package/@xui/date-picker) · [`@xui/date-range-input`](https://www.npmjs.com/package/@xui/date-range-input) · [`@xui/date-range-picker`](https://www.npmjs.com/package/@xui/date-range-picker) · [`@xui/time-picker`](https://www.npmjs.com/package/@xui/time-picker) · [`@xui/timezone-select`](https://www.npmjs.com/package/@xui/timezone-select)
129
+
130
+ **Data display** — [`@xui/avatar`](https://www.npmjs.com/package/@xui/avatar) · [`@xui/badge`](https://www.npmjs.com/package/@xui/badge) · [`@xui/card`](https://www.npmjs.com/package/@xui/card) · [`@xui/card-list`](https://www.npmjs.com/package/@xui/card-list) · [`@xui/carousel`](https://www.npmjs.com/package/@xui/carousel) · [`@xui/data-table`](https://www.npmjs.com/package/@xui/data-table) · [`@xui/descriptions`](https://www.npmjs.com/package/@xui/descriptions) · [`@xui/entity-title`](https://www.npmjs.com/package/@xui/entity-title) · [`@xui/kbd`](https://www.npmjs.com/package/@xui/kbd) · [`@xui/statistic`](https://www.npmjs.com/package/@xui/statistic) · [`@xui/status`](https://www.npmjs.com/package/@xui/status) · [`@xui/table`](https://www.npmjs.com/package/@xui/table) · [`@xui/tag`](https://www.npmjs.com/package/@xui/tag) · [`@xui/timeline`](https://www.npmjs.com/package/@xui/timeline) · [`@xui/tree`](https://www.npmjs.com/package/@xui/tree)
131
+
132
+ **Navigation** — [`@xui/breadcrumb`](https://www.npmjs.com/package/@xui/breadcrumb) · [`@xui/menubar`](https://www.npmjs.com/package/@xui/menubar) · [`@xui/navbar`](https://www.npmjs.com/package/@xui/navbar) · [`@xui/navigation-menu`](https://www.npmjs.com/package/@xui/navigation-menu) · [`@xui/pagination`](https://www.npmjs.com/package/@xui/pagination) · [`@xui/panel-stack`](https://www.npmjs.com/package/@xui/panel-stack) · [`@xui/steps`](https://www.npmjs.com/package/@xui/steps) · [`@xui/tabs`](https://www.npmjs.com/package/@xui/tabs)
133
+
134
+ **Overlays** — [`@xui/alert`](https://www.npmjs.com/package/@xui/alert) · [`@xui/alert-dialog`](https://www.npmjs.com/package/@xui/alert-dialog) · [`@xui/context-menu`](https://www.npmjs.com/package/@xui/context-menu) · [`@xui/dialog`](https://www.npmjs.com/package/@xui/dialog) · [`@xui/drawer`](https://www.npmjs.com/package/@xui/drawer) · [`@xui/menu`](https://www.npmjs.com/package/@xui/menu) · [`@xui/omnibar`](https://www.npmjs.com/package/@xui/omnibar) · [`@xui/popover`](https://www.npmjs.com/package/@xui/popover) · [`@xui/toast`](https://www.npmjs.com/package/@xui/toast) · [`@xui/tooltip`](https://www.npmjs.com/package/@xui/tooltip)
135
+
136
+ **Feedback** — [`@xui/callout`](https://www.npmjs.com/package/@xui/callout) · [`@xui/non-ideal-state`](https://www.npmjs.com/package/@xui/non-ideal-state) · [`@xui/progress-bar`](https://www.npmjs.com/package/@xui/progress-bar) · [`@xui/result`](https://www.npmjs.com/package/@xui/result) · [`@xui/skeleton`](https://www.npmjs.com/package/@xui/skeleton) · [`@xui/spinner`](https://www.npmjs.com/package/@xui/spinner)
137
+
138
+ **Layout** — [`@xui/accordion`](https://www.npmjs.com/package/@xui/accordion) · [`@xui/aspect-ratio`](https://www.npmjs.com/package/@xui/aspect-ratio) · [`@xui/collapse`](https://www.npmjs.com/package/@xui/collapse) · [`@xui/divider`](https://www.npmjs.com/package/@xui/divider) · [`@xui/dock-manager`](https://www.npmjs.com/package/@xui/dock-manager) · [`@xui/overflow-list`](https://www.npmjs.com/package/@xui/overflow-list) · [`@xui/scroll-area`](https://www.npmjs.com/package/@xui/scroll-area) · [`@xui/section`](https://www.npmjs.com/package/@xui/section) · [`@xui/splitter`](https://www.npmjs.com/package/@xui/splitter)
139
+
140
+ **Visualisation** — [`@xui/echarts`](https://www.npmjs.com/package/@xui/echarts) · [`@xui/konva`](https://www.npmjs.com/package/@xui/konva) · [`@xui/node-graph`](https://www.npmjs.com/package/@xui/node-graph)
141
+
142
+ </details>
118
143
 
119
144
  ## AI coding agents
120
145
 
121
146
  Two pieces of tooling teach coding agents how to build with xUI.
122
147
 
123
- **MCP server** — [`@xui/mcp`](https://github.com/Rikarin/xui/blob/HEAD/libs/mcp/README.md) exposes every package's real API (selectors,
124
- signal inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as
125
- MCP tools. It extracts them from the library sources, so all ~90 packages are covered and the
126
- answers match the installed version.
148
+ **MCP server** — [`@xui/mcp`](libs/mcp/README.md) exposes every package's real API (selectors, signal
149
+ inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as MCP tools.
150
+ It extracts them from the library sources, so every package is covered and the answers match the
151
+ installed version.
127
152
 
128
153
  ```json
129
154
  {
@@ -133,85 +158,46 @@ answers match the installed version.
133
158
  }
134
159
  ```
135
160
 
136
- In this repo, `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run `pnpm nx build mcp`
137
- once so it exists.
161
+ In this repository `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run
162
+ `pnpm nx build mcp` once so it exists.
138
163
 
139
- **Skill** — [`skills/xui`](https://github.com/Rikarin/xui/blob/HEAD/skills/xui/SKILL.md) is the procedural knowledge: the three-layer
164
+ **Skill** — [`skills/xui`](skills/xui/SKILL.md) is the procedural knowledge: the three-layer
140
165
  architecture, discovery through the MCP server, composition and styling rules, theming, the
141
166
  generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
142
167
  links to it for agents working in this repository.
143
168
 
144
- ## Issues
145
-
146
- 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).
147
-
148
- ## Roadmap
149
-
150
- - [ ] Accordion
151
- - [ ] Alert
152
- - [ ] Alert Dialog
153
- - [ ] Avatar
154
- - [ ] Calendar
155
- - [ ] Card
156
- - [ ] Carousel
157
- - [ ] Collapsible
158
- - [ ] Combobox
159
- - [ ] Command
160
- - [ ] Date Picker
161
- - [ ] Date Range Picker
162
- - [ ] Dialog
163
- - [ ] Hover Card
164
- - [ ] Menu
165
- - [ ] Pagination
166
- - [ ] Popover
167
- - [ ] Progress
168
- - [ ] Radio Group
169
- - [ ] Scroll Area
170
- - [ ] Select
171
- - [ ] Separator
172
- - [ ] Sheet
173
- - [ ] Slider
174
- - [ ] Switch
175
- - [ ] Tabs
176
- - [ ] Toggle
177
- - [ ] Tooltip
178
- - [ ] Typography
179
- - [ ] Input OTP
180
- - [ ] Toggle Group
181
-
182
- ### Additional
183
-
184
- - [ ] Decagram
185
- - [ ] Settings
186
- - [ ] Drawer
187
- - [ ] Panel Bar
188
- - [ ] Textarea
189
- - [ ] Time Picker
190
- - [ ] Image Upload
191
- - [ ] Banner
192
- - [ ] Snack bar
193
-
194
- ## Opinionated "components"
195
-
196
- - [ ] Graph View (Nodes)
197
- - [ ] Analysis
198
- - [ ] Charts (NG Charts?)
199
-
200
- ## CLI
201
-
202
- Make cli to install the components
203
-
204
- ## TODO
205
-
206
- - Button
207
-
208
- - Icon
209
- - Shine
210
-
211
- - Breadcrumb
212
-
213
- - fix styling issues
214
- - on hover stuff
215
- - data driven component
216
-
217
- - adjust generator to generate stories into the apps/storybook
169
+ ## Browser support
170
+
171
+ The browsers Angular itself supports see the
172
+ [Angular browser support policy](https://angular.dev/reference/versions#browser-support).
173
+
174
+ ## Development
175
+
176
+ The workspace is [Nx](https://nx.dev) + pnpm.
177
+
178
+ ```bash
179
+ pnpm install
180
+ pnpm start # documentation site on :4200
181
+ pnpm storybook # component gallery on :4400
182
+ pnpm nx serve admin # the example admin application
183
+ pnpm test # unit tests
184
+ pnpm nx test-storybook ui-storybook # render every story in headless Chromium
185
+ pnpm build # build every package
186
+ ```
187
+
188
+ Commits follow [Conventional Commits](https://www.conventionalcommits.org) and are linted — the
189
+ release is cut from them. See [docs/releasing.md](docs/releasing.md) for how a version is published,
190
+ [apps/ui-storybook/README.md](apps/ui-storybook/README.md) before writing stories, and
191
+ [apps/app/README.md](apps/app/README.md) for the documentation site, whose component pages are
192
+ generated from those same stories, and [apps/admin/README.md](apps/admin/README.md) for the example
193
+ admin application a full app built from these packages, which is the fastest way to see how they
194
+ fit together.
195
+
196
+ ## Contributing
197
+
198
+ Bugs and ideas are welcome in [issues](https://github.com/Rikarin/xui/issues). For a change of any
199
+ size, open an issue first so the API can be agreed before the code exists.
200
+
201
+ ## License
202
+
203
+ See [LICENSE](LICENSE).
@@ -1,7 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, model, numberAttribute, booleanAttribute, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { provideIcons, NgIcon } from '@ng-icons/core';
4
+ import { matStarRound } from '@ng-icons/material-icons/round';
3
5
  import { xui } from '@xui/core';
4
6
  import { injectXDirection, arrowValueDirection } from '@xui/core/a11y';
7
+ import { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';
8
+ import { XuiIcon } from '@xui/icon';
5
9
 
6
10
  /**
7
11
  * A star-rating input. Two-way bindable `value`; supports `allowHalf`,
@@ -13,7 +17,6 @@ import { injectXDirection, arrowValueDirection } from '@xui/core/a11y';
13
17
  * ```
14
18
  */
15
19
  class XuiRate {
16
- STAR = 'M12 2l2.9 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14l-5-4.87 7.1-1.01z';
17
20
  direction = injectXDirection();
18
21
  class = input('', /* @ts-ignore */
19
22
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
@@ -29,6 +32,11 @@ class XuiRate {
29
32
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
30
33
  /** Star size in pixels. */
31
34
  starSize = input(20, { ...(ngDevMode ? { debugName: "starSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
35
+ cva = createXValueAccessor({
36
+ onWrite: value => this.value.set(value ?? 0),
37
+ disabled: this.disabled
38
+ });
39
+ isDisabled = this.cva.disabled;
32
40
  hover = signal(null, /* @ts-ignore */
33
41
  ...(ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []));
34
42
  effectiveAriaLabel = computed(() => this.ariaLabel() ?? 'Rating', /* @ts-ignore */
@@ -53,18 +61,13 @@ class XuiRate {
53
61
  return 0;
54
62
  }
55
63
  pick(next) {
56
- if (this.readonly() || this.disabled()) {
64
+ if (this.readonly() || this.isDisabled()) {
57
65
  return;
58
66
  }
59
- if (this.allowClear() && next === this.value()) {
60
- this.value.set(0);
61
- }
62
- else {
63
- this.value.set(next);
64
- }
67
+ this.commit(this.allowClear() && next === this.value() ? 0 : next);
65
68
  }
66
69
  onKeydown(event) {
67
- if (this.readonly() || this.disabled()) {
70
+ if (this.readonly() || this.isDisabled()) {
68
71
  return;
69
72
  }
70
73
  const step = this.allowHalf() ? 0.5 : 1;
@@ -74,25 +77,36 @@ class XuiRate {
74
77
  }
75
78
  const next = arrow === 'increase' ? Math.min(this.count(), this.value() + step) : Math.max(0, this.value() - step);
76
79
  event.preventDefault();
80
+ this.commit(next);
81
+ }
82
+ /** Store and notify — the single write path for every user interaction. */
83
+ commit(next) {
77
84
  this.value.set(next);
85
+ this.cva.notifyChange(next);
78
86
  }
79
- computedClass = computed(() => xui('inline-flex items-center gap-1 outline-none focus-visible:outline-focus focus-visible:outline-2 focus-visible:outline-offset-2 rounded', (this.readonly() || this.disabled()) && 'cursor-default', this.disabled() && 'opacity-50', this.class()), /* @ts-ignore */
87
+ computedClass = computed(() => xui('inline-flex items-center gap-1 rounded', (this.readonly() || this.isDisabled()) && 'cursor-default', this.isDisabled() && 'opacity-50', this.class()), /* @ts-ignore */
80
88
  ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
89
+ writeValue = this.cva.writeValue;
90
+ registerOnChange = this.cva.registerOnChange;
91
+ registerOnTouched = this.cva.registerOnTouched;
92
+ setDisabledState = this.cva.setDisabledState;
81
93
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiRate, deps: [], target: i0.ɵɵFactoryTarget.Component });
82
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiRate, isStandalone: true, selector: "xui-rate", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, allowHalf: { classPropertyName: "allowHalf", publicName: "allowHalf", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, starSize: { classPropertyName: "starSize", publicName: "starSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "slider" }, listeners: { "keydown": "onKeydown($event)", "mouseleave": "hover.set(null)" }, properties: { "class": "computedClass()", "attr.aria-label": "effectiveAriaLabel()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "count()", "attr.aria-valuenow": "value()", "attr.aria-valuetext": "valueText()", "attr.aria-readonly": "readonly() || null", "attr.aria-disabled": "disabled() || null", "attr.tabindex": "readonly() || disabled() ? null : 0" } }, ngImport: i0, template: `
94
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiRate, isStandalone: true, selector: "xui-rate", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, allowHalf: { classPropertyName: "allowHalf", publicName: "allowHalf", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, starSize: { classPropertyName: "starSize", publicName: "starSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "slider" }, listeners: { "keydown": "onKeydown($event)", "mouseleave": "hover.set(null)", "blur": "cva.markTouched()" }, properties: { "class": "computedClass()", "attr.aria-label": "effectiveAriaLabel()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "count()", "attr.aria-valuenow": "value()", "attr.aria-valuetext": "valueText()", "attr.aria-readonly": "readonly() || null", "attr.aria-disabled": "isDisabled() || null", "attr.tabindex": "readonly() || isDisabled() ? null : 0" } }, providers: [provideXValueAccessor((() => XuiRate))], ngImport: i0, template: `
83
95
  @for (star of stars(); track star) {
84
96
  <span class="relative inline-block" [style.width.px]="starPx()" [style.height.px]="starPx()">
85
97
  <!-- empty base -->
86
- <svg viewBox="0 0 24 24" class="text-foreground-subtle absolute inset-0 h-full w-full" fill="currentColor">
87
- <path [attr.d]="STAR" />
88
- </svg>
98
+ <ng-icon xui [size]="starPx() + 'px'" color="subtle" name="matStarRound" class="absolute inset-0" />
89
99
  <!-- filled overlay, clipped to the fill fraction -->
90
100
  <span class="absolute inset-0 overflow-hidden" [style.width.%]="fillPercent(star)">
91
- <svg viewBox="0 0 24 24" class="text-warning h-full" [style.width.px]="starPx()" fill="currentColor">
92
- <path [attr.d]="STAR" />
93
- </svg>
101
+ <ng-icon
102
+ xui
103
+ [size]="starPx() + 'px'"
104
+ color="warning"
105
+ name="matStarRound"
106
+ class="absolute inset-y-0 start-0"
107
+ />
94
108
  </span>
95
- @if (!readonly() && !disabled()) {
109
+ @if (!readonly() && !isDisabled()) {
96
110
  @if (allowHalf()) {
97
111
  <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
98
112
  <span
@@ -111,26 +125,29 @@ class XuiRate {
111
125
  }
112
126
  </span>
113
127
  }
114
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
128
+ `, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "label"], exportAs: ["xuiIcon"] }], viewProviders: [provideIcons({ matStarRound })], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
115
129
  }
116
130
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiRate, decorators: [{
117
131
  type: Component,
118
132
  args: [{
119
133
  selector: 'xui-rate',
134
+ // eslint-disable-next-line local/no-hand-z-index -- half-star hit areas layer above the star glyph inside the control
120
135
  template: `
121
136
  @for (star of stars(); track star) {
122
137
  <span class="relative inline-block" [style.width.px]="starPx()" [style.height.px]="starPx()">
123
138
  <!-- empty base -->
124
- <svg viewBox="0 0 24 24" class="text-foreground-subtle absolute inset-0 h-full w-full" fill="currentColor">
125
- <path [attr.d]="STAR" />
126
- </svg>
139
+ <ng-icon xui [size]="starPx() + 'px'" color="subtle" name="matStarRound" class="absolute inset-0" />
127
140
  <!-- filled overlay, clipped to the fill fraction -->
128
141
  <span class="absolute inset-0 overflow-hidden" [style.width.%]="fillPercent(star)">
129
- <svg viewBox="0 0 24 24" class="text-warning h-full" [style.width.px]="starPx()" fill="currentColor">
130
- <path [attr.d]="STAR" />
131
- </svg>
142
+ <ng-icon
143
+ xui
144
+ [size]="starPx() + 'px'"
145
+ color="warning"
146
+ name="matStarRound"
147
+ class="absolute inset-y-0 start-0"
148
+ />
132
149
  </span>
133
- @if (!readonly() && !disabled()) {
150
+ @if (!readonly() && !isDisabled()) {
134
151
  @if (allowHalf()) {
135
152
  <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
136
153
  <span
@@ -159,11 +176,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
159
176
  '[attr.aria-valuenow]': 'value()',
160
177
  '[attr.aria-valuetext]': 'valueText()',
161
178
  '[attr.aria-readonly]': 'readonly() || null',
162
- '[attr.aria-disabled]': 'disabled() || null',
163
- '[attr.tabindex]': 'readonly() || disabled() ? null : 0',
179
+ '[attr.aria-disabled]': 'isDisabled() || null',
180
+ '[attr.tabindex]': 'readonly() || isDisabled() ? null : 0',
164
181
  '(keydown)': 'onKeydown($event)',
165
- '(mouseleave)': 'hover.set(null)'
182
+ '(mouseleave)': 'hover.set(null)',
183
+ '(blur)': 'cva.markTouched()'
166
184
  },
185
+ imports: [NgIcon, XuiIcon],
186
+ providers: [provideXValueAccessor((() => XuiRate))],
187
+ viewProviders: [provideIcons({ matStarRound })],
167
188
  changeDetection: ChangeDetectionStrategy.OnPush,
168
189
  encapsulation: ViewEncapsulation.None
169
190
  }]
@@ -1 +1 @@
1
- {"version":3,"file":"xui-rate.mjs","sources":["../../../../../../libs/ui/rate/xui/src/lib/rate.ts","../../../../../../libs/ui/rate/xui/src/index.ts","../../../../../../libs/ui/rate/xui/src/xui-rate.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { xui } from '@xui/core';\nimport { arrowValueDirection, injectXDirection } from '@xui/core/a11y';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A star-rating input. Two-way bindable `value`; supports `allowHalf`,\n * `allowClear` (click the current value to reset), `readonly`/`disabled`, hover\n * preview and arrow-key adjustment.\n *\n * ```html\n * <xui-rate [(value)]=\"score\" allowHalf />\n * ```\n */\n@Component({\n selector: 'xui-rate',\n template: `\n @for (star of stars(); track star) {\n <span class=\"relative inline-block\" [style.width.px]=\"starPx()\" [style.height.px]=\"starPx()\">\n <!-- empty base -->\n <svg viewBox=\"0 0 24 24\" class=\"text-foreground-subtle absolute inset-0 h-full w-full\" fill=\"currentColor\">\n <path [attr.d]=\"STAR\" />\n </svg>\n <!-- filled overlay, clipped to the fill fraction -->\n <span class=\"absolute inset-0 overflow-hidden\" [style.width.%]=\"fillPercent(star)\">\n <svg viewBox=\"0 0 24 24\" class=\"text-warning h-full\" [style.width.px]=\"starPx()\" fill=\"currentColor\">\n <path [attr.d]=\"STAR\" />\n </svg>\n </span>\n @if (!readonly() && !disabled()) {\n @if (allowHalf()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 start-0 z-10 w-1/2 cursor-pointer\"\n (click)=\"pick(star - 0.5)\"\n (mouseenter)=\"hover.set(star - 0.5)\"\n ></span>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 end-0 z-10 cursor-pointer\"\n [class]=\"allowHalf() ? 'w-1/2' : 'w-full'\"\n (click)=\"pick(star)\"\n (mouseenter)=\"hover.set(star)\"\n ></span>\n }\n </span>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'slider',\n '[attr.aria-label]': 'effectiveAriaLabel()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'count()',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-readonly]': 'readonly() || null',\n '[attr.aria-disabled]': 'disabled() || null',\n '[attr.tabindex]': 'readonly() || disabled() ? null : 0',\n '(keydown)': 'onKeydown($event)',\n '(mouseleave)': 'hover.set(null)'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiRate {\n protected readonly STAR = 'M12 2l2.9 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14l-5-4.87 7.1-1.01z';\n\n protected readonly direction = injectXDirection();\n\n readonly class = input<ClassValue>('');\n\n /** Names the control. Defaults to \"Rating\" so the slider is never anonymous. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n readonly value = model<number>(0);\n readonly count = input<number, NumberInput>(5, { transform: numberAttribute });\n readonly allowHalf = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Clicking the current value again resets it to 0. */\n readonly allowClear = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Star size in pixels. */\n readonly starSize = input<number, NumberInput>(20, { transform: numberAttribute });\n\n protected readonly hover = signal<number | null>(null);\n\n protected readonly effectiveAriaLabel = computed(() => this.ariaLabel() ?? 'Rating');\n\n /** A bare number tells a screen-reader user nothing about the scale. */\n protected readonly valueText = computed(() => `${this.value()} of ${this.count()}`);\n\n protected readonly stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1));\n protected readonly starPx = computed(() => this.starSize());\n private readonly display = computed(() => this.hover() ?? this.value());\n\n protected fillPercent(star: number): number {\n const display = this.display();\n if (display >= star) {\n return 100;\n }\n if (display >= star - 0.5) {\n return 50;\n }\n return 0;\n }\n\n protected pick(next: number): void {\n if (this.readonly() || this.disabled()) {\n return;\n }\n if (this.allowClear() && next === this.value()) {\n this.value.set(0);\n } else {\n this.value.set(next);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.readonly() || this.disabled()) {\n return;\n }\n const step = this.allowHalf() ? 0.5 : 1;\n const arrow = arrowValueDirection(event.key, this.direction());\n if (!arrow) {\n return;\n }\n\n const next = arrow === 'increase' ? Math.min(this.count(), this.value() + step) : Math.max(0, this.value() - step);\n\n event.preventDefault();\n this.value.set(next);\n }\n\n protected readonly computedClass = computed(() =>\n xui(\n 'inline-flex items-center gap-1 outline-none focus-visible:outline-focus focus-visible:outline-2 focus-visible:outline-offset-2 rounded',\n (this.readonly() || this.disabled()) && 'cursor-default',\n this.disabled() && 'opacity-50',\n this.class()\n )\n );\n}\n","import { XuiRate } from './lib/rate';\n\nexport * from './lib/rate';\n\nexport const XuiRateImports = [XuiRate] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAgBA;;;;;;;;AAQG;MAqDU,OAAO,CAAA;IACC,IAAI,GAAG,wFAAwF;IAE/F,SAAS,GAAG,gBAAgB,EAAE;IAExC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,SAAS,GAAG,KAAK,CAAgB,IAAI,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;IAE/D,KAAK,GAAG,KAAK,CAAS,CAAC;8EAAC;IACxB,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IACrE,SAAS,GAAG,KAAK,CAAwB,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEhF,UAAU,GAAG,KAAK,CAAwB,IAAI,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAChF,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC/E,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,QAAQ,GAAG,KAAK,CAAsB,EAAE,gFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IAE/D,KAAK,GAAG,MAAM,CAAgB,IAAI;8EAAC;IAEnC,kBAAkB,GAAG,QAAQ,CAAC,MAAM,IAA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AA,iBAAiB,EAAE,qCAAqC;AACxD,wBAAA,WAAW,EAAE,mBAAmB;AAChC,wBAAA,cAAc,EAAE;AACjB,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;ACxEM,MAAM,cAAc,GAAG,CAAC,OAAO;;ACJtC;;AAEG;;;;"}
1
+ {"version":3,"file":"xui-rate.mjs","sources":["../../../../../../libs/ui/rate/xui/src/lib/rate.ts","../../../../../../libs/ui/rate/xui/src/index.ts","../../../../../../libs/ui/rate/xui/src/xui-rate.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport type { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matStarRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { arrowValueDirection, injectXDirection } from '@xui/core/a11y';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A star-rating input. Two-way bindable `value`; supports `allowHalf`,\n * `allowClear` (click the current value to reset), `readonly`/`disabled`, hover\n * preview and arrow-key adjustment.\n *\n * ```html\n * <xui-rate [(value)]=\"score\" allowHalf />\n * ```\n */\n@Component({\n selector: 'xui-rate',\n // eslint-disable-next-line local/no-hand-z-index -- half-star hit areas layer above the star glyph inside the control\n template: `\n @for (star of stars(); track star) {\n <span class=\"relative inline-block\" [style.width.px]=\"starPx()\" [style.height.px]=\"starPx()\">\n <!-- empty base -->\n <ng-icon xui [size]=\"starPx() + 'px'\" color=\"subtle\" name=\"matStarRound\" class=\"absolute inset-0\" />\n <!-- filled overlay, clipped to the fill fraction -->\n <span class=\"absolute inset-0 overflow-hidden\" [style.width.%]=\"fillPercent(star)\">\n <ng-icon\n xui\n [size]=\"starPx() + 'px'\"\n color=\"warning\"\n name=\"matStarRound\"\n class=\"absolute inset-y-0 start-0\"\n />\n </span>\n @if (!readonly() && !isDisabled()) {\n @if (allowHalf()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 start-0 z-10 w-1/2 cursor-pointer\"\n (click)=\"pick(star - 0.5)\"\n (mouseenter)=\"hover.set(star - 0.5)\"\n ></span>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 end-0 z-10 cursor-pointer\"\n [class]=\"allowHalf() ? 'w-1/2' : 'w-full'\"\n (click)=\"pick(star)\"\n (mouseenter)=\"hover.set(star)\"\n ></span>\n }\n </span>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'slider',\n '[attr.aria-label]': 'effectiveAriaLabel()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'count()',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-readonly]': 'readonly() || null',\n '[attr.aria-disabled]': 'isDisabled() || null',\n '[attr.tabindex]': 'readonly() || isDisabled() ? null : 0',\n '(keydown)': 'onKeydown($event)',\n '(mouseleave)': 'hover.set(null)',\n '(blur)': 'cva.markTouched()'\n },\n imports: [NgIcon, XuiIcon],\n providers: [provideXValueAccessor(() => XuiRate)],\n viewProviders: [provideIcons({ matStarRound })],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiRate implements ControlValueAccessor {\n protected readonly direction = injectXDirection();\n\n readonly class = input<ClassValue>('');\n\n /** Names the control. Defaults to \"Rating\" so the slider is never anonymous. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n readonly value = model<number>(0);\n readonly count = input<number, NumberInput>(5, { transform: numberAttribute });\n readonly allowHalf = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Clicking the current value again resets it to 0. */\n readonly allowClear = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Star size in pixels. */\n readonly starSize = input<number, NumberInput>(20, { transform: numberAttribute });\n\n protected readonly cva = createXValueAccessor<number>({\n onWrite: value => this.value.set(value ?? 0),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly hover = signal<number | null>(null);\n\n protected readonly effectiveAriaLabel = computed(() => this.ariaLabel() ?? 'Rating');\n\n /** A bare number tells a screen-reader user nothing about the scale. */\n protected readonly valueText = computed(() => `${this.value()} of ${this.count()}`);\n\n protected readonly stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1));\n protected readonly starPx = computed(() => this.starSize());\n private readonly display = computed(() => this.hover() ?? this.value());\n\n protected fillPercent(star: number): number {\n const display = this.display();\n if (display >= star) {\n return 100;\n }\n if (display >= star - 0.5) {\n return 50;\n }\n return 0;\n }\n\n protected pick(next: number): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n this.commit(this.allowClear() && next === this.value() ? 0 : next);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n const step = this.allowHalf() ? 0.5 : 1;\n const arrow = arrowValueDirection(event.key, this.direction());\n if (!arrow) {\n return;\n }\n\n const next = arrow === 'increase' ? Math.min(this.count(), this.value() + step) : Math.max(0, this.value() - step);\n\n event.preventDefault();\n this.commit(next);\n }\n\n /** Store and notify — the single write path for every user interaction. */\n private commit(next: number): void {\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n protected readonly computedClass = computed(() =>\n xui(\n 'inline-flex items-center gap-1 rounded',\n (this.readonly() || this.isDisabled()) && 'cursor-default',\n this.isDisabled() && 'opacity-50',\n this.class()\n )\n );\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiRate } from './lib/rate';\n\nexport * from './lib/rate';\n\nexport const XuiRateImports = [XuiRate] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAqBA;;;;;;;;AAQG;MA4DU,OAAO,CAAA;IACC,SAAS,GAAG,gBAAgB,EAAE;IAExC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,SAAS,GAAG,KAAK,CAAgB,IAAI,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;IAE/D,KAAK,GAAG,KAAK,CAAS,CAAC;8EAAC;IACxB,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IACrE,SAAS,GAAG,KAAK,CAAwB,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEhF,UAAU,GAAG,KAAK,CAAwB,IAAI,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAChF,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC/E,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,QAAQ,GAAG,KAAK,CAAsB,EAAE,gFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IAE/D,GAAG,GAAG,oBAAoB,CAAS;AACpD,QAAA,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;QAC5C,QAAQ,EAAE,IAAI,CAAC;AAChB,KAAA,CAAC;AACiB,IAAA,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,Q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,GAAG,CAAC,OAAO;;ACJtC;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xui/rate",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.12",
4
4
  "description": "Modern Angular 22 UI Library based on TailwindCSS",
5
5
  "keywords": [
6
6
  "angular",
@@ -38,7 +38,11 @@
38
38
  "peerDependencies": {
39
39
  "@angular/cdk": "22",
40
40
  "@angular/core": "22",
41
- "@xui/core": "2.0.0-alpha.11",
41
+ "@angular/forms": "22",
42
+ "@ng-icons/core": "34",
43
+ "@ng-icons/material-icons": "34",
44
+ "@xui/core": "2.0.0-alpha.12",
45
+ "@xui/icon": "2.0.0-alpha.12",
42
46
  "clsx": "^2.1.1"
43
47
  },
44
48
  "publishConfig": {
@@ -1,6 +1,8 @@
1
+ import * as _xui_core_forms from '@xui/core/forms';
1
2
  import * as _angular_core from '@angular/core';
2
3
  import * as _xui_core_a11y from '@xui/core/a11y';
3
4
  import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
5
+ import { ControlValueAccessor } from '@angular/forms';
4
6
  import { ClassValue } from 'clsx';
5
7
 
6
8
  /**
@@ -12,8 +14,7 @@ import { ClassValue } from 'clsx';
12
14
  * <xui-rate [(value)]="score" allowHalf />
13
15
  * ```
14
16
  */
15
- declare class XuiRate {
16
- protected readonly STAR = "M12 2l2.9 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14l-5-4.87 7.1-1.01z";
17
+ declare class XuiRate implements ControlValueAccessor {
17
18
  protected readonly direction: _angular_core.Signal<_xui_core_a11y.XDirection>;
18
19
  readonly class: _angular_core.InputSignal<ClassValue>;
19
20
  /** Names the control. Defaults to "Rating" so the slider is never anonymous. */
@@ -27,6 +28,8 @@ declare class XuiRate {
27
28
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
28
29
  /** Star size in pixels. */
29
30
  readonly starSize: _angular_core.InputSignalWithTransform<number, NumberInput>;
31
+ protected readonly cva: _xui_core_forms.XValueAccessor<number>;
32
+ protected readonly isDisabled: _angular_core.Signal<boolean>;
30
33
  protected readonly hover: _angular_core.WritableSignal<number | null>;
31
34
  protected readonly effectiveAriaLabel: _angular_core.Signal<string>;
32
35
  /** A bare number tells a screen-reader user nothing about the scale. */
@@ -37,7 +40,13 @@ declare class XuiRate {
37
40
  protected fillPercent(star: number): number;
38
41
  protected pick(next: number): void;
39
42
  protected onKeydown(event: KeyboardEvent): void;
43
+ /** Store and notify — the single write path for every user interaction. */
44
+ private commit;
40
45
  protected readonly computedClass: _angular_core.Signal<string>;
46
+ readonly writeValue: (value: number) => void;
47
+ readonly registerOnChange: (fn: _xui_core_forms.XChangeFn<number>) => void;
48
+ readonly registerOnTouched: (fn: _xui_core_forms.XTouchFn) => void;
49
+ readonly setDisabledState: (isDisabled: boolean) => void;
41
50
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiRate, never>;
42
51
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiRate, "xui-rate", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "count": { "alias": "count"; "required": false; "isSignal": true; }; "allowHalf": { "alias": "allowHalf"; "required": false; "isSignal": true; }; "allowClear": { "alias": "allowClear"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "starSize": { "alias": "starSize"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
43
52
  }