@ks-digital/designsystem-angular 0.0.1-alpha.10
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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/README.md +40 -0
- package/dist/fesm2022/ks-digital-designsystem-angular.mjs +376 -0
- package/dist/fesm2022/ks-digital-designsystem-angular.mjs.map +1 -0
- package/dist/index.d.ts +89 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 KS Digital
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 🚧 KS Digital Designsystem for Angular
|
|
2
|
+
|
|
3
|
+
> This is an experimental POC as for now
|
|
4
|
+
|
|
5
|
+
This library provides Angular components for KS Digital, designed to align closely with the components from [Designsystemet.no](https://www.designsystemet.no/komponenter).
|
|
6
|
+
|
|
7
|
+
## Installation (WIP)
|
|
8
|
+
|
|
9
|
+
Install the required packages using your preferred package manager:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @ks-digital/designsystem-angular @ks-digital/designsystem-themes
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### 1. Include the Inter Font
|
|
18
|
+
|
|
19
|
+
Add the Inter font to your `index.html`. This API supports the same parameters as the Google Fonts API, allowing you to customize the font weights as needed:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<link href="https://static.fiks.ks.no/googlefonts/googleapis/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Import Base Styles and Themes
|
|
26
|
+
|
|
27
|
+
Import the base styles and the theme you want to use in your application:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
@import url('@ks-digital/designsystem-themes/base.css');
|
|
31
|
+
@import url('@ks-digital/designsystem-themes/forvaltning.css');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Use Components
|
|
35
|
+
|
|
36
|
+
To be written.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
A complete example setup is available in the `angular-demo` located under the `apps` folder.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 🚧 KS Digital Designsystem for Angular
|
|
2
|
+
|
|
3
|
+
> This is an experimental POC as for now
|
|
4
|
+
|
|
5
|
+
This library provides Angular components for KS Digital, designed to align closely with the components from [Designsystemet.no](https://www.designsystemet.no/komponenter).
|
|
6
|
+
|
|
7
|
+
## Installation (WIP)
|
|
8
|
+
|
|
9
|
+
Install the required packages using your preferred package manager:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @ks-digital/designsystem-angular @ks-digital/designsystem-themes
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### 1. Include the Inter Font
|
|
18
|
+
|
|
19
|
+
Add the Inter font to your `index.html`. This API supports the same parameters as the Google Fonts API, allowing you to customize the font weights as needed:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<link href="https://static.fiks.ks.no/googlefonts/googleapis/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Import Base Styles and Themes
|
|
26
|
+
|
|
27
|
+
Import the base styles and the theme you want to use in your application:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
@import url('@ks-digital/designsystem-themes/base.css');
|
|
31
|
+
@import url('@ks-digital/designsystem-themes/forvaltning.css');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Use Components
|
|
35
|
+
|
|
36
|
+
To be written.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
A complete example setup is available in the `angular-demo` located under the `apps` folder.
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, Directive, isDevMode, signal, booleanAttribute, numberAttribute, Component, computed, contentChild, inject, ElementRef, afterNextRender } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
|
5
|
+
/**
|
|
6
|
+
* We use input aliasing to bridge the gap between Angular's camelCase property naming convention and our HTML data attributes.
|
|
7
|
+
* This approach allows us to use valid HTML data attributes as documented by Designsystemet while maintaining
|
|
8
|
+
* proper TypeScript intellisense support.
|
|
9
|
+
*/
|
|
10
|
+
class CommonInputs {
|
|
11
|
+
/**
|
|
12
|
+
* Changes size for descendant Designsystemet components. Select from predefined sizes.
|
|
13
|
+
* @attribute data-size
|
|
14
|
+
*/
|
|
15
|
+
dataSize = input(undefined, { alias: 'data-size' });
|
|
16
|
+
/**
|
|
17
|
+
* Changes color for descendant Designsystemet components.
|
|
18
|
+
* Select from predefined colors and colors defined using theme.designsystemet.no.
|
|
19
|
+
* @attribute data-color
|
|
20
|
+
*/
|
|
21
|
+
dataColor = input(undefined, { alias: 'data-color' });
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: CommonInputs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
23
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: CommonInputs, isStandalone: true, inputs: { dataSize: { classPropertyName: "dataSize", publicName: "data-size", isSignal: true, isRequired: false, transformFunction: null }, dataColor: { classPropertyName: "dataColor", publicName: "data-color", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: CommonInputs, decorators: [{
|
|
26
|
+
type: Directive
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
const logIfDevMode = ({ component, message, }) => {
|
|
30
|
+
if (isDevMode()) {
|
|
31
|
+
console.log(`[${component}] ${message}`);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
class Input {
|
|
36
|
+
/**
|
|
37
|
+
* The value of the input
|
|
38
|
+
*/
|
|
39
|
+
value = signal('');
|
|
40
|
+
/**
|
|
41
|
+
* Whether the input is readonly
|
|
42
|
+
*/
|
|
43
|
+
readonly = input(false, { transform: booleanAttribute });
|
|
44
|
+
/**
|
|
45
|
+
* Displays a character counter. pass a number to set a limit.
|
|
46
|
+
*/
|
|
47
|
+
counter = input(0, { transform: numberAttribute });
|
|
48
|
+
onClick(event) {
|
|
49
|
+
if (this.readonly()) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Input, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
54
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: Input, isStandalone: true, selector: "input[ksd-input], textarea[ksd-input]", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, counter: { classPropertyName: "counter", publicName: "counter", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "input": "value.set($event.target.value)" }, properties: { "attr.readonly": "readonly() ? true : null" }, classAttribute: "ds-input" }, ngImport: i0 });
|
|
55
|
+
}
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Input, decorators: [{
|
|
57
|
+
type: Directive,
|
|
58
|
+
args: [{
|
|
59
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
60
|
+
selector: 'input[ksd-input], textarea[ksd-input]',
|
|
61
|
+
host: {
|
|
62
|
+
class: 'ds-input',
|
|
63
|
+
'[attr.readonly]': 'readonly() ? true : null',
|
|
64
|
+
'(click)': 'onClick($event)',
|
|
65
|
+
'(input)': 'value.set($event.target.value)',
|
|
66
|
+
},
|
|
67
|
+
}]
|
|
68
|
+
}] });
|
|
69
|
+
|
|
70
|
+
class Label {
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: Label, isStandalone: true, selector: "ksd-label", hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `
|
|
73
|
+
<!-- eslint-disable @angular-eslint/template/label-has-associated-control -- Fieldobserver handles binding the label to the input -->
|
|
74
|
+
<label class="ds-label"><ng-content /></label>
|
|
75
|
+
`, isInline: true });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Label, decorators: [{
|
|
78
|
+
type: Component,
|
|
79
|
+
args: [{
|
|
80
|
+
selector: 'ksd-label',
|
|
81
|
+
hostDirectives: [
|
|
82
|
+
{
|
|
83
|
+
directive: CommonInputs,
|
|
84
|
+
inputs: ['data-size', 'data-color'],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
template: `
|
|
88
|
+
<!-- eslint-disable @angular-eslint/template/label-has-associated-control -- Fieldobserver handles binding the label to the input -->
|
|
89
|
+
<label class="ds-label"><ng-content /></label>
|
|
90
|
+
`,
|
|
91
|
+
}]
|
|
92
|
+
}] });
|
|
93
|
+
|
|
94
|
+
class ValidationMessage {
|
|
95
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
96
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: ValidationMessage, isStandalone: true, selector: "p[ksd-validation-message]", host: { attributes: { "data-field": "validation" }, classAttribute: "ds-validation-message" }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ValidationMessage, decorators: [{
|
|
99
|
+
type: Component,
|
|
100
|
+
args: [{
|
|
101
|
+
selector: 'p[ksd-validation-message]',
|
|
102
|
+
template: `<ng-content />`,
|
|
103
|
+
host: {
|
|
104
|
+
class: 'ds-validation-message',
|
|
105
|
+
'data-field': 'validation',
|
|
106
|
+
},
|
|
107
|
+
}]
|
|
108
|
+
}] });
|
|
109
|
+
|
|
110
|
+
class FieldCounter {
|
|
111
|
+
/**
|
|
112
|
+
* The maximum allowed characters.
|
|
113
|
+
*
|
|
114
|
+
**/
|
|
115
|
+
limit = input.required();
|
|
116
|
+
/**
|
|
117
|
+
* How many characters have been typed.
|
|
118
|
+
*
|
|
119
|
+
**/
|
|
120
|
+
count = input.required();
|
|
121
|
+
remainder = computed(() => this.limit() - this.count());
|
|
122
|
+
excessCount = computed(() => Math.abs(this.remainder()));
|
|
123
|
+
hasExceededLimit = computed(() => this.count() > this.limit());
|
|
124
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
125
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: FieldCounter, isStandalone: true, selector: "ksd-field-counter", inputs: { limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: true, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
126
|
+
<div data-field="description" class="ds-sr-only" aria-live="polite">
|
|
127
|
+
@if (hasExceededLimit()) {
|
|
128
|
+
{{ excessCount() }} tegn for mye
|
|
129
|
+
}
|
|
130
|
+
</div>
|
|
131
|
+
@if (hasExceededLimit()) {
|
|
132
|
+
<p ksd-validation-message>{{ excessCount() }} tegn for mye</p>
|
|
133
|
+
} @else {
|
|
134
|
+
<p data-field="validation">{{ remainder() }} tegn igjen</p>
|
|
135
|
+
}
|
|
136
|
+
`, isInline: true, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"], dependencies: [{ kind: "component", type: ValidationMessage, selector: "p[ksd-validation-message]" }] });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldCounter, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{ selector: 'ksd-field-counter', imports: [ValidationMessage], template: `
|
|
141
|
+
<div data-field="description" class="ds-sr-only" aria-live="polite">
|
|
142
|
+
@if (hasExceededLimit()) {
|
|
143
|
+
{{ excessCount() }} tegn for mye
|
|
144
|
+
}
|
|
145
|
+
</div>
|
|
146
|
+
@if (hasExceededLimit()) {
|
|
147
|
+
<p ksd-validation-message>{{ excessCount() }} tegn for mye</p>
|
|
148
|
+
} @else {
|
|
149
|
+
<p data-field="validation">{{ remainder() }} tegn igjen</p>
|
|
150
|
+
}
|
|
151
|
+
`, styles: [":host>*{margin-top:var(--dsc-field-content-spacing)}\n"] }]
|
|
152
|
+
}] });
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Lifted from Designsystemet core repo.
|
|
156
|
+
* Takes care of binding ids, labels and aria-describedby attributes
|
|
157
|
+
*
|
|
158
|
+
* @param fieldElement - The field element to observe
|
|
159
|
+
* @returns A function to disconnect the observer
|
|
160
|
+
* */
|
|
161
|
+
function fieldObserver(fieldElement) {
|
|
162
|
+
if (!fieldElement)
|
|
163
|
+
return;
|
|
164
|
+
const elements = new Map();
|
|
165
|
+
const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
|
|
166
|
+
let input = null;
|
|
167
|
+
let describedby = '';
|
|
168
|
+
const process = (mutations) => {
|
|
169
|
+
const changed = [];
|
|
170
|
+
const removed = [];
|
|
171
|
+
// Merge MutationRecords
|
|
172
|
+
for (const mutation of mutations) {
|
|
173
|
+
if (mutation.attributeName)
|
|
174
|
+
changed.push(mutation.target ?? fieldElement);
|
|
175
|
+
// @ts-expect-error - addedNodes is not typed
|
|
176
|
+
changed.push(...(mutation.addedNodes || []));
|
|
177
|
+
removed.push(...(mutation.removedNodes || []));
|
|
178
|
+
}
|
|
179
|
+
// Register elements
|
|
180
|
+
for (const el of changed) {
|
|
181
|
+
if (!isElement(el))
|
|
182
|
+
continue;
|
|
183
|
+
if (isLabel(el))
|
|
184
|
+
elements.set(el, el.htmlFor);
|
|
185
|
+
else if (el.hasAttribute('data-field'))
|
|
186
|
+
elements.set(el, el.id);
|
|
187
|
+
else if (isInputLike(el)) {
|
|
188
|
+
input = el;
|
|
189
|
+
describedby = el.getAttribute('aria-describedby') || '';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Reset removed elements
|
|
193
|
+
for (const el of removed) {
|
|
194
|
+
if (!isElement(el))
|
|
195
|
+
continue;
|
|
196
|
+
if (input === el)
|
|
197
|
+
input = null;
|
|
198
|
+
if (elements.has(el)) {
|
|
199
|
+
setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el));
|
|
200
|
+
elements.delete(el);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Connect elements
|
|
204
|
+
const describedbyIds = [describedby]; // Keep original aria-describedby
|
|
205
|
+
const inputId = input?.id || uuid;
|
|
206
|
+
for (const [el, value] of elements) {
|
|
207
|
+
const descriptionType = el.getAttribute('data-field');
|
|
208
|
+
const id = descriptionType ? `${inputId}:${descriptionType}` : inputId;
|
|
209
|
+
if (!value)
|
|
210
|
+
setAttr(el, isLabel(el) ? 'for' : 'id', id); // Ensure we have a value
|
|
211
|
+
if (descriptionType === 'validation')
|
|
212
|
+
describedbyIds.unshift(el.id); // Validations to the front
|
|
213
|
+
else if (descriptionType)
|
|
214
|
+
describedbyIds.push(el.id); // Other descriptions to the back
|
|
215
|
+
}
|
|
216
|
+
setAttr(input, 'id', inputId);
|
|
217
|
+
setAttr(input, 'aria-describedby', describedbyIds.join(' ').trim());
|
|
218
|
+
};
|
|
219
|
+
const observer = createOptimizedMutationObserver(process);
|
|
220
|
+
observer.observe(fieldElement, {
|
|
221
|
+
attributeFilter: ['id', 'for', 'aria-describedby'],
|
|
222
|
+
attributes: true,
|
|
223
|
+
childList: true,
|
|
224
|
+
subtree: true,
|
|
225
|
+
});
|
|
226
|
+
process([{ addedNodes: fieldElement.querySelectorAll('*') }]); // Initial setup
|
|
227
|
+
observer.takeRecords(); // Clear initial setup queue
|
|
228
|
+
return () => observer.disconnect();
|
|
229
|
+
}
|
|
230
|
+
// Utilities
|
|
231
|
+
const isElement = (node) => node instanceof Element;
|
|
232
|
+
const isLabel = (node) => node instanceof HTMLLabelElement;
|
|
233
|
+
const isInputLike = (node) => node instanceof HTMLElement &&
|
|
234
|
+
'validity' in node &&
|
|
235
|
+
!(node instanceof HTMLButtonElement); // Matches input, textarea, select and form accosiated custom elements
|
|
236
|
+
const setAttr = (el, name, value) => value ? el?.setAttribute(name, value) : el?.removeAttribute(name);
|
|
237
|
+
// Speed up MutationObserver by debouncing, clearing internal queue after changes and only running when page is visible
|
|
238
|
+
function createOptimizedMutationObserver(callback) {
|
|
239
|
+
const queue = [];
|
|
240
|
+
const observer = new MutationObserver((mutations) => {
|
|
241
|
+
if (!queue.length)
|
|
242
|
+
requestAnimationFrame(process);
|
|
243
|
+
queue.push(...mutations);
|
|
244
|
+
});
|
|
245
|
+
const process = () => {
|
|
246
|
+
callback(queue, observer);
|
|
247
|
+
queue.length = 0; // Reset queue
|
|
248
|
+
observer.takeRecords(); // Clear queue due to DOM changes in callback
|
|
249
|
+
};
|
|
250
|
+
return observer;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Use the Field component to connect inputs and labels
|
|
255
|
+
*/
|
|
256
|
+
class Field {
|
|
257
|
+
/**
|
|
258
|
+
* Position of toggle inputs (radio, checkbox, switch) in field
|
|
259
|
+
* @default start
|
|
260
|
+
*/
|
|
261
|
+
position = input('start');
|
|
262
|
+
input = contentChild(Input);
|
|
263
|
+
label = contentChild(Label);
|
|
264
|
+
el = inject(ElementRef);
|
|
265
|
+
count = computed(() => this.input()?.value().length);
|
|
266
|
+
limit = computed(() => this.input()?.counter());
|
|
267
|
+
hasCounter = computed(() => this.limit());
|
|
268
|
+
constructor() {
|
|
269
|
+
afterNextRender(() => {
|
|
270
|
+
if (!this.label() || !this.input()) {
|
|
271
|
+
logIfDevMode({
|
|
272
|
+
component: 'Field',
|
|
273
|
+
message: 'Missing required elements: ksd-label and ksd-input must be provided as children. Check imports and markup.',
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
fieldObserver(this.el.nativeElement);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Field, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
280
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: Field, isStandalone: true, selector: "ksd-field", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.dataPosition": "position()" }, classAttribute: "ds-field" }, queries: [{ propertyName: "input", first: true, predicate: Input, descendants: true, isSignal: true }, { propertyName: "label", first: true, predicate: Label, descendants: true, isSignal: true }], hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `
|
|
281
|
+
<ng-content />
|
|
282
|
+
@if (hasCounter()) {
|
|
283
|
+
<ksd-field-counter [limit]="limit() ?? 0" [count]="count() ?? 0" />
|
|
284
|
+
}
|
|
285
|
+
`, isInline: true, dependencies: [{ kind: "component", type: FieldCounter, selector: "ksd-field-counter", inputs: ["limit", "count"] }] });
|
|
286
|
+
}
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Field, decorators: [{
|
|
288
|
+
type: Component,
|
|
289
|
+
args: [{
|
|
290
|
+
selector: 'ksd-field',
|
|
291
|
+
hostDirectives: [
|
|
292
|
+
{
|
|
293
|
+
directive: CommonInputs,
|
|
294
|
+
inputs: ['data-size', 'data-color'],
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
host: {
|
|
298
|
+
class: 'ds-field',
|
|
299
|
+
'[attr.dataPosition]': 'position()',
|
|
300
|
+
},
|
|
301
|
+
template: `
|
|
302
|
+
<ng-content />
|
|
303
|
+
@if (hasCounter()) {
|
|
304
|
+
<ksd-field-counter [limit]="limit() ?? 0" [count]="count() ?? 0" />
|
|
305
|
+
}
|
|
306
|
+
`,
|
|
307
|
+
imports: [FieldCounter],
|
|
308
|
+
}]
|
|
309
|
+
}], ctorParameters: () => [] });
|
|
310
|
+
|
|
311
|
+
class Fieldset {
|
|
312
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Fieldset, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
313
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: Fieldset, isStandalone: true, selector: "fieldset[ksd-fieldset]", host: { attributes: { "role": "fieldset" }, classAttribute: "ds-fieldset" }, ngImport: i0, template: ` <ng-content /> `, isInline: true });
|
|
314
|
+
}
|
|
315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Fieldset, decorators: [{
|
|
316
|
+
type: Component,
|
|
317
|
+
args: [{
|
|
318
|
+
selector: 'fieldset[ksd-fieldset]',
|
|
319
|
+
host: {
|
|
320
|
+
role: 'fieldset',
|
|
321
|
+
class: 'ds-fieldset',
|
|
322
|
+
},
|
|
323
|
+
template: ` <ng-content /> `,
|
|
324
|
+
}]
|
|
325
|
+
}] });
|
|
326
|
+
|
|
327
|
+
class FieldsetDescription {
|
|
328
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldsetDescription, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
329
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: FieldsetDescription, isStandalone: true, selector: "p[ksd-fieldset-description]", ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
330
|
+
}
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldsetDescription, decorators: [{
|
|
332
|
+
type: Component,
|
|
333
|
+
args: [{
|
|
334
|
+
selector: 'p[ksd-fieldset-description]',
|
|
335
|
+
template: `<ng-content />`,
|
|
336
|
+
host: {},
|
|
337
|
+
}]
|
|
338
|
+
}] });
|
|
339
|
+
|
|
340
|
+
class FieldsetLegend {
|
|
341
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldsetLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
342
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: FieldsetLegend, isStandalone: true, selector: "legend[ksd-fieldset-legend]", host: { attributes: { "role": "legend" }, classAttribute: "ds-label" }, ngImport: i0, template: ` <ng-content /> `, isInline: true });
|
|
343
|
+
}
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: FieldsetLegend, decorators: [{
|
|
345
|
+
type: Component,
|
|
346
|
+
args: [{
|
|
347
|
+
selector: 'legend[ksd-fieldset-legend]',
|
|
348
|
+
host: {
|
|
349
|
+
role: 'legend',
|
|
350
|
+
class: 'ds-label',
|
|
351
|
+
},
|
|
352
|
+
template: ` <ng-content /> `,
|
|
353
|
+
}]
|
|
354
|
+
}] });
|
|
355
|
+
|
|
356
|
+
class Paragraph {
|
|
357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Paragraph, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
358
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: Paragraph, isStandalone: true, selector: "p[ksd-paragraph]", host: { classAttribute: "ds-paragraph" }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
359
|
+
}
|
|
360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Paragraph, decorators: [{
|
|
361
|
+
type: Component,
|
|
362
|
+
args: [{
|
|
363
|
+
selector: 'p[ksd-paragraph]',
|
|
364
|
+
template: `<ng-content />`,
|
|
365
|
+
host: {
|
|
366
|
+
class: 'ds-paragraph',
|
|
367
|
+
},
|
|
368
|
+
}]
|
|
369
|
+
}] });
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Generated bundle index. Do not edit.
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
export { CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
376
|
+
//# sourceMappingURL=ks-digital-designsystem-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-digital-designsystem-angular.mjs","sources":["../../src/components/common-inputs.ts","../../src/utils/log-if-devmode.ts","../../src/components/input/input.ts","../../src/components/label/label.ts","../../src/components/validation-message/validation-message.ts","../../src/components/field/field-counter.ts","../../src/components/field/field-observer.ts","../../src/components/field/field.ts","../../src/components/fieldset/fieldset.ts","../../src/components/fieldset/fieldset-description.ts","../../src/components/fieldset/fieldset-legend.ts","../../src/components/paragraph/paragraph.ts","../../src/ks-digital-designsystem-angular.ts"],"sourcesContent":["/* eslint-disable @angular-eslint/no-input-rename */\n\n/**\n * We use input aliasing to bridge the gap between Angular's camelCase property naming convention and our HTML data attributes.\n * This approach allows us to use valid HTML data attributes as documented by Designsystemet while maintaining\n * proper TypeScript intellisense support.\n */\n\nimport { Directive, input } from '@angular/core'\nimport { Color } from './colors'\n\nexport type Size = 'sm' | 'md' | 'lg' | 'xl'\n\n@Directive()\nexport class CommonInputs {\n /**\n * Changes size for descendant Designsystemet components. Select from predefined sizes.\n * @attribute data-size\n */\n dataSize = input<Size>(undefined, { alias: 'data-size' })\n\n /**\n * Changes color for descendant Designsystemet components.\n * Select from predefined colors and colors defined using theme.designsystemet.no.\n * @attribute data-color\n */\n dataColor = input<Color>(undefined, { alias: 'data-color' })\n}\n","import { isDevMode } from '@angular/core'\n\nexport const logIfDevMode = ({\n component,\n message,\n}: {\n component: string\n message: string\n}) => {\n if (isDevMode()) {\n console.log(`[${component}] ${message}`)\n }\n}\n","import {\n booleanAttribute,\n Directive,\n input,\n numberAttribute,\n signal,\n} from '@angular/core'\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'input[ksd-input], textarea[ksd-input]',\n host: {\n class: 'ds-input',\n '[attr.readonly]': 'readonly() ? true : null',\n '(click)': 'onClick($event)',\n '(input)': 'value.set($event.target.value)',\n },\n})\nexport class Input {\n /**\n * The value of the input\n */\n value = signal('')\n\n /**\n * Whether the input is readonly\n */\n readonly = input(false, { transform: booleanAttribute })\n\n /**\n * Displays a character counter. pass a number to set a limit.\n */\n counter = input(0, { transform: numberAttribute })\n\n onClick(event: Event) {\n if (this.readonly()) {\n event.preventDefault()\n }\n }\n}\n","import { Component } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\n\n@Component({\n selector: 'ksd-label',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n template: `\n <!-- eslint-disable @angular-eslint/template/label-has-associated-control -- Fieldobserver handles binding the label to the input -->\n <label class=\"ds-label\"><ng-content /></label>\n `,\n})\nexport class Label {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-validation-message]',\n template: `<ng-content />`,\n host: {\n class: 'ds-validation-message',\n 'data-field': 'validation',\n },\n})\nexport class ValidationMessage {}\n","import { Component, computed, input } from '@angular/core'\nimport { ValidationMessage } from '../validation-message'\n\n@Component({\n selector: 'ksd-field-counter',\n imports: [ValidationMessage],\n template: `\n <div data-field=\"description\" class=\"ds-sr-only\" aria-live=\"polite\">\n @if (hasExceededLimit()) {\n {{ excessCount() }} tegn for mye\n }\n </div>\n @if (hasExceededLimit()) {\n <p ksd-validation-message>{{ excessCount() }} tegn for mye</p>\n } @else {\n <p data-field=\"validation\">{{ remainder() }} tegn igjen</p>\n }\n `,\n\n /**\n * Apply custom styles here to get correct spacing because\n * the rendered host element from Angular is getting in the way\n */\n styles: `\n :host > * {\n margin-top: var(--dsc-field-content-spacing);\n }\n `,\n})\nexport class FieldCounter {\n /**\n * The maximum allowed characters.\n *\n **/\n readonly limit = input.required<number>()\n\n /**\n * How many characters have been typed.\n *\n **/\n readonly count = input.required<number>()\n protected readonly remainder = computed(() => this.limit() - this.count())\n protected readonly excessCount = computed(() => Math.abs(this.remainder()))\n protected readonly hasExceededLimit = computed(\n () => this.count() > this.limit(),\n )\n}\n","/**\n * Lifted from Designsystemet core repo.\n * Takes care of binding ids, labels and aria-describedby attributes\n *\n * @param fieldElement - The field element to observe\n * @returns A function to disconnect the observer\n * */\nexport function fieldObserver(fieldElement: HTMLElement | null) {\n if (!fieldElement) return\n\n const elements = new Map<Element, string | null>()\n const uuid = `:${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`\n let input: Element | null = null\n let describedby = ''\n\n const process = (mutations: Partial<MutationRecord>[]) => {\n const changed: Node[] = []\n const removed: Node[] = []\n\n // Merge MutationRecords\n for (const mutation of mutations) {\n if (mutation.attributeName) changed.push(mutation.target ?? fieldElement)\n // @ts-expect-error - addedNodes is not typed\n changed.push(...(mutation.addedNodes || []))\n removed.push(...(mutation.removedNodes || []))\n }\n\n // Register elements\n for (const el of changed) {\n if (!isElement(el)) continue\n if (isLabel(el)) elements.set(el, el.htmlFor)\n else if (el.hasAttribute('data-field')) elements.set(el, el.id)\n else if (isInputLike(el)) {\n input = el\n describedby = el.getAttribute('aria-describedby') || ''\n }\n }\n\n // Reset removed elements\n for (const el of removed) {\n if (!isElement(el)) continue\n\n if (input === el) input = null\n if (elements.has(el)) {\n setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el))\n elements.delete(el)\n }\n }\n\n // Connect elements\n const describedbyIds = [describedby] // Keep original aria-describedby\n const inputId = input?.id || uuid\n\n for (const [el, value] of elements) {\n const descriptionType = el.getAttribute('data-field')\n const id = descriptionType ? `${inputId}:${descriptionType}` : inputId\n\n if (!value) setAttr(el, isLabel(el) ? 'for' : 'id', id) // Ensure we have a value\n if (descriptionType === 'validation')\n describedbyIds.unshift(el.id) // Validations to the front\n else if (descriptionType) describedbyIds.push(el.id) // Other descriptions to the back\n }\n\n setAttr(input, 'id', inputId)\n setAttr(input, 'aria-describedby', describedbyIds.join(' ').trim())\n }\n\n const observer = createOptimizedMutationObserver(process)\n observer.observe(fieldElement, {\n attributeFilter: ['id', 'for', 'aria-describedby'],\n attributes: true,\n childList: true,\n subtree: true,\n })\n\n process([{ addedNodes: fieldElement.querySelectorAll('*') }]) // Initial setup\n observer.takeRecords() // Clear initial setup queue\n return () => observer.disconnect()\n}\n\n// Utilities\nexport const isElement = (node: Node) => node instanceof Element\nexport const isLabel = (node: Node) => node instanceof HTMLLabelElement\nexport const isInputLike = (node: unknown): node is HTMLInputElement =>\n node instanceof HTMLElement &&\n 'validity' in node &&\n !(node instanceof HTMLButtonElement) // Matches input, textarea, select and form accosiated custom elements\n\nconst setAttr = (el: Element | null, name: string, value?: string | null) =>\n value ? el?.setAttribute(name, value) : el?.removeAttribute(name)\n\n// Speed up MutationObserver by debouncing, clearing internal queue after changes and only running when page is visible\nfunction createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = []\n const observer = new MutationObserver((mutations) => {\n if (!queue.length) requestAnimationFrame(process)\n queue.push(...mutations)\n })\n\n const process = () => {\n callback(queue, observer)\n queue.length = 0 // Reset queue\n observer.takeRecords() // Clear queue due to DOM changes in callback\n }\n\n return observer\n}\n","import {\n afterNextRender,\n Component,\n computed,\n contentChild,\n ElementRef,\n inject,\n input,\n} from '@angular/core'\nimport { logIfDevMode } from '../../utils/log-if-devmode'\nimport { CommonInputs } from '../common-inputs'\nimport { Input } from '../input/input'\nimport { Label } from '../label/label'\nimport { FieldCounter } from './field-counter'\nimport { fieldObserver } from './field-observer'\n\n/**\n * Use the Field component to connect inputs and labels\n */\n@Component({\n selector: 'ksd-field',\n hostDirectives: [\n {\n directive: CommonInputs,\n inputs: ['data-size', 'data-color'],\n },\n ],\n host: {\n class: 'ds-field',\n '[attr.dataPosition]': 'position()',\n },\n template: `\n <ng-content />\n @if (hasCounter()) {\n <ksd-field-counter [limit]=\"limit() ?? 0\" [count]=\"count() ?? 0\" />\n }\n `,\n imports: [FieldCounter],\n})\nexport class Field {\n /**\n * Position of toggle inputs (radio, checkbox, switch) in field\n * @default start\n */\n position = input<'start' | 'end'>('start')\n\n private input = contentChild(Input)\n private label = contentChild(Label)\n\n private el = inject(ElementRef)\n protected count = computed(() => this.input()?.value().length)\n protected limit = computed(() => this.input()?.counter())\n protected hasCounter = computed(() => this.limit())\n\n constructor() {\n afterNextRender(() => {\n if (!this.label() || !this.input()) {\n logIfDevMode({\n component: 'Field',\n message:\n 'Missing required elements: ksd-label and ksd-input must be provided as children. Check imports and markup.',\n })\n }\n\n fieldObserver(this.el.nativeElement)\n })\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'fieldset[ksd-fieldset]',\n host: {\n role: 'fieldset',\n class: 'ds-fieldset',\n },\n template: ` <ng-content /> `,\n})\nexport class Fieldset {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-fieldset-description]',\n template: `<ng-content />`,\n host: {},\n})\nexport class FieldsetDescription {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'legend[ksd-fieldset-legend]',\n host: {\n role: 'legend',\n class: 'ds-label',\n },\n template: ` <ng-content /> `,\n})\nexport class FieldsetLegend {}\n","import { Component } from '@angular/core'\n\n@Component({\n selector: 'p[ksd-paragraph]',\n template: `<ng-content />`,\n host: {\n class: 'ds-paragraph',\n },\n})\nexport class Paragraph {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names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AK,EAAE,UAAU;AAClB,qBAAA;AACD,oBAAA,QAAQ,EAAE,CAAA,gBAAA,CAAkB;AAC7B,iBAAA;;;MCAY,SAAS,CAAA;uGAAT,SAAS,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,sHALV,CAAA,cAAA,CAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAKf,SAAS,EAAA,UAAA,EAAA,CAAA;kBAPrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,CAAA,cAAA,CAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA;AACF,iBAAA;;;ACRD;;AAEG;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
3
|
+
type Size = 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
declare class CommonInputs {
|
|
5
|
+
/**
|
|
6
|
+
* Changes size for descendant Designsystemet components. Select from predefined sizes.
|
|
7
|
+
* @attribute data-size
|
|
8
|
+
*/
|
|
9
|
+
dataSize: i0.InputSignal<Size>;
|
|
10
|
+
/**
|
|
11
|
+
* Changes color for descendant Designsystemet components.
|
|
12
|
+
* Select from predefined colors and colors defined using theme.designsystemet.no.
|
|
13
|
+
* @attribute data-color
|
|
14
|
+
*/
|
|
15
|
+
dataColor: i0.InputSignal<string>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommonInputs, never>;
|
|
17
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CommonInputs, never, never, { "dataSize": { "alias": "data-size"; "required": false; "isSignal": true; }; "dataColor": { "alias": "data-color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Use the Field component to connect inputs and labels
|
|
22
|
+
*/
|
|
23
|
+
declare class Field {
|
|
24
|
+
/**
|
|
25
|
+
* Position of toggle inputs (radio, checkbox, switch) in field
|
|
26
|
+
* @default start
|
|
27
|
+
*/
|
|
28
|
+
position: i0.InputSignal<"start" | "end">;
|
|
29
|
+
private input;
|
|
30
|
+
private label;
|
|
31
|
+
private el;
|
|
32
|
+
protected count: i0.Signal<number>;
|
|
33
|
+
protected limit: i0.Signal<number>;
|
|
34
|
+
protected hasCounter: i0.Signal<number>;
|
|
35
|
+
constructor();
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Field, never>;
|
|
37
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Field, "ksd-field", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, ["input", "label"], ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare class Fieldset {
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Fieldset, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Fieldset, "fieldset[ksd-fieldset]", never, {}, {}, never, ["*"], true, never>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare class FieldsetDescription {
|
|
46
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FieldsetDescription, never>;
|
|
47
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetDescription, "p[ksd-fieldset-description]", never, {}, {}, never, ["*"], true, never>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare class FieldsetLegend {
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FieldsetLegend, never>;
|
|
52
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetLegend, "legend[ksd-fieldset-legend]", never, {}, {}, never, ["*"], true, never>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class Input {
|
|
56
|
+
/**
|
|
57
|
+
* The value of the input
|
|
58
|
+
*/
|
|
59
|
+
value: i0.WritableSignal<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the input is readonly
|
|
62
|
+
*/
|
|
63
|
+
readonly: i0.InputSignalWithTransform<boolean, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Displays a character counter. pass a number to set a limit.
|
|
66
|
+
*/
|
|
67
|
+
counter: i0.InputSignalWithTransform<number, unknown>;
|
|
68
|
+
onClick(event: Event): void;
|
|
69
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Input, never>;
|
|
70
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<Input, "input[ksd-input], textarea[ksd-input]", never, { "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "counter": { "alias": "counter"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class Label {
|
|
74
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Label, never>;
|
|
75
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Label, "ksd-label", never, {}, {}, never, ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare class Paragraph {
|
|
79
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Paragraph, never>;
|
|
80
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Paragraph, "p[ksd-paragraph]", never, {}, {}, never, ["*"], true, never>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class ValidationMessage {
|
|
84
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
|
|
85
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ValidationMessage, "p[ksd-validation-message]", never, {}, {}, never, ["*"], true, never>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Input, Label, Paragraph, ValidationMessage };
|
|
89
|
+
export type { Size };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ks-digital/designsystem-angular",
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/ks-no/designsystem.git",
|
|
6
|
+
"directory": "packages/angular"
|
|
7
|
+
},
|
|
8
|
+
"version": "0.0.1-alpha.10",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"private": false,
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"files": [
|
|
16
|
+
"./dist"
|
|
17
|
+
],
|
|
18
|
+
"main": "./dist/fesm2022/ks-digital-designsystem-angular.mjs",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@angular/common": ">=20.0.0",
|
|
22
|
+
"@angular/core": ">=20.0.0",
|
|
23
|
+
"@angular/platform-browser": ">=20.0.0",
|
|
24
|
+
"@angular/platform-server": ">=20.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@analogjs/storybook-angular": "^1.18.0",
|
|
28
|
+
"@analogjs/vite-plugin-angular": "~1.17.1",
|
|
29
|
+
"@analogjs/vitest-angular": "~1.17.1",
|
|
30
|
+
"@angular-eslint/builder": "^20.0.0",
|
|
31
|
+
"@angular-eslint/bundled-angular-compiler": "^20.0.0",
|
|
32
|
+
"@angular-eslint/eslint-plugin": "^20.0.0",
|
|
33
|
+
"@angular-eslint/eslint-plugin-template": "^20.0.0",
|
|
34
|
+
"@angular-eslint/schematics": "^20.0.0",
|
|
35
|
+
"@angular-eslint/template-parser": "^20.0.0",
|
|
36
|
+
"@testing-library/angular": "^17.4.0",
|
|
37
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
38
|
+
"angular-eslint": "^20.0.0",
|
|
39
|
+
"jsdom": "~22.1.0",
|
|
40
|
+
"ng-packagr": "^20.0.1"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "ng-packagr -p ng-package.json"
|
|
44
|
+
}
|
|
45
|
+
}
|