@kraft.stitch/angular 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +33 -0
- package/README.md +2 -3
- package/ng-package.json +10 -0
- package/package.json +27 -4
- package/src/lib/Buttons/button/button.ts +152 -0
- package/src/lib/Buttons/button-group/button-group.ts +129 -0
- package/src/lib/Buttons/chips/chips.ts +131 -0
- package/src/lib/Buttons/fab/fab.ts +96 -0
- package/src/lib/Calendars/datepicker/datepicker.ts +105 -0
- package/src/lib/Calendars/daterange/daterange.ts +112 -0
- package/src/lib/Calendars/timepicker/timepicker.ts +117 -0
- package/src/lib/Dropdowns/dropdown/dropdown.ts +121 -0
- package/src/lib/Dropdowns/listbox/listbox.ts +116 -0
- package/src/lib/Inputs/checkbox/checkbox.ts +126 -0
- package/src/lib/Inputs/colour-picker/colour-picker.ts +101 -0
- package/src/lib/Inputs/input/input.ts +139 -0
- package/src/lib/Inputs/otp-input/otp-input.ts +113 -0
- package/src/lib/Inputs/radio/radio.ts +115 -0
- package/src/lib/Inputs/rating/rating.ts +104 -0
- package/src/lib/Inputs/slider/slider.ts +121 -0
- package/src/lib/Inputs/switch/switch.ts +100 -0
- package/src/lib/Inputs/textarea/textarea.ts +129 -0
- package/src/lib/Inputs/theme-switch/theme-switch.ts +61 -0
- package/src/lib/Inputs/uploader/uploader.ts +97 -0
- package/src/lib/Layout/avatar/avatar.ts +66 -0
- package/src/lib/Layout/card/card.ts +88 -0
- package/src/lib/Layout/code-view/code-view.ts +77 -0
- package/src/lib/Layout/dialog/dialog.ts +80 -0
- package/src/lib/Layout/not-found/not-found.ts +73 -0
- package/src/lib/Layout/sidebar/sidebar.ts +97 -0
- package/src/lib/Layout/table/table.ts +81 -0
- package/src/lib/Layout/tooltip/tooltip.ts +48 -0
- package/src/lib/Navigation/accordion/accordion.ts +80 -0
- package/src/lib/Navigation/breadcrumb/breadcrumb.ts +58 -0
- package/src/lib/Navigation/carousel/carousel.ts +70 -0
- package/src/lib/Navigation/context-menu/context-menu.ts +79 -0
- package/src/lib/Navigation/nav-bar/nav-bar.ts +72 -0
- package/src/lib/Navigation/pagination/pagination.ts +82 -0
- package/src/lib/Navigation/stepper/stepper.ts +77 -0
- package/src/lib/Navigation/tab/tab.ts +71 -0
- package/src/lib/Navigation/toolbar/toolbar.ts +60 -0
- package/src/lib/Navigation/top-nav-bar/top-nav-bar.ts +71 -0
- package/src/lib/Navigation/tree-view/tree-view.ts +75 -0
- package/src/lib/Notification/badge/badge.ts +55 -0
- package/src/lib/Notification/loader/loader.ts +41 -0
- package/src/lib/Notification/message/message.ts +60 -0
- package/src/lib/Notification/progress/progress.ts +65 -0
- package/src/lib/Notification/spinner/spinner.ts +50 -0
- package/src/lib/Notification/toast/toast.ts +56 -0
- package/src/public-api.ts +62 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-tree-view` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-tree-view.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, effect, inject, input, output } from '@angular/core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Mirrors `KsTreeNode` exported by
|
|
9
|
+
* `core/src/components/Navigation/tree-view/tree-view.tsx`. Duplicated
|
|
10
|
+
* locally — see the note in `Buttons/button-group/button-group.ts` for why.
|
|
11
|
+
*/
|
|
12
|
+
export interface KsTreeNode {
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
children?: KsTreeNode[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** DOM shape of the real `<ks-tree-view>` custom element, typed for the wrapper. */
|
|
21
|
+
type KsTreeViewElement = HTMLElement & {
|
|
22
|
+
nodes: KsTreeNode[];
|
|
23
|
+
expandedKeys: string[];
|
|
24
|
+
multi: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Angular wrapper around the `<ks-tree-view>` Stencil custom element.
|
|
29
|
+
* No `<slot>` in the wrapped Stencil render — data-driven only.
|
|
30
|
+
*/
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'ks-tree-view',
|
|
33
|
+
standalone: true,
|
|
34
|
+
template: '',
|
|
35
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36
|
+
})
|
|
37
|
+
export class KsTreeViewComponent {
|
|
38
|
+
private readonly el: KsTreeViewElement;
|
|
39
|
+
|
|
40
|
+
/** Tree data */
|
|
41
|
+
readonly nodes = input<KsTreeNode[]>([]);
|
|
42
|
+
|
|
43
|
+
/** Keys of nodes that start expanded */
|
|
44
|
+
readonly expandedKeys = input<string[]>([]);
|
|
45
|
+
|
|
46
|
+
/** Allow selecting multiple nodes */
|
|
47
|
+
readonly multi = input(false);
|
|
48
|
+
|
|
49
|
+
/** Emits key(s) when selection changes. From the native `selectionChanged` event. */
|
|
50
|
+
readonly ksSelectionChanged = output<string | string[]>();
|
|
51
|
+
|
|
52
|
+
/** Emits when a node is expanded/collapsed. From the native `expandChange` event. */
|
|
53
|
+
readonly ksExpandChange = output<{ key: string; expanded: boolean }>();
|
|
54
|
+
|
|
55
|
+
constructor(ref: ElementRef<KsTreeViewElement>) {
|
|
56
|
+
this.el = ref.nativeElement;
|
|
57
|
+
|
|
58
|
+
effect(() => (this.el.nodes = this.nodes()));
|
|
59
|
+
effect(() => (this.el.expandedKeys = this.expandedKeys()));
|
|
60
|
+
effect(() => (this.el.multi = this.multi()));
|
|
61
|
+
|
|
62
|
+
const onNativeSelectionChanged = (event: Event): void => {
|
|
63
|
+
this.ksSelectionChanged.emit((event as CustomEvent<string | string[]>).detail);
|
|
64
|
+
};
|
|
65
|
+
const onNativeExpandChange = (event: Event): void => {
|
|
66
|
+
this.ksExpandChange.emit((event as CustomEvent<{ key: string; expanded: boolean }>).detail);
|
|
67
|
+
};
|
|
68
|
+
this.el.addEventListener('selectionChanged', onNativeSelectionChanged);
|
|
69
|
+
this.el.addEventListener('expandChange', onNativeExpandChange);
|
|
70
|
+
inject(DestroyRef).onDestroy(() => {
|
|
71
|
+
this.el.removeEventListener('selectionChanged', onNativeSelectionChanged);
|
|
72
|
+
this.el.removeEventListener('expandChange', onNativeExpandChange);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-badge` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-badge.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, ElementRef, effect, input } from '@angular/core';
|
|
6
|
+
import type { KsBaseSize, KsBaseVariant } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/** DOM shape of the real `<ks-badge>` custom element, typed for the wrapper. */
|
|
9
|
+
type KsBadgeElement = HTMLElement & {
|
|
10
|
+
label: string;
|
|
11
|
+
variant: KsBaseVariant;
|
|
12
|
+
size: KsBaseSize;
|
|
13
|
+
dot: boolean;
|
|
14
|
+
pill: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Angular wrapper around the `<ks-badge>` Stencil custom element.
|
|
19
|
+
* Purely presentational — no events, no `<slot>` in the wrapped Stencil
|
|
20
|
+
* render, plain inputs only.
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'ks-badge',
|
|
24
|
+
standalone: true,
|
|
25
|
+
template: '',
|
|
26
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
|
+
})
|
|
28
|
+
export class KsBadgeComponent {
|
|
29
|
+
private readonly el: KsBadgeElement;
|
|
30
|
+
|
|
31
|
+
/** Display text */
|
|
32
|
+
readonly label = input('');
|
|
33
|
+
|
|
34
|
+
/** Colour variant */
|
|
35
|
+
readonly variant = input<KsBaseVariant>('brand');
|
|
36
|
+
|
|
37
|
+
/** Size */
|
|
38
|
+
readonly size = input<KsBaseSize>('md');
|
|
39
|
+
|
|
40
|
+
/** Show a dot instead of text */
|
|
41
|
+
readonly dot = input(false);
|
|
42
|
+
|
|
43
|
+
/** Pill (fully rounded) shape */
|
|
44
|
+
readonly pill = input(true);
|
|
45
|
+
|
|
46
|
+
constructor(ref: ElementRef<KsBadgeElement>) {
|
|
47
|
+
this.el = ref.nativeElement;
|
|
48
|
+
|
|
49
|
+
effect(() => (this.el.label = this.label()));
|
|
50
|
+
effect(() => (this.el.variant = this.variant()));
|
|
51
|
+
effect(() => (this.el.size = this.size()));
|
|
52
|
+
effect(() => (this.el.dot = this.dot()));
|
|
53
|
+
effect(() => (this.el.pill = this.pill()));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-loader` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-loader.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, ElementRef, effect, input } from '@angular/core';
|
|
6
|
+
import { LoaderStateEnum } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/** DOM shape of the real `<ks-loader>` custom element, typed for the wrapper. */
|
|
9
|
+
type KsLoaderElement = HTMLElement & {
|
|
10
|
+
state: LoaderStateEnum;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Angular wrapper around the `<ks-loader>` Stencil custom element.
|
|
15
|
+
*
|
|
16
|
+
* Renders real, consumer-facing named slots — `loading`, `empty`,
|
|
17
|
+
* `empty-action`, `error`, `error-action` — plus a default (unnamed)
|
|
18
|
+
* slot for the `Success` state. Same single unfiltered
|
|
19
|
+
* `<ng-content>` pass-through as `Layout/card/card.ts`: give each
|
|
20
|
+
* projected child its own native `slot="loading"` / `slot="empty"` /
|
|
21
|
+
* `slot="empty-action"` / `slot="error"` / `slot="error-action"`
|
|
22
|
+
* attribute (or none, for the default/success slot).
|
|
23
|
+
*/
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'ks-loader',
|
|
26
|
+
standalone: true,
|
|
27
|
+
template: '<ng-content></ng-content>',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
})
|
|
30
|
+
export class KsLoaderComponent {
|
|
31
|
+
private readonly el: KsLoaderElement;
|
|
32
|
+
|
|
33
|
+
/** Current state */
|
|
34
|
+
readonly state = input<LoaderStateEnum>(LoaderStateEnum.Loading);
|
|
35
|
+
|
|
36
|
+
constructor(ref: ElementRef<KsLoaderElement>) {
|
|
37
|
+
this.el = ref.nativeElement;
|
|
38
|
+
|
|
39
|
+
effect(() => (this.el.state = this.state()));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-message` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-message.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, effect, inject, input, output } from '@angular/core';
|
|
6
|
+
import type { KsBaseVariant } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/** DOM shape of the real `<ks-message>` custom element, typed for the wrapper. */
|
|
9
|
+
type KsMessageElement = HTMLElement & {
|
|
10
|
+
text: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
variant: KsBaseVariant;
|
|
13
|
+
dismissible: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Angular wrapper around the `<ks-message>` Stencil custom element.
|
|
18
|
+
*
|
|
19
|
+
* `<ks-message>` renders a default `<slot />` only as a fallback when
|
|
20
|
+
* `text` is empty — same single unfiltered `<ng-content>` pass-through as
|
|
21
|
+
* `Layout/card/card.ts`; omit `text` and project content instead if
|
|
22
|
+
* richer markup is needed.
|
|
23
|
+
*/
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'ks-message',
|
|
26
|
+
standalone: true,
|
|
27
|
+
template: '<ng-content></ng-content>',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
})
|
|
30
|
+
export class KsMessageComponent {
|
|
31
|
+
private readonly el: KsMessageElement;
|
|
32
|
+
|
|
33
|
+
/** Main message text */
|
|
34
|
+
readonly text = input('');
|
|
35
|
+
|
|
36
|
+
/** Optional icon class (e.g. Material Icon or Font Awesome) */
|
|
37
|
+
readonly icon = input('');
|
|
38
|
+
|
|
39
|
+
/** Colour variant */
|
|
40
|
+
readonly variant = input<KsBaseVariant>('info');
|
|
41
|
+
|
|
42
|
+
/** Show a dismiss (×) button */
|
|
43
|
+
readonly dismissible = input(false);
|
|
44
|
+
|
|
45
|
+
/** Emits when the message is dismissed. From the native `dismissed` event. */
|
|
46
|
+
readonly ksDismissed = output<void>();
|
|
47
|
+
|
|
48
|
+
constructor(ref: ElementRef<KsMessageElement>) {
|
|
49
|
+
this.el = ref.nativeElement;
|
|
50
|
+
|
|
51
|
+
effect(() => (this.el.text = this.text()));
|
|
52
|
+
effect(() => (this.el.icon = this.icon()));
|
|
53
|
+
effect(() => (this.el.variant = this.variant()));
|
|
54
|
+
effect(() => (this.el.dismissible = this.dismissible()));
|
|
55
|
+
|
|
56
|
+
const onNativeDismissed = (): void => this.ksDismissed.emit();
|
|
57
|
+
this.el.addEventListener('dismissed', onNativeDismissed);
|
|
58
|
+
inject(DestroyRef).onDestroy(() => this.el.removeEventListener('dismissed', onNativeDismissed));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-progress` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-progress.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, ElementRef, effect, input } from '@angular/core';
|
|
6
|
+
import type { KsBaseSize, KsBaseVariant } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/** DOM shape of the real `<ks-progress>` custom element, typed for the wrapper. */
|
|
9
|
+
type KsProgressElement = HTMLElement & {
|
|
10
|
+
value: number;
|
|
11
|
+
max: number;
|
|
12
|
+
showLabel: boolean;
|
|
13
|
+
variant: KsBaseVariant;
|
|
14
|
+
size: KsBaseSize;
|
|
15
|
+
indeterminate: boolean;
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Angular wrapper around the `<ks-progress>` Stencil custom element.
|
|
21
|
+
* Purely presentational — no events, no `<slot>` in the wrapped Stencil
|
|
22
|
+
* render, plain inputs only.
|
|
23
|
+
*/
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'ks-progress',
|
|
26
|
+
standalone: true,
|
|
27
|
+
template: '',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
})
|
|
30
|
+
export class KsProgressComponent {
|
|
31
|
+
private readonly el: KsProgressElement;
|
|
32
|
+
|
|
33
|
+
/** Progress value (0-100) */
|
|
34
|
+
readonly value = input(0);
|
|
35
|
+
|
|
36
|
+
/** Maximum value */
|
|
37
|
+
readonly max = input(100);
|
|
38
|
+
|
|
39
|
+
/** Show percentage label */
|
|
40
|
+
readonly showLabel = input(false);
|
|
41
|
+
|
|
42
|
+
/** Progress variant */
|
|
43
|
+
readonly variant = input<KsBaseVariant>('brand');
|
|
44
|
+
|
|
45
|
+
/** Progress size */
|
|
46
|
+
readonly size = input<KsBaseSize>('md');
|
|
47
|
+
|
|
48
|
+
/** Indeterminate/loading state */
|
|
49
|
+
readonly indeterminate = input(false);
|
|
50
|
+
|
|
51
|
+
/** Optional label text */
|
|
52
|
+
readonly label = input('');
|
|
53
|
+
|
|
54
|
+
constructor(ref: ElementRef<KsProgressElement>) {
|
|
55
|
+
this.el = ref.nativeElement;
|
|
56
|
+
|
|
57
|
+
effect(() => (this.el.value = this.value()));
|
|
58
|
+
effect(() => (this.el.max = this.max()));
|
|
59
|
+
effect(() => (this.el.showLabel = this.showLabel()));
|
|
60
|
+
effect(() => (this.el.variant = this.variant()));
|
|
61
|
+
effect(() => (this.el.size = this.size()));
|
|
62
|
+
effect(() => (this.el.indeterminate = this.indeterminate()));
|
|
63
|
+
effect(() => (this.el.label = this.label()));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-spinner` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-spinner.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, ElementRef, effect, input } from '@angular/core';
|
|
6
|
+
import type { KsBaseVariant, KsSize } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/** DOM shape of the real `<ks-spinner>` custom element, typed for the wrapper. */
|
|
9
|
+
type KsSpinnerElement = HTMLElement & {
|
|
10
|
+
size: KsSize;
|
|
11
|
+
variant: KsBaseVariant;
|
|
12
|
+
text: string;
|
|
13
|
+
centered: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Angular wrapper around the `<ks-spinner>` Stencil custom element.
|
|
18
|
+
* Purely presentational — no events, no `<slot>` in the wrapped Stencil
|
|
19
|
+
* render, plain inputs only.
|
|
20
|
+
*/
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'ks-spinner',
|
|
23
|
+
standalone: true,
|
|
24
|
+
template: '',
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
})
|
|
27
|
+
export class KsSpinnerComponent {
|
|
28
|
+
private readonly el: KsSpinnerElement;
|
|
29
|
+
|
|
30
|
+
/** Spinner size */
|
|
31
|
+
readonly size = input<KsSize>('md');
|
|
32
|
+
|
|
33
|
+
/** Spinner variant/color */
|
|
34
|
+
readonly variant = input<KsBaseVariant>('brand');
|
|
35
|
+
|
|
36
|
+
/** Optional text to display */
|
|
37
|
+
readonly text = input('');
|
|
38
|
+
|
|
39
|
+
/** Center the spinner in container */
|
|
40
|
+
readonly centered = input(false);
|
|
41
|
+
|
|
42
|
+
constructor(ref: ElementRef<KsSpinnerElement>) {
|
|
43
|
+
this.el = ref.nativeElement;
|
|
44
|
+
|
|
45
|
+
effect(() => (this.el.size = this.size()));
|
|
46
|
+
effect(() => (this.el.variant = this.variant()));
|
|
47
|
+
effect(() => (this.el.text = this.text()));
|
|
48
|
+
effect(() => (this.el.centered = this.centered()));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Side-effect import: registers the `ks-toast-outlet` tag — see
|
|
2
|
+
// `Buttons/button/button.ts` for the full explanation of this pattern.
|
|
3
|
+
import '@kraft.stitch/core/dist/components/ks-toast-outlet.js';
|
|
4
|
+
|
|
5
|
+
import { ChangeDetectionStrategy, Component, ElementRef, effect, input } from '@angular/core';
|
|
6
|
+
import type { KsToastPosition } from '@kraft.stitch/core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Re-exported so Angular consumers don't need a separate `@kraft.stitch/core`
|
|
10
|
+
* import for the imperative side of the toast system. `toastStore` is a
|
|
11
|
+
* plain module-level singleton (see `core/src/utils/ks-toast.store.ts`)
|
|
12
|
+
* — there's no DI/service wrapper needed; call
|
|
13
|
+
* `toastStore.show('Saved!', { variant: 'success' })` directly from any
|
|
14
|
+
* component or service, and any mounted `<ks-toast>` (`KsToastComponent`)
|
|
15
|
+
* on the page will pick it up via its internal subscription.
|
|
16
|
+
*/
|
|
17
|
+
export { toastStore } from '@kraft.stitch/core';
|
|
18
|
+
export type { KsToast, KsToastPosition } from '@kraft.stitch/core';
|
|
19
|
+
|
|
20
|
+
/** DOM shape of the real `<ks-toast-outlet>` custom element, typed for the wrapper. */
|
|
21
|
+
type KsToastOutletElement = HTMLElement & {
|
|
22
|
+
position: KsToastPosition;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Angular wrapper around the `<ks-toast-outlet>` Stencil custom element.
|
|
27
|
+
* Named `KsToastOutletComponent` (matching the literal tag, not just
|
|
28
|
+
* `KsToastComponent`) for consistency with the React wrapper, which must
|
|
29
|
+
* avoid colliding with the re-exported `KsToast` *data* interface above
|
|
30
|
+
* (TypeScript disallows a value and a type export sharing one identifier
|
|
31
|
+
* from the same module) — see `react/src/components/Notification/toast/toast.tsx`.
|
|
32
|
+
* `<ks-toast-outlet position="top-right" />` is all a consumer needs; add
|
|
33
|
+
* one per screen corner they want to stack toasts in.
|
|
34
|
+
*
|
|
35
|
+
* No `<slot>`, no events — it purely subscribes to the shared
|
|
36
|
+
* `toastStore` singleton (re-exported above) and renders whatever's
|
|
37
|
+
* enqueued.
|
|
38
|
+
*/
|
|
39
|
+
@Component({
|
|
40
|
+
selector: 'ks-toast-outlet',
|
|
41
|
+
standalone: true,
|
|
42
|
+
template: '',
|
|
43
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
|
+
})
|
|
45
|
+
export class KsToastOutletComponent {
|
|
46
|
+
private readonly el: KsToastOutletElement;
|
|
47
|
+
|
|
48
|
+
/** Where on screen to stack toasts */
|
|
49
|
+
readonly position = input<KsToastPosition>('top-right');
|
|
50
|
+
|
|
51
|
+
constructor(ref: ElementRef<KsToastOutletElement>) {
|
|
52
|
+
this.el = ref.nativeElement;
|
|
53
|
+
|
|
54
|
+
effect(() => (this.el.position = this.position()));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API surface of `@ks/wc-angular`.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* ================= Buttons ================= */
|
|
6
|
+
export * from './lib/Buttons/button/button';
|
|
7
|
+
export * from './lib/Buttons/button-group/button-group';
|
|
8
|
+
export * from './lib/Buttons/chips/chips';
|
|
9
|
+
export * from './lib/Buttons/fab/fab';
|
|
10
|
+
|
|
11
|
+
/* ================= Calendars ================= */
|
|
12
|
+
export * from './lib/Calendars/datepicker/datepicker';
|
|
13
|
+
export * from './lib/Calendars/daterange/daterange';
|
|
14
|
+
export * from './lib/Calendars/timepicker/timepicker';
|
|
15
|
+
|
|
16
|
+
/* ================= Dropdowns ================= */
|
|
17
|
+
export * from './lib/Dropdowns/dropdown/dropdown';
|
|
18
|
+
export * from './lib/Dropdowns/listbox/listbox';
|
|
19
|
+
|
|
20
|
+
/* ================= Inputs ================= */
|
|
21
|
+
export * from './lib/Inputs/checkbox/checkbox';
|
|
22
|
+
export * from './lib/Inputs/colour-picker/colour-picker';
|
|
23
|
+
export * from './lib/Inputs/input/input';
|
|
24
|
+
export * from './lib/Inputs/otp-input/otp-input';
|
|
25
|
+
export * from './lib/Inputs/radio/radio';
|
|
26
|
+
export * from './lib/Inputs/rating/rating';
|
|
27
|
+
export * from './lib/Inputs/slider/slider';
|
|
28
|
+
export * from './lib/Inputs/switch/switch';
|
|
29
|
+
export * from './lib/Inputs/textarea/textarea';
|
|
30
|
+
export * from './lib/Inputs/theme-switch/theme-switch';
|
|
31
|
+
export * from './lib/Inputs/uploader/uploader';
|
|
32
|
+
|
|
33
|
+
/* ================= Layout ================= */
|
|
34
|
+
export * from './lib/Layout/avatar/avatar';
|
|
35
|
+
export * from './lib/Layout/card/card';
|
|
36
|
+
export * from './lib/Layout/code-view/code-view';
|
|
37
|
+
export * from './lib/Layout/dialog/dialog';
|
|
38
|
+
export * from './lib/Layout/not-found/not-found';
|
|
39
|
+
export * from './lib/Layout/sidebar/sidebar';
|
|
40
|
+
export * from './lib/Layout/table/table';
|
|
41
|
+
export * from './lib/Layout/tooltip/tooltip';
|
|
42
|
+
|
|
43
|
+
/* ================= Navigation ================= */
|
|
44
|
+
export * from './lib/Navigation/accordion/accordion';
|
|
45
|
+
export * from './lib/Navigation/breadcrumb/breadcrumb';
|
|
46
|
+
export * from './lib/Navigation/carousel/carousel';
|
|
47
|
+
export * from './lib/Navigation/context-menu/context-menu';
|
|
48
|
+
export * from './lib/Navigation/nav-bar/nav-bar';
|
|
49
|
+
export * from './lib/Navigation/pagination/pagination';
|
|
50
|
+
export * from './lib/Navigation/stepper/stepper';
|
|
51
|
+
export * from './lib/Navigation/tab/tab';
|
|
52
|
+
export * from './lib/Navigation/toolbar/toolbar';
|
|
53
|
+
export * from './lib/Navigation/top-nav-bar/top-nav-bar';
|
|
54
|
+
export * from './lib/Navigation/tree-view/tree-view';
|
|
55
|
+
|
|
56
|
+
/* ================= Notification ================= */
|
|
57
|
+
export * from './lib/Notification/badge/badge';
|
|
58
|
+
export * from './lib/Notification/loader/loader';
|
|
59
|
+
export * from './lib/Notification/message/message';
|
|
60
|
+
export * from './lib/Notification/progress/progress';
|
|
61
|
+
export * from './lib/Notification/spinner/spinner';
|
|
62
|
+
export * from './lib/Notification/toast/toast';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "es2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"dom",
|
|
8
|
+
"es2022"
|
|
9
|
+
],
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"useDefineForClassFields": false
|
|
15
|
+
},
|
|
16
|
+
"angularCompilerOptions": {
|
|
17
|
+
"enableIvy": true,
|
|
18
|
+
"strictTemplates": true
|
|
19
|
+
},
|
|
20
|
+
"exclude": [
|
|
21
|
+
"node_modules"
|
|
22
|
+
]
|
|
23
|
+
}
|