@xui/transfer 2.0.0-alpha.11
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 +201 -0
- package/README.md +217 -0
- package/fesm2022/xui-transfer.mjs +466 -0
- package/fesm2022/xui-transfer.mjs.map +1 -0
- package/package.json +47 -0
- package/types/xui-transfer.d.ts +69 -0
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
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<p style="font-size: 5rem; font-weight: 700; text-align: center">
|
|
2
|
+
<span style="color: #1f75cb">x</span>UI
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
[](https://xuijs.org/)
|
|
9
|
+
[](https://www.npmjs.com/org/xui)
|
|
10
|
+
[](/LICENSE)
|
|
11
|
+
[](https://app.netlify.com/sites/xui/deploys)
|
|
12
|
+
|
|
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.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
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 | [](https://www.npmjs.com/package/%40xui/core)<br />[](https://www.npmjs.com/package/%40xui/core)<br />[](https://bundlephobia.com/result?p=%40xui/core) | Core package required by all other packages |
|
|
42
|
+
| Badge | [](https://www.npmjs.com/package/%40xui/badge)<br />[](https://www.npmjs.com/package/%40xui/badge)<br />[](https://bundlephobia.com/result?p=%40xui/badge) | Badge component |
|
|
43
|
+
| Breadcrumb | [](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[](https://bundlephobia.com/result?p=%40xui/breadcrumb) | Breadcrumb component |
|
|
44
|
+
| Button | [](https://www.npmjs.com/package/%40xui/button)<br />[](https://www.npmjs.com/package/%40xui/button)<br />[](https://bundlephobia.com/result?p=%40xui/button) | Button component |
|
|
45
|
+
| Button Group | [](https://www.npmjs.com/package/%40xui/button-group)<br />[](https://www.npmjs.com/package/%40xui/button-group)<br />[](https://bundlephobia.com/result?p=%40xui/button-group) | Button Group component |
|
|
46
|
+
| Checkbox | [](https://www.npmjs.com/package/%40xui/checkbox)<br />[](https://www.npmjs.com/package/%40xui/checkbox)<br />[](https://bundlephobia.com/result?p=%40xui/checkbox) | Checkbox component |
|
|
47
|
+
| Form Field | [](https://www.npmjs.com/package/%40xui/form-field)<br />[](https://www.npmjs.com/package/%40xui/form-field)<br />[](https://bundlephobia.com/result?p=%40xui/form-field) | Form Field component |
|
|
48
|
+
| Icon | [](https://www.npmjs.com/package/%40xui/icon)<br />[](https://www.npmjs.com/package/%40xui/icon)<br />[](https://bundlephobia.com/result?p=%40xui/icon) | Icon component |
|
|
49
|
+
| Input | [](https://www.npmjs.com/package/%40xui/input)<br />[](https://www.npmjs.com/package/%40xui/input)<br />[](https://bundlephobia.com/result?p=%40xui/input) | Input component |
|
|
50
|
+
| Label | [](https://www.npmjs.com/package/%40xui/label)<br />[](https://www.npmjs.com/package/%40xui/label)<br />[](https://bundlephobia.com/result?p=%40xui/label) | Label component |
|
|
51
|
+
| Skeleton | [](https://www.npmjs.com/package/%40xui/skeleton)<br />[](https://www.npmjs.com/package/%40xui/skeleton)<br />[](https://bundlephobia.com/result?p=%40xui/skeleton) | Skeleton component |
|
|
52
|
+
| Spinner | [](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://bundlephobia.com/result?p=%40xui/spinner) | Spinner component |
|
|
53
|
+
| Status | [](https://www.npmjs.com/package/%40xui/status)<br />[](https://www.npmjs.com/package/%40xui/status)<br />[](https://bundlephobia.com/result?p=%40xui/status) | Status component |
|
|
54
|
+
| Table | [](https://www.npmjs.com/package/%40xui/table)<br />[](https://www.npmjs.com/package/%40xui/table)<br />[](https://bundlephobia.com/result?p=%40xui/table) | Table component |
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Install package with **PNPM**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm i @xui/core ....
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Theming
|
|
65
|
+
|
|
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:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
@import 'tailwindcss';
|
|
72
|
+
@import '@xui/core/styles/theme.css';
|
|
73
|
+
|
|
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. */
|
|
76
|
+
@import '@angular/cdk/overlay-prebuilt.css';
|
|
77
|
+
|
|
78
|
+
/* Tell Tailwind to scan the component sources for utility classes. */
|
|
79
|
+
@source '../node_modules/@xui';
|
|
80
|
+
```
|
|
81
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
Re-theme by overriding tokens after the import — the `darker` / `lighter` / `subtle` / `muted` /
|
|
87
|
+
`emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
:root {
|
|
91
|
+
--primary: var(--color-violet-600);
|
|
92
|
+
--surface-inset: var(--color-zinc-50);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
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).
|
|
98
|
+
|
|
99
|
+
## Browser Support
|
|
100
|
+
|
|
101
|
+
xUI Supports most recent browsers according to Angular [support](https://angular.io/guide/browser-support).
|
|
102
|
+
|
|
103
|
+
## Development
|
|
104
|
+
|
|
105
|
+
The project uses `NX` and `Angular` to build the package.
|
|
106
|
+
|
|
107
|
+
To start docs page use
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm start
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
To start storybook use
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm storybook
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## AI coding agents
|
|
120
|
+
|
|
121
|
+
Two pieces of tooling teach coding agents how to build with xUI.
|
|
122
|
+
|
|
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.
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"xui": { "command": "npx", "args": ["-y", "@xui/mcp"] }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
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.
|
|
138
|
+
|
|
139
|
+
**Skill** — [`skills/xui`](https://github.com/Rikarin/xui/blob/HEAD/skills/xui/SKILL.md) is the procedural knowledge: the three-layer
|
|
140
|
+
architecture, discovery through the MCP server, composition and styling rules, theming, the
|
|
141
|
+
generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
|
|
142
|
+
links to it for agents working in this repository.
|
|
143
|
+
|
|
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
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, booleanAttribute, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { xui } from '@xui/core';
|
|
4
|
+
import { uniqueId } from '@xui/core/a11y';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A dual list-box that moves items between a source and a target list. `items`
|
|
8
|
+
* is the full set; `targetKeys` (two-way) are the keys on the right. Check items
|
|
9
|
+
* and use the arrow buttons to move them; each side can be searched.
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <xui-transfer [items]="all" [(targetKeys)]="selected" searchable />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class XuiTransfer {
|
|
16
|
+
SIDES = ['left', 'right'];
|
|
17
|
+
class = input('', /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
19
|
+
items = input([], /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
21
|
+
targetKeys = model([], /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "targetKeys" }] : /* istanbul ignore next */ []));
|
|
23
|
+
titles = input(['Source', 'Target'], /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "titles" }] : /* istanbul ignore next */ []));
|
|
25
|
+
searchable = input(false, { ...(ngDevMode ? { debugName: "searchable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
26
|
+
checkedLeft = signal(new Set(), /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "checkedLeft" }] : /* istanbul ignore next */ []));
|
|
28
|
+
checkedRight = signal(new Set(), /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "checkedRight" }] : /* istanbul ignore next */ []));
|
|
30
|
+
searchLeft = signal('', /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "searchLeft" }] : /* istanbul ignore next */ []));
|
|
32
|
+
searchRight = signal('', /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "searchRight" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** The option the arrow keys are on, per side — see `aria-activedescendant`. */
|
|
35
|
+
activeLeft = signal(null, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "activeLeft" }] : /* istanbul ignore next */ []));
|
|
37
|
+
activeRight = signal(null, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "activeRight" }] : /* istanbul ignore next */ []));
|
|
39
|
+
idPrefix = uniqueId('xui-transfer');
|
|
40
|
+
targetSet = computed(() => new Set(this.targetKeys()), /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "targetSet" }] : /* istanbul ignore next */ []));
|
|
42
|
+
leftItems = computed(() => this.items().filter(item => !this.targetSet().has(item.key)), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "leftItems" }] : /* istanbul ignore next */ []));
|
|
44
|
+
rightItems = computed(() => this.items().filter(item => this.targetSet().has(item.key)), /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "rightItems" }] : /* istanbul ignore next */ []));
|
|
46
|
+
title(side) {
|
|
47
|
+
return side === 'left' ? this.titles()[0] : this.titles()[1];
|
|
48
|
+
}
|
|
49
|
+
list(side) {
|
|
50
|
+
return side === 'left' ? this.leftItems() : this.rightItems();
|
|
51
|
+
}
|
|
52
|
+
checked(side) {
|
|
53
|
+
return side === 'left' ? this.checkedLeft() : this.checkedRight();
|
|
54
|
+
}
|
|
55
|
+
filtered(side) {
|
|
56
|
+
const query = (side === 'left' ? this.searchLeft() : this.searchRight()).toLowerCase().trim();
|
|
57
|
+
const list = this.list(side);
|
|
58
|
+
return query ? list.filter(item => item.title.toLowerCase().includes(query)) : list;
|
|
59
|
+
}
|
|
60
|
+
checkedCount(side) {
|
|
61
|
+
const checked = this.checked(side);
|
|
62
|
+
return this.list(side).filter(item => checked.has(item.key)).length;
|
|
63
|
+
}
|
|
64
|
+
allChecked(side) {
|
|
65
|
+
const enabled = this.filtered(side).filter(item => !item.disabled);
|
|
66
|
+
return enabled.length > 0 && enabled.every(item => this.checked(side).has(item.key));
|
|
67
|
+
}
|
|
68
|
+
someChecked(side) {
|
|
69
|
+
return this.checkedCount(side) > 0 && !this.allChecked(side);
|
|
70
|
+
}
|
|
71
|
+
setSearch(side, value) {
|
|
72
|
+
(side === 'left' ? this.searchLeft : this.searchRight).set(value);
|
|
73
|
+
// The old active option may have been filtered away.
|
|
74
|
+
(side === 'left' ? this.activeLeft : this.activeRight).set(null);
|
|
75
|
+
}
|
|
76
|
+
// --- keyboard -------------------------------------------------------------
|
|
77
|
+
optionId(side, key) {
|
|
78
|
+
return `${this.idPrefix}-${side}-${key}`;
|
|
79
|
+
}
|
|
80
|
+
/** The active option's key, defaulting to the first one so a fresh Tab lands somewhere. */
|
|
81
|
+
activeKey(side) {
|
|
82
|
+
const active = side === 'left' ? this.activeLeft() : this.activeRight();
|
|
83
|
+
const options = this.filtered(side);
|
|
84
|
+
if (active && options.some(item => item.key === active)) {
|
|
85
|
+
return active;
|
|
86
|
+
}
|
|
87
|
+
return options[0]?.key ?? null;
|
|
88
|
+
}
|
|
89
|
+
activeOptionId(side) {
|
|
90
|
+
const key = this.activeKey(side);
|
|
91
|
+
return key === null ? null : this.optionId(side, key);
|
|
92
|
+
}
|
|
93
|
+
/** Move the active option and check it — clicking does both, so keys match. */
|
|
94
|
+
activate(side, item) {
|
|
95
|
+
(side === 'left' ? this.activeLeft : this.activeRight).set(item.key);
|
|
96
|
+
this.toggle(side, item);
|
|
97
|
+
}
|
|
98
|
+
onListKeydown(side, event) {
|
|
99
|
+
const options = this.filtered(side);
|
|
100
|
+
if (!options.length) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const current = Math.max(0, options.findIndex(item => item.key === this.activeKey(side)));
|
|
104
|
+
let next;
|
|
105
|
+
switch (event.key) {
|
|
106
|
+
case 'ArrowDown':
|
|
107
|
+
next = Math.min(options.length - 1, current + 1);
|
|
108
|
+
break;
|
|
109
|
+
case 'ArrowUp':
|
|
110
|
+
next = Math.max(0, current - 1);
|
|
111
|
+
break;
|
|
112
|
+
case 'Home':
|
|
113
|
+
next = 0;
|
|
114
|
+
break;
|
|
115
|
+
case 'End':
|
|
116
|
+
next = options.length - 1;
|
|
117
|
+
break;
|
|
118
|
+
case ' ':
|
|
119
|
+
case 'Enter':
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
this.toggle(side, options[current]);
|
|
122
|
+
return;
|
|
123
|
+
default:
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
(side === 'left' ? this.activeLeft : this.activeRight).set(options[next].key);
|
|
128
|
+
}
|
|
129
|
+
toggle(side, item) {
|
|
130
|
+
if (item.disabled) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const signalRef = side === 'left' ? this.checkedLeft : this.checkedRight;
|
|
134
|
+
const next = new Set(signalRef());
|
|
135
|
+
if (next.has(item.key)) {
|
|
136
|
+
next.delete(item.key);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
next.add(item.key);
|
|
140
|
+
}
|
|
141
|
+
signalRef.set(next);
|
|
142
|
+
}
|
|
143
|
+
toggleAll(side) {
|
|
144
|
+
const signalRef = side === 'left' ? this.checkedLeft : this.checkedRight;
|
|
145
|
+
const enabled = this.filtered(side).filter(item => !item.disabled);
|
|
146
|
+
if (this.allChecked(side)) {
|
|
147
|
+
const next = new Set(signalRef());
|
|
148
|
+
enabled.forEach(item => next.delete(item.key));
|
|
149
|
+
signalRef.set(next);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const next = new Set(signalRef());
|
|
153
|
+
enabled.forEach(item => next.add(item.key));
|
|
154
|
+
signalRef.set(next);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
move(to) {
|
|
158
|
+
if (to === 'right') {
|
|
159
|
+
const moving = this.leftItems().filter(item => !item.disabled && this.checkedLeft().has(item.key));
|
|
160
|
+
this.targetKeys.set([...this.targetKeys(), ...moving.map(item => item.key)]);
|
|
161
|
+
this.checkedLeft.set(new Set());
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const movingKeys = new Set(this.rightItems()
|
|
165
|
+
.filter(item => !item.disabled && this.checkedRight().has(item.key))
|
|
166
|
+
.map(item => item.key));
|
|
167
|
+
this.targetKeys.set(this.targetKeys().filter(key => !movingKeys.has(key)));
|
|
168
|
+
this.checkedRight.set(new Set());
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
computedClass = computed(() => xui('flex items-stretch', this.class()), /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
173
|
+
panelClass = computed(() => xui('border-border bg-surface flex w-56 flex-col rounded-lg border'), /* @ts-ignore */
|
|
174
|
+
...(ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []));
|
|
175
|
+
searchClass = computed(() => xui('border-border bg-surface text-foreground focus:border-focus h-(--control-height-md) w-full rounded-md border px-(--control-padding-sm) text-sm focus:outline-none'), /* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "searchClass" }] : /* istanbul ignore next */ []));
|
|
177
|
+
checkboxClass(active) {
|
|
178
|
+
return xui('flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded border', active ? 'bg-primary border-primary text-primary-foreground' : 'border-border');
|
|
179
|
+
}
|
|
180
|
+
itemClass(item, active) {
|
|
181
|
+
return xui('flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-sm select-none', item.disabled ? 'text-foreground-subtle cursor-not-allowed' : 'hover:bg-surface-inset',
|
|
182
|
+
// The list owns the tab stop, so the active option is marked here rather
|
|
183
|
+
// than by a focus ring on the option itself.
|
|
184
|
+
active && 'bg-surface-inset');
|
|
185
|
+
}
|
|
186
|
+
moveClass() {
|
|
187
|
+
return xui('border-border text-foreground hover:bg-surface-inset flex size-(--control-height-md) items-center justify-center rounded-md border disabled:pointer-events-none disabled:opacity-40');
|
|
188
|
+
}
|
|
189
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiTransfer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
190
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiTransfer, isStandalone: true, selector: "xui-transfer", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, targetKeys: { classPropertyName: "targetKeys", publicName: "targetKeys", isSignal: true, isRequired: false, transformFunction: null }, titles: { classPropertyName: "titles", publicName: "titles", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { targetKeys: "targetKeysChange" }, host: { properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
191
|
+
@for (side of SIDES; track side) {
|
|
192
|
+
<div [class]="panelClass()">
|
|
193
|
+
<div class="border-border flex items-center gap-2 border-b px-3 py-2">
|
|
194
|
+
<button
|
|
195
|
+
type="button"
|
|
196
|
+
role="checkbox"
|
|
197
|
+
[class]="checkboxClass(allChecked(side))"
|
|
198
|
+
[attr.aria-checked]="allChecked(side) ? 'true' : someChecked(side) ? 'mixed' : 'false'"
|
|
199
|
+
[attr.aria-label]="'Select all in ' + title(side)"
|
|
200
|
+
(click)="toggleAll(side)"
|
|
201
|
+
>
|
|
202
|
+
@if (allChecked(side)) {
|
|
203
|
+
<svg viewBox="0 0 24 24" class="h-3 w-3" fill="none">
|
|
204
|
+
<path
|
|
205
|
+
d="M20 6 9 17l-5-5"
|
|
206
|
+
stroke="currentColor"
|
|
207
|
+
stroke-width="3"
|
|
208
|
+
stroke-linecap="round"
|
|
209
|
+
stroke-linejoin="round"
|
|
210
|
+
/>
|
|
211
|
+
</svg>
|
|
212
|
+
} @else if (someChecked(side)) {
|
|
213
|
+
<span class="bg-primary-foreground h-0.5 w-2"></span>
|
|
214
|
+
}
|
|
215
|
+
</button>
|
|
216
|
+
<span class="text-foreground text-sm font-medium">{{ title(side) }}</span>
|
|
217
|
+
<span class="text-foreground-muted ms-auto text-xs">{{ checkedCount(side) }}/{{ list(side).length }}</span>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
@if (searchable()) {
|
|
221
|
+
<div class="border-border border-b p-2">
|
|
222
|
+
<input
|
|
223
|
+
[class]="searchClass()"
|
|
224
|
+
[value]="side === 'left' ? searchLeft() : searchRight()"
|
|
225
|
+
(input)="setSearch(side, $any($event.target).value)"
|
|
226
|
+
[attr.placeholder]="'Search'"
|
|
227
|
+
aria-label="Search"
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
<!-- A multi-select listbox: one tab stop per side, arrow keys move the
|
|
233
|
+
active option, Space/Enter checks it. -->
|
|
234
|
+
<ul
|
|
235
|
+
role="listbox"
|
|
236
|
+
aria-multiselectable="true"
|
|
237
|
+
[attr.aria-label]="title(side)"
|
|
238
|
+
[attr.aria-activedescendant]="activeOptionId(side)"
|
|
239
|
+
class="min-h-40 flex-1 overflow-auto p-1"
|
|
240
|
+
[tabindex]="filtered(side).length ? 0 : -1"
|
|
241
|
+
(keydown)="onListKeydown(side, $event)"
|
|
242
|
+
>
|
|
243
|
+
@for (item of filtered(side); track item.key) {
|
|
244
|
+
<!-- The keyboard path is the listbox's, not the option's: under
|
|
245
|
+
aria-activedescendant the container holds the tab stop and the
|
|
246
|
+
key handler, so a per-option one would be a second, conflicting
|
|
247
|
+
tab stop. The lint rules only look at this element. -->
|
|
248
|
+
<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
|
|
249
|
+
<li
|
|
250
|
+
role="option"
|
|
251
|
+
[id]="optionId(side, item.key)"
|
|
252
|
+
[class]="itemClass(item, activeKey(side) === item.key)"
|
|
253
|
+
[attr.aria-selected]="checked(side).has(item.key)"
|
|
254
|
+
[attr.aria-disabled]="item.disabled ? true : null"
|
|
255
|
+
(click)="activate(side, item)"
|
|
256
|
+
>
|
|
257
|
+
<span [class]="checkboxClass(checked(side).has(item.key))">
|
|
258
|
+
@if (checked(side).has(item.key)) {
|
|
259
|
+
<svg viewBox="0 0 24 24" class="h-3 w-3" fill="none">
|
|
260
|
+
<path
|
|
261
|
+
d="M20 6 9 17l-5-5"
|
|
262
|
+
stroke="currentColor"
|
|
263
|
+
stroke-width="3"
|
|
264
|
+
stroke-linecap="round"
|
|
265
|
+
stroke-linejoin="round"
|
|
266
|
+
/>
|
|
267
|
+
</svg>
|
|
268
|
+
}
|
|
269
|
+
</span>
|
|
270
|
+
<span class="truncate">{{ item.title }}</span>
|
|
271
|
+
</li>
|
|
272
|
+
} @empty {
|
|
273
|
+
<li class="text-foreground-subtle px-2 py-6 text-center text-sm">No items</li>
|
|
274
|
+
}
|
|
275
|
+
</ul>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
@if (side === 'left') {
|
|
279
|
+
<div class="flex flex-col justify-center gap-2 px-2">
|
|
280
|
+
<button
|
|
281
|
+
type="button"
|
|
282
|
+
[class]="moveClass()"
|
|
283
|
+
[disabled]="checkedCount('left') === 0"
|
|
284
|
+
(click)="move('right')"
|
|
285
|
+
aria-label="Move right"
|
|
286
|
+
>
|
|
287
|
+
<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none">
|
|
288
|
+
<path
|
|
289
|
+
d="M9 6l6 6-6 6"
|
|
290
|
+
stroke="currentColor"
|
|
291
|
+
stroke-width="2"
|
|
292
|
+
stroke-linecap="round"
|
|
293
|
+
stroke-linejoin="round"
|
|
294
|
+
/>
|
|
295
|
+
</svg>
|
|
296
|
+
</button>
|
|
297
|
+
<button
|
|
298
|
+
type="button"
|
|
299
|
+
[class]="moveClass()"
|
|
300
|
+
[disabled]="checkedCount('right') === 0"
|
|
301
|
+
(click)="move('left')"
|
|
302
|
+
aria-label="Move left"
|
|
303
|
+
>
|
|
304
|
+
<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none">
|
|
305
|
+
<path
|
|
306
|
+
d="M15 6l-6 6 6 6"
|
|
307
|
+
stroke="currentColor"
|
|
308
|
+
stroke-width="2"
|
|
309
|
+
stroke-linecap="round"
|
|
310
|
+
stroke-linejoin="round"
|
|
311
|
+
/>
|
|
312
|
+
</svg>
|
|
313
|
+
</button>
|
|
314
|
+
</div>
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
318
|
+
}
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiTransfer, decorators: [{
|
|
320
|
+
type: Component,
|
|
321
|
+
args: [{
|
|
322
|
+
selector: 'xui-transfer',
|
|
323
|
+
template: `
|
|
324
|
+
@for (side of SIDES; track side) {
|
|
325
|
+
<div [class]="panelClass()">
|
|
326
|
+
<div class="border-border flex items-center gap-2 border-b px-3 py-2">
|
|
327
|
+
<button
|
|
328
|
+
type="button"
|
|
329
|
+
role="checkbox"
|
|
330
|
+
[class]="checkboxClass(allChecked(side))"
|
|
331
|
+
[attr.aria-checked]="allChecked(side) ? 'true' : someChecked(side) ? 'mixed' : 'false'"
|
|
332
|
+
[attr.aria-label]="'Select all in ' + title(side)"
|
|
333
|
+
(click)="toggleAll(side)"
|
|
334
|
+
>
|
|
335
|
+
@if (allChecked(side)) {
|
|
336
|
+
<svg viewBox="0 0 24 24" class="h-3 w-3" fill="none">
|
|
337
|
+
<path
|
|
338
|
+
d="M20 6 9 17l-5-5"
|
|
339
|
+
stroke="currentColor"
|
|
340
|
+
stroke-width="3"
|
|
341
|
+
stroke-linecap="round"
|
|
342
|
+
stroke-linejoin="round"
|
|
343
|
+
/>
|
|
344
|
+
</svg>
|
|
345
|
+
} @else if (someChecked(side)) {
|
|
346
|
+
<span class="bg-primary-foreground h-0.5 w-2"></span>
|
|
347
|
+
}
|
|
348
|
+
</button>
|
|
349
|
+
<span class="text-foreground text-sm font-medium">{{ title(side) }}</span>
|
|
350
|
+
<span class="text-foreground-muted ms-auto text-xs">{{ checkedCount(side) }}/{{ list(side).length }}</span>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
@if (searchable()) {
|
|
354
|
+
<div class="border-border border-b p-2">
|
|
355
|
+
<input
|
|
356
|
+
[class]="searchClass()"
|
|
357
|
+
[value]="side === 'left' ? searchLeft() : searchRight()"
|
|
358
|
+
(input)="setSearch(side, $any($event.target).value)"
|
|
359
|
+
[attr.placeholder]="'Search'"
|
|
360
|
+
aria-label="Search"
|
|
361
|
+
/>
|
|
362
|
+
</div>
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
<!-- A multi-select listbox: one tab stop per side, arrow keys move the
|
|
366
|
+
active option, Space/Enter checks it. -->
|
|
367
|
+
<ul
|
|
368
|
+
role="listbox"
|
|
369
|
+
aria-multiselectable="true"
|
|
370
|
+
[attr.aria-label]="title(side)"
|
|
371
|
+
[attr.aria-activedescendant]="activeOptionId(side)"
|
|
372
|
+
class="min-h-40 flex-1 overflow-auto p-1"
|
|
373
|
+
[tabindex]="filtered(side).length ? 0 : -1"
|
|
374
|
+
(keydown)="onListKeydown(side, $event)"
|
|
375
|
+
>
|
|
376
|
+
@for (item of filtered(side); track item.key) {
|
|
377
|
+
<!-- The keyboard path is the listbox's, not the option's: under
|
|
378
|
+
aria-activedescendant the container holds the tab stop and the
|
|
379
|
+
key handler, so a per-option one would be a second, conflicting
|
|
380
|
+
tab stop. The lint rules only look at this element. -->
|
|
381
|
+
<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
|
|
382
|
+
<li
|
|
383
|
+
role="option"
|
|
384
|
+
[id]="optionId(side, item.key)"
|
|
385
|
+
[class]="itemClass(item, activeKey(side) === item.key)"
|
|
386
|
+
[attr.aria-selected]="checked(side).has(item.key)"
|
|
387
|
+
[attr.aria-disabled]="item.disabled ? true : null"
|
|
388
|
+
(click)="activate(side, item)"
|
|
389
|
+
>
|
|
390
|
+
<span [class]="checkboxClass(checked(side).has(item.key))">
|
|
391
|
+
@if (checked(side).has(item.key)) {
|
|
392
|
+
<svg viewBox="0 0 24 24" class="h-3 w-3" fill="none">
|
|
393
|
+
<path
|
|
394
|
+
d="M20 6 9 17l-5-5"
|
|
395
|
+
stroke="currentColor"
|
|
396
|
+
stroke-width="3"
|
|
397
|
+
stroke-linecap="round"
|
|
398
|
+
stroke-linejoin="round"
|
|
399
|
+
/>
|
|
400
|
+
</svg>
|
|
401
|
+
}
|
|
402
|
+
</span>
|
|
403
|
+
<span class="truncate">{{ item.title }}</span>
|
|
404
|
+
</li>
|
|
405
|
+
} @empty {
|
|
406
|
+
<li class="text-foreground-subtle px-2 py-6 text-center text-sm">No items</li>
|
|
407
|
+
}
|
|
408
|
+
</ul>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
@if (side === 'left') {
|
|
412
|
+
<div class="flex flex-col justify-center gap-2 px-2">
|
|
413
|
+
<button
|
|
414
|
+
type="button"
|
|
415
|
+
[class]="moveClass()"
|
|
416
|
+
[disabled]="checkedCount('left') === 0"
|
|
417
|
+
(click)="move('right')"
|
|
418
|
+
aria-label="Move right"
|
|
419
|
+
>
|
|
420
|
+
<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none">
|
|
421
|
+
<path
|
|
422
|
+
d="M9 6l6 6-6 6"
|
|
423
|
+
stroke="currentColor"
|
|
424
|
+
stroke-width="2"
|
|
425
|
+
stroke-linecap="round"
|
|
426
|
+
stroke-linejoin="round"
|
|
427
|
+
/>
|
|
428
|
+
</svg>
|
|
429
|
+
</button>
|
|
430
|
+
<button
|
|
431
|
+
type="button"
|
|
432
|
+
[class]="moveClass()"
|
|
433
|
+
[disabled]="checkedCount('right') === 0"
|
|
434
|
+
(click)="move('left')"
|
|
435
|
+
aria-label="Move left"
|
|
436
|
+
>
|
|
437
|
+
<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none">
|
|
438
|
+
<path
|
|
439
|
+
d="M15 6l-6 6 6 6"
|
|
440
|
+
stroke="currentColor"
|
|
441
|
+
stroke-width="2"
|
|
442
|
+
stroke-linecap="round"
|
|
443
|
+
stroke-linejoin="round"
|
|
444
|
+
/>
|
|
445
|
+
</svg>
|
|
446
|
+
</button>
|
|
447
|
+
</div>
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
`,
|
|
451
|
+
host: {
|
|
452
|
+
'[class]': 'computedClass()'
|
|
453
|
+
},
|
|
454
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
455
|
+
encapsulation: ViewEncapsulation.None
|
|
456
|
+
}]
|
|
457
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], targetKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "targetKeys", required: false }] }, { type: i0.Output, args: ["targetKeysChange"] }], titles: [{ type: i0.Input, args: [{ isSignal: true, alias: "titles", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }] } });
|
|
458
|
+
|
|
459
|
+
const XuiTransferImports = [XuiTransfer];
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Generated bundle index. Do not edit.
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
export { XuiTransfer, XuiTransferImports };
|
|
466
|
+
//# sourceMappingURL=xui-transfer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xui-transfer.mjs","sources":["../../../../../../libs/ui/transfer/xui/src/lib/transfer.ts","../../../../../../libs/ui/transfer/xui/src/index.ts","../../../../../../libs/ui/transfer/xui/src/xui-transfer.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { xui } from '@xui/core';\nimport { uniqueId } from '@xui/core/a11y';\nimport type { ClassValue } from 'clsx';\n\nexport interface XuiTransferItem {\n key: string;\n title: string;\n disabled?: boolean;\n}\n\ntype Side = 'left' | 'right';\n\n/**\n * A dual list-box that moves items between a source and a target list. `items`\n * is the full set; `targetKeys` (two-way) are the keys on the right. Check items\n * and use the arrow buttons to move them; each side can be searched.\n *\n * ```html\n * <xui-transfer [items]=\"all\" [(targetKeys)]=\"selected\" searchable />\n * ```\n */\n@Component({\n selector: 'xui-transfer',\n template: `\n @for (side of SIDES; track side) {\n <div [class]=\"panelClass()\">\n <div class=\"border-border flex items-center gap-2 border-b px-3 py-2\">\n <button\n type=\"button\"\n role=\"checkbox\"\n [class]=\"checkboxClass(allChecked(side))\"\n [attr.aria-checked]=\"allChecked(side) ? 'true' : someChecked(side) ? 'mixed' : 'false'\"\n [attr.aria-label]=\"'Select all in ' + title(side)\"\n (click)=\"toggleAll(side)\"\n >\n @if (allChecked(side)) {\n <svg viewBox=\"0 0 24 24\" class=\"h-3 w-3\" fill=\"none\">\n <path\n d=\"M20 6 9 17l-5-5\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n } @else if (someChecked(side)) {\n <span class=\"bg-primary-foreground h-0.5 w-2\"></span>\n }\n </button>\n <span class=\"text-foreground text-sm font-medium\">{{ title(side) }}</span>\n <span class=\"text-foreground-muted ms-auto text-xs\">{{ checkedCount(side) }}/{{ list(side).length }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"border-border border-b p-2\">\n <input\n [class]=\"searchClass()\"\n [value]=\"side === 'left' ? searchLeft() : searchRight()\"\n (input)=\"setSearch(side, $any($event.target).value)\"\n [attr.placeholder]=\"'Search'\"\n aria-label=\"Search\"\n />\n </div>\n }\n\n <!-- A multi-select listbox: one tab stop per side, arrow keys move the\n active option, Space/Enter checks it. -->\n <ul\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [attr.aria-label]=\"title(side)\"\n [attr.aria-activedescendant]=\"activeOptionId(side)\"\n class=\"min-h-40 flex-1 overflow-auto p-1\"\n [tabindex]=\"filtered(side).length ? 0 : -1\"\n (keydown)=\"onListKeydown(side, $event)\"\n >\n @for (item of filtered(side); track item.key) {\n <!-- The keyboard path is the listbox's, not the option's: under\n aria-activedescendant the container holds the tab stop and the\n key handler, so a per-option one would be a second, conflicting\n tab stop. The lint rules only look at this element. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"optionId(side, item.key)\"\n [class]=\"itemClass(item, activeKey(side) === item.key)\"\n [attr.aria-selected]=\"checked(side).has(item.key)\"\n [attr.aria-disabled]=\"item.disabled ? true : null\"\n (click)=\"activate(side, item)\"\n >\n <span [class]=\"checkboxClass(checked(side).has(item.key))\">\n @if (checked(side).has(item.key)) {\n <svg viewBox=\"0 0 24 24\" class=\"h-3 w-3\" fill=\"none\">\n <path\n d=\"M20 6 9 17l-5-5\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n <span class=\"truncate\">{{ item.title }}</span>\n </li>\n } @empty {\n <li class=\"text-foreground-subtle px-2 py-6 text-center text-sm\">No items</li>\n }\n </ul>\n </div>\n\n @if (side === 'left') {\n <div class=\"flex flex-col justify-center gap-2 px-2\">\n <button\n type=\"button\"\n [class]=\"moveClass()\"\n [disabled]=\"checkedCount('left') === 0\"\n (click)=\"move('right')\"\n aria-label=\"Move right\"\n >\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\">\n <path\n d=\"M9 6l6 6-6 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n [class]=\"moveClass()\"\n [disabled]=\"checkedCount('right') === 0\"\n (click)=\"move('left')\"\n aria-label=\"Move left\"\n >\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\">\n <path\n d=\"M15 6l-6 6 6 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n }\n }\n `,\n host: {\n '[class]': 'computedClass()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiTransfer {\n protected readonly SIDES: Side[] = ['left', 'right'];\n\n readonly class = input<ClassValue>('');\n readonly items = input<XuiTransferItem[]>([]);\n readonly targetKeys = model<string[]>([]);\n readonly titles = input<[string, string]>(['Source', 'Target']);\n readonly searchable = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n private readonly checkedLeft = signal(new Set<string>());\n private readonly checkedRight = signal(new Set<string>());\n protected readonly searchLeft = signal('');\n protected readonly searchRight = signal('');\n\n /** The option the arrow keys are on, per side — see `aria-activedescendant`. */\n private readonly activeLeft = signal<string | null>(null);\n private readonly activeRight = signal<string | null>(null);\n private readonly idPrefix = uniqueId('xui-transfer');\n\n private readonly targetSet = computed(() => new Set(this.targetKeys()));\n protected readonly leftItems = computed(() => this.items().filter(item => !this.targetSet().has(item.key)));\n protected readonly rightItems = computed(() => this.items().filter(item => this.targetSet().has(item.key)));\n\n protected title(side: Side): string {\n return side === 'left' ? this.titles()[0] : this.titles()[1];\n }\n protected list(side: Side): XuiTransferItem[] {\n return side === 'left' ? this.leftItems() : this.rightItems();\n }\n protected checked(side: Side): Set<string> {\n return side === 'left' ? this.checkedLeft() : this.checkedRight();\n }\n\n protected filtered(side: Side): XuiTransferItem[] {\n const query = (side === 'left' ? this.searchLeft() : this.searchRight()).toLowerCase().trim();\n const list = this.list(side);\n return query ? list.filter(item => item.title.toLowerCase().includes(query)) : list;\n }\n\n protected checkedCount(side: Side): number {\n const checked = this.checked(side);\n return this.list(side).filter(item => checked.has(item.key)).length;\n }\n protected allChecked(side: Side): boolean {\n const enabled = this.filtered(side).filter(item => !item.disabled);\n return enabled.length > 0 && enabled.every(item => this.checked(side).has(item.key));\n }\n protected someChecked(side: Side): boolean {\n return this.checkedCount(side) > 0 && !this.allChecked(side);\n }\n\n protected setSearch(side: Side, value: string): void {\n (side === 'left' ? this.searchLeft : this.searchRight).set(value);\n // The old active option may have been filtered away.\n (side === 'left' ? this.activeLeft : this.activeRight).set(null);\n }\n\n // --- keyboard -------------------------------------------------------------\n\n protected optionId(side: Side, key: string): string {\n return `${this.idPrefix}-${side}-${key}`;\n }\n\n /** The active option's key, defaulting to the first one so a fresh Tab lands somewhere. */\n protected activeKey(side: Side): string | null {\n const active = side === 'left' ? this.activeLeft() : this.activeRight();\n const options = this.filtered(side);\n if (active && options.some(item => item.key === active)) {\n return active;\n }\n return options[0]?.key ?? null;\n }\n\n protected activeOptionId(side: Side): string | null {\n const key = this.activeKey(side);\n return key === null ? null : this.optionId(side, key);\n }\n\n /** Move the active option and check it — clicking does both, so keys match. */\n protected activate(side: Side, item: XuiTransferItem): void {\n (side === 'left' ? this.activeLeft : this.activeRight).set(item.key);\n this.toggle(side, item);\n }\n\n protected onListKeydown(side: Side, event: KeyboardEvent): void {\n const options = this.filtered(side);\n if (!options.length) {\n return;\n }\n\n const current = Math.max(\n 0,\n options.findIndex(item => item.key === this.activeKey(side))\n );\n let next: number;\n\n switch (event.key) {\n case 'ArrowDown':\n next = Math.min(options.length - 1, current + 1);\n break;\n case 'ArrowUp':\n next = Math.max(0, current - 1);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = options.length - 1;\n break;\n case ' ':\n case 'Enter':\n event.preventDefault();\n this.toggle(side, options[current]);\n return;\n default:\n return;\n }\n\n event.preventDefault();\n (side === 'left' ? this.activeLeft : this.activeRight).set(options[next].key);\n }\n\n protected toggle(side: Side, item: XuiTransferItem): void {\n if (item.disabled) {\n return;\n }\n const signalRef = side === 'left' ? this.checkedLeft : this.checkedRight;\n const next = new Set(signalRef());\n if (next.has(item.key)) {\n next.delete(item.key);\n } else {\n next.add(item.key);\n }\n signalRef.set(next);\n }\n\n protected toggleAll(side: Side): void {\n const signalRef = side === 'left' ? this.checkedLeft : this.checkedRight;\n const enabled = this.filtered(side).filter(item => !item.disabled);\n if (this.allChecked(side)) {\n const next = new Set(signalRef());\n enabled.forEach(item => next.delete(item.key));\n signalRef.set(next);\n } else {\n const next = new Set(signalRef());\n enabled.forEach(item => next.add(item.key));\n signalRef.set(next);\n }\n }\n\n protected move(to: Side): void {\n if (to === 'right') {\n const moving = this.leftItems().filter(item => !item.disabled && this.checkedLeft().has(item.key));\n this.targetKeys.set([...this.targetKeys(), ...moving.map(item => item.key)]);\n this.checkedLeft.set(new Set());\n } else {\n const movingKeys = new Set(\n this.rightItems()\n .filter(item => !item.disabled && this.checkedRight().has(item.key))\n .map(item => item.key)\n );\n this.targetKeys.set(this.targetKeys().filter(key => !movingKeys.has(key)));\n this.checkedRight.set(new Set());\n }\n }\n\n protected readonly computedClass = computed(() => xui('flex items-stretch', this.class()));\n protected readonly panelClass = computed(() => xui('border-border bg-surface flex w-56 flex-col rounded-lg border'));\n protected readonly searchClass = computed(() =>\n xui(\n 'border-border bg-surface text-foreground focus:border-focus h-(--control-height-md) w-full rounded-md border px-(--control-padding-sm) text-sm focus:outline-none'\n )\n );\n\n protected checkboxClass(active: boolean): string {\n return xui(\n 'flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded border',\n active ? 'bg-primary border-primary text-primary-foreground' : 'border-border'\n );\n }\n protected itemClass(item: XuiTransferItem, active: boolean): string {\n return xui(\n 'flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-sm select-none',\n item.disabled ? 'text-foreground-subtle cursor-not-allowed' : 'hover:bg-surface-inset',\n // The list owns the tab stop, so the active option is marked here rather\n // than by a focus ring on the option itself.\n active && 'bg-surface-inset'\n );\n }\n protected moveClass(): string {\n return xui(\n 'border-border text-foreground hover:bg-surface-inset flex size-(--control-height-md) items-center justify-center rounded-md border disabled:pointer-events-none disabled:opacity-40'\n );\n }\n}\n","import { XuiTransfer } from './lib/transfer';\n\nexport * from './lib/transfer';\n\nexport const XuiTransferImports = [XuiTransfer] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAuBA;;;;;;;;AAQG;MAyIU,WAAW,CAAA;AACH,IAAA,KAAK,GAAW,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3C,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;IAC7B,KAAK,GAAG,KAAK,CAAoB,EAAE;8EAAC;IACpC,UAAU,GAAG,KAAK,CAAW,EAAE;mFAAC;AAChC,IAAA,MAAM,GAAG,KAAK,CAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;+EAAC;IACtD,UAAU,GAAG,KAAK,CAAwB,KAAK,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAEzE,IAAA,WAAW,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU;oFAAC;AACvC,IAAA,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU;qFAAC;IACtC,UAAU,GAAG,MAAM,CAAC,EAAE;mFAAC;IACvB,WAAW,GAAG,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BAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAtIZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+HT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAOU,WAAW,EAAA,UAAA,EAAA,CAAA;kBAxIvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+HT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;ACnKM,MAAM,kBAAkB,GAAG,CAAC,WAAW;;ACJ9C;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xui/transfer",
|
|
3
|
+
"version": "2.0.0-alpha.11",
|
|
4
|
+
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"ui",
|
|
8
|
+
"components",
|
|
9
|
+
"tailwindcss"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://xuijs.org",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/rikarin/xui/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": "https://github.com/Rikarin/xui",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Jiu",
|
|
18
|
+
"maintainers": [
|
|
19
|
+
"Jiu",
|
|
20
|
+
"Rikarin"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./package.json": {
|
|
26
|
+
"default": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./types/xui-transfer.d.ts",
|
|
30
|
+
"default": "./fesm2022/xui-transfer.mjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"module": "fesm2022/xui-transfer.mjs",
|
|
34
|
+
"typings": "types/xui-transfer.d.ts",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"tslib": "^2.3.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@angular/cdk": "22",
|
|
40
|
+
"@angular/core": "22",
|
|
41
|
+
"@xui/core": "2.0.0-alpha.11",
|
|
42
|
+
"clsx": "^2.1.1"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
interface XuiTransferItem {
|
|
6
|
+
key: string;
|
|
7
|
+
title: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type Side = 'left' | 'right';
|
|
11
|
+
/**
|
|
12
|
+
* A dual list-box that moves items between a source and a target list. `items`
|
|
13
|
+
* is the full set; `targetKeys` (two-way) are the keys on the right. Check items
|
|
14
|
+
* and use the arrow buttons to move them; each side can be searched.
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <xui-transfer [items]="all" [(targetKeys)]="selected" searchable />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare class XuiTransfer {
|
|
21
|
+
protected readonly SIDES: Side[];
|
|
22
|
+
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
23
|
+
readonly items: _angular_core.InputSignal<XuiTransferItem[]>;
|
|
24
|
+
readonly targetKeys: _angular_core.ModelSignal<string[]>;
|
|
25
|
+
readonly titles: _angular_core.InputSignal<[string, string]>;
|
|
26
|
+
readonly searchable: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
27
|
+
private readonly checkedLeft;
|
|
28
|
+
private readonly checkedRight;
|
|
29
|
+
protected readonly searchLeft: _angular_core.WritableSignal<string>;
|
|
30
|
+
protected readonly searchRight: _angular_core.WritableSignal<string>;
|
|
31
|
+
/** The option the arrow keys are on, per side — see `aria-activedescendant`. */
|
|
32
|
+
private readonly activeLeft;
|
|
33
|
+
private readonly activeRight;
|
|
34
|
+
private readonly idPrefix;
|
|
35
|
+
private readonly targetSet;
|
|
36
|
+
protected readonly leftItems: _angular_core.Signal<XuiTransferItem[]>;
|
|
37
|
+
protected readonly rightItems: _angular_core.Signal<XuiTransferItem[]>;
|
|
38
|
+
protected title(side: Side): string;
|
|
39
|
+
protected list(side: Side): XuiTransferItem[];
|
|
40
|
+
protected checked(side: Side): Set<string>;
|
|
41
|
+
protected filtered(side: Side): XuiTransferItem[];
|
|
42
|
+
protected checkedCount(side: Side): number;
|
|
43
|
+
protected allChecked(side: Side): boolean;
|
|
44
|
+
protected someChecked(side: Side): boolean;
|
|
45
|
+
protected setSearch(side: Side, value: string): void;
|
|
46
|
+
protected optionId(side: Side, key: string): string;
|
|
47
|
+
/** The active option's key, defaulting to the first one so a fresh Tab lands somewhere. */
|
|
48
|
+
protected activeKey(side: Side): string | null;
|
|
49
|
+
protected activeOptionId(side: Side): string | null;
|
|
50
|
+
/** Move the active option and check it — clicking does both, so keys match. */
|
|
51
|
+
protected activate(side: Side, item: XuiTransferItem): void;
|
|
52
|
+
protected onListKeydown(side: Side, event: KeyboardEvent): void;
|
|
53
|
+
protected toggle(side: Side, item: XuiTransferItem): void;
|
|
54
|
+
protected toggleAll(side: Side): void;
|
|
55
|
+
protected move(to: Side): void;
|
|
56
|
+
protected readonly computedClass: _angular_core.Signal<string>;
|
|
57
|
+
protected readonly panelClass: _angular_core.Signal<string>;
|
|
58
|
+
protected readonly searchClass: _angular_core.Signal<string>;
|
|
59
|
+
protected checkboxClass(active: boolean): string;
|
|
60
|
+
protected itemClass(item: XuiTransferItem, active: boolean): string;
|
|
61
|
+
protected moveClass(): string;
|
|
62
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiTransfer, never>;
|
|
63
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiTransfer, "xui-transfer", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "targetKeys": { "alias": "targetKeys"; "required": false; "isSignal": true; }; "titles": { "alias": "titles"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; }, { "targetKeys": "targetKeysChange"; }, never, never, true, never>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare const XuiTransferImports: readonly [typeof XuiTransfer];
|
|
67
|
+
|
|
68
|
+
export { XuiTransfer, XuiTransferImports };
|
|
69
|
+
export type { XuiTransferItem };
|