@vadem/ui 0.0.0-stage → 0.0.1
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-lucide.txt +43 -0
- package/README.md +19 -2
- package/fesm2022/vadem-ui-accordion.mjs +139 -0
- package/fesm2022/vadem-ui-accordion.mjs.map +1 -0
- package/fesm2022/vadem-ui-active-filters.mjs +355 -0
- package/fesm2022/vadem-ui-active-filters.mjs.map +1 -0
- package/fesm2022/vadem-ui-alert-dialog.mjs +433 -0
- package/fesm2022/vadem-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/vadem-ui-alert.mjs +266 -0
- package/fesm2022/vadem-ui-alert.mjs.map +1 -0
- package/fesm2022/vadem-ui-autocomplete.mjs +715 -0
- package/fesm2022/vadem-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/vadem-ui-avatar.mjs +219 -0
- package/fesm2022/vadem-ui-avatar.mjs.map +1 -0
- package/fesm2022/vadem-ui-badge.mjs +86 -0
- package/fesm2022/vadem-ui-badge.mjs.map +1 -0
- package/fesm2022/vadem-ui-breadcrumbs.mjs +61 -0
- package/fesm2022/vadem-ui-breadcrumbs.mjs.map +1 -0
- package/fesm2022/vadem-ui-button.mjs +220 -0
- package/fesm2022/vadem-ui-button.mjs.map +1 -0
- package/fesm2022/vadem-ui-calendar.mjs +1314 -0
- package/fesm2022/vadem-ui-calendar.mjs.map +1 -0
- package/fesm2022/vadem-ui-card.mjs +271 -0
- package/fesm2022/vadem-ui-card.mjs.map +1 -0
- package/fesm2022/vadem-ui-character-count.mjs +269 -0
- package/fesm2022/vadem-ui-character-count.mjs.map +1 -0
- package/fesm2022/vadem-ui-chart.mjs +1984 -0
- package/fesm2022/vadem-ui-chart.mjs.map +1 -0
- package/fesm2022/vadem-ui-checkbox.mjs +67 -0
- package/fesm2022/vadem-ui-checkbox.mjs.map +1 -0
- package/fesm2022/vadem-ui-color-picker.mjs +815 -0
- package/fesm2022/vadem-ui-color-picker.mjs.map +1 -0
- package/fesm2022/vadem-ui-command.mjs +735 -0
- package/fesm2022/vadem-ui-command.mjs.map +1 -0
- package/fesm2022/vadem-ui-copy-button.mjs +375 -0
- package/fesm2022/vadem-ui-copy-button.mjs.map +1 -0
- package/fesm2022/vadem-ui-date-range-picker.mjs +1011 -0
- package/fesm2022/vadem-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/vadem-ui-description-list.mjs +59 -0
- package/fesm2022/vadem-ui-description-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-dialog.mjs +587 -0
- package/fesm2022/vadem-ui-dialog.mjs.map +1 -0
- package/fesm2022/vadem-ui-dropzone.mjs +176 -0
- package/fesm2022/vadem-ui-dropzone.mjs.map +1 -0
- package/fesm2022/vadem-ui-editable-text.mjs +641 -0
- package/fesm2022/vadem-ui-editable-text.mjs.map +1 -0
- package/fesm2022/vadem-ui-empty-state.mjs +175 -0
- package/fesm2022/vadem-ui-empty-state.mjs.map +1 -0
- package/fesm2022/vadem-ui-expandable-text.mjs +244 -0
- package/fesm2022/vadem-ui-expandable-text.mjs.map +1 -0
- package/fesm2022/vadem-ui-field.mjs +583 -0
- package/fesm2022/vadem-ui-field.mjs.map +1 -0
- package/fesm2022/vadem-ui-file-preview.mjs +532 -0
- package/fesm2022/vadem-ui-file-preview.mjs.map +1 -0
- package/fesm2022/vadem-ui-file-size.mjs +83 -0
- package/fesm2022/vadem-ui-file-size.mjs.map +1 -0
- package/fesm2022/vadem-ui-form-error-summary.mjs +201 -0
- package/fesm2022/vadem-ui-form-error-summary.mjs.map +1 -0
- package/fesm2022/vadem-ui-icon.mjs +303 -0
- package/fesm2022/vadem-ui-icon.mjs.map +1 -0
- package/fesm2022/vadem-ui-input.mjs +120 -0
- package/fesm2022/vadem-ui-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-kbd.mjs +286 -0
- package/fesm2022/vadem-ui-kbd.mjs.map +1 -0
- package/fesm2022/vadem-ui-keyboard.mjs +105 -0
- package/fesm2022/vadem-ui-keyboard.mjs.map +1 -0
- package/fesm2022/vadem-ui-locale.mjs +443 -0
- package/fesm2022/vadem-ui-locale.mjs.map +1 -0
- package/fesm2022/vadem-ui-menu.mjs +637 -0
- package/fesm2022/vadem-ui-menu.mjs.map +1 -0
- package/fesm2022/vadem-ui-navigation-list.mjs +130 -0
- package/fesm2022/vadem-ui-navigation-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-number-input.mjs +264 -0
- package/fesm2022/vadem-ui-number-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-otp-input.mjs +86 -0
- package/fesm2022/vadem-ui-otp-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-pagination.mjs +353 -0
- package/fesm2022/vadem-ui-pagination.mjs.map +1 -0
- package/fesm2022/vadem-ui-password-input.mjs +213 -0
- package/fesm2022/vadem-ui-password-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-popover.mjs +178 -0
- package/fesm2022/vadem-ui-popover.mjs.map +1 -0
- package/fesm2022/vadem-ui-progress.mjs +331 -0
- package/fesm2022/vadem-ui-progress.mjs.map +1 -0
- package/fesm2022/vadem-ui-radio.mjs +39 -0
- package/fesm2022/vadem-ui-radio.mjs.map +1 -0
- package/fesm2022/vadem-ui-range-slider.mjs +561 -0
- package/fesm2022/vadem-ui-range-slider.mjs.map +1 -0
- package/fesm2022/vadem-ui-rating.mjs +404 -0
- package/fesm2022/vadem-ui-rating.mjs.map +1 -0
- package/fesm2022/vadem-ui-relative-time.mjs +217 -0
- package/fesm2022/vadem-ui-relative-time.mjs.map +1 -0
- package/fesm2022/vadem-ui-reorder-list.mjs +601 -0
- package/fesm2022/vadem-ui-reorder-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-scroll-area.mjs +65 -0
- package/fesm2022/vadem-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/vadem-ui-search-input.mjs +307 -0
- package/fesm2022/vadem-ui-search-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-segmented.mjs +297 -0
- package/fesm2022/vadem-ui-segmented.mjs.map +1 -0
- package/fesm2022/vadem-ui-select.mjs +1462 -0
- package/fesm2022/vadem-ui-select.mjs.map +1 -0
- package/fesm2022/vadem-ui-sidebar.mjs +493 -0
- package/fesm2022/vadem-ui-sidebar.mjs.map +1 -0
- package/fesm2022/vadem-ui-skeleton.mjs +106 -0
- package/fesm2022/vadem-ui-skeleton.mjs.map +1 -0
- package/fesm2022/vadem-ui-slider.mjs +60 -0
- package/fesm2022/vadem-ui-slider.mjs.map +1 -0
- package/fesm2022/vadem-ui-splitter.mjs +438 -0
- package/fesm2022/vadem-ui-splitter.mjs.map +1 -0
- package/fesm2022/vadem-ui-stat.mjs +369 -0
- package/fesm2022/vadem-ui-stat.mjs.map +1 -0
- package/fesm2022/vadem-ui-stepper.mjs +483 -0
- package/fesm2022/vadem-ui-stepper.mjs.map +1 -0
- package/fesm2022/vadem-ui-switch.mjs +45 -0
- package/fesm2022/vadem-ui-switch.mjs.map +1 -0
- package/fesm2022/vadem-ui-table.mjs +593 -0
- package/fesm2022/vadem-ui-table.mjs.map +1 -0
- package/fesm2022/vadem-ui-tabs.mjs +405 -0
- package/fesm2022/vadem-ui-tabs.mjs.map +1 -0
- package/fesm2022/vadem-ui-tag-input.mjs +685 -0
- package/fesm2022/vadem-ui-tag-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-text-highlight.mjs +126 -0
- package/fesm2022/vadem-ui-text-highlight.mjs.map +1 -0
- package/fesm2022/vadem-ui-time-input.mjs +430 -0
- package/fesm2022/vadem-ui-time-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-timeline.mjs +313 -0
- package/fesm2022/vadem-ui-timeline.mjs.map +1 -0
- package/fesm2022/vadem-ui-toast.mjs +397 -0
- package/fesm2022/vadem-ui-toast.mjs.map +1 -0
- package/fesm2022/vadem-ui-toolbar.mjs +396 -0
- package/fesm2022/vadem-ui-toolbar.mjs.map +1 -0
- package/fesm2022/vadem-ui-tooltip.mjs +218 -0
- package/fesm2022/vadem-ui-tooltip.mjs.map +1 -0
- package/fesm2022/vadem-ui-tree.mjs +551 -0
- package/fesm2022/vadem-ui-tree.mjs.map +1 -0
- package/fesm2022/vadem-ui-upload-list.mjs +408 -0
- package/fesm2022/vadem-ui-upload-list.mjs.map +1 -0
- package/fesm2022/vadem-ui.mjs +4 -0
- package/fesm2022/vadem-ui.mjs.map +1 -0
- package/fonts/jetbrains-mono/OFL.txt +93 -0
- package/fonts/jetbrains-mono/jetbrains-mono-cyrillic.woff2 +0 -0
- package/fonts/jetbrains-mono/jetbrains-mono-latin.woff2 +0 -0
- package/fonts/manrope/OFL.txt +93 -0
- package/fonts/manrope/manrope-cyrillic.woff2 +0 -0
- package/fonts/manrope/manrope-latin.woff2 +0 -0
- package/package.json +306 -3
- package/styles/base.css +160 -0
- package/styles/components/accordion.css +130 -0
- package/styles/components/active-filters.css +42 -0
- package/styles/components/alert-dialog.css +34 -0
- package/styles/components/alert.css +159 -0
- package/styles/components/autocomplete.css +97 -0
- package/styles/components/avatar.css +90 -0
- package/styles/components/badge.css +91 -0
- package/styles/components/breadcrumbs.css +94 -0
- package/styles/components/button.css +174 -0
- package/styles/components/calendar.css +186 -0
- package/styles/components/card.css +206 -0
- package/styles/components/character-count.css +41 -0
- package/styles/components/chart.css +308 -0
- package/styles/components/checkbox.css +115 -0
- package/styles/components/color-picker.css +158 -0
- package/styles/components/command.css +175 -0
- package/styles/components/copy-button.css +58 -0
- package/styles/components/date-range-picker.css +153 -0
- package/styles/components/description-list.css +69 -0
- package/styles/components/dialog.css +334 -0
- package/styles/components/dropzone.css +89 -0
- package/styles/components/editable-text.css +58 -0
- package/styles/components/empty-state.css +72 -0
- package/styles/components/expandable-text.css +24 -0
- package/styles/components/field.css +148 -0
- package/styles/components/file-preview.css +65 -0
- package/styles/components/form-error-summary.css +71 -0
- package/styles/components/icon.css +38 -0
- package/styles/components/index.css +80 -0
- package/styles/components/input.css +171 -0
- package/styles/components/kbd.css +42 -0
- package/styles/components/menu.css +168 -0
- package/styles/components/multi-select.css +156 -0
- package/styles/components/navigation-list.css +147 -0
- package/styles/components/number-input.css +33 -0
- package/styles/components/otp-input.css +26 -0
- package/styles/components/pagination.css +127 -0
- package/styles/components/password-input.css +20 -0
- package/styles/components/popover.css +93 -0
- package/styles/components/progress-ring.css +112 -0
- package/styles/components/progress.css +162 -0
- package/styles/components/radio.css +117 -0
- package/styles/components/range-slider.css +158 -0
- package/styles/components/rating.css +100 -0
- package/styles/components/reorder-list.css +143 -0
- package/styles/components/scroll-area.css +39 -0
- package/styles/components/search-input.css +25 -0
- package/styles/components/segmented.css +136 -0
- package/styles/components/select.css +257 -0
- package/styles/components/sidebar.css +105 -0
- package/styles/components/skeleton.css +83 -0
- package/styles/components/slider.css +132 -0
- package/styles/components/splitter.css +83 -0
- package/styles/components/stat.css +62 -0
- package/styles/components/stepper.css +236 -0
- package/styles/components/switch.css +107 -0
- package/styles/components/table.css +195 -0
- package/styles/components/tabs.css +198 -0
- package/styles/components/tag-input.css +138 -0
- package/styles/components/text-highlight.css +22 -0
- package/styles/components/time-input.css +96 -0
- package/styles/components/timeline.css +182 -0
- package/styles/components/toast.css +146 -0
- package/styles/components/toolbar.css +72 -0
- package/styles/components/tooltip.css +93 -0
- package/styles/components/tree.css +88 -0
- package/styles/components/upload-list.css +113 -0
- package/styles/fonts.css +67 -0
- package/styles/index.css +14 -0
- package/styles/reset.css +57 -0
- package/styles/tokens/primitives.css +364 -0
- package/styles/tokens/semantic.css +233 -0
- package/types/vadem-ui-accordion.d.ts +43 -0
- package/types/vadem-ui-active-filters.d.ts +73 -0
- package/types/vadem-ui-alert-dialog.d.ts +87 -0
- package/types/vadem-ui-alert.d.ts +64 -0
- package/types/vadem-ui-autocomplete.d.ts +156 -0
- package/types/vadem-ui-avatar.d.ts +59 -0
- package/types/vadem-ui-badge.d.ts +25 -0
- package/types/vadem-ui-breadcrumbs.d.ts +22 -0
- package/types/vadem-ui-button.d.ts +52 -0
- package/types/vadem-ui-calendar.d.ts +327 -0
- package/types/vadem-ui-card.d.ts +58 -0
- package/types/vadem-ui-character-count.d.ts +71 -0
- package/types/vadem-ui-chart.d.ts +452 -0
- package/types/vadem-ui-checkbox.d.ts +20 -0
- package/types/vadem-ui-color-picker.d.ts +171 -0
- package/types/vadem-ui-command.d.ts +145 -0
- package/types/vadem-ui-copy-button.d.ts +90 -0
- package/types/vadem-ui-date-range-picker.d.ts +216 -0
- package/types/vadem-ui-description-list.d.ts +15 -0
- package/types/vadem-ui-dialog.d.ts +174 -0
- package/types/vadem-ui-dropzone.d.ts +73 -0
- package/types/vadem-ui-editable-text.d.ts +141 -0
- package/types/vadem-ui-empty-state.d.ts +34 -0
- package/types/vadem-ui-expandable-text.d.ts +52 -0
- package/types/vadem-ui-field.d.ts +180 -0
- package/types/vadem-ui-file-preview.d.ts +108 -0
- package/types/vadem-ui-file-size.d.ts +18 -0
- package/types/vadem-ui-form-error-summary.d.ts +46 -0
- package/types/vadem-ui-icon.d.ts +152 -0
- package/types/vadem-ui-input.d.ts +31 -0
- package/types/vadem-ui-kbd.d.ts +66 -0
- package/types/vadem-ui-keyboard.d.ts +61 -0
- package/types/vadem-ui-locale.d.ts +241 -0
- package/types/vadem-ui-menu.d.ts +132 -0
- package/types/vadem-ui-navigation-list.d.ts +28 -0
- package/types/vadem-ui-number-input.d.ts +39 -0
- package/types/vadem-ui-otp-input.d.ts +15 -0
- package/types/vadem-ui-pagination.d.ts +96 -0
- package/types/vadem-ui-password-input.d.ts +36 -0
- package/types/vadem-ui-popover.d.ts +48 -0
- package/types/vadem-ui-progress.d.ts +95 -0
- package/types/vadem-ui-radio.d.ts +11 -0
- package/types/vadem-ui-range-slider.d.ts +136 -0
- package/types/vadem-ui-rating.d.ts +95 -0
- package/types/vadem-ui-relative-time.d.ts +58 -0
- package/types/vadem-ui-reorder-list.d.ts +120 -0
- package/types/vadem-ui-scroll-area.d.ts +13 -0
- package/types/vadem-ui-search-input.d.ts +58 -0
- package/types/vadem-ui-segmented.d.ts +76 -0
- package/types/vadem-ui-select.d.ts +303 -0
- package/types/vadem-ui-sidebar.d.ts +70 -0
- package/types/vadem-ui-skeleton.d.ts +28 -0
- package/types/vadem-ui-slider.d.ts +17 -0
- package/types/vadem-ui-splitter.d.ts +99 -0
- package/types/vadem-ui-stat.d.ts +101 -0
- package/types/vadem-ui-stepper.d.ts +108 -0
- package/types/vadem-ui-switch.d.ts +10 -0
- package/types/vadem-ui-table.d.ts +172 -0
- package/types/vadem-ui-tabs.d.ts +101 -0
- package/types/vadem-ui-tag-input.d.ts +170 -0
- package/types/vadem-ui-text-highlight.d.ts +27 -0
- package/types/vadem-ui-time-input.d.ts +47 -0
- package/types/vadem-ui-timeline.d.ts +54 -0
- package/types/vadem-ui-toast.d.ts +104 -0
- package/types/vadem-ui-toolbar.d.ts +80 -0
- package/types/vadem-ui-tooltip.d.ts +71 -0
- package/types/vadem-ui-tree.d.ts +123 -0
- package/types/vadem-ui-upload-list.d.ts +70 -0
- package/types/vadem-ui.d.ts +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The following Lucide icons are derived from the Feather project:
|
|
20
|
+
|
|
21
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT) (for the icons listed above)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2013-present Cole Bemis
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vadem/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular UI components with shared CSS tokens and self-hosted fonts. Requires Angular 22.2
|
|
4
|
+
compatible with the package's peer dependency ranges.
|
|
5
|
+
|
|
6
|
+
Import styles once in the consuming application's global stylesheet:
|
|
7
|
+
|
|
8
|
+
```css
|
|
9
|
+
@import '@vadem/ui/styles.css';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Import each component from its secondary entry point:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { VdButton } from '@vadem/ui/button';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
From the workspace root, run `npm run build:ui` to build `dist/ui` including CSS, fonts,
|
|
19
|
+
and third-party notices. The package is under development and is not published by this command.
|
|
20
|
+
See the repository README, interactive demo, and `specs/` for setup and component contracts.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, booleanAttribute, computed, inject, input, linkedSignal, output } from "@angular/core";
|
|
3
|
+
import { vdUniqueId } from "@vadem/ui/field";
|
|
4
|
+
var VdAccordion = class VdAccordion {
|
|
5
|
+
exclusive = input(false, {
|
|
6
|
+
...ngDevMode ? { debugName: "exclusive" } : /* istanbul ignore next */ {},
|
|
7
|
+
transform: booleanAttribute
|
|
8
|
+
});
|
|
9
|
+
name = vdUniqueId("vd-accordion");
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
11
|
+
minVersion: "12.0.0",
|
|
12
|
+
version: "22.2.1",
|
|
13
|
+
ngImport: i0,
|
|
14
|
+
type: VdAccordion,
|
|
15
|
+
deps: [],
|
|
16
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
17
|
+
});
|
|
18
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
19
|
+
minVersion: "17.1.0",
|
|
20
|
+
version: "22.2.1",
|
|
21
|
+
type: VdAccordion,
|
|
22
|
+
isStandalone: true,
|
|
23
|
+
selector: "[vdAccordion]",
|
|
24
|
+
inputs: { exclusive: {
|
|
25
|
+
classPropertyName: "exclusive",
|
|
26
|
+
publicName: "exclusive",
|
|
27
|
+
isSignal: true,
|
|
28
|
+
isRequired: false,
|
|
29
|
+
transformFunction: null
|
|
30
|
+
} },
|
|
31
|
+
host: { classAttribute: "vd-accordion" },
|
|
32
|
+
ngImport: i0
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36
|
+
minVersion: "12.0.0",
|
|
37
|
+
version: "22.2.1",
|
|
38
|
+
ngImport: i0,
|
|
39
|
+
type: VdAccordion,
|
|
40
|
+
decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: "[vdAccordion]",
|
|
44
|
+
host: { class: "vd-accordion" }
|
|
45
|
+
}]
|
|
46
|
+
}],
|
|
47
|
+
propDecorators: { exclusive: [{
|
|
48
|
+
type: i0.Input,
|
|
49
|
+
args: [{
|
|
50
|
+
isSignal: true,
|
|
51
|
+
alias: "exclusive",
|
|
52
|
+
required: false
|
|
53
|
+
}]
|
|
54
|
+
}] }
|
|
55
|
+
});
|
|
56
|
+
var VdAccordionItem = class VdAccordionItem {
|
|
57
|
+
open = input(false, {
|
|
58
|
+
...ngDevMode ? { debugName: "open" } : /* istanbul ignore next */ {},
|
|
59
|
+
transform: booleanAttribute
|
|
60
|
+
});
|
|
61
|
+
openChange = output();
|
|
62
|
+
isOpen = linkedSignal(() => this.open(), ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
|
|
63
|
+
group = inject(VdAccordion, { optional: true });
|
|
64
|
+
groupName = computed(() => this.group?.exclusive() ? this.group.name : null, ...ngDevMode ? [{ debugName: "groupName" }] : /* istanbul ignore next */ []);
|
|
65
|
+
onToggle(event) {
|
|
66
|
+
const open = event.target.open;
|
|
67
|
+
if (open === this.isOpen()) return;
|
|
68
|
+
this.isOpen.set(open);
|
|
69
|
+
this.openChange.emit(open);
|
|
70
|
+
}
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "22.2.1",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: VdAccordionItem,
|
|
76
|
+
deps: [],
|
|
77
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
78
|
+
});
|
|
79
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
80
|
+
minVersion: "17.1.0",
|
|
81
|
+
version: "22.2.1",
|
|
82
|
+
type: VdAccordionItem,
|
|
83
|
+
isStandalone: true,
|
|
84
|
+
selector: "details[vdAccordionItem]",
|
|
85
|
+
inputs: { open: {
|
|
86
|
+
classPropertyName: "open",
|
|
87
|
+
publicName: "open",
|
|
88
|
+
isSignal: true,
|
|
89
|
+
isRequired: false,
|
|
90
|
+
transformFunction: null
|
|
91
|
+
} },
|
|
92
|
+
outputs: { openChange: "openChange" },
|
|
93
|
+
host: {
|
|
94
|
+
listeners: { "toggle": "onToggle($event)" },
|
|
95
|
+
properties: {
|
|
96
|
+
"attr.name": "groupName()",
|
|
97
|
+
"open": "isOpen()"
|
|
98
|
+
},
|
|
99
|
+
classAttribute: "vd-accordion__item"
|
|
100
|
+
},
|
|
101
|
+
ngImport: i0
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
105
|
+
minVersion: "12.0.0",
|
|
106
|
+
version: "22.2.1",
|
|
107
|
+
ngImport: i0,
|
|
108
|
+
type: VdAccordionItem,
|
|
109
|
+
decorators: [{
|
|
110
|
+
type: Directive,
|
|
111
|
+
args: [{
|
|
112
|
+
selector: "details[vdAccordionItem]",
|
|
113
|
+
host: {
|
|
114
|
+
class: "vd-accordion__item",
|
|
115
|
+
"[attr.name]": "groupName()",
|
|
116
|
+
"[open]": "isOpen()",
|
|
117
|
+
"(toggle)": "onToggle($event)"
|
|
118
|
+
}
|
|
119
|
+
}]
|
|
120
|
+
}],
|
|
121
|
+
propDecorators: {
|
|
122
|
+
open: [{
|
|
123
|
+
type: i0.Input,
|
|
124
|
+
args: [{
|
|
125
|
+
isSignal: true,
|
|
126
|
+
alias: "open",
|
|
127
|
+
required: false
|
|
128
|
+
}]
|
|
129
|
+
}],
|
|
130
|
+
openChange: [{
|
|
131
|
+
type: i0.Output,
|
|
132
|
+
args: ["openChange"]
|
|
133
|
+
}]
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const VD_ACCORDION = [VdAccordion, VdAccordionItem];
|
|
137
|
+
export { VD_ACCORDION, VdAccordion, VdAccordionItem };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=vadem-ui-accordion.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vadem-ui-accordion.mjs","names":[],"sources":["../../../projects/ui/accordion/src/accordion.ts"],"sourcesContent":["import {\n Directive,\n booleanAttribute,\n computed,\n inject,\n input,\n linkedSignal,\n output,\n} from '@angular/core';\nimport { vdUniqueId } from '@vadem/ui/field';\n\n/**\n * Group of `details[vdAccordionItem]`. With `exclusive`, the items share a `name`, so the\n * browser keeps at most one open. Spec: specs/accordion.md\n */\n@Directive({\n selector: '[vdAccordion]',\n host: { class: 'vd-accordion' },\n})\nexport class VdAccordion {\n /** At most one item open at a time (native `<details name>`). */\n readonly exclusive = input(false, { transform: booleanAttribute });\n readonly name = vdUniqueId('vd-accordion');\n}\n\n/**\n * One disclosure on a native `<details>` with a `<summary>`: keyboard, find-in-page (opens the\n * matching item) and state stay native. `open` works as a plain attribute (`<details open>`)\n * and two-way (`[(open)]`).\n */\n@Directive({\n selector: 'details[vdAccordionItem]',\n host: {\n class: 'vd-accordion__item',\n '[attr.name]': 'groupName()',\n '[open]': 'isOpen()',\n '(toggle)': 'onToggle($event)',\n },\n})\nexport class VdAccordionItem {\n readonly open = input(false, { transform: booleanAttribute });\n readonly openChange = output<boolean>();\n /** Follows the input, and the browser's own toggles in between. */\n protected readonly isOpen = linkedSignal(() => this.open());\n\n private readonly group = inject(VdAccordion, { optional: true });\n protected readonly groupName = computed(() => (this.group?.exclusive() ? this.group.name : null));\n\n protected onToggle(event: Event): void {\n // The browser toggles (summary click, find-in-page, exclusive siblings): mirror it.\n const open = (event.target as HTMLDetailsElement).open;\n if (open === this.isOpen()) return;\n this.isOpen.set(open);\n this.openChange.emit(open);\n }\n}\n\nexport const VD_ACCORDION = [VdAccordion, VdAccordionItem] as const;\n"],"mappings":";;;AAmBA,IAAa,cAAb,MAAa,YAAW;CAEb,YAAY,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,YAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACtD,OAAO,WAAW,cAAc;CAH9B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAA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GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,SAAA,EAAA,YAAA,aAAA;EAAA,MAAA;GAAA,WAAA,EAAA,UAAA,mBAAA;GAAA,YAAA;IAAA,aAAA;IAAA,QAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAT3B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM;IACJ,OAAO;IACP,eAAe;IACf,UAAU;IACV,YAAY;GACb;EACF,CAAA;;;;;;;;;;;;;;;;;AAmBD,MAAa,eAAe,CAAC,aAAa,eAAe"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, effect, inject, input, output } from "@angular/core";
|
|
3
|
+
import { VdButton } from "@vadem/ui/button";
|
|
4
|
+
import { VdIcon } from "@vadem/ui/icon";
|
|
5
|
+
import { vdTexts } from "@vadem/ui/locale";
|
|
6
|
+
function vdActiveFiltersValid(filters) {
|
|
7
|
+
const ids = /* @__PURE__ */ new Set();
|
|
8
|
+
for (const filter of filters) {
|
|
9
|
+
if (typeof filter.id !== "string" || !filter.id.trim() || ids.has(filter.id)) return false;
|
|
10
|
+
ids.add(filter.id);
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
var VdActiveFilters = class VdActiveFilters {
|
|
15
|
+
filters = input([], ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
|
|
16
|
+
disabled = input(false, {
|
|
17
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
18
|
+
transform: booleanAttribute
|
|
19
|
+
});
|
|
20
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
21
|
+
clearText = input(...ngDevMode ? [void 0, { debugName: "clearText" }] : /* istanbul ignore next */ []);
|
|
22
|
+
emptyText = input(...ngDevMode ? [void 0, { debugName: "emptyText" }] : /* istanbul ignore next */ []);
|
|
23
|
+
invalidText = input(...ngDevMode ? [void 0, { debugName: "invalidText" }] : /* istanbul ignore next */ []);
|
|
24
|
+
removeLabel = input(...ngDevMode ? [void 0, { debugName: "removeLabel" }] : /* istanbul ignore next */ []);
|
|
25
|
+
filterRemove = output();
|
|
26
|
+
clearAll = output();
|
|
27
|
+
valid = computed(() => vdActiveFiltersValid(this.filters()), ...ngDevMode ? [{ debugName: "valid" }] : /* istanbul ignore next */ []);
|
|
28
|
+
t = vdTexts("activeFilters", {
|
|
29
|
+
label: this.label,
|
|
30
|
+
clearText: this.clearText,
|
|
31
|
+
emptyText: this.emptyText,
|
|
32
|
+
invalidText: this.invalidText,
|
|
33
|
+
removeLabel: this.removeLabel
|
|
34
|
+
});
|
|
35
|
+
host = inject(ElementRef).nativeElement;
|
|
36
|
+
focus = null;
|
|
37
|
+
constructor() {
|
|
38
|
+
effect(() => {
|
|
39
|
+
this.filters();
|
|
40
|
+
this.disabled();
|
|
41
|
+
this.valid();
|
|
42
|
+
const active = this.host.ownerDocument.activeElement;
|
|
43
|
+
const buttons = this.buttons();
|
|
44
|
+
const index = buttons.findIndex((button) => button === active);
|
|
45
|
+
this.focus = index < 0 ? null : {
|
|
46
|
+
element: buttons[index],
|
|
47
|
+
id: buttons[index].dataset["filterId"],
|
|
48
|
+
index
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
afterRenderEffect(() => {
|
|
52
|
+
this.filters();
|
|
53
|
+
this.disabled();
|
|
54
|
+
this.valid();
|
|
55
|
+
const focus = this.focus;
|
|
56
|
+
this.focus = null;
|
|
57
|
+
if (!focus) return;
|
|
58
|
+
const active = this.host.ownerDocument.activeElement;
|
|
59
|
+
if (active === focus.element && !focus.element.disabled) return;
|
|
60
|
+
if (active && active !== this.host.ownerDocument.body && active !== focus.element) return;
|
|
61
|
+
const buttons = this.buttons().filter((button) => !button.disabled);
|
|
62
|
+
const same = focus.id === void 0 ? buttons.find((button) => button.dataset["action"] === "clear") : buttons.find((button) => button.dataset["filterId"] === focus.id);
|
|
63
|
+
const removes = buttons.filter((button) => button.dataset["filterId"] !== void 0);
|
|
64
|
+
(same ?? removes[Math.min(focus.index, removes.length - 1)] ?? this.host).focus();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
buttons() {
|
|
68
|
+
return Array.from(this.host.querySelectorAll("button"));
|
|
69
|
+
}
|
|
70
|
+
remove(id) {
|
|
71
|
+
if (!this.disabled() && this.valid() && this.filters().some((filter) => filter.id === id)) this.filterRemove.emit(id);
|
|
72
|
+
}
|
|
73
|
+
clear() {
|
|
74
|
+
if (!this.disabled() && this.valid() && this.filters().length) this.clearAll.emit();
|
|
75
|
+
}
|
|
76
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
77
|
+
minVersion: "12.0.0",
|
|
78
|
+
version: "22.2.1",
|
|
79
|
+
ngImport: i0,
|
|
80
|
+
type: VdActiveFilters,
|
|
81
|
+
deps: [],
|
|
82
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
83
|
+
});
|
|
84
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
85
|
+
minVersion: "17.0.0",
|
|
86
|
+
version: "22.2.1",
|
|
87
|
+
type: VdActiveFilters,
|
|
88
|
+
isStandalone: true,
|
|
89
|
+
selector: "vd-active-filters",
|
|
90
|
+
inputs: {
|
|
91
|
+
filters: {
|
|
92
|
+
classPropertyName: "filters",
|
|
93
|
+
publicName: "filters",
|
|
94
|
+
isSignal: true,
|
|
95
|
+
isRequired: false,
|
|
96
|
+
transformFunction: null
|
|
97
|
+
},
|
|
98
|
+
disabled: {
|
|
99
|
+
classPropertyName: "disabled",
|
|
100
|
+
publicName: "disabled",
|
|
101
|
+
isSignal: true,
|
|
102
|
+
isRequired: false,
|
|
103
|
+
transformFunction: null
|
|
104
|
+
},
|
|
105
|
+
label: {
|
|
106
|
+
classPropertyName: "label",
|
|
107
|
+
publicName: "label",
|
|
108
|
+
isSignal: true,
|
|
109
|
+
isRequired: false,
|
|
110
|
+
transformFunction: null
|
|
111
|
+
},
|
|
112
|
+
clearText: {
|
|
113
|
+
classPropertyName: "clearText",
|
|
114
|
+
publicName: "clearText",
|
|
115
|
+
isSignal: true,
|
|
116
|
+
isRequired: false,
|
|
117
|
+
transformFunction: null
|
|
118
|
+
},
|
|
119
|
+
emptyText: {
|
|
120
|
+
classPropertyName: "emptyText",
|
|
121
|
+
publicName: "emptyText",
|
|
122
|
+
isSignal: true,
|
|
123
|
+
isRequired: false,
|
|
124
|
+
transformFunction: null
|
|
125
|
+
},
|
|
126
|
+
invalidText: {
|
|
127
|
+
classPropertyName: "invalidText",
|
|
128
|
+
publicName: "invalidText",
|
|
129
|
+
isSignal: true,
|
|
130
|
+
isRequired: false,
|
|
131
|
+
transformFunction: null
|
|
132
|
+
},
|
|
133
|
+
removeLabel: {
|
|
134
|
+
classPropertyName: "removeLabel",
|
|
135
|
+
publicName: "removeLabel",
|
|
136
|
+
isSignal: true,
|
|
137
|
+
isRequired: false,
|
|
138
|
+
transformFunction: null
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
outputs: {
|
|
142
|
+
filterRemove: "filterRemove",
|
|
143
|
+
clearAll: "clearAll"
|
|
144
|
+
},
|
|
145
|
+
host: {
|
|
146
|
+
attributes: {
|
|
147
|
+
"role": "group",
|
|
148
|
+
"tabindex": "-1"
|
|
149
|
+
},
|
|
150
|
+
properties: {
|
|
151
|
+
"attr.aria-label": "t().label",
|
|
152
|
+
"attr.data-state": "!valid() ? \"invalid\" : !filters().length ? \"empty\" : disabled() ? \"disabled\" : \"active\""
|
|
153
|
+
},
|
|
154
|
+
classAttribute: "vd-active-filters"
|
|
155
|
+
},
|
|
156
|
+
ngImport: i0,
|
|
157
|
+
template: `
|
|
158
|
+
@if (!valid()) {
|
|
159
|
+
<p class="vd-active-filters__message">{{ t().invalidText }}</p>
|
|
160
|
+
} @else if (!filters().length) {
|
|
161
|
+
<p class="vd-active-filters__message">{{ t().emptyText }}</p>
|
|
162
|
+
} @else {
|
|
163
|
+
<ul class="vd-active-filters__list" role="list">
|
|
164
|
+
@for (filter of filters(); track filter.id) {
|
|
165
|
+
<li class="vd-active-filters__item">
|
|
166
|
+
<button
|
|
167
|
+
vdButton
|
|
168
|
+
variant="secondary"
|
|
169
|
+
size="sm"
|
|
170
|
+
type="button"
|
|
171
|
+
class="vd-active-filters__remove"
|
|
172
|
+
[attr.data-filter-id]="filter.id"
|
|
173
|
+
[disabled]="disabled()"
|
|
174
|
+
[attr.aria-label]="t().removeLabel(filter.label, filter.value)"
|
|
175
|
+
(click)="remove(filter.id)"
|
|
176
|
+
>
|
|
177
|
+
<span class="vd-active-filters__text"
|
|
178
|
+
><bdi>{{ filter.label }}</bdi
|
|
179
|
+
>: <bdi>{{ filter.value }}</bdi></span
|
|
180
|
+
>
|
|
181
|
+
<vd-icon name="x" slot="end" />
|
|
182
|
+
</button>
|
|
183
|
+
</li>
|
|
184
|
+
}
|
|
185
|
+
</ul>
|
|
186
|
+
<button
|
|
187
|
+
vdButton
|
|
188
|
+
variant="ghost"
|
|
189
|
+
size="sm"
|
|
190
|
+
type="button"
|
|
191
|
+
data-action="clear"
|
|
192
|
+
[disabled]="disabled()"
|
|
193
|
+
(click)="clear()"
|
|
194
|
+
>
|
|
195
|
+
{{ t().clearText }}
|
|
196
|
+
</button>
|
|
197
|
+
}
|
|
198
|
+
`,
|
|
199
|
+
isInline: true,
|
|
200
|
+
dependencies: [{
|
|
201
|
+
kind: "component",
|
|
202
|
+
type: VdButton,
|
|
203
|
+
selector: "button[vdButton], a[vdButton]",
|
|
204
|
+
inputs: [
|
|
205
|
+
"variant",
|
|
206
|
+
"size",
|
|
207
|
+
"disabled",
|
|
208
|
+
"loading",
|
|
209
|
+
"iconOnly",
|
|
210
|
+
"type"
|
|
211
|
+
]
|
|
212
|
+
}, {
|
|
213
|
+
kind: "component",
|
|
214
|
+
type: VdIcon,
|
|
215
|
+
selector: "vd-icon",
|
|
216
|
+
inputs: ["name", "label"]
|
|
217
|
+
}],
|
|
218
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
219
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
223
|
+
minVersion: "12.0.0",
|
|
224
|
+
version: "22.2.1",
|
|
225
|
+
ngImport: i0,
|
|
226
|
+
type: VdActiveFilters,
|
|
227
|
+
decorators: [{
|
|
228
|
+
type: Component,
|
|
229
|
+
args: [{
|
|
230
|
+
selector: "vd-active-filters",
|
|
231
|
+
imports: [VdButton, VdIcon],
|
|
232
|
+
template: `
|
|
233
|
+
@if (!valid()) {
|
|
234
|
+
<p class="vd-active-filters__message">{{ t().invalidText }}</p>
|
|
235
|
+
} @else if (!filters().length) {
|
|
236
|
+
<p class="vd-active-filters__message">{{ t().emptyText }}</p>
|
|
237
|
+
} @else {
|
|
238
|
+
<ul class="vd-active-filters__list" role="list">
|
|
239
|
+
@for (filter of filters(); track filter.id) {
|
|
240
|
+
<li class="vd-active-filters__item">
|
|
241
|
+
<button
|
|
242
|
+
vdButton
|
|
243
|
+
variant="secondary"
|
|
244
|
+
size="sm"
|
|
245
|
+
type="button"
|
|
246
|
+
class="vd-active-filters__remove"
|
|
247
|
+
[attr.data-filter-id]="filter.id"
|
|
248
|
+
[disabled]="disabled()"
|
|
249
|
+
[attr.aria-label]="t().removeLabel(filter.label, filter.value)"
|
|
250
|
+
(click)="remove(filter.id)"
|
|
251
|
+
>
|
|
252
|
+
<span class="vd-active-filters__text"
|
|
253
|
+
><bdi>{{ filter.label }}</bdi
|
|
254
|
+
>: <bdi>{{ filter.value }}</bdi></span
|
|
255
|
+
>
|
|
256
|
+
<vd-icon name="x" slot="end" />
|
|
257
|
+
</button>
|
|
258
|
+
</li>
|
|
259
|
+
}
|
|
260
|
+
</ul>
|
|
261
|
+
<button
|
|
262
|
+
vdButton
|
|
263
|
+
variant="ghost"
|
|
264
|
+
size="sm"
|
|
265
|
+
type="button"
|
|
266
|
+
data-action="clear"
|
|
267
|
+
[disabled]="disabled()"
|
|
268
|
+
(click)="clear()"
|
|
269
|
+
>
|
|
270
|
+
{{ t().clearText }}
|
|
271
|
+
</button>
|
|
272
|
+
}
|
|
273
|
+
`,
|
|
274
|
+
host: {
|
|
275
|
+
class: "vd-active-filters",
|
|
276
|
+
role: "group",
|
|
277
|
+
tabindex: "-1",
|
|
278
|
+
"[attr.aria-label]": "t().label",
|
|
279
|
+
"[attr.data-state]": "!valid() ? \"invalid\" : !filters().length ? \"empty\" : disabled() ? \"disabled\" : \"active\""
|
|
280
|
+
},
|
|
281
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
282
|
+
encapsulation: ViewEncapsulation.None
|
|
283
|
+
}]
|
|
284
|
+
}],
|
|
285
|
+
ctorParameters: () => [],
|
|
286
|
+
propDecorators: {
|
|
287
|
+
filters: [{
|
|
288
|
+
type: i0.Input,
|
|
289
|
+
args: [{
|
|
290
|
+
isSignal: true,
|
|
291
|
+
alias: "filters",
|
|
292
|
+
required: false
|
|
293
|
+
}]
|
|
294
|
+
}],
|
|
295
|
+
disabled: [{
|
|
296
|
+
type: i0.Input,
|
|
297
|
+
args: [{
|
|
298
|
+
isSignal: true,
|
|
299
|
+
alias: "disabled",
|
|
300
|
+
required: false
|
|
301
|
+
}]
|
|
302
|
+
}],
|
|
303
|
+
label: [{
|
|
304
|
+
type: i0.Input,
|
|
305
|
+
args: [{
|
|
306
|
+
isSignal: true,
|
|
307
|
+
alias: "label",
|
|
308
|
+
required: false
|
|
309
|
+
}]
|
|
310
|
+
}],
|
|
311
|
+
clearText: [{
|
|
312
|
+
type: i0.Input,
|
|
313
|
+
args: [{
|
|
314
|
+
isSignal: true,
|
|
315
|
+
alias: "clearText",
|
|
316
|
+
required: false
|
|
317
|
+
}]
|
|
318
|
+
}],
|
|
319
|
+
emptyText: [{
|
|
320
|
+
type: i0.Input,
|
|
321
|
+
args: [{
|
|
322
|
+
isSignal: true,
|
|
323
|
+
alias: "emptyText",
|
|
324
|
+
required: false
|
|
325
|
+
}]
|
|
326
|
+
}],
|
|
327
|
+
invalidText: [{
|
|
328
|
+
type: i0.Input,
|
|
329
|
+
args: [{
|
|
330
|
+
isSignal: true,
|
|
331
|
+
alias: "invalidText",
|
|
332
|
+
required: false
|
|
333
|
+
}]
|
|
334
|
+
}],
|
|
335
|
+
removeLabel: [{
|
|
336
|
+
type: i0.Input,
|
|
337
|
+
args: [{
|
|
338
|
+
isSignal: true,
|
|
339
|
+
alias: "removeLabel",
|
|
340
|
+
required: false
|
|
341
|
+
}]
|
|
342
|
+
}],
|
|
343
|
+
filterRemove: [{
|
|
344
|
+
type: i0.Output,
|
|
345
|
+
args: ["filterRemove"]
|
|
346
|
+
}],
|
|
347
|
+
clearAll: [{
|
|
348
|
+
type: i0.Output,
|
|
349
|
+
args: ["clearAll"]
|
|
350
|
+
}]
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
export { VdActiveFilters };
|
|
354
|
+
|
|
355
|
+
//# sourceMappingURL=vadem-ui-active-filters.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vadem-ui-active-filters.mjs","names":[],"sources":["../../../projects/ui/active-filters/src/core/active-filters.ts","../../../projects/ui/active-filters/src/active-filters.ts"],"sourcesContent":["export function vdActiveFiltersValid(filters: readonly { id: string }[]): boolean {\n const ids = new Set<string>();\n for (const filter of filters) {\n if (typeof filter.id !== 'string' || !filter.id.trim() || ids.has(filter.id)) return false;\n ids.add(filter.id);\n }\n return true;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n afterRenderEffect,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { VdButton } from '@vadem/ui/button';\nimport { VdIcon } from '@vadem/ui/icon';\nimport { vdTexts } from '@vadem/ui/locale';\nimport { vdActiveFiltersValid } from './core/active-filters';\n\nexport interface VdActiveFilter {\n readonly id: string;\n readonly label: string;\n readonly value: string;\n}\ninterface Focus {\n element: HTMLButtonElement;\n id: string | undefined;\n index: number;\n}\n\n@Component({\n selector: 'vd-active-filters',\n imports: [VdButton, VdIcon],\n template: `\n @if (!valid()) {\n <p class=\"vd-active-filters__message\">{{ t().invalidText }}</p>\n } @else if (!filters().length) {\n <p class=\"vd-active-filters__message\">{{ t().emptyText }}</p>\n } @else {\n <ul class=\"vd-active-filters__list\" role=\"list\">\n @for (filter of filters(); track filter.id) {\n <li class=\"vd-active-filters__item\">\n <button\n vdButton\n variant=\"secondary\"\n size=\"sm\"\n type=\"button\"\n class=\"vd-active-filters__remove\"\n [attr.data-filter-id]=\"filter.id\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"t().removeLabel(filter.label, filter.value)\"\n (click)=\"remove(filter.id)\"\n >\n <span class=\"vd-active-filters__text\"\n ><bdi>{{ filter.label }}</bdi\n >: <bdi>{{ filter.value }}</bdi></span\n >\n <vd-icon name=\"x\" slot=\"end\" />\n </button>\n </li>\n }\n </ul>\n <button\n vdButton\n variant=\"ghost\"\n size=\"sm\"\n type=\"button\"\n data-action=\"clear\"\n [disabled]=\"disabled()\"\n (click)=\"clear()\"\n >\n {{ t().clearText }}\n </button>\n }\n `,\n host: {\n class: 'vd-active-filters',\n role: 'group',\n tabindex: '-1',\n '[attr.aria-label]': 't().label',\n '[attr.data-state]':\n '!valid() ? \"invalid\" : !filters().length ? \"empty\" : disabled() ? \"disabled\" : \"active\"',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class VdActiveFilters {\n readonly filters = input<readonly VdActiveFilter[]>([]);\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly label = input<string>();\n readonly clearText = input<string>();\n readonly emptyText = input<string>();\n readonly invalidText = input<string>();\n readonly removeLabel = input<(label: string, value: string) => string>();\n readonly filterRemove = output<string>();\n readonly clearAll = output<void>();\n protected readonly valid = computed(() => vdActiveFiltersValid(this.filters()));\n protected readonly t = vdTexts('activeFilters', {\n label: this.label,\n clearText: this.clearText,\n emptyText: this.emptyText,\n invalidText: this.invalidText,\n removeLabel: this.removeLabel,\n });\n private readonly host: HTMLElement = inject(ElementRef).nativeElement;\n private focus: Focus | null = null;\n constructor() {\n effect(() => {\n this.filters();\n this.disabled();\n this.valid();\n const active = this.host.ownerDocument.activeElement;\n const buttons = this.buttons();\n const index = buttons.findIndex((button) => button === active);\n this.focus =\n index < 0\n ? null\n : { element: buttons[index], id: buttons[index].dataset['filterId'], index };\n });\n afterRenderEffect(() => {\n this.filters();\n this.disabled();\n this.valid();\n const focus = this.focus;\n this.focus = null;\n if (!focus) return;\n const active = this.host.ownerDocument.activeElement;\n if (active === focus.element && !focus.element.disabled) return;\n if (active && active !== this.host.ownerDocument.body && active !== focus.element) return;\n const buttons = this.buttons().filter((button) => !button.disabled);\n const same =\n focus.id === undefined\n ? buttons.find((button) => button.dataset['action'] === 'clear')\n : buttons.find((button) => button.dataset['filterId'] === focus.id);\n const removes = buttons.filter((button) => button.dataset['filterId'] !== undefined);\n (same ?? removes[Math.min(focus.index, removes.length - 1)] ?? this.host).focus();\n });\n }\n private buttons(): HTMLButtonElement[] {\n return Array.from(this.host.querySelectorAll<HTMLButtonElement>('button'));\n }\n protected remove(id: string): void {\n if (!this.disabled() && this.valid() && this.filters().some((filter) => filter.id === id))\n this.filterRemove.emit(id);\n }\n protected clear(): void {\n if (!this.disabled() && this.valid() && this.filters().length) this.clearAll.emit();\n }\n}\n"],"mappings":";;;;;AAAA,SAAgB,qBAAqB,SAAkC;CACrE,MAAM,sBAAM,IAAI,IAAG;CACnB,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,OAAO,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