@ks-digital/designsystem-angular 0.0.1-alpha.7 → 0.0.1-alpha.70

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.
Files changed (104) hide show
  1. package/README.md +28 -11
  2. package/__internals/README.md +3 -0
  3. package/alert/README.md +3 -0
  4. package/breadcrumbs/README.md +3 -0
  5. package/button/README.md +3 -0
  6. package/card/README.md +3 -0
  7. package/details/README.md +3 -0
  8. package/dialog/README.md +3 -0
  9. package/dropdown/README.md +3 -0
  10. package/error-summary/README.md +3 -0
  11. package/fesm2022/ks-digital-designsystem-angular-__internals.mjs +82 -0
  12. package/fesm2022/ks-digital-designsystem-angular-__internals.mjs.map +1 -0
  13. package/fesm2022/ks-digital-designsystem-angular-alert.mjs +34 -0
  14. package/fesm2022/ks-digital-designsystem-angular-alert.mjs.map +1 -0
  15. package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs +51 -0
  16. package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs.map +1 -0
  17. package/fesm2022/ks-digital-designsystem-angular-button.mjs +74 -0
  18. package/fesm2022/ks-digital-designsystem-angular-button.mjs.map +1 -0
  19. package/fesm2022/ks-digital-designsystem-angular-card.mjs +86 -0
  20. package/fesm2022/ks-digital-designsystem-angular-card.mjs.map +1 -0
  21. package/fesm2022/ks-digital-designsystem-angular-chip.mjs +43 -0
  22. package/fesm2022/ks-digital-designsystem-angular-chip.mjs.map +1 -0
  23. package/fesm2022/ks-digital-designsystem-angular-details.mjs +64 -0
  24. package/fesm2022/ks-digital-designsystem-angular-details.mjs.map +1 -0
  25. package/fesm2022/ks-digital-designsystem-angular-dialog.mjs +48 -0
  26. package/fesm2022/ks-digital-designsystem-angular-dialog.mjs.map +1 -0
  27. package/fesm2022/ks-digital-designsystem-angular-dropdown.mjs +46 -0
  28. package/fesm2022/ks-digital-designsystem-angular-dropdown.mjs.map +1 -0
  29. package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs +49 -0
  30. package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs.map +1 -0
  31. package/fesm2022/ks-digital-designsystem-angular-forms.mjs +227 -0
  32. package/fesm2022/ks-digital-designsystem-angular-forms.mjs.map +1 -0
  33. package/fesm2022/ks-digital-designsystem-angular-heading.mjs +40 -0
  34. package/fesm2022/ks-digital-designsystem-angular-heading.mjs.map +1 -0
  35. package/fesm2022/ks-digital-designsystem-angular-link.mjs +31 -0
  36. package/fesm2022/ks-digital-designsystem-angular-link.mjs.map +1 -0
  37. package/fesm2022/ks-digital-designsystem-angular-pagination.mjs +143 -0
  38. package/fesm2022/ks-digital-designsystem-angular-pagination.mjs.map +1 -0
  39. package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs +25 -0
  40. package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs.map +1 -0
  41. package/fesm2022/ks-digital-designsystem-angular-popover.mjs +46 -0
  42. package/fesm2022/ks-digital-designsystem-angular-popover.mjs.map +1 -0
  43. package/fesm2022/ks-digital-designsystem-angular-search.mjs +159 -0
  44. package/fesm2022/ks-digital-designsystem-angular-search.mjs.map +1 -0
  45. package/fesm2022/ks-digital-designsystem-angular-skeleton.mjs +35 -0
  46. package/fesm2022/ks-digital-designsystem-angular-skeleton.mjs.map +1 -0
  47. package/fesm2022/ks-digital-designsystem-angular-spinner.mjs +104 -0
  48. package/fesm2022/ks-digital-designsystem-angular-spinner.mjs.map +1 -0
  49. package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs +375 -0
  50. package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs.map +1 -0
  51. package/fesm2022/ks-digital-designsystem-angular-table.mjs +105 -0
  52. package/fesm2022/ks-digital-designsystem-angular-table.mjs.map +1 -0
  53. package/fesm2022/ks-digital-designsystem-angular-tabs.mjs +148 -0
  54. package/fesm2022/ks-digital-designsystem-angular-tabs.mjs.map +1 -0
  55. package/fesm2022/ks-digital-designsystem-angular-tag.mjs +38 -0
  56. package/fesm2022/ks-digital-designsystem-angular-tag.mjs.map +1 -0
  57. package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs +25 -0
  58. package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs.map +1 -0
  59. package/fesm2022/ks-digital-designsystem-angular.mjs +7 -0
  60. package/fesm2022/ks-digital-designsystem-angular.mjs.map +1 -0
  61. package/forms/README.md +3 -0
  62. package/heading/README.md +3 -0
  63. package/link/README.md +3 -0
  64. package/package.json +113 -28
  65. package/pagination/README.md +3 -0
  66. package/paragraph/README.md +3 -0
  67. package/popover/README.md +3 -0
  68. package/search/README.md +3 -0
  69. package/skeleton/README.md +3 -0
  70. package/spinner/README.md +3 -0
  71. package/suggestion/README.md +3 -0
  72. package/table/README.md +3 -0
  73. package/tabs/README.md +3 -0
  74. package/tag/README.md +3 -0
  75. package/types/ks-digital-designsystem-angular-__internals.d.ts +50 -0
  76. package/types/ks-digital-designsystem-angular-alert.d.ts +12 -0
  77. package/types/ks-digital-designsystem-angular-breadcrumbs.d.ts +13 -0
  78. package/types/ks-digital-designsystem-angular-button.d.ts +32 -0
  79. package/types/ks-digital-designsystem-angular-card.d.ts +24 -0
  80. package/types/ks-digital-designsystem-angular-chip.d.ts +15 -0
  81. package/types/ks-digital-designsystem-angular-details.d.ts +20 -0
  82. package/types/ks-digital-designsystem-angular-dialog.d.ts +18 -0
  83. package/types/ks-digital-designsystem-angular-dropdown.d.ts +13 -0
  84. package/types/ks-digital-designsystem-angular-error-summary.d.ts +14 -0
  85. package/types/ks-digital-designsystem-angular-forms.d.ts +81 -0
  86. package/types/ks-digital-designsystem-angular-heading.d.ts +19 -0
  87. package/types/ks-digital-designsystem-angular-link.d.ts +9 -0
  88. package/types/ks-digital-designsystem-angular-pagination.d.ts +58 -0
  89. package/types/ks-digital-designsystem-angular-paragraph.d.ts +8 -0
  90. package/types/ks-digital-designsystem-angular-popover.d.ts +13 -0
  91. package/types/ks-digital-designsystem-angular-search.d.ts +76 -0
  92. package/types/ks-digital-designsystem-angular-skeleton.d.ts +18 -0
  93. package/types/ks-digital-designsystem-angular-spinner.d.ts +23 -0
  94. package/types/ks-digital-designsystem-angular-suggestion.d.ts +132 -0
  95. package/types/ks-digital-designsystem-angular-table.d.ts +43 -0
  96. package/types/ks-digital-designsystem-angular-tabs.d.ts +65 -0
  97. package/types/ks-digital-designsystem-angular-tag.d.ts +15 -0
  98. package/types/ks-digital-designsystem-angular-validation-message.d.ts +8 -0
  99. package/types/ks-digital-designsystem-angular.d.ts +2 -0
  100. package/validation-message/README.md +3 -0
  101. package/dist/README.md +0 -43
  102. package/dist/fesm2022/ks-digital-designsystem-angular.mjs +0 -195
  103. package/dist/fesm2022/ks-digital-designsystem-angular.mjs.map +0 -1
  104. package/dist/index.d.ts +0 -75
