@thalassic/ui 0.10.0 → 0.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thalassic/ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/cdk": "^21.0.0",
@@ -5,10 +5,10 @@ import { FormUiControl, WithOptionalFieldTree, ValidationError, FormCheckboxCont
5
5
  import { CdkDialogContainer, DialogRole, DialogRef } from '@angular/cdk/dialog';
6
6
  import { ComponentType } from '@angular/cdk/portal';
7
7
  import { Day } from 'date-fns';
8
+ import { FlexibleConnectedPositionStrategyOrigin, ConnectedPosition } from '@angular/cdk/overlay';
8
9
  import { SafeHtml } from '@angular/platform-browser';
9
10
  import { Point } from '@thalassic/core';
10
11
  import { DataSource } from '@angular/cdk/table';
11
- import { ConnectedPosition } from '@angular/cdk/overlay';
12
12
 
13
13
  type color = 'primary' | 'secondary' | 'tertiary' | 'success' | 'info' | 'warning' | 'danger';
14
14
 
@@ -38,6 +38,7 @@ interface tlsUiConfigProvider {
38
38
  input?: Partial<InputConfig>;
39
39
  loader?: Partial<LoaderConfig>;
40
40
  menu?: Partial<MenuConfig>;
41
+ multiSelect?: Partial<MultiSelectConfig>;
41
42
  pagination?: Partial<PaginationConfig>;
42
43
  password?: Partial<PasswordConfig>;
43
44
  pinInput?: Partial<PinInputConfig>;
@@ -612,38 +613,171 @@ declare class RadioButton extends ValueFormControl<unknown> {
612
613
  static ɵcmp: i0.ɵɵComponentDeclaration<RadioButton, "tls-radio-button", never, { "radioValue": { "alias": "radioValue"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
613
614
  }
614
615
 
615
- declare class Select<T, V = unknown> extends ValueFormControl<V | null> {
616
- private readonly _config;
616
+ interface ConnectedOverlayConfig {
617
+ /** Template projected into the overlay. */
618
+ content: TemplateRef<unknown>;
619
+ /** Element or point the overlay is anchored to. */
620
+ origin: FlexibleConnectedPositionStrategyOrigin;
621
+ /** Connected positions to try, in order of preference. */
622
+ positions: ConnectedPosition[];
623
+ /** Forwarded to the position strategy. Defaults to the CDK default (true). */
624
+ flexibleDimensions?: boolean;
625
+ /** Forwarded to the position strategy. Defaults to the CDK default (true). */
626
+ push?: boolean;
627
+ /** Scroll handling while open. Defaults to `'reposition'`. */
628
+ scrollStrategy?: 'reposition' | 'close';
629
+ /** Whether to render a backdrop. Defaults to `true`. */
630
+ hasBackdrop?: boolean;
631
+ /** Backdrop class when a backdrop is rendered. Defaults to the transparent backdrop. */
632
+ backdropClass?: string;
633
+ /** Extra class(es) applied to the overlay pane. */
634
+ panelClass?: string | string[];
635
+ /** Close when the backdrop is clicked. Defaults to `true` when a backdrop is rendered. */
636
+ closeOnBackdropClick?: boolean;
637
+ /** Close on an outside pointer event. Defaults to `true` when no backdrop is rendered. */
638
+ closeOnOutsidePointer?: boolean;
639
+ /** Close when Escape is pressed. Defaults to `true`. */
640
+ closeOnEscape?: boolean;
641
+ /** Minimum width applied to the pane on every open (e.g. to match a trigger). */
642
+ minWidth?: number | string;
643
+ /**
644
+ * Keep the overlay alive across open/close (detach instead of dispose), so the
645
+ * same instance is reused on the next open. Defaults to `false`.
646
+ */
647
+ reuse?: boolean;
648
+ /** Invoked after the overlay closes, from any cause (explicit, backdrop, outside, Escape). */
649
+ onClose?: () => void;
650
+ }
651
+ /**
652
+ * Owns the CDK-Overlay lifecycle shared by the library's connected overlay
653
+ * components (popover, menu, select): create/attach, dismissal wiring
654
+ * (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
655
+ * positional and dismissal differences between components are expressed through
656
+ * {@link ConnectedOverlayConfig} rather than duplicated per component.
657
+ *
658
+ * Create one via {@link createOverlayManager} from a component field initializer
659
+ * so it is bound to the host's injection context.
660
+ */
661
+ declare class OverlayManager {
617
662
  private readonly _overlay;
618
- private readonly _triggerElement;
619
- private readonly _panelTemplate;
620
- readonly value: ModelSignal<V | null>;
663
+ private readonly _viewContainerRef;
664
+ private readonly _destroyRef;
665
+ private _overlayRef;
666
+ private _config;
667
+ private readonly _isOpen;
668
+ readonly isOpen: i0.Signal<boolean>;
669
+ private readonly _teardown;
670
+ open(config: ConnectedOverlayConfig): void;
671
+ close(): void;
672
+ private _buildPositionStrategy;
673
+ private _wireDismissal;
674
+ private _dispose;
675
+ }
676
+
677
+ /**
678
+ * Shared base for the single {@link Select} and {@link MultiSelect} controls.
679
+ * Owns everything the two listbox-combobox controls have in common: the option
680
+ * inputs, the connected overlay lifecycle, roving `aria-activedescendant`
681
+ * navigation, and the keyboard handler. The per-control differences (the value
682
+ * shape, the selected-state check, how the trigger label is built and what a
683
+ * commit does) are expressed through the abstract members below.
684
+ */
685
+ declare abstract class AbstractSelect<T, V, ValueType> extends ValueFormControl<ValueType> {
686
+ protected readonly overlay: OverlayManager;
687
+ private readonly triggerElement;
688
+ private readonly panelTemplate;
621
689
  readonly inputId: InputSignal<string | null>;
622
690
  readonly options: InputSignal<optionInput<T>[]>;
623
691
  readonly optionLabel: InputSignal<keyof T | undefined>;
624
692
  readonly optionValue: InputSignal<keyof T | undefined>;
625
693
  readonly optionDisabled: InputSignal<keyof T | undefined>;
626
- readonly placeholder: InputSignal<string>;
627
- readonly size: InputSignal<controlSize>;
628
- readonly fluid: InputSignalWithTransform<boolean, unknown>;
629
694
  readonly tabindex: InputSignal<string | number>;
630
- readonly clearable: InputSignalWithTransform<boolean, unknown>;
695
+ abstract readonly placeholder: InputSignal<string>;
696
+ abstract readonly size: InputSignal<controlSize>;
697
+ abstract readonly fluid: InputSignalWithTransform<boolean, unknown>;
698
+ abstract readonly clearable: InputSignalWithTransform<boolean, unknown>;
631
699
  protected readonly isOpen: Signal<boolean>;
632
700
  protected readonly activeIndex: WritableSignal<number>;
633
701
  protected readonly normalizedOptions: Signal<Option<V>[]>;
634
- protected readonly hasValue: Signal<boolean>;
635
- protected readonly selectedLabel: Signal<string>;
702
+ protected readonly activeDescendantId: Signal<string | null>;
636
703
  protected readonly hostClasses: Signal<string[]>;
704
+ protected get listboxId(): string;
705
+ protected abstract readonly uniqueId: string;
706
+ protected abstract readonly hostClassBase: string;
707
+ protected abstract readonly panelClass: string;
708
+ protected abstract readonly hasValue: Signal<boolean>;
709
+ /** Index the active option starts on when the panel opens. */
710
+ protected abstract getInitialActiveIndex(): number;
711
+ /** Apply the active option's selection when committed via mouse or keyboard. */
712
+ protected abstract commitActiveOption(option: Option<V>): void;
713
+ /** Reset the control to its empty value. */
714
+ protected abstract clear(): void;
637
715
  protected open(): void;
638
716
  protected close(): void;
639
717
  protected toggle(): void;
640
- protected select(option: Option<V>): void;
641
- protected clear(): void;
642
718
  protected onOptionHover(index: number, disabled?: boolean): void;
643
719
  protected onKeydown(event: KeyboardEvent): void;
644
- private _moveActive;
720
+ protected optionId(index: number): string;
721
+ private moveActive;
722
+ private moveActiveToEdge;
723
+ static ɵfac: i0.ɵɵFactoryDeclaration<AbstractSelect<any, any, any>, never>;
724
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractSelect<any, any, any>, never, never, { "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionLabel": { "alias": "optionLabel"; "required": false; "isSignal": true; }; "optionValue": { "alias": "optionValue"; "required": false; "isSignal": true; }; "optionDisabled": { "alias": "optionDisabled"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
725
+ }
726
+
727
+ declare class MultiSelect<T, V = unknown> extends AbstractSelect<T, V, V[]> {
728
+ private static _nextUniqueId;
729
+ private readonly _config;
730
+ protected readonly uniqueId: string;
731
+ protected readonly hostClassBase = "tls-multi-select";
732
+ protected readonly panelClass = "tls-multi-select-panel";
733
+ readonly value: ModelSignal<V[]>;
734
+ readonly placeholder: InputSignal<string>;
735
+ readonly size: InputSignal<controlSize>;
736
+ readonly fluid: InputSignalWithTransform<boolean, unknown>;
737
+ readonly clearable: InputSignalWithTransform<boolean, unknown>;
738
+ readonly maxLabels: InputSignal<number>;
739
+ protected readonly hasValue: Signal<boolean>;
740
+ protected readonly selectedValues: Signal<Set<V>>;
741
+ protected readonly triggerLabel: Signal<string>;
742
+ protected isSelected(option: Option<V>): boolean;
743
+ protected toggleOption(option: Option<V>): void;
744
+ protected clear(): void;
745
+ protected getInitialActiveIndex(): number;
746
+ protected commitActiveOption(option: Option<V>): void;
747
+ static ɵfac: i0.ɵɵFactoryDeclaration<MultiSelect<any, any>, never>;
748
+ static ɵcmp: i0.ɵɵComponentDeclaration<MultiSelect<any, any>, "tls-multi-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "maxLabels": { "alias": "maxLabels"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
749
+ }
750
+
751
+ interface MultiSelectConfig {
752
+ size: controlSize;
753
+ placeholder: string;
754
+ fluid: boolean;
755
+ clearable: boolean;
756
+ maxLabels: number;
757
+ }
758
+ declare const DEFAULT_MULTI_SELECT_CONFIG: MultiSelectConfig;
759
+
760
+ declare const MULTI_SELECT_CONFIG: InjectionToken<MultiSelectConfig>;
761
+
762
+ declare class Select<T, V = unknown> extends AbstractSelect<T, V, V | null> {
763
+ private static _nextUniqueId;
764
+ private readonly _config;
765
+ protected readonly uniqueId: string;
766
+ protected readonly hostClassBase = "tls-select";
767
+ protected readonly panelClass = "tls-select-panel";
768
+ readonly value: ModelSignal<V | null>;
769
+ readonly placeholder: InputSignal<string>;
770
+ readonly size: InputSignal<controlSize>;
771
+ readonly fluid: InputSignalWithTransform<boolean, unknown>;
772
+ readonly clearable: InputSignalWithTransform<boolean, unknown>;
773
+ protected readonly hasValue: Signal<boolean>;
774
+ protected readonly selectedLabel: Signal<string>;
775
+ protected select(option: Option<V>): void;
776
+ protected clear(): void;
777
+ protected getInitialActiveIndex(): number;
778
+ protected commitActiveOption(option: Option<V>): void;
645
779
  static ɵfac: i0.ɵɵFactoryDeclaration<Select<any, any>, never>;
646
- static ɵcmp: i0.ɵɵComponentDeclaration<Select<any, any>, "tls-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionLabel": { "alias": "optionLabel"; "required": false; "isSignal": true; }; "optionValue": { "alias": "optionValue"; "required": false; "isSignal": true; }; "optionDisabled": { "alias": "optionDisabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
780
+ static ɵcmp: i0.ɵɵComponentDeclaration<Select<any, any>, "tls-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
647
781
  }
648
782
 
649
783
  interface SelectConfig {
@@ -1180,5 +1314,5 @@ declare const TOOLTIP_CONFIG: InjectionToken<TooltipConfig>;
1180
1314
 
1181
1315
  declare const provideThalassicUIConfig: (config: tlsUiConfigProvider) => EnvironmentProviders;
1182
1316
 
1183
- export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
1184
- export type { AlertConfig, ButtonConfig, CheckboxConfig, ChipConfig, ChipContext, ChipControlConfig, ChipInputConfig, DateTimePickerConfig, DialogConfig, DialogOpenConfig, DividerConfig, FileUploaderConfig, FileUploaderDropZoneContext, FileUploaderFileContext, FormControlGroupConfig, FormItemConfig, IconConfig, InputConfig, LoaderConfig, MenuActionItem, MenuConfig, MenuCustomItem, MenuDivider, MenuItemDefinition, MenuLabel, PaginationConfig, PasswordConfig, PinInputConfig, PopoverConfig, RadioButtonConfig, SelectConfig, SkeletonConfig, StepConfig, StepperConfig, StepperSelectEvent, SwitchConfig, TableColumnDefinition, TableConfig, TableData, TableTrackBy, TabsConfig, TextareaConfig, ToggleGroupConfig, TooltipConfig, acceptInput, chipColor, chipTemplateContext, chipVariant, color, controlSize, dateTimePickerMode, dialogSize, dividerContentPosition, dividerOrientation, dividerVariant, fileUploaderDragState, menuItemType, menuPosition, orientation, overlayPosition, paginationItem, pinInputType, size, stepperColor, stepperOrientation, stepperValue, tableColumnAlignment, textareaResize, tlsUiConfigProvider, toggleGroupType, tooltipColor, tooltipOrigin, tooltipPosition };
1317
+ export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
1318
+ export type { AlertConfig, ButtonConfig, CheckboxConfig, ChipConfig, ChipContext, ChipControlConfig, ChipInputConfig, DateTimePickerConfig, DialogConfig, DialogOpenConfig, DividerConfig, FileUploaderConfig, FileUploaderDropZoneContext, FileUploaderFileContext, FormControlGroupConfig, FormItemConfig, IconConfig, InputConfig, LoaderConfig, MenuActionItem, MenuConfig, MenuCustomItem, MenuDivider, MenuItemDefinition, MenuLabel, MultiSelectConfig, PaginationConfig, PasswordConfig, PinInputConfig, PopoverConfig, RadioButtonConfig, SelectConfig, SkeletonConfig, StepConfig, StepperConfig, StepperSelectEvent, SwitchConfig, TableColumnDefinition, TableConfig, TableData, TableTrackBy, TabsConfig, TextareaConfig, ToggleGroupConfig, TooltipConfig, acceptInput, chipColor, chipTemplateContext, chipVariant, color, controlSize, dateTimePickerMode, dialogSize, dividerContentPosition, dividerOrientation, dividerVariant, fileUploaderDragState, menuItemType, menuPosition, orientation, overlayPosition, paginationItem, pinInputType, size, stepperColor, stepperOrientation, stepperValue, tableColumnAlignment, textareaResize, tlsUiConfigProvider, toggleGroupType, tooltipColor, tooltipOrigin, tooltipPosition };