ud-components 0.1.0 → 0.1.2

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.
@@ -0,0 +1,39 @@
1
+ import * as i0 from "@angular/core";
2
+ export type UdButtonVariant = 'flat' | 'stroked' | 'icon-only';
3
+ export type UdButtonColor = 'primary' | 'secondary' | 'danger';
4
+ export type UdButtonSize = 'sm' | 'md' | 'lg';
5
+ export type UdButtonIconPosition = 'left' | 'right';
6
+ /**
7
+ * Styled button that wraps Angular Material with the library's design tokens.
8
+ *
9
+ * Usage:
10
+ * <ud-button>Save</ud-button>
11
+ * <ud-button variant="stroked" color="secondary">Cancel</ud-button>
12
+ * <ud-button [loading]="isSaving" icon="save">Save</ud-button>
13
+ * <ud-button color="danger" variant="stroked">Delete</ud-button>
14
+ */
15
+ export declare class UdButtonComponent {
16
+ /** Visual style of the button */
17
+ variant: UdButtonVariant;
18
+ /** Colour role */
19
+ color: UdButtonColor;
20
+ /** Size preset */
21
+ size: UdButtonSize;
22
+ /** Native button type */
23
+ type: 'button' | 'submit' | 'reset';
24
+ /** Material icon name. Shows a spinner when loading is true instead. */
25
+ icon?: string;
26
+ /** Which side the icon appears on */
27
+ iconPosition: UdButtonIconPosition;
28
+ /** Font set for the icon (default: material-icons-outlined) */
29
+ iconFontSet: string;
30
+ /** Shows a spinner and disables the button */
31
+ loading: boolean;
32
+ /** Explicitly disable the button */
33
+ disabled: boolean;
34
+ /** Stretch to fill the container width */
35
+ fullWidth: boolean;
36
+ get isDisabled(): boolean;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<UdButtonComponent, never>;
38
+ static ɵcmp: i0.ɵɵComponentDeclaration<UdButtonComponent, "ud-button", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "type": { "alias": "type"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconPosition": { "alias": "iconPosition"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; }, {}, never, ["*"], true, never>;
39
+ }
@@ -2,7 +2,9 @@ import { TemplateRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class EditViewSectionDirective {
4
4
  templateRef: TemplateRef<any>;
5
+ label: string;
6
+ icon: string;
5
7
  constructor(templateRef: TemplateRef<any>);
6
8
  static ɵfac: i0.ɵɵFactoryDeclaration<EditViewSectionDirective, never>;
7
- static ɵdir: i0.ɵɵDirectiveDeclaration<EditViewSectionDirective, "[editViewSection]", never, {}, {}, never, never, true, never>;
9
+ static ɵdir: i0.ɵɵDirectiveDeclaration<EditViewSectionDirective, "[editViewSection]", never, { "label": { "alias": "label"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; }, {}, never, never, true, never>;
8
10
  }
@@ -0,0 +1,50 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { FormControl } from '@angular/forms';
3
+ import * as i0 from "@angular/core";
4
+ export interface UdSelectOption {
5
+ /** The value stored in the form control */
6
+ value: any;
7
+ /** Already-translated, human-readable label */
8
+ label: string;
9
+ }
10
+ /**
11
+ * Styled multi-select with a chip trigger that participates in the parent FormGroup.
12
+ *
13
+ * Usage:
14
+ * <ud-multi-select
15
+ * controlName="roles"
16
+ * label="Roles"
17
+ * icon="sell"
18
+ * [options]="rolesOptions"
19
+ * [maxChipsVisible]="2"
20
+ * moreText="+{n} more" />
21
+ *
22
+ * Pass options with already-resolved labels (translate before passing in):
23
+ * rolesOptions = roles.map(r => ({ value: r.key, label: translate(r.translationKey) }));
24
+ */
25
+ export declare class MultiSelectComponent implements OnInit, OnDestroy {
26
+ controlName: string;
27
+ label: string;
28
+ icon?: string;
29
+ iconFontSet: string;
30
+ options: UdSelectOption[];
31
+ /** How many chips to show before collapsing into "+N more" */
32
+ maxChipsVisible: number;
33
+ /**
34
+ * Template for the overflow chip. Use `{n}` as the placeholder for the count.
35
+ * Default: "+{n} more"
36
+ */
37
+ moreText: string;
38
+ selectedValues: any[];
39
+ private controlContainer;
40
+ private destroy$;
41
+ private labelMap;
42
+ get control(): FormControl;
43
+ ngOnInit(): void;
44
+ ngOnDestroy(): void;
45
+ getLabelFor(value: any): string;
46
+ getMoreText(count: number): string;
47
+ private buildLabelMap;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<MultiSelectComponent, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<MultiSelectComponent, "ud-multi-select", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "options": { "alias": "options"; "required": false; }; "maxChipsVisible": { "alias": "maxChipsVisible"; "required": false; }; "moreText": { "alias": "moreText"; "required": false; }; }, {}, never, never, true, never>;
50
+ }
@@ -0,0 +1,27 @@
1
+ import { FormControl } from '@angular/forms';
2
+ import * as i0 from "@angular/core";
3
+ export interface PillToggleOption {
4
+ value: string;
5
+ label: string;
6
+ }
7
+ /**
8
+ * Segmented pill toggle that participates in the parent FormGroup.
9
+ * Visually mimics a mat-form-field outline field so it aligns perfectly
10
+ * alongside real mat-form-fields in a form grid.
11
+ *
12
+ * Usage:
13
+ * <ud-pill-toggle
14
+ * controlName="gender"
15
+ * label="Gender"
16
+ * [options]="[{ value: 'male', label: 'Male' }, { value: 'female', label: 'Female' }]" />
17
+ */
18
+ export declare class PillToggleComponent {
19
+ controlName: string;
20
+ label: string;
21
+ options: PillToggleOption[];
22
+ private controlContainer;
23
+ get control(): FormControl;
24
+ select(value: string): void;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<PillToggleComponent, never>;
26
+ static ɵcmp: i0.ɵɵComponentDeclaration<PillToggleComponent, "ud-pill-toggle", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, {}, never, never, true, never>;
27
+ }
@@ -0,0 +1,23 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Styled text input that participates in the parent FormGroup.
4
+ *
5
+ * Usage:
6
+ * <ud-text-input
7
+ * controlName="name"
8
+ * label="Full name"
9
+ * icon="account_circle"
10
+ * placeholder="Enter name" />
11
+ */
12
+ export declare class TextInputComponent {
13
+ /** Key of the control inside the parent FormGroup */
14
+ controlName: string;
15
+ label: string;
16
+ placeholder: string;
17
+ type: 'text' | 'email' | 'password' | 'number';
18
+ /** Material icon name. Leave empty to show no icon. */
19
+ icon?: string;
20
+ iconFontSet: string;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<TextInputComponent, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<TextInputComponent, "ud-text-input", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "type": { "alias": "type"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; }, {}, never, never, true, never>;
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ud-components",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.0",
6
6
  "@angular/core": "^19.2.0"
package/public-api.d.ts CHANGED
@@ -13,6 +13,10 @@ export * from './lib/progress-bar/progress-bar.component';
13
13
  export * from './lib/summary-view/summary-view.component';
14
14
  export * from './lib/tabs/tabs.component';
15
15
  export * from './lib/tel-input/tel-input.component';
16
+ export * from './lib/form-fields/text-input/text-input.component';
17
+ export * from './lib/form-fields/multi-select/multi-select.component';
18
+ export * from './lib/form-fields/pill-toggle/pill-toggle.component';
19
+ export * from './lib/button/button.component';
16
20
  export * from './enums/application-status.enum';
17
21
  export * from './enums/custom-table.enum';
18
22
  export * from './enums/modal-input-type.enum';