@@ -0,0 +1,15 @@
1
+ import * as i0 from '@angular/core';
2
+ import * as i1 from '@ks-digital/designsystem-angular/__internals';
3
+
4
+ declare class Tag {
5
+ /**
6
+ * The visual variant of the tag
7
+ *
8
+ * @default 'default'
9
+ */
10
+ readonly variant: i0.InputSignal<"default" | "outline">;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<Tag, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<Tag, "ksd-tag", never, { "variant": { "alias": "data-variant"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof i1.HostSize; inputs: { "data-size": "data-size"; }; outputs: {}; }, { directive: typeof i1.HostColor; inputs: { "data-color": "data-color"; }; outputs: {}; }]>;
13
+ }
14
+
15
+ export { Tag };
@@ -0,0 +1,8 @@
1
+ import * as i0 from '@angular/core';
2
+
3
+ declare class ValidationMessage {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ValidationMessage, "[ksd-validation-message]", never, {}, {}, never, never, true, never>;
6
+ }
7
+
8
+ export { ValidationMessage };
@@ -0,0 +1,2 @@
1
+
2
+ export { };
@@ -0,0 +1,3 @@
1
+ # @ks-digital/designsystem-angular/validation-message
2
+
3
+ Secondary entry point of `@ks-digital/designsystem-angular`. It can be used by importing from `@ks-digital/designsystem-angular/validation-message`.
package/dist/README.md DELETED
@@ -1,43 +0,0 @@
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
23
- href="https://static.fiks.ks.no/googlefonts/googleapis/css2?family=Inter&display=swap"
24
- rel="stylesheet"
25
- />
26
- ```
27
-
28
- ### 2. Import Base Styles and Themes
29
-
30
- Import the base styles and the theme you want to use in your application:
31
-
32
- ```javascript
33
- import '@ks-digital/designsystem-themes/base.css'
34
- import '@ks-digital/designsystem-themes/ledsagerbevis.css'
35
- ```
36
-
37
- ### 3. Use Components
38
-
39
- To be written.
40
-
41
- ## Example
42
-
43
- A complete example setup is available in the `angular-demo` located under the `apps` folder.
@@ -1,195 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { input, Directive, model, Component, contentChild, signal, afterNextRender, isDevMode } 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.3", ngImport: i0, type: CommonInputs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
23
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", 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.3", ngImport: i0, type: CommonInputs, decorators: [{
26
- type: Directive
27
- }] });
28
-
29
- class Checkbox {
30
- id = model();
31
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Checkbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
32
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.3", type: Checkbox, isStandalone: true, selector: "input[ksd-checkbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { id: "idChange" }, host: { attributes: { "type": "checkbox" }, properties: { "attr.id": "id()" }, classAttribute: "ds-input" }, hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: ``, isInline: true });
33
- }
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Checkbox, decorators: [{
35
- type: Component,
36
- args: [{
37
- selector: 'input[ksd-checkbox]',
38
- hostDirectives: [{
39
- directive: CommonInputs,
40
- inputs: ['data-size', 'data-color']
41
- }],
42
- host: {
43
- type: 'checkbox',
44
- class: 'ds-input',
45
- '[attr.id]': 'id()',
46
- },
47
- template: ``,
48
- }]
49
- }] });
50
-
51
- const randomId = () => {
52
- return Math.random().toString(36).slice(2, 7);
53
- };
54
-
55
- class Label {
56
- for = model();
57
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
58
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.3", type: Label, isStandalone: true, selector: "ksd-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { for: "forChange" }, hostDirectives: [{ directive: CommonInputs, inputs: ["data-size", "data-size", "data-color", "data-color"] }], ngImport: i0, template: `<label class="ds-label" [for]="for()"><ng-content /></label>`, isInline: true });
59
- }
60
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Label, decorators: [{
61
- type: Component,
62
- args: [{
63
- selector: 'ksd-label',
64
- hostDirectives: [{
65
- directive: CommonInputs,
66
- inputs: ['data-size', 'data-color']
67
- }],
68
- template: `<label class="ds-label" [for]="for()"><ng-content /></label>`,
69
- }]
70
- }] });
71
-
72
- /**
73
- * Use the Field component to connect inputs and labels
74
- */
75
- class Field {
76
- /**
77
- * Position of toggle inputs (radio, checkbox, switch) in field
78
- * @default start
79
- */
80
- position = input('start');
81
- input = contentChild(Checkbox);
82
- label = contentChild(Label);
83
- id = signal(randomId());
84
- constructor() {
85
- afterNextRender(() => {
86
- if (isDevMode() && (!this.label() || !this.input())) {
87
- console.error('[Field] Missing required elements: ksd-label and ksd-input must be provided as children');
88
- }
89
- this.input()?.id.set(this.id());
90
- this.label()?.for.set(this.id());
91
- });
92
- }
93
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Field, deps: [], target: i0.ɵɵFactoryTarget.Component });
94
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.3", 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: Checkbox, 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: ` <ng-content /> `, isInline: true });
95
- }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Field, decorators: [{
97
- type: Component,
98
- args: [{
99
- selector: 'ksd-field',
100
- hostDirectives: [
101
- {
102
- directive: CommonInputs,
103
- inputs: ['data-size', 'data-color'],
104
- },
105
- ],
106
- host: {
107
- class: 'ds-field',
108
- '[attr.dataPosition]': 'position()',
109
- },
110
- template: ` <ng-content /> `,
111
- }]
112
- }], ctorParameters: () => [] });
113
-
114
- class Fieldset {
115
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Fieldset, deps: [], target: i0.ɵɵFactoryTarget.Component });
116
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: Fieldset, isStandalone: true, selector: "fieldset[ksd-fieldset]", host: { attributes: { "role": "fieldset" }, classAttribute: "ds-fieldset" }, ngImport: i0, template: ` <ng-content /> `, isInline: true });
117
- }
118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Fieldset, decorators: [{
119
- type: Component,
120
- args: [{
121
- selector: 'fieldset[ksd-fieldset]',
122
- host: {
123
- role: 'fieldset',
124
- class: 'ds-fieldset',
125
- },
126
- template: ` <ng-content /> `,
127
- }]
128
- }] });
129
-
130
- class FieldsetDescription {
131
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FieldsetDescription, deps: [], target: i0.ɵɵFactoryTarget.Component });
132
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: FieldsetDescription, isStandalone: true, selector: "p[ksd-fieldset-description]", ngImport: i0, template: `<ng-content />`, isInline: true });
133
- }
134
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FieldsetDescription, decorators: [{
135
- type: Component,
136
- args: [{
137
- selector: 'p[ksd-fieldset-description]',
138
- template: `<ng-content />`,
139
- host: {}
140
- }]
141
- }] });
142
-
143
- class FieldsetLegend {
144
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FieldsetLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
145
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: FieldsetLegend, isStandalone: true, selector: "legend[ksd-fieldset-legend]", host: { attributes: { "role": "legend" }, classAttribute: "ds-label" }, ngImport: i0, template: ` <ng-content /> `, isInline: true });
146
- }
147
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FieldsetLegend, decorators: [{
148
- type: Component,
149
- args: [{
150
- selector: 'legend[ksd-fieldset-legend]',
151
- host: {
152
- role: 'legend',
153
- class: 'ds-label',
154
- },
155
- template: ` <ng-content /> `,
156
- }]
157
- }] });
158
-
159
- class Paragraph {
160
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Paragraph, deps: [], target: i0.ɵɵFactoryTarget.Component });
161
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: Paragraph, isStandalone: true, selector: "ksd-paragraph", host: { classAttribute: "ds-paragraph" }, ngImport: i0, template: `<ng-content />`, isInline: true });
162
- }
163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Paragraph, decorators: [{
164
- type: Component,
165
- args: [{
166
- selector: 'ksd-paragraph',
167
- template: `<ng-content />`,
168
- host: {
169
- class: 'ds-paragraph',
170
- },
171
- }]
172
- }] });
173
-
174
- class ValidationMessage {
175
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ValidationMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
176
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", 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 });
177
- }
178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ValidationMessage, decorators: [{
179
- type: Component,
180
- args: [{
181
- selector: 'p[ksd-validation-message]',
182
- template: `<ng-content />`,
183
- host: {
184
- class: 'ds-validation-message',
185
- 'data-field': 'validation',
186
- },
187
- }]
188
- }] });
189
-
190
- /**
191
- * Generated bundle index. Do not edit.
192
- */
193
-
194
- export { Checkbox, CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Label, Paragraph, ValidationMessage };
195
- //# sourceMappingURL=ks-digital-designsystem-angular.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ks-digital-designsystem-angular.mjs","sources":["../../src/components/common-inputs.ts","../../src/components/checkbox/checkbox.ts","../../src/utils/random-id.ts","../../src/components/label/label.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/components/validation-message/validation-message.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 { Component, model } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\n\n@Component({\n selector: 'input[ksd-checkbox]',\n hostDirectives: [{\n directive: CommonInputs,\n inputs: ['data-size', 'data-color']\n }],\n host: {\n type: 'checkbox',\n class: 'ds-input',\n '[attr.id]': 'id()',\n },\n template: ``,\n})\nexport class Checkbox {\n id = model<string>()\n}\n","export const randomId = () => {\n return Math.random().toString(36).slice(2, 7)\n}\n","import { Component, model } from '@angular/core'\nimport { CommonInputs } from '../common-inputs'\n\n@Component({\n selector: 'ksd-label',\n hostDirectives: [{\n directive: CommonInputs,\n inputs: ['data-size', 'data-color']\n }],\n template: `<label class=\"ds-label\" [for]=\"for()\"><ng-content /></label>`,\n})\nexport class Label {\n for = model<string>()\n}\n","import {\n afterNextRender,\n Component,\n contentChild,\n input,\n isDevMode,\n signal,\n} from '@angular/core'\nimport { randomId } from '../../utils/random-id'\nimport { Checkbox } from '../checkbox/checkbox'\nimport { CommonInputs } from '../common-inputs'\nimport { Label } from '../label/label'\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: ` <ng-content /> `,\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(Checkbox)\n private label = contentChild(Label)\n private readonly id = signal(randomId())\n\n constructor() {\n afterNextRender(() => {\n if (isDevMode() && (!this.label() || !this.input())) {\n console.error(\n '[Field] Missing required elements: ksd-label and ksd-input must be provided as children',\n )\n }\n\n this.input()?.id.set(this.id())\n this.label()?.for.set(this.id())\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}\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: 'ksd-paragraph',\n template: `<ng-content />`,\n host: {\n class: 'ds-paragraph',\n },\n})\nexport class Paragraph {}\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AAEA;;;;AAIG;MAQU,YAAY,CAAA;AACrB;;;AAGG;IACH,QAAQ,GAAG,KAAK,CAAO,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAEzD;;;;AAIG;IACH,SAAS,GAAG,KAAK,CAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;uGAZnD,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA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J,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA;AACF,iBAAA;;;MCEY,iBAAiB,CAAA;uGAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAjB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,iBAAiB,oLANlB,CAAgB,cAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAMf,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAR7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,2BAA2B;AACrC,oBAAA,QAAQ,EAAE,CAAgB,cAAA,CAAA;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,uBAAuB;AAC9B,wBAAA,YAAY,EAAE,YAAY;AAC3B,qBAAA;AACF,iBAAA;;;ACTD;;AAEG;;;;"}
package/dist/index.d.ts DELETED
@@ -1,75 +0,0 @@
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
- declare class Checkbox {
21
- id: i0.ModelSignal<string>;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<Checkbox, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<Checkbox, "input[ksd-checkbox]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "id": "idChange"; }, never, never, true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
24
- }
25
-
26
- /**
27
- * Use the Field component to connect inputs and labels
28
- */
29
- declare class Field {
30
- /**
31
- * Position of toggle inputs (radio, checkbox, switch) in field
32
- * @default start
33
- */
34
- position: i0.InputSignal<"start" | "end">;
35
- private input;
36
- private label;
37
- private readonly id;
38
- constructor();
39
- static ɵfac: i0.ɵɵFactoryDeclaration<Field, never>;
40
- 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: {}; }]>;
41
- }
42
-
43
- declare class Fieldset {
44
- static ɵfac: i0.ɵɵFactoryDeclaration<Fieldset, never>;
45
- static ɵcmp: i0.ɵɵComponentDeclaration<Fieldset, "fieldset[ksd-fieldset]", never, {}, {}, never, ["*"], true, never>;
46
- }
47
-
48
- declare class FieldsetDescription {
49
- static ɵfac: i0.ɵɵFactoryDeclaration<FieldsetDescription, never>;
50
- static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetDescription, "p[ksd-fieldset-description]", never, {}, {}, never, ["*"], true, never>;
51
- }
52
-
53
- declare class FieldsetLegend {
54
- static ɵfac: i0.ɵɵFactoryDeclaration<FieldsetLegend, never>;
55
- static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetLegend, "legend[ksd-fieldset-legend]", never, {}, {}, never, ["*"], true, never>;
56
- }
57
-
58
- declare class Label {
59
- for: i0.ModelSignal<string>;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<Label, never>;
61
- static ɵcmp: i0.ɵɵComponentDeclaration<Label, "ksd-label", never, { "for": { "alias": "for"; "required": false; "isSignal": true; }; }, { "for": "forChange"; }, never, ["*"], true, [{ directive: typeof CommonInputs; inputs: { "data-size": "data-size"; "data-color": "data-color"; }; outputs: {}; }]>;
62
- }
63
-
64
- declare class Paragraph {
65
- static ɵfac: i0.ɵɵFactoryDeclaration<Paragraph, never>;
66
- static ɵcmp: i0.ɵɵComponentDeclaration<Paragraph, "ksd-paragraph", never, {}, {}, never, ["*"], true, never>;
67
- }
68
-
69
- declare class ValidationMessage {
70
- static ɵfac: i0.ɵɵFactoryDeclaration<ValidationMessage, never>;
71
- static ɵcmp: i0.ɵɵComponentDeclaration<ValidationMessage, "p[ksd-validation-message]", never, {}, {}, never, ["*"], true, never>;
72
- }
73
-
74
- export { Checkbox, CommonInputs, Field, Fieldset, FieldsetDescription, FieldsetLegend, Label, Paragraph, ValidationMessage };
75
- export type { Size };