@tailng-ui/components 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -5
- package/src/lib/feedback/empty/tng-empty.component.d.ts +16 -1
- package/src/lib/feedback/empty/tng-empty.component.d.ts.map +1 -1
- package/src/lib/feedback/empty/tng-empty.component.js +47 -57
- package/src/lib/feedback/empty/tng-empty.component.js.map +1 -1
- package/src/lib/feedback/index.d.ts +0 -5
- package/src/lib/feedback/index.d.ts.map +1 -1
- package/src/lib/feedback/index.js +4 -5
- package/src/lib/feedback/index.js.map +1 -1
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.d.ts +4 -0
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.d.ts.map +1 -1
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.js +16 -26
- package/src/lib/feedback/progress-bar/tng-progress-bar.component.js.map +1 -1
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.d.ts +4 -0
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.d.ts.map +1 -1
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.js +18 -32
- package/src/lib/feedback/progress-spinner/tng-progress-spinner.component.js.map +1 -1
- package/src/lib/feedback/skeleton/tng-skeleton.component.d.ts +4 -0
- package/src/lib/feedback/skeleton/tng-skeleton.component.d.ts.map +1 -1
- package/src/lib/feedback/skeleton/tng-skeleton.component.js +14 -20
- package/src/lib/feedback/skeleton/tng-skeleton.component.js.map +1 -1
- package/src/lib/feedback/toast/tng-toast.component.d.ts +4 -1
- package/src/lib/feedback/toast/tng-toast.component.d.ts.map +1 -1
- package/src/lib/feedback/toast/tng-toast.component.js +17 -19
- package/src/lib/feedback/toast/tng-toast.component.js.map +1 -1
- package/src/lib/form/autocomplete/tng-autocomplete.component.d.ts +4 -0
- package/src/lib/form/autocomplete/tng-autocomplete.component.d.ts.map +1 -1
- package/src/lib/form/autocomplete/tng-autocomplete.component.js +46 -49
- package/src/lib/form/autocomplete/tng-autocomplete.component.js.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.d.ts +3 -0
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.d.ts.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.js +33 -58
- package/src/lib/form/button-toggle/tng-button-toggle-group.component.js.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle.component.d.ts +3 -0
- package/src/lib/form/button-toggle/tng-button-toggle.component.d.ts.map +1 -1
- package/src/lib/form/button-toggle/tng-button-toggle.component.js +15 -26
- package/src/lib/form/button-toggle/tng-button-toggle.component.js.map +1 -1
- package/src/lib/form/checkbox/tng-checkbox.component.d.ts +3 -0
- package/src/lib/form/checkbox/tng-checkbox.component.d.ts.map +1 -1
- package/src/lib/form/checkbox/tng-checkbox.component.js +32 -42
- package/src/lib/form/checkbox/tng-checkbox.component.js.map +1 -1
- package/src/lib/form/chips/tng-chips.component.d.ts +3 -0
- package/src/lib/form/chips/tng-chips.component.d.ts.map +1 -1
- package/src/lib/form/chips/tng-chips.component.js +14 -19
- package/src/lib/form/chips/tng-chips.component.js.map +1 -1
- package/src/lib/form/combobox/tng-combobox.component.d.ts +3 -0
- package/src/lib/form/combobox/tng-combobox.component.d.ts.map +1 -1
- package/src/lib/form/combobox/tng-combobox.component.js +10 -13
- package/src/lib/form/combobox/tng-combobox.component.js.map +1 -1
- package/src/lib/form/datepicker/tng-datepicker.component.d.ts +4 -1
- package/src/lib/form/datepicker/tng-datepicker.component.d.ts.map +1 -1
- package/src/lib/form/datepicker/tng-datepicker.component.js +58 -98
- package/src/lib/form/datepicker/tng-datepicker.component.js.map +1 -1
- package/src/lib/form/form-field/tng-form-field.component.d.ts +3 -0
- package/src/lib/form/form-field/tng-form-field.component.d.ts.map +1 -1
- package/src/lib/form/form-field/tng-form-field.component.js +28 -33
- package/src/lib/form/form-field/tng-form-field.component.js.map +1 -1
- package/src/lib/form/index.d.ts +0 -20
- package/src/lib/form/index.d.ts.map +1 -1
- package/src/lib/form/index.js +4 -20
- package/src/lib/form/index.js.map +1 -1
- package/src/lib/form/input/tng-input.component.d.ts +3 -0
- package/src/lib/form/input/tng-input.component.d.ts.map +1 -1
- package/src/lib/form/input/tng-input.component.js +49 -60
- package/src/lib/form/input/tng-input.component.js.map +1 -1
- package/src/lib/form/input-otp/tng-input-otp.component.d.ts +3 -0
- package/src/lib/form/input-otp/tng-input-otp.component.d.ts.map +1 -1
- package/src/lib/form/input-otp/tng-input-otp.component.js +55 -69
- package/src/lib/form/input-otp/tng-input-otp.component.js.map +1 -1
- package/src/lib/form/label/tng-label.component.d.ts +3 -0
- package/src/lib/form/label/tng-label.component.d.ts.map +1 -1
- package/src/lib/form/label/tng-label.component.js +12 -19
- package/src/lib/form/label/tng-label.component.js.map +1 -1
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.d.ts +4 -0
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.d.ts.map +1 -1
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.js +40 -43
- package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.component.js.map +1 -1
- package/src/lib/form/multiselect/tng-multiselect.component.d.ts +4 -0
- package/src/lib/form/multiselect/tng-multiselect.component.d.ts.map +1 -1
- package/src/lib/form/multiselect/tng-multiselect.component.js +49 -52
- package/src/lib/form/multiselect/tng-multiselect.component.js.map +1 -1
- package/src/lib/form/radio/tng-radio.component.d.ts +3 -0
- package/src/lib/form/radio/tng-radio.component.d.ts.map +1 -1
- package/src/lib/form/radio/tng-radio.component.js +18 -33
- package/src/lib/form/radio/tng-radio.component.js.map +1 -1
- package/src/lib/form/select/tng-select.component.d.ts +4 -0
- package/src/lib/form/select/tng-select.component.d.ts.map +1 -1
- package/src/lib/form/select/tng-select.component.js +52 -53
- package/src/lib/form/select/tng-select.component.js.map +1 -1
- package/src/lib/form/select/tng-select.slots.d.ts +5 -0
- package/src/lib/form/select/tng-select.slots.d.ts.map +1 -1
- package/src/lib/form/select/tng-select.slots.js +21 -17
- package/src/lib/form/select/tng-select.slots.js.map +1 -1
- package/src/lib/form/slider/tng-slider.component.d.ts +3 -0
- package/src/lib/form/slider/tng-slider.component.d.ts.map +1 -1
- package/src/lib/form/slider/tng-slider.component.js +14 -27
- package/src/lib/form/slider/tng-slider.component.js.map +1 -1
- package/src/lib/form/switch/tng-switch.component.d.ts +3 -0
- package/src/lib/form/switch/tng-switch.component.d.ts.map +1 -1
- package/src/lib/form/switch/tng-switch.component.js +15 -24
- package/src/lib/form/switch/tng-switch.component.js.map +1 -1
- package/src/lib/form/textarea/tng-textarea.component.d.ts +3 -0
- package/src/lib/form/textarea/tng-textarea.component.d.ts.map +1 -1
- package/src/lib/form/textarea/tng-textarea.component.js +19 -36
- package/src/lib/form/textarea/tng-textarea.component.js.map +1 -1
- package/src/lib/form/toggle/tng-toggle.component.d.ts +3 -0
- package/src/lib/form/toggle/tng-toggle.component.d.ts.map +1 -1
- package/src/lib/form/toggle/tng-toggle.component.js +41 -41
- package/src/lib/form/toggle/tng-toggle.component.js.map +1 -1
- package/src/lib/form/toggle-group/tng-toggle-group.component.d.ts +4 -0
- package/src/lib/form/toggle-group/tng-toggle-group.component.d.ts.map +1 -1
- package/src/lib/form/toggle-group/tng-toggle-group.component.js +28 -31
- package/src/lib/form/toggle-group/tng-toggle-group.component.js.map +1 -1
- package/src/lib/layout/accordion/tng-accordion.component.d.ts +10 -0
- package/src/lib/layout/accordion/tng-accordion.component.d.ts.map +1 -1
- package/src/lib/layout/accordion/tng-accordion.component.js +49 -148
- package/src/lib/layout/accordion/tng-accordion.component.js.map +1 -1
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.d.ts +3 -0
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.d.ts.map +1 -1
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.js +10 -13
- package/src/lib/layout/bottom-sheet/tng-bottom-sheet.component.js.map +1 -1
- package/src/lib/layout/card/tng-card.component.d.ts +21 -0
- package/src/lib/layout/card/tng-card.component.d.ts.map +1 -1
- package/src/lib/layout/card/tng-card.component.js +92 -136
- package/src/lib/layout/card/tng-card.component.js.map +1 -1
- package/src/lib/layout/collapsible/tng-collapsible.component.d.ts +3 -0
- package/src/lib/layout/collapsible/tng-collapsible.component.d.ts.map +1 -1
- package/src/lib/layout/collapsible/tng-collapsible.component.js +17 -24
- package/src/lib/layout/collapsible/tng-collapsible.component.js.map +1 -1
- package/src/lib/layout/drawer/tng-drawer.component.d.ts +4 -0
- package/src/lib/layout/drawer/tng-drawer.component.d.ts.map +1 -1
- package/src/lib/layout/drawer/tng-drawer.component.js +48 -51
- package/src/lib/layout/drawer/tng-drawer.component.js.map +1 -1
- package/src/lib/layout/grid/tng-grid.component.d.ts +8 -0
- package/src/lib/layout/grid/tng-grid.component.d.ts.map +1 -1
- package/src/lib/layout/grid/tng-grid.component.js +48 -110
- package/src/lib/layout/grid/tng-grid.component.js.map +1 -1
- package/src/lib/layout/index.d.ts +1 -8
- package/src/lib/layout/index.d.ts.map +1 -1
- package/src/lib/layout/index.js +5 -8
- package/src/lib/layout/index.js.map +1 -1
- package/src/lib/layout/separator/tng-separator.component.d.ts +3 -0
- package/src/lib/layout/separator/tng-separator.component.d.ts.map +1 -1
- package/src/lib/layout/separator/tng-separator.component.js +11 -16
- package/src/lib/layout/separator/tng-separator.component.js.map +1 -1
- package/src/lib/layout/stepper/tng-stepper.component.d.ts +3 -0
- package/src/lib/layout/stepper/tng-stepper.component.d.ts.map +1 -1
- package/src/lib/layout/stepper/tng-stepper.component.js +10 -13
- package/src/lib/layout/stepper/tng-stepper.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.js +47 -49
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-item.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.js +16 -18
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-link.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.js +10 -12
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-list.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.d.ts +3 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.js +12 -10
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator-template.directive.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.js +12 -14
- package/src/lib/navigation/breadcrumb/tng-breadcrumb-separator.component.js.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.d.ts +4 -0
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.d.ts.map +1 -1
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.js +23 -25
- package/src/lib/navigation/breadcrumb/tng-breadcrumb.component.js.map +1 -1
- package/src/lib/navigation/context-menu/tng-context-menu.component.d.ts +5 -0
- package/src/lib/navigation/context-menu/tng-context-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/context-menu/tng-context-menu.component.js +24 -26
- package/src/lib/navigation/context-menu/tng-context-menu.component.js.map +1 -1
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.d.ts +4 -0
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.js +19 -23
- package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.component.js.map +1 -1
- package/src/lib/navigation/index.d.ts +0 -12
- package/src/lib/navigation/index.d.ts.map +1 -1
- package/src/lib/navigation/index.js +4 -12
- package/src/lib/navigation/index.js.map +1 -1
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.d.ts +3 -0
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.d.ts.map +1 -1
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.js +22 -20
- package/src/lib/navigation/menu/tng-menu-trigger-for.directive.js.map +1 -1
- package/src/lib/navigation/menu/tng-menu.component.d.ts +5 -0
- package/src/lib/navigation/menu/tng-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/menu/tng-menu.component.js +21 -23
- package/src/lib/navigation/menu/tng-menu.component.js.map +1 -1
- package/src/lib/navigation/menubar/tng-menubar.component.d.ts +5 -0
- package/src/lib/navigation/menubar/tng-menubar.component.d.ts.map +1 -1
- package/src/lib/navigation/menubar/tng-menubar.component.js +20 -22
- package/src/lib/navigation/menubar/tng-menubar.component.js.map +1 -1
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.d.ts +4 -0
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.d.ts.map +1 -1
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.js +11 -13
- package/src/lib/navigation/navigation-menu/tng-navigation-menu.component.js.map +1 -1
- package/src/lib/navigation/tabs/tng-tabs.component.d.ts +5 -0
- package/src/lib/navigation/tabs/tng-tabs.component.d.ts.map +1 -1
- package/src/lib/navigation/tabs/tng-tabs.component.js +32 -34
- package/src/lib/navigation/tabs/tng-tabs.component.js.map +1 -1
- package/src/lib/navigation/toolbar/tng-toolbar.component.d.ts +4 -0
- package/src/lib/navigation/toolbar/tng-toolbar.component.d.ts.map +1 -1
- package/src/lib/navigation/toolbar/tng-toolbar.component.js +11 -13
- package/src/lib/navigation/toolbar/tng-toolbar.component.js.map +1 -1
- package/src/lib/overlay/dialog/tng-dialog.component.d.ts +4 -0
- package/src/lib/overlay/dialog/tng-dialog.component.d.ts.map +1 -1
- package/src/lib/overlay/dialog/tng-dialog.component.js +18 -25
- package/src/lib/overlay/dialog/tng-dialog.component.js.map +1 -1
- package/src/lib/overlay/index.d.ts +0 -3
- package/src/lib/overlay/index.d.ts.map +1 -1
- package/src/lib/overlay/index.js +4 -3
- package/src/lib/overlay/index.js.map +1 -1
- package/src/lib/overlay/popover/tng-popover.component.d.ts +4 -0
- package/src/lib/overlay/popover/tng-popover.component.d.ts.map +1 -1
- package/src/lib/overlay/popover/tng-popover.component.js +23 -37
- package/src/lib/overlay/popover/tng-popover.component.js.map +1 -1
- package/src/lib/overlay/tooltip/tng-tooltip.component.d.ts +4 -0
- package/src/lib/overlay/tooltip/tng-tooltip.component.d.ts.map +1 -1
- package/src/lib/overlay/tooltip/tng-tooltip.component.js +17 -21
- package/src/lib/overlay/tooltip/tng-tooltip.component.js.map +1 -1
- package/src/lib/utility/avatar/tng-avatar.component.d.ts +4 -1
- package/src/lib/utility/avatar/tng-avatar.component.d.ts.map +1 -1
- package/src/lib/utility/avatar/tng-avatar.component.js +20 -22
- package/src/lib/utility/avatar/tng-avatar.component.js.map +1 -1
- package/src/lib/utility/badge/tng-badge.component.d.ts +4 -0
- package/src/lib/utility/badge/tng-badge.component.d.ts.map +1 -1
- package/src/lib/utility/badge/tng-badge.component.js +13 -10
- package/src/lib/utility/badge/tng-badge.component.js.map +1 -1
- package/src/lib/utility/button/tng-button.component.d.ts +4 -1
- package/src/lib/utility/button/tng-button.component.d.ts.map +1 -1
- package/src/lib/utility/button/tng-button.component.js +19 -29
- package/src/lib/utility/button/tng-button.component.js.map +1 -1
- package/src/lib/utility/code-block/tng-code-block.component.d.ts +4 -0
- package/src/lib/utility/code-block/tng-code-block.component.d.ts.map +1 -1
- package/src/lib/utility/code-block/tng-code-block.component.js +73 -103
- package/src/lib/utility/code-block/tng-code-block.component.js.map +1 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.d.ts +4 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.d.ts.map +1 -1
- package/src/lib/utility/copy-button/tng-copy-button.component.js +28 -36
- package/src/lib/utility/copy-button/tng-copy-button.component.js.map +1 -1
- package/src/lib/utility/index.d.ts +1 -9
- package/src/lib/utility/index.d.ts.map +1 -1
- package/src/lib/utility/index.js +5 -8
- package/src/lib/utility/index.js.map +1 -1
- package/src/lib/utility/tag/tng-tag.component.d.ts +4 -1
- package/src/lib/utility/tag/tng-tag.component.d.ts.map +1 -1
- package/src/lib/utility/tag/tng-tag.component.js +18 -24
- package/src/lib/utility/tag/tng-tag.component.js.map +1 -1
- package/src/lib/utility/tree/tng-tree.component.d.ts +4 -1
- package/src/lib/utility/tree/tng-tree.component.d.ts.map +1 -1
- package/src/lib/utility/tree/tng-tree.component.js +23 -25
- package/src/lib/utility/tree/tng-tree.component.js.map +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
1
|
import { Component, ContentChild, TemplateRef, computed, inject, input, } from '@angular/core';
|
|
3
2
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
3
|
import { TngMultiSelect, TngSelectTrigger, TngSelectValue, TngSelectIcon, TngSelectContent, TngSelectOverlay, TngMultiSelectListbox, TngMultiSelectOption, } from '@tailng-ui/primitives';
|
|
5
|
-
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@tailng-ui/primitives";
|
|
6
|
+
export class TngMultiSelectComponent {
|
|
6
7
|
primitive = inject(TngMultiSelect);
|
|
7
|
-
options = input([]);
|
|
8
|
-
placeholder = input('Select…');
|
|
9
|
-
getOptionValue = input(((opt) => opt?.value));
|
|
10
|
-
getOptionLabel = input(((opt) => String(opt?.label ?? opt?.value ?? opt)));
|
|
11
|
-
isOptionDisabled = input(((opt) => !!opt?.disabled));
|
|
12
|
-
trackBy = input((_, opt) => opt);
|
|
13
|
-
iconText = input('▾');
|
|
8
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
9
|
+
placeholder = input('Select…', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
10
|
+
getOptionValue = input(((opt) => opt?.value), ...(ngDevMode ? [{ debugName: "getOptionValue" }] : []));
|
|
11
|
+
getOptionLabel = input(((opt) => String(opt?.label ?? opt?.value ?? opt)), ...(ngDevMode ? [{ debugName: "getOptionLabel" }] : []));
|
|
12
|
+
isOptionDisabled = input(((opt) => !!opt?.disabled), ...(ngDevMode ? [{ debugName: "isOptionDisabled" }] : []));
|
|
13
|
+
trackBy = input((_, opt) => opt, ...(ngDevMode ? [{ debugName: "trackBy" }] : []));
|
|
14
|
+
iconText = input('▾', ...(ngDevMode ? [{ debugName: "iconText" }] : []));
|
|
14
15
|
valueTpl;
|
|
15
16
|
optionTpl;
|
|
16
17
|
selectedOptions = computed(() => {
|
|
@@ -23,13 +24,13 @@ let TngMultiSelectComponent = class TngMultiSelectComponent {
|
|
|
23
24
|
result.push(opt);
|
|
24
25
|
}
|
|
25
26
|
return result;
|
|
26
|
-
});
|
|
27
|
+
}, ...(ngDevMode ? [{ debugName: "selectedOptions" }] : []));
|
|
27
28
|
selectedLabel = computed(() => {
|
|
28
29
|
const opts = this.selectedOptions();
|
|
29
30
|
if (opts.length === 0)
|
|
30
31
|
return this.placeholder();
|
|
31
32
|
return opts.map((o) => this.getOptionLabel()(o)).join(', ');
|
|
32
|
-
});
|
|
33
|
+
}, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
|
|
33
34
|
valueContext() {
|
|
34
35
|
const opts = this.selectedOptions();
|
|
35
36
|
const v = this.primitive.value() ?? [];
|
|
@@ -67,45 +68,41 @@ let TngMultiSelectComponent = class TngMultiSelectComponent {
|
|
|
67
68
|
clear() {
|
|
68
69
|
this.primitive.clear();
|
|
69
70
|
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
styleUrl: './tng-multiselect.component.css',
|
|
108
|
-
})
|
|
109
|
-
], TngMultiSelectComponent);
|
|
110
|
-
export { TngMultiSelectComponent };
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngMultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: TngMultiSelectComponent, isStandalone: true, selector: "tng-multiselect", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, getOptionValue: { classPropertyName: "getOptionValue", publicName: "getOptionValue", isSignal: true, isRequired: false, transformFunction: null }, getOptionLabel: { classPropertyName: "getOptionLabel", publicName: "getOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, isOptionDisabled: { classPropertyName: "isOptionDisabled", publicName: "isOptionDisabled", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, iconText: { classPropertyName: "iconText", publicName: "iconText", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "valueTpl", first: true, predicate: ["tngMultiSelectValueTpl"], descendants: true, read: TemplateRef }, { propertyName: "optionTpl", first: true, predicate: ["tngMultiSelectOptionTpl"], descendants: true, read: TemplateRef }], hostDirectives: [{ directive: i1.TngMultiSelect, inputs: ["open", "open", "value", "value", "disabled", "disabled", "loading", "loading", "invalid", "invalid", "labelId", "labelId", "descriptionId", "descriptionId", "errorId", "errorId"], outputs: ["openChange", "openChange", "valueChange", "valueChange"] }], ngImport: i0, template: "<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngMultiSelectListbox [multiple]=\"true\">\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngMultiSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>\n", styles: [":host {\n display: block;\n}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TngSelectTrigger, selector: "[tngSelectTrigger]", exportAs: ["tngSelectTrigger"] }, { kind: "directive", type: TngSelectValue, selector: "[tngSelectValue]", exportAs: ["tngSelectValue"] }, { kind: "directive", type: TngSelectIcon, selector: "[tngSelectIcon]", exportAs: ["tngSelectIcon"] }, { kind: "directive", type: TngSelectContent, selector: "[tngSelectContent]", exportAs: ["tngSelectContent"] }, { kind: "directive", type: TngSelectOverlay, selector: "[tngSelectOverlay]", inputs: ["placement", "offset", "collision"], exportAs: ["tngSelectOverlay"] }, { kind: "directive", type: TngMultiSelectListbox, selector: "[tngMultiSelectListbox]" }, { kind: "directive", type: TngMultiSelectOption, selector: "[tngMultiSelectOption]" }] });
|
|
73
|
+
}
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngMultiSelectComponent, decorators: [{
|
|
75
|
+
type: Component,
|
|
76
|
+
args: [{ selector: 'tng-multiselect', imports: [
|
|
77
|
+
NgTemplateOutlet,
|
|
78
|
+
TngSelectTrigger,
|
|
79
|
+
TngSelectValue,
|
|
80
|
+
TngSelectIcon,
|
|
81
|
+
TngSelectContent,
|
|
82
|
+
TngSelectOverlay,
|
|
83
|
+
TngMultiSelectListbox,
|
|
84
|
+
TngMultiSelectOption,
|
|
85
|
+
], hostDirectives: [
|
|
86
|
+
{
|
|
87
|
+
directive: TngMultiSelect,
|
|
88
|
+
inputs: [
|
|
89
|
+
'open',
|
|
90
|
+
'value',
|
|
91
|
+
'disabled',
|
|
92
|
+
'loading',
|
|
93
|
+
'invalid',
|
|
94
|
+
'labelId',
|
|
95
|
+
'descriptionId',
|
|
96
|
+
'errorId',
|
|
97
|
+
],
|
|
98
|
+
outputs: ['openChange', 'valueChange'],
|
|
99
|
+
},
|
|
100
|
+
], template: "<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngMultiSelectListbox [multiple]=\"true\">\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngMultiSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>\n", styles: [":host {\n display: block;\n}\n"] }]
|
|
101
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], getOptionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "getOptionValue", required: false }] }], getOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "getOptionLabel", required: false }] }], isOptionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOptionDisabled", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], iconText: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconText", required: false }] }], valueTpl: [{
|
|
102
|
+
type: ContentChild,
|
|
103
|
+
args: ['tngMultiSelectValueTpl', { read: TemplateRef }]
|
|
104
|
+
}], optionTpl: [{
|
|
105
|
+
type: ContentChild,
|
|
106
|
+
args: ['tngMultiSelectOptionTpl', { read: TemplateRef }]
|
|
107
|
+
}] } });
|
|
111
108
|
//# sourceMappingURL=tng-multiselect.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-multiselect.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/multiselect/tng-multiselect.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tng-multiselect.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/multiselect/tng-multiselect.component.ts","../../../../../../../../libs/tailng-ui/components/src/lib/form/multiselect/tng-multiselect.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,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,+FAChB,cAAc,2FACd,aAAa,yFACb,gBAAgB,+FAChB,gBAAgB,6IAChB,qBAAqB,oEACrB,oBAAoB;;2FAqBX,uBAAuB;kBA/BnC,SAAS;+BACE,iBAAiB,WAClB;wBACP,gBAAgB;wBAChB,gBAAgB;wBAChB,cAAc;wBACd,aAAa;wBACb,gBAAgB;wBAChB,gBAAgB;wBAChB,qBAAqB;wBACrB,oBAAoB;qBACrB,kBACe;wBACd;4BACE,SAAS,EAAE,cAAc;4BACzB,MAAM,EAAE;gCACN,MAAM;gCACN,OAAO;gCACP,UAAU;gCACV,SAAS;gCACT,SAAS;gCACT,SAAS;gCACT,eAAe;gCACf,SAAS;6BACV;4BACD,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;yBACvC;qBACF;;sBAuBA,YAAY;uBAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;;sBAC5D,YAAY;uBAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE","sourcesContent":["import {\n Component,\n ContentChild,\n TemplateRef,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\nimport {\n TngMultiSelect,\n TngSelectTrigger,\n TngSelectValue,\n TngSelectIcon,\n TngSelectContent,\n TngSelectOverlay,\n TngMultiSelectListbox,\n TngMultiSelectOption,\n} from '@tailng-ui/primitives';\n\nexport type TngMultiSelectGetValue<O, V> = (opt: O) => V;\nexport type TngMultiSelectGetLabel<O> = (opt: O) => string;\nexport type TngMultiSelectIsDisabled<O> = (opt: O) => boolean;\nexport type TngMultiSelectTrackBy<O> = (index: number, opt: O) => unknown;\n\nexport type TngMultiSelectValueContext<O, V> = {\n $implicit: {\n value: readonly V[];\n options: readonly O[];\n label: string;\n removeItem: (item: V) => void;\n };\n};\nexport type TngMultiSelectOptionContext<O, V> = {\n $implicit: { option: O; value: V; label: string; disabled: boolean; selected: boolean; active: boolean };\n};\n\n@Component({\n selector: 'tng-multiselect',\n imports: [\n NgTemplateOutlet,\n TngSelectTrigger,\n TngSelectValue,\n TngSelectIcon,\n TngSelectContent,\n TngSelectOverlay,\n TngMultiSelectListbox,\n TngMultiSelectOption,\n ],\n hostDirectives: [\n {\n directive: TngMultiSelect,\n inputs: [\n 'open',\n 'value',\n 'disabled',\n 'loading',\n 'invalid',\n 'labelId',\n 'descriptionId',\n 'errorId',\n ],\n outputs: ['openChange', 'valueChange'],\n },\n ],\n templateUrl: './tng-multiselect.component.html',\n styleUrl: './tng-multiselect.component.css',\n})\nexport class TngMultiSelectComponent<O = unknown, V = unknown> {\n protected readonly primitive = inject<TngMultiSelect<V>>(TngMultiSelect);\n\n readonly options = input<readonly O[]>([]);\n readonly placeholder = input<string>('Select…');\n\n readonly getOptionValue = input<TngMultiSelectGetValue<O, V>>(\n ((opt: unknown) => (opt as { value?: V })?.value) as TngMultiSelectGetValue<O, V>,\n );\n readonly getOptionLabel = input<TngMultiSelectGetLabel<O>>(\n ((opt: unknown) => String((opt as { label?: string; value?: unknown })?.label ?? (opt as { value?: unknown })?.value ?? opt)) as TngMultiSelectGetLabel<O>,\n );\n readonly isOptionDisabled = input<TngMultiSelectIsDisabled<O>>(\n ((opt: unknown) => !!(opt as { disabled?: boolean })?.disabled) as TngMultiSelectIsDisabled<O>,\n );\n readonly trackBy = input<TngMultiSelectTrackBy<O>>((_, opt) => opt as unknown);\n\n readonly iconText = input<string>('▾');\n\n @ContentChild('tngMultiSelectValueTpl', { read: TemplateRef }) valueTpl?: TemplateRef<TngMultiSelectValueContext<O, V>>;\n @ContentChild('tngMultiSelectOptionTpl', { read: TemplateRef }) optionTpl?: TemplateRef<TngMultiSelectOptionContext<O, V>>;\n\n protected readonly selectedOptions = computed<readonly O[]>(() => {\n const v = this.primitive.value() ?? [];\n const getV = this.getOptionValue();\n const result: O[] = [];\n for (const opt of this.options()) {\n const optVal = getV(opt);\n if (v.some((x) => Object.is(x, optVal))) result.push(opt);\n }\n return result;\n });\n\n protected readonly selectedLabel = computed<string>(() => {\n const opts = this.selectedOptions();\n if (opts.length === 0) return this.placeholder();\n return opts.map((o) => this.getOptionLabel()(o)).join(', ');\n });\n\n protected valueContext(): TngMultiSelectValueContext<O, V> {\n const opts = this.selectedOptions();\n const v = this.primitive.value() ?? [];\n const label = opts.length > 0 ? opts.map((o) => this.getOptionLabel()(o)).join(', ') : this.placeholder();\n return {\n $implicit: {\n value: v,\n options: opts,\n label,\n removeItem: (item: V) => this.removeSelectedItem(item),\n },\n };\n }\n\n protected optionContext(opt: O): TngMultiSelectOptionContext<O, V> {\n const optVal = this.getOptionValue()(opt);\n const label = this.getOptionLabel()(opt);\n const disabled = this.isOptionDisabled()(opt);\n const v = this.primitive.value() ?? [];\n const selected = v.some((x) => Object.is(x, optVal));\n\n return { $implicit: { option: opt, value: optVal, label, disabled, selected, active: false } };\n }\n\n /** Adds an item to the selection. Delegates to primitive. */\n addSelectedItem(item: V): void {\n this.primitive.addSelectedItem(item);\n }\n\n /** Removes an item from the selection. Delegates to primitive. */\n removeSelectedItem(item: V): void {\n this.primitive.removeSelectedItem(item);\n }\n\n /** Toggles an item in the selection. Delegates to primitive. */\n toggleSelectedItem(item: V): void {\n this.primitive.toggleSelectedItem(item);\n }\n\n /** Clears the selection. Delegates to primitive. */\n clear(): void {\n this.primitive.clear();\n }\n}\n","<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngMultiSelectListbox [multiple]=\"true\">\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngMultiSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
1
2
|
export declare function readTngRadioChecked(event: unknown): boolean | null;
|
|
2
3
|
export declare function shouldEmitTngRadioCheckedChange(disabled: boolean, readonly: boolean): boolean;
|
|
3
4
|
export declare class TngRadioComponent {
|
|
@@ -12,5 +13,7 @@ export declare class TngRadioComponent {
|
|
|
12
13
|
readonly value: import("@angular/core").InputSignal<string>;
|
|
13
14
|
readonly checkedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
14
15
|
onChange(event: unknown): void;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TngRadioComponent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TngRadioComponent, "tng-radio", never, { "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "ariaInvalid": { "alias": "ariaInvalid"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;
|
|
15
18
|
}
|
|
16
19
|
//# sourceMappingURL=tng-radio.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-radio.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/radio/tng-radio.component.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAWlE;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAE7F;AAED,qBAMa,iBAAiB;IAC5B,SAAgB,eAAe,qDAA8B;IAC7D,SAAgB,WAAW,8EAExB;IACH,SAAgB,OAAO,8EAEpB;IACH,SAAgB,QAAQ,8EAErB;IACH,SAAgB,OAAO,8EAEpB;IACH,SAAgB,IAAI,qDAA8B;IAClD,SAAgB,QAAQ,8EAErB;IACH,SAAgB,QAAQ,8EAErB;IACH,SAAgB,KAAK,8CAAuB;IAE5C,SAAgB,aAAa,oDAAqB;IAE3C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"tng-radio.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/radio/tng-radio.component.ts"],"names":[],"mappings":";AAGA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAWlE;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAE7F;AAED,qBAMa,iBAAiB;IAC5B,SAAgB,eAAe,qDAA8B;IAC7D,SAAgB,WAAW,8EAExB;IACH,SAAgB,OAAO,8EAEpB;IACH,SAAgB,QAAQ,8EAErB;IACH,SAAgB,OAAO,8EAEpB;IACH,SAAgB,IAAI,qDAA8B;IAClD,SAAgB,QAAQ,8EAErB;IACH,SAAgB,QAAQ,8EAErB;IACH,SAAgB,KAAK,8CAAuB;IAE5C,SAAgB,aAAa,oDAAqB;IAE3C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;yCAzB1B,iBAAiB;2CAAjB,iBAAiB;CAqC7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
1
|
import { booleanAttribute, Component, input, output } from '@angular/core';
|
|
3
2
|
import { TngRadio as TngRadioPrimitive } from '@tailng-ui/primitives';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
4
|
export function readTngRadioChecked(event) {
|
|
5
5
|
if (!(event instanceof Event)) {
|
|
6
6
|
return null;
|
|
@@ -14,28 +14,16 @@ export function readTngRadioChecked(event) {
|
|
|
14
14
|
export function shouldEmitTngRadioCheckedChange(disabled, readonly) {
|
|
15
15
|
return !disabled && !readonly;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
ariaDescribedBy = input(null);
|
|
19
|
-
ariaInvalid = input(false, {
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
invalid = input(false, {
|
|
29
|
-
transform: booleanAttribute,
|
|
30
|
-
});
|
|
31
|
-
name = input(null);
|
|
32
|
-
readonly = input(false, {
|
|
33
|
-
transform: booleanAttribute,
|
|
34
|
-
});
|
|
35
|
-
required = input(false, {
|
|
36
|
-
transform: booleanAttribute,
|
|
37
|
-
});
|
|
38
|
-
value = input('on');
|
|
17
|
+
export class TngRadioComponent {
|
|
18
|
+
ariaDescribedBy = input(null, ...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : []));
|
|
19
|
+
ariaInvalid = input(false, { ...(ngDevMode ? { debugName: "ariaInvalid" } : {}), transform: booleanAttribute });
|
|
20
|
+
checked = input(false, { ...(ngDevMode ? { debugName: "checked" } : {}), transform: booleanAttribute });
|
|
21
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
22
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
|
|
23
|
+
name = input(null, ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
24
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
25
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
|
|
26
|
+
value = input('on', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
39
27
|
checkedChange = output();
|
|
40
28
|
onChange(event) {
|
|
41
29
|
const checked = readTngRadioChecked(event);
|
|
@@ -47,14 +35,11 @@ let TngRadioComponent = class TngRadioComponent {
|
|
|
47
35
|
}
|
|
48
36
|
this.checkedChange.emit(checked);
|
|
49
37
|
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
})
|
|
58
|
-
], TngRadioComponent);
|
|
59
|
-
export { TngRadioComponent };
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
39
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.1", type: TngRadioComponent, isStandalone: true, selector: "tng-radio", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "ariaInvalid", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<label\n class=\"tng-radio-root\"\n [attr.data-disabled]=\"disabled() ? '' : null\"\n [attr.data-invalid]=\"invalid() ? '' : null\"\n [attr.data-readonly]=\"readonly() ? '' : null\"\n>\n <input\n tngRadio\n class=\"tng-radio-control\"\n [ariaInvalid]=\"ariaInvalid()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [invalid]=\"invalid()\"\n [required]=\"required()\"\n [readonly]=\"readonly()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n (change)=\"onChange($event)\"\n />\n <span class=\"tng-radio-label\">\n <ng-content />\n </span>\n</label>\n", styles: [":host {\n display: inline-flex;\n}\n\n.tng-radio-root {\n align-items: center;\n color: var(--tng-semantic-foreground-primary);\n cursor: pointer;\n display: inline-flex;\n gap: 0.55rem;\n user-select: none;\n}\n\n.tng-radio-root[data-disabled] {\n cursor: not-allowed;\n opacity: 0.65;\n}\n\n.tng-radio-root[data-readonly] {\n cursor: default;\n}\n\n.tng-radio-control {\n accent-color: var(--tng-semantic-accent-brand);\n block-size: 1rem;\n inline-size: 1rem;\n margin: 0;\n}\n\n.tng-radio-root[data-invalid] .tng-radio-control {\n outline: 1px solid var(--tng-semantic-accent-danger);\n outline-offset: 1px;\n}\n\n.tng-radio-control:focus-visible {\n box-shadow: 0 0 0 3px var(--tng-semantic-focus-ring);\n outline: none;\n}\n\n.tng-radio-label {\n font-size: 0.925rem;\n line-height: 1.2;\n}\n"], dependencies: [{ kind: "directive", type: TngRadioPrimitive, selector: "input[tngRadio]", inputs: ["ariaDescribedBy", "ariaInvalid", "checked", "disabled", "invalid", "name", "readonly", "required", "value"], exportAs: ["tngRadio"] }] });
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngRadioComponent, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{ selector: 'tng-radio', imports: [TngRadioPrimitive], template: "<label\n class=\"tng-radio-root\"\n [attr.data-disabled]=\"disabled() ? '' : null\"\n [attr.data-invalid]=\"invalid() ? '' : null\"\n [attr.data-readonly]=\"readonly() ? '' : null\"\n>\n <input\n tngRadio\n class=\"tng-radio-control\"\n [ariaInvalid]=\"ariaInvalid()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [invalid]=\"invalid()\"\n [required]=\"required()\"\n [readonly]=\"readonly()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n (change)=\"onChange($event)\"\n />\n <span class=\"tng-radio-label\">\n <ng-content />\n </span>\n</label>\n", styles: [":host {\n display: inline-flex;\n}\n\n.tng-radio-root {\n align-items: center;\n color: var(--tng-semantic-foreground-primary);\n cursor: pointer;\n display: inline-flex;\n gap: 0.55rem;\n user-select: none;\n}\n\n.tng-radio-root[data-disabled] {\n cursor: not-allowed;\n opacity: 0.65;\n}\n\n.tng-radio-root[data-readonly] {\n cursor: default;\n}\n\n.tng-radio-control {\n accent-color: var(--tng-semantic-accent-brand);\n block-size: 1rem;\n inline-size: 1rem;\n margin: 0;\n}\n\n.tng-radio-root[data-invalid] .tng-radio-control {\n outline: 1px solid var(--tng-semantic-accent-danger);\n outline-offset: 1px;\n}\n\n.tng-radio-control:focus-visible {\n box-shadow: 0 0 0 3px var(--tng-semantic-focus-ring);\n outline: none;\n}\n\n.tng-radio-label {\n font-size: 0.925rem;\n line-height: 1.2;\n}\n"] }]
|
|
44
|
+
}], propDecorators: { ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaInvalid", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
|
|
60
45
|
//# sourceMappingURL=tng-radio.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-radio.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/radio/tng-radio.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tng-radio.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/radio/tng-radio.component.ts","../../../../../../../../libs/tailng-ui/components/src/lib/form/radio/tng-radio.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;;AAEtE,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,CAAC,MAAM,YAAY,gBAAgB,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,QAAiB,EAAE,QAAiB;IAClF,OAAO,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;AAChC,CAAC;AAQD,MAAM,OAAO,iBAAiB;IACZ,eAAe,GAAG,KAAK,CAAgB,IAAI,2DAAC,CAAC;IAC7C,WAAW,GAAG,KAAK,CAA4B,KAAK,wDAClE,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,OAAO,GAAG,KAAK,CAA4B,KAAK,oDAC9D,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,QAAQ,GAAG,KAAK,CAA4B,KAAK,qDAC/D,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,OAAO,GAAG,KAAK,CAA4B,KAAK,oDAC9D,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,IAAI,GAAG,KAAK,CAAgB,IAAI,gDAAC,CAAC;IAClC,QAAQ,GAAG,KAAK,CAA4B,KAAK,qDAC/D,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,QAAQ,GAAG,KAAK,CAA4B,KAAK,qDAC/D,SAAS,EAAE,gBAAgB,GAC3B,CAAC;IACa,KAAK,GAAG,KAAK,CAAS,IAAI,iDAAC,CAAC;IAE5B,aAAa,GAAG,MAAM,EAAW,CAAC;IAE3C,QAAQ,CAAC,KAAc;QAC5B,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YACvE,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;uGApCU,iBAAiB;2FAAjB,iBAAiB,0wCC1B9B,woBAwBA,42BDFY,iBAAiB;;2FAIhB,iBAAiB;kBAN7B,SAAS;+BACE,WAAW,WACZ,CAAC,iBAAiB,CAAC","sourcesContent":["import { booleanAttribute, Component, input, output } from '@angular/core';\nimport { TngRadio as TngRadioPrimitive } from '@tailng-ui/primitives';\n\nexport function readTngRadioChecked(event: unknown): boolean | null {\n if (!(event instanceof Event)) {\n return null;\n }\n\n const target = event.target;\n if (!(target instanceof HTMLInputElement)) {\n return null;\n }\n\n return target.checked;\n}\n\nexport function shouldEmitTngRadioCheckedChange(disabled: boolean, readonly: boolean): boolean {\n return !disabled && !readonly;\n}\n\n@Component({\n selector: 'tng-radio',\n imports: [TngRadioPrimitive],\n templateUrl: './tng-radio.component.html',\n styleUrl: './tng-radio.component.css',\n})\nexport class TngRadioComponent {\n public readonly ariaDescribedBy = input<string | null>(null);\n public readonly ariaInvalid = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly checked = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly disabled = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly invalid = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly name = input<string | null>(null);\n public readonly readonly = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly required = input<boolean, boolean | string>(false, {\n transform: booleanAttribute,\n });\n public readonly value = input<string>('on');\n\n public readonly checkedChange = output<boolean>();\n\n public onChange(event: unknown): void {\n const checked = readTngRadioChecked(event);\n if (checked === null) {\n return;\n }\n\n if (!shouldEmitTngRadioCheckedChange(this.disabled(), this.readonly())) {\n return;\n }\n\n this.checkedChange.emit(checked);\n }\n}\n","<label\n class=\"tng-radio-root\"\n [attr.data-disabled]=\"disabled() ? '' : null\"\n [attr.data-invalid]=\"invalid() ? '' : null\"\n [attr.data-readonly]=\"readonly() ? '' : null\"\n>\n <input\n tngRadio\n class=\"tng-radio-control\"\n [ariaInvalid]=\"ariaInvalid()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [invalid]=\"invalid()\"\n [required]=\"required()\"\n [readonly]=\"readonly()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [ariaDescribedBy]=\"ariaDescribedBy()\"\n (change)=\"onChange($event)\"\n />\n <span class=\"tng-radio-label\">\n <ng-content />\n </span>\n</label>\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TemplateRef } from '@angular/core';
|
|
2
2
|
import { TngSelect } from '@tailng-ui/primitives';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@tailng-ui/primitives";
|
|
3
5
|
export type TngSelectGetValue<O, V> = (opt: O) => V;
|
|
4
6
|
export type TngSelectGetLabel<O> = (opt: O) => string;
|
|
5
7
|
export type TngSelectIsDisabled<O> = (opt: O) => boolean;
|
|
@@ -36,5 +38,7 @@ export declare class TngSelectComponent<O = unknown, V = unknown> {
|
|
|
36
38
|
protected readonly selectedLabel: import("@angular/core").Signal<string>;
|
|
37
39
|
protected valueContext(): TngSelectValueContext<O, V>;
|
|
38
40
|
protected optionContext(opt: O): TngSelectOptionContext<O, V>;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TngSelectComponent<any, any>, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TngSelectComponent<any, any>, "tng-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "getOptionValue": { "alias": "getOptionValue"; "required": false; "isSignal": true; }; "getOptionLabel": { "alias": "getOptionLabel"; "required": false; "isSignal": true; }; "isOptionDisabled": { "alias": "isOptionDisabled"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "iconText": { "alias": "iconText"; "required": false; "isSignal": true; }; }, {}, ["valueTpl", "optionTpl"], never, true, [{ directive: typeof i1.TngSelect; inputs: { "open": "open"; "value": "value"; "disabled": "disabled"; "loading": "loading"; "invalid": "invalid"; "labelId": "labelId"; "descriptionId": "descriptionId"; "errorId": "errorId"; }; outputs: { "openChange": "openChange"; "valueChange": "valueChange"; }; }]>;
|
|
39
43
|
}
|
|
40
44
|
//# sourceMappingURL=tng-select.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-select.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAIZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,SAAS,EAQV,MAAM,uBAAuB,CAAC
|
|
1
|
+
{"version":3,"file":"tng-select.component.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAIZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,SAAS,EAQV,MAAM,uBAAuB,CAAC;;;AAE/B,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AACpD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;AACtD,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;AAGrE,MAAM,MAAM,qBAAqB,CAAC,CAAC,EAAE,CAAC,IAAI;IACxC,SAAS,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAChF,CAAC;AACF,MAAM,MAAM,sBAAsB,CAAC,CAAC,EAAE,CAAC,IAAI;IACzC,SAAS,EAAE;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1G,CAAC;AAEF,qBAgCa,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IAGtD,SAAS,CAAC,QAAQ,CAAC,SAAS,eAAmC;IAG/D,QAAQ,CAAC,OAAO,oDAA2B;IAC3C,QAAQ,CAAC,WAAW,8CAA4B;IAEhD,QAAQ,CAAC,cAAc,+DAErB;IACF,QAAQ,CAAC,cAAc,4DAErB;IACF,QAAQ,CAAC,gBAAgB,8DAEvB;IACF,QAAQ,CAAC,OAAO,2DAA0D;IAG1E,QAAQ,CAAC,QAAQ,8CAAsB;IAGmB,QAAQ,CAAC,EAAE,WAAW,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAGjH,SAAS,CAAC,QAAQ,CAAC,cAAc,2CAS9B;IAEH,SAAS,CAAC,QAAQ,CAAC,aAAa,yCAG7B;IAGH,SAAS,CAAC,YAAY,IAAI,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC;IAOrD,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC;yCApDlD,kBAAkB;2CAAlB,kBAAkB;CAiE9B"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
1
|
import { Component, ContentChild, TemplateRef, computed, inject, input, } from '@angular/core';
|
|
3
2
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
3
|
import { TngSelect, TngSelectTrigger, TngSelectValue, TngSelectIcon, TngSelectContent, TngSelectOverlay, TngSelectListbox, TngSelectOption, } from '@tailng-ui/primitives';
|
|
5
|
-
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@tailng-ui/primitives";
|
|
6
|
+
export class TngSelectComponent {
|
|
6
7
|
// Access primitive instance for reading value/open state inside template.
|
|
7
8
|
// (This works because the primitive is attached via hostDirectives.)
|
|
8
9
|
primitive = inject(TngSelect);
|
|
9
10
|
// ----- data / accessors (recommended API) -----
|
|
10
|
-
options = input([]);
|
|
11
|
-
placeholder = input('Select…');
|
|
12
|
-
getOptionValue = input(((opt) => opt?.value));
|
|
13
|
-
getOptionLabel = input(((opt) => String(opt?.label ?? opt?.value ?? opt)));
|
|
14
|
-
isOptionDisabled = input(((opt) => !!opt?.disabled));
|
|
15
|
-
trackBy = input((_, opt) => opt);
|
|
11
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
12
|
+
placeholder = input('Select…', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
13
|
+
getOptionValue = input(((opt) => opt?.value), ...(ngDevMode ? [{ debugName: "getOptionValue" }] : []));
|
|
14
|
+
getOptionLabel = input(((opt) => String(opt?.label ?? opt?.value ?? opt)), ...(ngDevMode ? [{ debugName: "getOptionLabel" }] : []));
|
|
15
|
+
isOptionDisabled = input(((opt) => !!opt?.disabled), ...(ngDevMode ? [{ debugName: "isOptionDisabled" }] : []));
|
|
16
|
+
trackBy = input((_, opt) => opt, ...(ngDevMode ? [{ debugName: "trackBy" }] : []));
|
|
16
17
|
// ----- optional: icon text/slot (still headless) -----
|
|
17
|
-
iconText = input('▾');
|
|
18
|
+
iconText = input('▾', ...(ngDevMode ? [{ debugName: "iconText" }] : []));
|
|
18
19
|
// ----- slots (optional) -----
|
|
19
20
|
valueTpl;
|
|
20
21
|
optionTpl;
|
|
@@ -29,11 +30,11 @@ let TngSelectComponent = class TngSelectComponent {
|
|
|
29
30
|
return opt;
|
|
30
31
|
}
|
|
31
32
|
return null;
|
|
32
|
-
});
|
|
33
|
+
}, ...(ngDevMode ? [{ debugName: "selectedOption" }] : []));
|
|
33
34
|
selectedLabel = computed(() => {
|
|
34
35
|
const opt = this.selectedOption();
|
|
35
36
|
return opt ? this.getOptionLabel()(opt) : this.placeholder();
|
|
36
|
-
});
|
|
37
|
+
}, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
|
|
37
38
|
// Context helpers for templates
|
|
38
39
|
valueContext() {
|
|
39
40
|
const v = this.primitive.value();
|
|
@@ -52,46 +53,44 @@ let TngSelectComponent = class TngSelectComponent {
|
|
|
52
53
|
const active = false;
|
|
53
54
|
return { $implicit: { option: opt, value: v, label, disabled, selected, active } };
|
|
54
55
|
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
],
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
], TngSelectComponent);
|
|
96
|
-
export { TngSelectComponent };
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: TngSelectComponent, isStandalone: true, selector: "tng-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, getOptionValue: { classPropertyName: "getOptionValue", publicName: "getOptionValue", isSignal: true, isRequired: false, transformFunction: null }, getOptionLabel: { classPropertyName: "getOptionLabel", publicName: "getOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, isOptionDisabled: { classPropertyName: "isOptionDisabled", publicName: "isOptionDisabled", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, iconText: { classPropertyName: "iconText", publicName: "iconText", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "valueTpl", first: true, predicate: ["tngSelectValueTpl"], descendants: true, read: TemplateRef }, { propertyName: "optionTpl", first: true, predicate: ["tngSelectOptionTpl"], descendants: true, read: TemplateRef }], hostDirectives: [{ directive: i1.TngSelect, inputs: ["open", "open", "value", "value", "disabled", "disabled", "loading", "loading", "invalid", "invalid", "labelId", "labelId", "descriptionId", "descriptionId", "errorId", "errorId"], outputs: ["openChange", "openChange", "valueChange", "valueChange"] }], ngImport: i0, template: "<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngSelectListbox>\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type:
|
|
58
|
+
// primitives used in template
|
|
59
|
+
TngSelectTrigger, selector: "[tngSelectTrigger]", exportAs: ["tngSelectTrigger"] }, { kind: "directive", type: TngSelectValue, selector: "[tngSelectValue]", exportAs: ["tngSelectValue"] }, { kind: "directive", type: TngSelectIcon, selector: "[tngSelectIcon]", exportAs: ["tngSelectIcon"] }, { kind: "directive", type: TngSelectContent, selector: "[tngSelectContent]", exportAs: ["tngSelectContent"] }, { kind: "directive", type: TngSelectOverlay, selector: "[tngSelectOverlay]", inputs: ["placement", "offset", "collision"], exportAs: ["tngSelectOverlay"] }, { kind: "directive", type: TngSelectListbox, selector: "[tngSelectListbox]" }, { kind: "directive", type: TngSelectOption, selector: "[tngSelectOption]" }] });
|
|
60
|
+
}
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngSelectComponent, decorators: [{
|
|
62
|
+
type: Component,
|
|
63
|
+
args: [{ selector: 'tng-select', imports: [
|
|
64
|
+
NgTemplateOutlet,
|
|
65
|
+
// primitives used in template
|
|
66
|
+
TngSelectTrigger,
|
|
67
|
+
TngSelectValue,
|
|
68
|
+
TngSelectIcon,
|
|
69
|
+
TngSelectContent,
|
|
70
|
+
TngSelectOverlay,
|
|
71
|
+
TngSelectListbox,
|
|
72
|
+
TngSelectOption,
|
|
73
|
+
], hostDirectives: [
|
|
74
|
+
{
|
|
75
|
+
directive: TngSelect,
|
|
76
|
+
inputs: [
|
|
77
|
+
'open',
|
|
78
|
+
'value',
|
|
79
|
+
'disabled',
|
|
80
|
+
'loading',
|
|
81
|
+
'invalid',
|
|
82
|
+
'labelId',
|
|
83
|
+
'descriptionId',
|
|
84
|
+
'errorId',
|
|
85
|
+
],
|
|
86
|
+
outputs: ['openChange', 'valueChange'],
|
|
87
|
+
},
|
|
88
|
+
], template: "<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngSelectListbox>\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>" }]
|
|
89
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], getOptionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "getOptionValue", required: false }] }], getOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "getOptionLabel", required: false }] }], isOptionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOptionDisabled", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], iconText: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconText", required: false }] }], valueTpl: [{
|
|
90
|
+
type: ContentChild,
|
|
91
|
+
args: ['tngSelectValueTpl', { read: TemplateRef }]
|
|
92
|
+
}], optionTpl: [{
|
|
93
|
+
type: ContentChild,
|
|
94
|
+
args: ['tngSelectOptionTpl', { read: TemplateRef }]
|
|
95
|
+
}] } });
|
|
97
96
|
//# sourceMappingURL=tng-select.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-select.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tng-select.component.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.component.ts","../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng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AG,IAAI,CAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QAEtD,mFAAmF;QACnF,8DAA8D;QAC9D,oFAAoF;QACpF,MAAM,MAAM,GAAG,KAAK,CAAC;QAErB,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IACrF,CAAC;uGAhEU,kBAAkB;2FAAlB,kBAAkB,8mCAwBc,WAAW,0GACV,WAAW,+UC3FzD,81BAgCM,4CDKF,gBAAgB;gBAChB,8BAA8B;gBAC9B,gBAAgB,+FAChB,cAAc,2FACd,aAAa,yFACb,gBAAgB,+FAChB,gBAAgB,6IAChB,gBAAgB,+DAChB,eAAe;;2FAqBN,kBAAkB;kBAhC9B,SAAS;+BACE,YAAY,WACb;wBACP,gBAAgB;wBAChB,8BAA8B;wBAC9B,gBAAgB;wBAChB,cAAc;wBACd,aAAa;wBACb,gBAAgB;wBAChB,gBAAgB;wBAChB,gBAAgB;wBAChB,eAAe;qBAChB,kBAEe;wBACd;4BACE,SAAS,EAAE,SAAS;4BACpB,MAAM,EAAE;gCACN,MAAM;gCACN,OAAO;gCACP,UAAU;gCACV,SAAS;gCACT,SAAS;gCACT,SAAS;gCACT,eAAe;gCACf,SAAS;6BACV;4BACD,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;yBACvC;qBACF;;sBA2BA,YAAY;uBAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;;sBACvD,YAAY;uBAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE","sourcesContent":["import {\n Component,\n ContentChild,\n TemplateRef,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\nimport {\n TngSelect,\n TngSelectTrigger,\n TngSelectValue,\n TngSelectIcon,\n TngSelectContent,\n TngSelectOverlay,\n TngSelectListbox,\n TngSelectOption,\n} from '@tailng-ui/primitives';\n\nexport type TngSelectGetValue<O, V> = (opt: O) => V;\nexport type TngSelectGetLabel<O> = (opt: O) => string;\nexport type TngSelectIsDisabled<O> = (opt: O) => boolean;\nexport type TngSelectTrackBy<O> = (index: number, opt: O) => unknown;\n\n// Slot templates (optional)\nexport type TngSelectValueContext<O, V> = {\n $implicit: { value: V | readonly V[] | null; option: O | null; label: string };\n};\nexport type TngSelectOptionContext<O, V> = {\n $implicit: { option: O; value: V; label: string; disabled: boolean; selected: boolean; active: boolean };\n};\n\n@Component({\n selector: 'tng-select',\n imports: [\n NgTemplateOutlet,\n // primitives used in template\n TngSelectTrigger,\n TngSelectValue,\n TngSelectIcon,\n TngSelectContent,\n TngSelectOverlay,\n TngSelectListbox,\n TngSelectOption,\n ],\n // Attach primitive directive to host + re-expose its controlled API.\n hostDirectives: [\n {\n directive: TngSelect,\n inputs: [\n 'open',\n 'value',\n 'disabled',\n 'loading',\n 'invalid',\n 'labelId',\n 'descriptionId',\n 'errorId',\n ],\n outputs: ['openChange', 'valueChange'],\n },\n ],\n templateUrl: './tng-select.component.html',\n})\nexport class TngSelectComponent<O = unknown, V = unknown> {\n // Access primitive instance for reading value/open state inside template.\n // (This works because the primitive is attached via hostDirectives.)\n protected readonly primitive = inject<TngSelect<V>>(TngSelect);\n\n // ----- data / accessors (recommended API) -----\n readonly options = input<readonly O[]>([]);\n readonly placeholder = input<string>('Select…');\n\n readonly getOptionValue = input<TngSelectGetValue<O, V>>(\n ((opt: any) => opt?.value) as TngSelectGetValue<O, V>,\n );\n readonly getOptionLabel = input<TngSelectGetLabel<O>>(\n ((opt: any) => String(opt?.label ?? opt?.value ?? opt)) as TngSelectGetLabel<O>,\n );\n readonly isOptionDisabled = input<TngSelectIsDisabled<O>>(\n ((opt: any) => !!opt?.disabled) as TngSelectIsDisabled<O>,\n );\n readonly trackBy = input<TngSelectTrackBy<O>>((_, opt) => opt as unknown);\n\n // ----- optional: icon text/slot (still headless) -----\n readonly iconText = input<string>('▾');\n\n // ----- slots (optional) -----\n @ContentChild('tngSelectValueTpl', { read: TemplateRef }) valueTpl?: TemplateRef<TngSelectValueContext<O, V>>;\n @ContentChild('tngSelectOptionTpl', { read: TemplateRef }) optionTpl?: TemplateRef<TngSelectOptionContext<O, V>>;\n\n // ----- derived state for default rendering -----\n protected readonly selectedOption = computed<O | null>(() => {\n const v = this.primitive.value();\n if (v === null) return null;\n\n const getV = this.getOptionValue();\n for (const opt of this.options()) {\n if (Object.is(getV(opt), v)) return opt;\n }\n return null;\n });\n\n protected readonly selectedLabel = computed<string>(() => {\n const opt = this.selectedOption();\n return opt ? this.getOptionLabel()(opt) : this.placeholder();\n });\n\n // Context helpers for templates\n protected valueContext(): TngSelectValueContext<O, V> {\n const v = this.primitive.value();\n const opt = this.selectedOption();\n const label = opt ? this.getOptionLabel()(opt) : this.placeholder();\n return { $implicit: { value: v, option: opt, label } };\n }\n\n protected optionContext(opt: O): TngSelectOptionContext<O, V> {\n const v = this.getOptionValue()(opt);\n const label = this.getOptionLabel()(opt);\n const disabled = this.isOptionDisabled()(opt);\n const selected = Object.is(this.primitive.value(), v);\n\n // “active” styling is handled by listbox primitive via data-active on the element,\n // but we include it in case the consumer’s template wants it.\n // (We can’t reliably compute active here without reading listbox controller state.)\n const active = false;\n\n return { $implicit: { option: opt, value: v, label, disabled, selected, active } };\n }\n}","<button tngSelectTrigger type=\"button\">\n <span tngSelectValue>\n @if (valueTpl) {\n <ng-container *ngTemplateOutlet=\"valueTpl; context: valueContext()\" />\n } @else {\n {{ selectedLabel() }}\n }\n </span>\n\n <span tngSelectIcon aria-hidden=\"true\">\n {{ iconText() }}\n </span>\n</button>\n\n<div tngSelectContent>\n <div tngSelectOverlay>\n <ul tngSelectListbox>\n @for (opt of options(); track trackBy()($index, opt)) {\n <li\n tngSelectOption\n [tngValue]=\"getOptionValue()(opt)\"\n [disabled]=\"isOptionDisabled()(opt)\"\n >\n @if (optionTpl) {\n <ng-container *ngTemplateOutlet=\"optionTpl; context: optionContext(opt)\" />\n } @else {\n {{ getOptionLabel()(opt) }}\n }\n </li>\n }\n </ul>\n </div>\n</div>"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
export type TngSelectTriggerTplContext<O, V> = Readonly<{
|
|
3
4
|
value: V | null;
|
|
4
5
|
option: O | null;
|
|
@@ -9,6 +10,8 @@ export type TngSelectTriggerTplContext<O, V> = Readonly<{
|
|
|
9
10
|
}>;
|
|
10
11
|
export declare class TngSelectTriggerTpl<O = unknown, V = unknown> {
|
|
11
12
|
readonly tpl: TemplateRef<any>;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TngSelectTriggerTpl<any, any>, never>;
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TngSelectTriggerTpl<any, any>, "ng-template[tngSelectTriggerTpl]", never, {}, {}, never, never, true, never>;
|
|
12
15
|
}
|
|
13
16
|
export type TngSelectOptionTplContext<O, V> = Readonly<{
|
|
14
17
|
$implicit: O;
|
|
@@ -21,5 +24,7 @@ export type TngSelectOptionTplContext<O, V> = Readonly<{
|
|
|
21
24
|
}>;
|
|
22
25
|
export declare class TngSelectOptionTpl<O = unknown, V = unknown> {
|
|
23
26
|
readonly tpl: TemplateRef<any>;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TngSelectOptionTpl<any, any>, never>;
|
|
28
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TngSelectOptionTpl<any, any>, "ng-template[tngSelectOptionTpl]", never, {}, {}, never, never, true, never>;
|
|
24
29
|
}
|
|
25
30
|
//# sourceMappingURL=tng-select.slots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tng-select.slots.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAU,MAAM,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"tng-select.slots.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/components/src/lib/form/select/tng-select.slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAU,MAAM,eAAe,CAAC;;AAE/D,MAAM,MAAM,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC;IACtD,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,qBAGa,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACvD,QAAQ,CAAC,GAAG,mBAAyD;yCAD1D,mBAAmB;2CAAnB,mBAAmB;CAE/B;AAED,MAAM,MAAM,yBAAyB,CAAC,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC;IACrD,SAAS,EAAE,CAAC,CAAC;IACb,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,qBAGa,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACtD,QAAQ,CAAC,GAAG,mBAAwD;yCADzD,kBAAkB;2CAAlB,kBAAkB;CAE9B"}
|