@ks-digital/designsystem-angular 0.0.1-alpha.5 → 0.0.1-alpha.51
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/README.md +23 -11
- package/__internals/README.md +3 -0
- package/alert/README.md +3 -0
- package/breadcrumbs/README.md +3 -0
- package/button/README.md +3 -0
- package/card/README.md +3 -0
- package/details/README.md +3 -0
- package/error-summary/README.md +3 -0
- package/fesm2022/ks-digital-designsystem-angular-__internals.mjs +82 -0
- package/fesm2022/ks-digital-designsystem-angular-__internals.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-alert.mjs +34 -0
- package/fesm2022/ks-digital-designsystem-angular-alert.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs +59 -0
- package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-button.mjs +72 -0
- package/fesm2022/ks-digital-designsystem-angular-button.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-card.mjs +86 -0
- package/fesm2022/ks-digital-designsystem-angular-card.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-chip.mjs +43 -0
- package/fesm2022/ks-digital-designsystem-angular-chip.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-details.mjs +64 -0
- package/fesm2022/ks-digital-designsystem-angular-details.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs +49 -0
- package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-forms.mjs +209 -0
- package/fesm2022/ks-digital-designsystem-angular-forms.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-heading.mjs +40 -0
- package/fesm2022/ks-digital-designsystem-angular-heading.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-link.mjs +31 -0
- package/fesm2022/ks-digital-designsystem-angular-link.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-pagination.mjs +143 -0
- package/fesm2022/ks-digital-designsystem-angular-pagination.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs +25 -0
- package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-popover.mjs +46 -0
- package/fesm2022/ks-digital-designsystem-angular-popover.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-search.mjs +183 -0
- package/fesm2022/ks-digital-designsystem-angular-search.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-spinner.mjs +87 -0
- package/fesm2022/ks-digital-designsystem-angular-spinner.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs +281 -0
- package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-table.mjs +105 -0
- package/fesm2022/ks-digital-designsystem-angular-table.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-tabs.mjs +130 -0
- package/fesm2022/ks-digital-designsystem-angular-tabs.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-tag.mjs +38 -0
- package/fesm2022/ks-digital-designsystem-angular-tag.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs +25 -0
- package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs.map +1 -0
- package/fesm2022/ks-digital-designsystem-angular.mjs +7 -0
- package/fesm2022/ks-digital-designsystem-angular.mjs.map +1 -0
- package/forms/README.md +3 -0
- package/heading/README.md +3 -0
- package/link/README.md +3 -0
- package/package.json +101 -31
- package/pagination/README.md +3 -0
- package/paragraph/README.md +3 -0
- package/popover/README.md +3 -0
- package/search/README.md +3 -0
- package/spinner/README.md +3 -0
- package/suggestion/README.md +3 -0
- package/table/README.md +3 -0
- package/tabs/README.md +3 -0
- package/tag/README.md +3 -0
- package/types/ks-digital-designsystem-angular-__internals.d.ts +51 -0
- package/types/ks-digital-designsystem-angular-alert.d.ts +12 -0
- package/types/ks-digital-designsystem-angular-breadcrumbs.d.ts +13 -0
- package/types/ks-digital-designsystem-angular-button.d.ts +30 -0
- package/types/ks-digital-designsystem-angular-card.d.ts +24 -0
- package/types/ks-digital-designsystem-angular-chip.d.ts +15 -0
- package/types/ks-digital-designsystem-angular-details.d.ts +20 -0
- package/types/ks-digital-designsystem-angular-error-summary.d.ts +14 -0
- package/types/ks-digital-designsystem-angular-forms.d.ts +71 -0
- package/types/ks-digital-designsystem-angular-heading.d.ts +19 -0
- package/types/ks-digital-designsystem-angular-link.d.ts +9 -0
- package/types/ks-digital-designsystem-angular-pagination.d.ts +58 -0
- package/types/ks-digital-designsystem-angular-paragraph.d.ts +8 -0
- package/types/ks-digital-designsystem-angular-popover.d.ts +13 -0
- package/types/ks-digital-designsystem-angular-search.d.ts +84 -0
- package/types/ks-digital-designsystem-angular-spinner.d.ts +22 -0
- package/types/ks-digital-designsystem-angular-suggestion.d.ts +97 -0
- package/types/ks-digital-designsystem-angular-table.d.ts +43 -0
- package/types/ks-digital-designsystem-angular-tabs.d.ts +37 -0
- package/types/ks-digital-designsystem-angular-tag.d.ts +15 -0
- package/types/ks-digital-designsystem-angular-validation-message.d.ts +8 -0
- package/types/ks-digital-designsystem-angular.d.ts +2 -0
- package/validation-message/README.md +3 -0
- package/dist/README.md +0 -43
- package/dist/components/checkbox/checkbox.d.ts +0 -4
- package/dist/components/checkbox/checkbox.d.ts.map +0 -1
- package/dist/components/checkbox/index.d.ts +0 -2
- package/dist/components/checkbox/index.d.ts.map +0 -1
- package/dist/components/colors.d.ts +0 -27
- package/dist/components/colors.d.ts.map +0 -1
- package/dist/components/common-inputs.d.ts +0 -15
- package/dist/components/common-inputs.d.ts.map +0 -1
- package/dist/components/field/field.d.ts +0 -15
- package/dist/components/field/field.d.ts.map +0 -1
- package/dist/components/field/index.d.ts +0 -2
- package/dist/components/field/index.d.ts.map +0 -1
- package/dist/components/fieldset/fieldset-description.d.ts +0 -3
- package/dist/components/fieldset/fieldset-description.d.ts.map +0 -1
- package/dist/components/fieldset/fieldset-legend.d.ts +0 -3
- package/dist/components/fieldset/fieldset-legend.d.ts.map +0 -1
- package/dist/components/fieldset/fieldset.d.ts +0 -3
- package/dist/components/fieldset/fieldset.d.ts.map +0 -1
- package/dist/components/fieldset/index.d.ts +0 -4
- package/dist/components/fieldset/index.d.ts.map +0 -1
- package/dist/components/label/index.d.ts +0 -2
- package/dist/components/label/index.d.ts.map +0 -1
- package/dist/components/label/label.d.ts +0 -4
- package/dist/components/label/label.d.ts.map +0 -1
- package/dist/components/paragraph/index.d.ts +0 -2
- package/dist/components/paragraph/index.d.ts.map +0 -1
- package/dist/components/paragraph/paragraph.d.ts +0 -3
- package/dist/components/paragraph/paragraph.d.ts.map +0 -1
- package/dist/components/validation-message/index.d.ts +0 -2
- package/dist/components/validation-message/index.d.ts.map +0 -1
- package/dist/components/validation-message/validation-message.d.ts +0 -3
- package/dist/components/validation-message/validation-message.d.ts.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1
- package/dist/package.json +0 -48
- package/dist/utils/random-id.d.ts +0 -2
- package/dist/utils/random-id.d.ts.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, Directive } from '@angular/core';
|
|
3
|
+
import '@digdir/designsystemet-web';
|
|
4
|
+
import * as i1 from '@ks-digital/designsystem-angular/__internals';
|
|
5
|
+
import { HostSize, HostColor } from '@ks-digital/designsystem-angular/__internals';
|
|
6
|
+
|
|
7
|
+
class Popover {
|
|
8
|
+
autoPlacement = input(true, { ...(ngDevMode ? { debugName: "autoPlacement" } : {}), transform: booleanAttribute });
|
|
9
|
+
variant = input('default', { ...(ngDevMode ? { debugName: "variant" } : {}), alias: 'data-variant' });
|
|
10
|
+
// Todo: replace with centralized types
|
|
11
|
+
placement = input('top', { ...(ngDevMode ? { debugName: "placement" } : {}), alias: 'data-placement' });
|
|
12
|
+
popover = input('auto', { ...(ngDevMode ? { debugName: "popover" } : {}), alias: 'popover' });
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
14
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: Popover, isStandalone: true, selector: "[ksd-popover]", inputs: { autoPlacement: { classPropertyName: "autoPlacement", publicName: "autoPlacement", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "data-variant", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "data-placement", isSignal: true, isRequired: false, transformFunction: null }, popover: { classPropertyName: "popover", publicName: "popover", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-variant": "variant()", "attr.data-placement": "placement()", "attr.data-autoplacement": "autoPlacement()", "attr.popover": "popover()" }, classAttribute: "ds-popover" }, hostDirectives: [{ directive: i1.HostSize, inputs: ["data-size", "data-size"] }, { directive: i1.HostColor, inputs: ["data-color", "data-color"] }], ngImport: i0 });
|
|
15
|
+
}
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Popover, decorators: [{
|
|
17
|
+
type: Directive,
|
|
18
|
+
args: [{
|
|
19
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
20
|
+
selector: '[ksd-popover]',
|
|
21
|
+
hostDirectives: [
|
|
22
|
+
{
|
|
23
|
+
directive: HostSize,
|
|
24
|
+
inputs: ['data-size'],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
directive: HostColor,
|
|
28
|
+
inputs: ['data-color'],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
host: {
|
|
32
|
+
class: 'ds-popover',
|
|
33
|
+
'[attr.data-variant]': 'variant()',
|
|
34
|
+
'[attr.data-placement]': 'placement()',
|
|
35
|
+
'[attr.data-autoplacement]': 'autoPlacement()',
|
|
36
|
+
'[attr.popover]': 'popover()',
|
|
37
|
+
},
|
|
38
|
+
}]
|
|
39
|
+
}], propDecorators: { autoPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoPlacement", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "data-variant", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "data-placement", required: false }] }], popover: [{ type: i0.Input, args: [{ isSignal: true, alias: "popover", required: false }] }] } });
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generated bundle index. Do not edit.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export { Popover };
|
|
46
|
+
//# sourceMappingURL=ks-digital-designsystem-angular-popover.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-digital-designsystem-angular-popover.mjs","sources":["../../../../packages/angular/popover/src/popover.ts","../../../../packages/angular/popover/src/ks-digital-designsystem-angular-popover.ts"],"sourcesContent":["import { booleanAttribute, Directive, input } from '@angular/core'\nimport '@digdir/designsystemet-web'\nimport {\n HostColor,\n HostSize,\n} from '@ks-digital/designsystem-angular/__internals'\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[ksd-popover]',\n hostDirectives: [\n {\n directive: HostSize,\n inputs: ['data-size'],\n },\n {\n directive: HostColor,\n inputs: ['data-color'],\n },\n ],\n host: {\n class: 'ds-popover',\n '[attr.data-variant]': 'variant()',\n '[attr.data-placement]': 'placement()',\n '[attr.data-autoplacement]': 'autoPlacement()',\n '[attr.popover]': 'popover()',\n },\n})\nexport class Popover {\n readonly autoPlacement = input(true, { transform: booleanAttribute })\n readonly variant = input<'tinted' | 'default'>('default', {\n alias: 'data-variant',\n })\n\n // Todo: replace with centralized types\n readonly placement = input<\n | 'bottom'\n | 'bottom-end'\n | 'bottom-start'\n | 'left'\n | 'left-end'\n | 'left-start'\n | 'right'\n | 'right-end'\n | 'right-start'\n | 'top'\n | 'top-end'\n | 'top-start'\n >('top', { alias: 'data-placement' })\n\n readonly popover = input<'auto' | 'manual'>('auto', { alias: 'popover' })\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MA4Ba,OAAO,CAAA;IACT,aAAa,GAAG,KAAK,CAAC,IAAI,0DAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC5D,OAAO,GAAG,KAAK,CAAuB,SAAS,oDACtD,KAAK,EAAE,cAAc,EAAA,CACrB;;IAGO,SAAS,GAAG,KAAK,CAaxB,KAAK,sDAAI,KAAK,EAAE,gBAAgB,EAAA,CAAG;IAE5B,OAAO,GAAG,KAAK,CAAoB,MAAM,oDAAI,KAAK,EAAE,SAAS,EAAA,CAAG;uGAtB9D,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,aAAA,EAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,UAAA,EAAA,eAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,cAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAA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, Component, input, output } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ks-digital/designsystem-angular/__internals';
|
|
4
|
+
import { logIfDevMode, HostSize, HostColor } from '@ks-digital/designsystem-angular/__internals';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Search input
|
|
8
|
+
*
|
|
9
|
+
* Used within Search to provide a search input.
|
|
10
|
+
*/
|
|
11
|
+
class SearchInput {
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
13
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: SearchInput, isStandalone: true, selector: "input[ksd-search-input]", host: { attributes: { "type": "search", "placeholder": "" }, classAttribute: "ds-input" }, ngImport: i0 });
|
|
14
|
+
}
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchInput, decorators: [{
|
|
16
|
+
type: Directive,
|
|
17
|
+
args: [{
|
|
18
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
19
|
+
selector: 'input[ksd-search-input]',
|
|
20
|
+
host: {
|
|
21
|
+
class: 'ds-input',
|
|
22
|
+
type: 'search',
|
|
23
|
+
placeholder: '', // Need empty placeholder to enable show/hide for clear button
|
|
24
|
+
},
|
|
25
|
+
}]
|
|
26
|
+
}] });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Search Component
|
|
30
|
+
*
|
|
31
|
+
* Use to contain the search input and buttons.
|
|
32
|
+
* Only `SearchInput` is required, while `SearchClear` and `SearchButton` are optional.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <div ksd-search>
|
|
36
|
+
* <input ksd-search-input />
|
|
37
|
+
* <button ksd-search-clear></button>
|
|
38
|
+
* <button ksd-search-button></button>
|
|
39
|
+
* </div>
|
|
40
|
+
*/
|
|
41
|
+
class Search {
|
|
42
|
+
input = contentChild(SearchInput, ...(ngDevMode ? [{ debugName: "input" }] : []));
|
|
43
|
+
constructor() {
|
|
44
|
+
afterNextRender(() => {
|
|
45
|
+
if (!this.input()) {
|
|
46
|
+
logIfDevMode({
|
|
47
|
+
component: 'Search',
|
|
48
|
+
message: 'Missing required elements: ksd-search-input must be provided as child. Check imports and markup.',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Search, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: Search, isStandalone: true, selector: "ksd-search", host: { classAttribute: "ds-search" }, queries: [{ propertyName: "input", first: true, predicate: SearchInput, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.HostSize, inputs: ["data-size", "data-size"] }, { directive: i1.HostColor, inputs: ["data-color", "data-color"] }], ngImport: i0, template: `
|
|
55
|
+
<ng-content select="[ksd-search-input]" />
|
|
56
|
+
<ng-content select="[ksd-search-clear]" />
|
|
57
|
+
<ng-content select="[ksd-search-button]" />
|
|
58
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Search, decorators: [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{
|
|
63
|
+
selector: 'ksd-search',
|
|
64
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
65
|
+
template: `
|
|
66
|
+
<ng-content select="[ksd-search-input]" />
|
|
67
|
+
<ng-content select="[ksd-search-clear]" />
|
|
68
|
+
<ng-content select="[ksd-search-button]" />
|
|
69
|
+
`,
|
|
70
|
+
host: {
|
|
71
|
+
class: 'ds-search',
|
|
72
|
+
},
|
|
73
|
+
hostDirectives: [
|
|
74
|
+
{
|
|
75
|
+
directive: HostSize,
|
|
76
|
+
inputs: ['data-size'],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
directive: HostColor,
|
|
80
|
+
inputs: ['data-color'],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
}]
|
|
84
|
+
}], ctorParameters: () => [], propDecorators: { input: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SearchInput), { isSignal: true }] }] } });
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Search button
|
|
88
|
+
*
|
|
89
|
+
* Used within Search to provide a submit button.
|
|
90
|
+
*
|
|
91
|
+
* @param {('primary' | 'secondary')} [variant] - Specify which button variant to use
|
|
92
|
+
* @param {string} [aria-label] - Aria label for the button
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
class SearchButton {
|
|
96
|
+
/**
|
|
97
|
+
* Specify which button variant to use
|
|
98
|
+
*
|
|
99
|
+
* @default 'primary'
|
|
100
|
+
*/
|
|
101
|
+
variant = input('primary', ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
102
|
+
/**
|
|
103
|
+
* Aria label for the button
|
|
104
|
+
*/
|
|
105
|
+
ariaLabel = input('', { ...(ngDevMode ? { debugName: "ariaLabel" } : {}), alias: 'aria-label' });
|
|
106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
107
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: SearchButton, isStandalone: true, selector: "button[ksd-search-button]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "submit" }, properties: { "attr.aria-label": "this.ariaLabel()", "attr.data-variant": "this.variant()" }, classAttribute: "ds-button" }, ngImport: i0 });
|
|
108
|
+
}
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchButton, decorators: [{
|
|
110
|
+
type: Directive,
|
|
111
|
+
args: [{
|
|
112
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
113
|
+
selector: 'button[ksd-search-button]',
|
|
114
|
+
host: {
|
|
115
|
+
class: 'ds-button',
|
|
116
|
+
type: 'submit',
|
|
117
|
+
'[attr.aria-label]': 'this.ariaLabel()',
|
|
118
|
+
'[attr.data-variant]': 'this.variant()',
|
|
119
|
+
},
|
|
120
|
+
}]
|
|
121
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Search clear button
|
|
125
|
+
*
|
|
126
|
+
* Used within Search to provide a clear button.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} [aria-label] - Aria label for the button.
|
|
129
|
+
*
|
|
130
|
+
* @event clearInput - Emitted when the clear button is clicked.
|
|
131
|
+
* Use this to notify controlled forms that the input should be cleared.
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
class SearchClear {
|
|
135
|
+
/**
|
|
136
|
+
* Aria label for the button
|
|
137
|
+
* @default 'Tøm'
|
|
138
|
+
*/
|
|
139
|
+
ariaLabel = input('Tøm', { ...(ngDevMode ? { debugName: "ariaLabel" } : {}), alias: 'aria-label' });
|
|
140
|
+
/**
|
|
141
|
+
* Output to notify controlled forms that input should be cleared
|
|
142
|
+
*/
|
|
143
|
+
clearInput = output();
|
|
144
|
+
handleClear(e) {
|
|
145
|
+
const target = e.target;
|
|
146
|
+
let inputElement = null;
|
|
147
|
+
if (target instanceof HTMLElement) {
|
|
148
|
+
inputElement = target.closest('.ds-search')?.querySelector('input');
|
|
149
|
+
}
|
|
150
|
+
if (!inputElement)
|
|
151
|
+
throw new Error('Input is missing');
|
|
152
|
+
if (!(inputElement instanceof HTMLInputElement)) {
|
|
153
|
+
throw new Error('Input is not an input element');
|
|
154
|
+
}
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
inputElement.value = '';
|
|
157
|
+
this.clearInput.emit();
|
|
158
|
+
inputElement.focus();
|
|
159
|
+
}
|
|
160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchClear, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
161
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: SearchClear, isStandalone: true, selector: "button[ksd-search-clear]", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clearInput: "clearInput" }, host: { attributes: { "type": "reset" }, listeners: { "click": "handleClear($event)" }, properties: { "attr.data-variant": "'tertiary'", "attr.aria-label": "this.ariaLabel()" }, classAttribute: "ds-button" }, ngImport: i0 });
|
|
162
|
+
}
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SearchClear, decorators: [{
|
|
164
|
+
type: Directive,
|
|
165
|
+
args: [{
|
|
166
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
167
|
+
selector: 'button[ksd-search-clear]',
|
|
168
|
+
host: {
|
|
169
|
+
class: 'ds-button',
|
|
170
|
+
type: 'reset',
|
|
171
|
+
'[attr.data-variant]': "'tertiary'",
|
|
172
|
+
'[attr.aria-label]': 'this.ariaLabel()',
|
|
173
|
+
'(click)': 'handleClear($event)',
|
|
174
|
+
},
|
|
175
|
+
}]
|
|
176
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], clearInput: [{ type: i0.Output, args: ["clearInput"] }] } });
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Generated bundle index. Do not edit.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
export { Search, SearchButton, SearchClear, SearchInput };
|
|
183
|
+
//# sourceMappingURL=ks-digital-designsystem-angular-search.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-digital-designsystem-angular-search.mjs","sources":["../../../../packages/angular/search/src/search-input.ts","../../../../packages/angular/search/src/search.ts","../../../../packages/angular/search/src/search-button.ts","../../../../packages/angular/search/src/search-clear.ts","../../../../packages/angular/search/src/ks-digital-designsystem-angular-search.ts"],"sourcesContent":["import { Directive } from '@angular/core'\n\n/**\n * Search input\n *\n * Used within Search to provide a search input.\n */\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'input[ksd-search-input]',\n host: {\n class: 'ds-input',\n type: 'search',\n placeholder: '', // Need empty placeholder to enable show/hide for clear button\n },\n})\nexport class SearchInput {}\n","import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n contentChild,\n} from '@angular/core'\nimport {\n HostColor,\n HostSize,\n logIfDevMode,\n} from '@ks-digital/designsystem-angular/__internals'\nimport { SearchInput } from './search-input'\n\n/**\n * Search Component\n *\n * Use to contain the search input and buttons.\n * Only `SearchInput` is required, while `SearchClear` and `SearchButton` are optional.\n *\n * @example\n * <div ksd-search>\n * <input ksd-search-input />\n * <button ksd-search-clear></button>\n * <button ksd-search-button></button>\n * </div>\n */\n@Component({\n selector: 'ksd-search',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <ng-content select=\"[ksd-search-input]\" />\n <ng-content select=\"[ksd-search-clear]\" />\n <ng-content select=\"[ksd-search-button]\" />\n `,\n host: {\n class: 'ds-search',\n },\n hostDirectives: [\n {\n directive: HostSize,\n inputs: ['data-size'],\n },\n {\n directive: HostColor,\n inputs: ['data-color'],\n },\n ],\n})\nexport class Search {\n private readonly input = contentChild(SearchInput)\n\n constructor() {\n afterNextRender(() => {\n if (!this.input()) {\n logIfDevMode({\n component: 'Search',\n message:\n 'Missing required elements: ksd-search-input must be provided as child. Check imports and markup.',\n })\n }\n })\n }\n}\n","import { Directive, input } from '@angular/core'\n\n/**\n * Search button\n *\n * Used within Search to provide a submit button.\n *\n * @param {('primary' | 'secondary')} [variant] - Specify which button variant to use\n * @param {string} [aria-label] - Aria label for the button\n *\n */\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'button[ksd-search-button]',\n host: {\n class: 'ds-button',\n type: 'submit',\n '[attr.aria-label]': 'this.ariaLabel()',\n '[attr.data-variant]': 'this.variant()',\n },\n})\nexport class SearchButton {\n /**\n * Specify which button variant to use\n *\n * @default 'primary'\n */\n readonly variant = input<'primary' | 'secondary'>('primary')\n\n /**\n * Aria label for the button\n */\n readonly ariaLabel = input('', { alias: 'aria-label' })\n}\n","import { Directive, input, output } from '@angular/core'\n\n/**\n * Search clear button\n *\n * Used within Search to provide a clear button.\n *\n * @param {string} [aria-label] - Aria label for the button.\n *\n * @event clearInput - Emitted when the clear button is clicked.\n * Use this to notify controlled forms that the input should be cleared.\n *\n */\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'button[ksd-search-clear]',\n host: {\n class: 'ds-button',\n type: 'reset',\n '[attr.data-variant]': \"'tertiary'\",\n '[attr.aria-label]': 'this.ariaLabel()',\n '(click)': 'handleClear($event)',\n },\n})\nexport class SearchClear {\n /**\n * Aria label for the button\n * @default 'Tøm'\n */\n readonly ariaLabel = input('Tøm', { alias: 'aria-label' })\n\n /**\n * Output to notify controlled forms that input should be cleared\n */\n clearInput = output<void>()\n\n handleClear(e: Event): void {\n const target = e.target as HTMLButtonElement\n let inputElement: HTMLElement | null | undefined = null\n\n if (target instanceof HTMLElement) {\n inputElement = target.closest('.ds-search')?.querySelector('input')\n }\n\n if (!inputElement) throw new Error('Input is missing')\n\n if (!(inputElement instanceof HTMLInputElement)) {\n throw new Error('Input is not an input element')\n }\n\n e.preventDefault()\n inputElement.value = ''\n this.clearInput.emit()\n inputElement.focus()\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEA;;;;AAIG;MAUU,WAAW,CAAA;uGAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAX,WAAW,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,aAAA,EAAA,EAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBATvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;AAET,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,UAAU;AACjB,wBAAA,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,EAAE;AAChB,qBAAA;AACF,iBAAA;;;ACFD;;;;;;;;;;;;AAYG;MAuBU,MAAM,CAAA;AACA,IAAA,KAAK,GAAG,YAAY,CAAC,WAAW,iDAAC;AAElD,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;AACnB,YAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE;AACjB,gBAAA,YAAY,CAAC;AACX,oBAAA,SAAS,EAAE,QAAQ;AACnB,oBAAA,OAAO,EACL,kGAAkG;AACrG,iBAAA,CAAC;YACJ;AACF,QAAA,CAAC,CAAC;IACJ;uGAbW,MAAM,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAN,MAAM,EAAA,YAAA,EAAA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,mBAAA,EAAA,YAAA,EAAA,iBAAA,EAAA,kBAAA,EAAA,EAAA,cAAA,EAAA,WAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAXvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;AAET,oBAAA,QAAQ,EAAE,0BAA0B;AACpC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,WAAW;AAClB,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,qBAAqB,EAAE,YAAY;AACnC,wBAAA,mBAAmB,EAAE,kBAAkB;AACvC,wBAAA,SAAS,EAAE,qBAAqB;AACjC,qBAAA;AACF,iBAAA;;;ACvBD;;AAEG;;;;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ks-digital/designsystem-angular/__internals';
|
|
4
|
+
import { HostColor } from '@ks-digital/designsystem-angular/__internals';
|
|
5
|
+
|
|
6
|
+
class Spinner {
|
|
7
|
+
/**
|
|
8
|
+
* Aria-label for the spinner
|
|
9
|
+
*/
|
|
10
|
+
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : {}), alias: 'aria-label' });
|
|
11
|
+
/**
|
|
12
|
+
* Aria-hidden for the spinner
|
|
13
|
+
*/
|
|
14
|
+
ariaHidden = input(undefined, { ...(ngDevMode ? { debugName: "ariaHidden" } : {}), transform: booleanAttribute,
|
|
15
|
+
alias: 'aria-hidden' });
|
|
16
|
+
/**
|
|
17
|
+
* Changes size for descendant Designsystemet components. Select from predefined sizes.
|
|
18
|
+
* @attribute data-size
|
|
19
|
+
*/
|
|
20
|
+
dataSize = input(undefined, { ...(ngDevMode ? { debugName: "dataSize" } : {}), alias: 'data-size' });
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Spinner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: Spinner, isStandalone: true, selector: "ksd-spinner", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaHidden: { classPropertyName: "ariaHidden", publicName: "aria-hidden", isSignal: true, isRequired: false, transformFunction: null }, dataSize: { classPropertyName: "dataSize", publicName: "data-size", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.HostColor, inputs: ["data-color", "data-color"] }], ngImport: i0, template: `
|
|
23
|
+
<svg
|
|
24
|
+
class="ds-spinner"
|
|
25
|
+
role="img"
|
|
26
|
+
viewBox="0 0 50 50"
|
|
27
|
+
[attr.data-size]="dataSize()"
|
|
28
|
+
>
|
|
29
|
+
<circle
|
|
30
|
+
class="ds-spinner__background"
|
|
31
|
+
cx="25"
|
|
32
|
+
cy="25"
|
|
33
|
+
r="20"
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke-width="5"
|
|
36
|
+
/>
|
|
37
|
+
<circle
|
|
38
|
+
class="ds-spinner__circle"
|
|
39
|
+
cx="25"
|
|
40
|
+
cy="25"
|
|
41
|
+
r="20"
|
|
42
|
+
fill="none"
|
|
43
|
+
stroke-width="5"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
`, isInline: true, styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
47
|
+
}
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Spinner, decorators: [{
|
|
49
|
+
type: Component,
|
|
50
|
+
args: [{ selector: 'ksd-spinner', changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
51
|
+
<svg
|
|
52
|
+
class="ds-spinner"
|
|
53
|
+
role="img"
|
|
54
|
+
viewBox="0 0 50 50"
|
|
55
|
+
[attr.data-size]="dataSize()"
|
|
56
|
+
>
|
|
57
|
+
<circle
|
|
58
|
+
class="ds-spinner__background"
|
|
59
|
+
cx="25"
|
|
60
|
+
cy="25"
|
|
61
|
+
r="20"
|
|
62
|
+
fill="none"
|
|
63
|
+
stroke-width="5"
|
|
64
|
+
/>
|
|
65
|
+
<circle
|
|
66
|
+
class="ds-spinner__circle"
|
|
67
|
+
cx="25"
|
|
68
|
+
cy="25"
|
|
69
|
+
r="20"
|
|
70
|
+
fill="none"
|
|
71
|
+
stroke-width="5"
|
|
72
|
+
/>
|
|
73
|
+
</svg>
|
|
74
|
+
`, hostDirectives: [
|
|
75
|
+
{
|
|
76
|
+
directive: HostColor,
|
|
77
|
+
inputs: ['data-color'],
|
|
78
|
+
},
|
|
79
|
+
], styles: [":host{display:contents}\n"] }]
|
|
80
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaHidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-hidden", required: false }] }], dataSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "data-size", required: false }] }] } });
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generated bundle index. Do not edit.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
export { Spinner };
|
|
87
|
+
//# sourceMappingURL=ks-digital-designsystem-angular-spinner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-digital-designsystem-angular-spinner.mjs","sources":["../../../../packages/angular/spinner/src/spinner.ts","../../../../packages/angular/spinner/src/ks-digital-designsystem-angular-spinner.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n input,\n} from '@angular/core'\nimport { HostColor } from '@ks-digital/designsystem-angular/__internals'\nimport { SpinnerSize } from './spinner-sizes'\n\n@Component({\n selector: 'ksd-spinner',\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: `\n :host {\n display: contents;\n }\n `,\n template: `\n <svg\n class=\"ds-spinner\"\n role=\"img\"\n viewBox=\"0 0 50 50\"\n [attr.data-size]=\"dataSize()\"\n >\n <circle\n class=\"ds-spinner__background\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n />\n <circle\n class=\"ds-spinner__circle\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n />\n </svg>\n `,\n hostDirectives: [\n {\n directive: HostColor,\n inputs: ['data-color'],\n },\n ],\n})\nexport class Spinner {\n /**\n * Aria-label for the spinner\n */\n readonly ariaLabel = input<string>(undefined, { alias: 'aria-label' })\n\n /**\n * Aria-hidden for the spinner\n */\n readonly ariaHidden = input(undefined, {\n transform: booleanAttribute,\n alias: 'aria-hidden',\n })\n\n /**\n * Changes size for descendant Designsystemet components. Select from predefined sizes.\n * @attribute data-size\n */\n readonly dataSize = input<SpinnerSize>(undefined, {\n alias: 'data-size',\n })\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiDa,OAAO,CAAA;AAClB;;AAEG;IACM,SAAS,GAAG,KAAK,CAAS,SAAS,sDAAI,KAAK,EAAE,YAAY,EAAA,CAAG;AAEtE;;AAEG;AACM,IAAA,UAAU,GAAG,KAAK,CAAC,SAAS,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,YAAA,EAAA,GAAA,EAAA,CAAA,EACnC,SAAS,EAAE,gBAAgB;QAC3B,KAAK,EAAE,aAAa,EAAA,CACpB;AAEF;;;AAGG;IACM,QAAQ,GAAG,KAAK,CAAc,SAAS,qDAC9C,KAAK,EAAE,WAAW,EAAA,CAClB;uGApBS,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAP,IAAA,OAA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E,CAAC,YAAY,CAAC;AACvB,yBAAA;AACF,qBAAA,EAAA,MAAA,EAAA,CAAA,2BAAA,CAAA,EAAA;;;AC/CH;;AAEG;;;;"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { viewChild, ChangeDetectionStrategy, Component, input, CUSTOM_ELEMENTS_SCHEMA, contentChildren, contentChild, booleanAttribute, model, computed, afterNextRender, effect } from '@angular/core';
|
|
3
|
+
import '@digdir/designsystemet-web';
|
|
4
|
+
import * as i1 from '@ks-digital/designsystem-angular/__internals';
|
|
5
|
+
import { HostSize, HostColor } from '@ks-digital/designsystem-angular/__internals';
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class SuggestionListEmpty {
|
|
9
|
+
/**
|
|
10
|
+
* Hack to get the content from parent component so that we can
|
|
11
|
+
* keep the dom structure needed without additional host elements
|
|
12
|
+
*/
|
|
13
|
+
templateRef = viewChild('tpl', ...(ngDevMode ? [{ debugName: "templateRef" }] : []));
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionListEmpty, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: SuggestionListEmpty, isStandalone: true, selector: "ksd-suggestion-list-empty", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["tpl"], descendants: true, isSignal: true }], ngImport: i0, template: ` <ng-template #tpl><ng-content /></ng-template> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionListEmpty, decorators: [{
|
|
18
|
+
type: Component,
|
|
19
|
+
args: [{
|
|
20
|
+
selector: 'ksd-suggestion-list-empty',
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `,
|
|
23
|
+
}]
|
|
24
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }] } });
|
|
25
|
+
|
|
26
|
+
class SuggestionListOption {
|
|
27
|
+
/**
|
|
28
|
+
* Hack to get the content from parent component so that we can
|
|
29
|
+
* keep the dom structure needed without additional host elements
|
|
30
|
+
*/
|
|
31
|
+
templateRef = viewChild('tpl', ...(ngDevMode ? [{ debugName: "templateRef" }] : []));
|
|
32
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionListOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
34
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: SuggestionListOption, isStandalone: true, selector: "ksd-suggestion-list-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["tpl"], descendants: true, isSignal: true }], ngImport: i0, template: ` <ng-template #tpl><ng-content /></ng-template> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionListOption, decorators: [{
|
|
37
|
+
type: Component,
|
|
38
|
+
args: [{
|
|
39
|
+
selector: 'ksd-suggestion-list-option',
|
|
40
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
41
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
42
|
+
imports: [],
|
|
43
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `,
|
|
44
|
+
}]
|
|
45
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
46
|
+
|
|
47
|
+
class SuggestionList {
|
|
48
|
+
/**
|
|
49
|
+
* Screen reader announcement template for singular result count.
|
|
50
|
+
*
|
|
51
|
+
* @default '%d forslag'
|
|
52
|
+
*/
|
|
53
|
+
singular = input('%d forslag', ...(ngDevMode ? [{ debugName: "singular" }] : []));
|
|
54
|
+
/**
|
|
55
|
+
* Screen reader announcement template for plural result count.
|
|
56
|
+
*
|
|
57
|
+
* @default '%d forslag'
|
|
58
|
+
*/
|
|
59
|
+
plural = input('%d forslag', ...(ngDevMode ? [{ debugName: "plural" }] : []));
|
|
60
|
+
options = contentChildren(SuggestionListOption, { ...(ngDevMode ? { debugName: "options" } : {}), descendants: true });
|
|
61
|
+
empty = contentChild(SuggestionListEmpty, ...(ngDevMode ? [{ debugName: "empty" }] : []));
|
|
62
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
63
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: SuggestionList, isStandalone: true, selector: "ksd-suggestion-list", inputs: { singular: { classPropertyName: "singular", publicName: "singular", isSignal: true, isRequired: false, transformFunction: null }, plural: { classPropertyName: "plural", publicName: "plural", isSignal: true, isRequired: false, transformFunction: null } }, host: { styleAttribute: "display: contents;" }, queries: [{ propertyName: "options", predicate: SuggestionListOption, descendants: true, isSignal: true }, { propertyName: "empty", first: true, predicate: SuggestionListEmpty, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
64
|
+
<u-datalist
|
|
65
|
+
data-nofilter
|
|
66
|
+
[attr.data-sr-singular]="singular()"
|
|
67
|
+
[attr.data-sr-plural]="plural()"
|
|
68
|
+
>
|
|
69
|
+
@for (option of options(); track option) {
|
|
70
|
+
<u-option [value]="option.value()">
|
|
71
|
+
<ng-container *ngTemplateOutlet="option.templateRef()" />
|
|
72
|
+
</u-option>
|
|
73
|
+
}
|
|
74
|
+
@if (empty()?.templateRef()) {
|
|
75
|
+
<u-option data-empty value="" hidden>
|
|
76
|
+
<ng-container *ngTemplateOutlet="empty()?.templateRef()" />
|
|
77
|
+
</u-option>
|
|
78
|
+
}
|
|
79
|
+
</u-datalist>
|
|
80
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
81
|
+
}
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SuggestionList, decorators: [{
|
|
83
|
+
type: Component,
|
|
84
|
+
args: [{
|
|
85
|
+
selector: 'ksd-suggestion-list',
|
|
86
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
87
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
88
|
+
imports: [NgTemplateOutlet],
|
|
89
|
+
host: {
|
|
90
|
+
style: 'display: contents;',
|
|
91
|
+
},
|
|
92
|
+
template: `
|
|
93
|
+
<u-datalist
|
|
94
|
+
data-nofilter
|
|
95
|
+
[attr.data-sr-singular]="singular()"
|
|
96
|
+
[attr.data-sr-plural]="plural()"
|
|
97
|
+
>
|
|
98
|
+
@for (option of options(); track option) {
|
|
99
|
+
<u-option [value]="option.value()">
|
|
100
|
+
<ng-container *ngTemplateOutlet="option.templateRef()" />
|
|
101
|
+
</u-option>
|
|
102
|
+
}
|
|
103
|
+
@if (empty()?.templateRef()) {
|
|
104
|
+
<u-option data-empty value="" hidden>
|
|
105
|
+
<ng-container *ngTemplateOutlet="empty()?.templateRef()" />
|
|
106
|
+
</u-option>
|
|
107
|
+
}
|
|
108
|
+
</u-datalist>
|
|
109
|
+
`,
|
|
110
|
+
}]
|
|
111
|
+
}], propDecorators: { singular: [{ type: i0.Input, args: [{ isSignal: true, alias: "singular", required: false }] }], plural: [{ type: i0.Input, args: [{ isSignal: true, alias: "plural", required: false }] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SuggestionListOption), { ...{
|
|
112
|
+
descendants: true,
|
|
113
|
+
}, isSignal: true }] }], empty: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SuggestionListEmpty), { isSignal: true }] }] } });
|
|
114
|
+
|
|
115
|
+
const sanitizeItems = (values) => !values ? [] : Array.isArray(values) ? values : [values];
|
|
116
|
+
const toItem = (data) => ({
|
|
117
|
+
label: data.textContent?.trim() || data.value,
|
|
118
|
+
value: data.value,
|
|
119
|
+
});
|
|
120
|
+
const nextSelected = (data, previous, multiple) => {
|
|
121
|
+
const item = toItem(data);
|
|
122
|
+
if (!multiple) {
|
|
123
|
+
return data.isConnected ? undefined : item;
|
|
124
|
+
}
|
|
125
|
+
const prevItems = sanitizeItems(previous);
|
|
126
|
+
return data.isConnected
|
|
127
|
+
? prevItems.filter(({ value }) => value !== item.value)
|
|
128
|
+
: [...prevItems, item];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const defaultFilter = ({ label, input }) => label.toLowerCase().includes(input.value.trim().toLowerCase());
|
|
132
|
+
class Suggestion {
|
|
133
|
+
/**
|
|
134
|
+
* Allows the user to select multiple items
|
|
135
|
+
*
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : {}), transform: booleanAttribute });
|
|
139
|
+
/**
|
|
140
|
+
* Allows the user to create new items
|
|
141
|
+
*
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
creatable = input(false, { ...(ngDevMode ? { debugName: "creatable" } : {}), transform: booleanAttribute });
|
|
145
|
+
/**
|
|
146
|
+
* Filter options; boolean or a custom callback.
|
|
147
|
+
*
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
filter = input(true, ...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
151
|
+
/**
|
|
152
|
+
* Model for the selected item(s).
|
|
153
|
+
*
|
|
154
|
+
* @default undefined
|
|
155
|
+
*/
|
|
156
|
+
selected = model(undefined, ...(ngDevMode ? [{ debugName: "selected" }] : []));
|
|
157
|
+
selectedArray = computed(() => sanitizeItems(this.selected()), ...(ngDevMode ? [{ debugName: "selectedArray" }] : []));
|
|
158
|
+
suggestionElement = viewChild('suggestionElement', ...(ngDevMode ? [{ debugName: "suggestionElement" }] : []));
|
|
159
|
+
suggestionList = contentChild(SuggestionList, ...(ngDevMode ? [{ debugName: "suggestionList" }] : []));
|
|
160
|
+
constructor() {
|
|
161
|
+
afterNextRender(() => this.syncOptions(null));
|
|
162
|
+
effect(() => {
|
|
163
|
+
this.suggestionList()?.options();
|
|
164
|
+
queueMicrotask(() => this.syncOptions(null));
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
onSelect(event) {
|
|
168
|
+
const customEvent = event;
|
|
169
|
+
customEvent.preventDefault();
|
|
170
|
+
const data = customEvent.detail;
|
|
171
|
+
if (!data)
|
|
172
|
+
return;
|
|
173
|
+
this.selected.set(nextSelected(data, this.selected(), this.multiple()));
|
|
174
|
+
}
|
|
175
|
+
onKeyDown(event) {
|
|
176
|
+
const keyboardEvent = event;
|
|
177
|
+
if (keyboardEvent.key !== 'Escape')
|
|
178
|
+
return;
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
}
|
|
181
|
+
onInput(event) {
|
|
182
|
+
const inputElement = event.target;
|
|
183
|
+
setTimeout(() => this.syncOptions(inputElement));
|
|
184
|
+
}
|
|
185
|
+
syncOptions(inputElement) {
|
|
186
|
+
const suggestionElement = this.suggestionElement()?.nativeElement;
|
|
187
|
+
if (!suggestionElement)
|
|
188
|
+
return;
|
|
189
|
+
const input = inputElement ?? suggestionElement.querySelector('input');
|
|
190
|
+
const options = Array.from(suggestionElement.querySelectorAll('u-option:not([data-empty])'));
|
|
191
|
+
const filter = this.filter();
|
|
192
|
+
const filterFn = filter === true ? defaultFilter : filter;
|
|
193
|
+
if (filterFn && input) {
|
|
194
|
+
let index = 0;
|
|
195
|
+
for (const option of options) {
|
|
196
|
+
option.disabled = !filterFn({
|
|
197
|
+
index,
|
|
198
|
+
input,
|
|
199
|
+
label: option.label,
|
|
200
|
+
optionElement: option,
|
|
201
|
+
text: option.text,
|
|
202
|
+
value: option.value,
|
|
203
|
+
});
|
|
204
|
+
index++;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
for (const option of options) {
|
|
209
|
+
option.disabled = false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const visibleOptions = options.filter((option) => !option.disabled && !option.hidden);
|
|
213
|
+
const emptyOption = suggestionElement.querySelector('u-option[data-empty]');
|
|
214
|
+
if (!emptyOption)
|
|
215
|
+
return;
|
|
216
|
+
if (visibleOptions.length === 0) {
|
|
217
|
+
emptyOption.removeAttribute('hidden');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
emptyOption.setAttribute('hidden', '');
|
|
221
|
+
}
|
|
222
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Suggestion, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
223
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: Suggestion, isStandalone: true, selector: "ksd-suggestion", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, creatable: { classPropertyName: "creatable", publicName: "creatable", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, queries: [{ propertyName: "suggestionList", first: true, predicate: SuggestionList, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "suggestionElement", first: true, predicate: ["suggestionElement"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.HostSize, inputs: ["data-size", "data-size"] }, { directive: i1.HostColor, inputs: ["data-color", "data-color"] }], ngImport: i0, template: `
|
|
224
|
+
<ds-suggestion
|
|
225
|
+
#suggestionElement
|
|
226
|
+
class="ds-suggestion"
|
|
227
|
+
[attr.data-multiple]="multiple() || undefined"
|
|
228
|
+
[attr.data-creatable]="creatable() || undefined"
|
|
229
|
+
(comboboxbeforeselect)="onSelect($event)"
|
|
230
|
+
(input)="onInput($event)"
|
|
231
|
+
(keydown)="onKeyDown($event)"
|
|
232
|
+
>
|
|
233
|
+
@for (option of selectedArray(); track option.value) {
|
|
234
|
+
<data [attr.value]="option.value">{{ option.label }}</data>
|
|
235
|
+
}
|
|
236
|
+
<ng-content />
|
|
237
|
+
</ds-suggestion>
|
|
238
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Suggestion, decorators: [{
|
|
241
|
+
type: Component,
|
|
242
|
+
args: [{
|
|
243
|
+
selector: 'ksd-suggestion',
|
|
244
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
245
|
+
hostDirectives: [
|
|
246
|
+
{
|
|
247
|
+
directive: HostSize,
|
|
248
|
+
inputs: ['data-size'],
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
directive: HostColor,
|
|
252
|
+
inputs: ['data-color'],
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
256
|
+
host: {},
|
|
257
|
+
template: `
|
|
258
|
+
<ds-suggestion
|
|
259
|
+
#suggestionElement
|
|
260
|
+
class="ds-suggestion"
|
|
261
|
+
[attr.data-multiple]="multiple() || undefined"
|
|
262
|
+
[attr.data-creatable]="creatable() || undefined"
|
|
263
|
+
(comboboxbeforeselect)="onSelect($event)"
|
|
264
|
+
(input)="onInput($event)"
|
|
265
|
+
(keydown)="onKeyDown($event)"
|
|
266
|
+
>
|
|
267
|
+
@for (option of selectedArray(); track option.value) {
|
|
268
|
+
<data [attr.value]="option.value">{{ option.label }}</data>
|
|
269
|
+
}
|
|
270
|
+
<ng-content />
|
|
271
|
+
</ds-suggestion>
|
|
272
|
+
`,
|
|
273
|
+
}]
|
|
274
|
+
}], ctorParameters: () => [], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], creatable: [{ type: i0.Input, args: [{ isSignal: true, alias: "creatable", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], suggestionElement: [{ type: i0.ViewChild, args: ['suggestionElement', { isSignal: true }] }], suggestionList: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SuggestionList), { isSignal: true }] }] } });
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Generated bundle index. Do not edit.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
export { Suggestion, SuggestionList, SuggestionListEmpty, SuggestionListOption };
|
|
281
|
+
//# sourceMappingURL=ks-digital-designsystem-angular-suggestion.mjs.map
|