@ks-digital/designsystem-angular 0.0.1-alpha.23 → 0.0.1-alpha.25
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/.storybook/customTheme.ts +15 -0
- package/.storybook/default-args.ts +18 -0
- package/.storybook/main.ts +27 -0
- package/.storybook/manager.ts +10 -0
- package/.storybook/preview-head.html +16 -0
- package/.storybook/preview.ts +70 -0
- package/.storybook/themes.ts +9 -0
- package/.storybook/tsconfig.json +16 -0
- package/.storybook/vite.config.mts +5 -0
- package/README.md +3 -3
- package/eslint.config.mjs +28 -0
- package/ng-package.json +9 -0
- package/package.json +18 -27
- package/project.json +81 -0
- package/src/components/alert/alert.mdx +46 -0
- package/src/components/alert/alert.spec.ts +33 -0
- package/src/components/alert/alert.stories.ts +138 -0
- package/src/components/alert/alert.ts +46 -0
- package/src/components/alert/index.ts +1 -0
- package/src/components/button/button.mdx +40 -0
- package/src/components/button/button.spec.ts +86 -0
- package/src/components/button/button.stories.ts +123 -0
- package/src/components/button/button.ts +60 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/card/card-block.ts +10 -0
- package/src/components/card/card.mdx +100 -0
- package/src/components/card/card.spec.ts +70 -0
- package/src/components/card/card.stories.ts +101 -0
- package/src/components/card/card.ts +44 -0
- package/src/components/card/index.ts +2 -0
- package/src/components/checkbox/README.md +13 -0
- package/src/components/checkbox/checkbox.mdx +50 -0
- package/src/components/checkbox/checkbox.spec.ts +21 -0
- package/src/components/checkbox/checkbox.stories.ts +182 -0
- package/src/components/checkbox/index.ts +0 -0
- package/src/components/colors.ts +36 -0
- package/src/components/common-inputs.ts +30 -0
- package/src/components/details/controlled-details.ts +63 -0
- package/src/components/details/details-content.ts +7 -0
- package/src/components/details/details-summary.ts +7 -0
- package/src/components/details/details.mdx +89 -0
- package/src/components/details/details.spec.ts +56 -0
- package/src/components/details/details.stories.ts +129 -0
- package/src/components/details/details.ts +69 -0
- package/src/components/details/index.ts +3 -0
- package/src/components/field/field-counter.ts +56 -0
- package/src/components/field/field-description.ts +10 -0
- package/src/components/field/field-error.ts +13 -0
- package/src/components/field/field-observer.ts +121 -0
- package/src/components/field/field-state.ts +21 -0
- package/src/components/field/field.mdx +40 -0
- package/src/components/field/field.spec.ts +131 -0
- package/src/components/field/field.stories.ts +98 -0
- package/src/components/field/field.ts +70 -0
- package/src/components/field/index.ts +3 -0
- package/src/components/fieldset/fieldset-description.ts +8 -0
- package/src/components/fieldset/fieldset-legend.ts +11 -0
- package/src/components/fieldset/fieldset.spec.ts +80 -0
- package/src/components/fieldset/fieldset.ts +11 -0
- package/src/components/fieldset/index.ts +3 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.mdx +11 -0
- package/src/components/input/input.spec.ts +25 -0
- package/src/components/input/input.stories.ts +72 -0
- package/src/components/input/input.ts +67 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/label/label.ts +17 -0
- package/src/components/paragraph/index.ts +1 -0
- package/src/components/paragraph/paragraph.ts +10 -0
- package/src/components/popover/controlled-popover.ts +62 -0
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover.mdx +81 -0
- package/src/components/popover/popover.spec.ts +143 -0
- package/src/components/popover/popover.stories.ts +63 -0
- package/src/components/popover/popover.ts +186 -0
- package/src/components/radio/radio.mdx +117 -0
- package/src/components/radio/radio.stories.ts +226 -0
- package/src/components/search/index.ts +4 -0
- package/src/components/search/search-button.ts +35 -0
- package/src/components/search/search-clear.ts +57 -0
- package/src/components/search/search-input.ts +18 -0
- package/src/components/search/search.mdx +56 -0
- package/src/components/search/search.spec.ts +48 -0
- package/src/components/search/search.stories.ts +205 -0
- package/src/components/search/search.ts +50 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.mdx +24 -0
- package/src/components/spinner/spinner.spec.ts +13 -0
- package/src/components/spinner/spinner.stories.ts +54 -0
- package/src/components/spinner/spinner.ts +62 -0
- package/src/components/switch/switch.mdx +82 -0
- package/src/components/switch/switch.stories.ts +94 -0
- package/src/components/textarea/textarea.mdx +14 -0
- package/src/components/textarea/textarea.stories.ts +52 -0
- package/src/components/validation-message/index.ts +1 -0
- package/src/components/validation-message/validation-message.ts +11 -0
- package/src/index.ts +14 -0
- package/src/test-setup.ts +12 -0
- package/src/utils/log-if-devmode.ts +13 -0
- package/src/utils/random-id.ts +3 -0
- package/tsconfig.json +34 -0
- package/tsconfig.lib.json +28 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +30 -0
- package/vite.config.mts +35 -0
- package/dist/README.md +0 -55
- package/dist/fesm2022/ks-digital-designsystem-angular.mjs +0 -1068
- package/dist/fesm2022/ks-digital-designsystem-angular.mjs.map +0 -1
- package/dist/index.d.ts +0 -315
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, Primary, Controls, Story } from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
import * as TextareaStories from './textarea.stories'
|
|
4
|
+
|
|
5
|
+
<Meta of={TextareaStories} />
|
|
6
|
+
|
|
7
|
+
# Textarea
|
|
8
|
+
|
|
9
|
+
`Textarea` brukes når brukeren skal kunne skrive inn tekst som går over flere linjer.
|
|
10
|
+
|
|
11
|
+
<Primary />
|
|
12
|
+
<Controls />
|
|
13
|
+
|
|
14
|
+
## Bruk
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
argsToTemplate,
|
|
3
|
+
moduleMetadata,
|
|
4
|
+
type Meta,
|
|
5
|
+
type StoryObj,
|
|
6
|
+
} from '@storybook/angular'
|
|
7
|
+
import { CommonArgs } from '../../../.storybook/default-args'
|
|
8
|
+
import { Field } from '../field/field'
|
|
9
|
+
import { Input } from '../input/input'
|
|
10
|
+
import { Label } from '../label/label'
|
|
11
|
+
|
|
12
|
+
type TextareaArgs = CommonArgs & {
|
|
13
|
+
readonly: boolean
|
|
14
|
+
disabled: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const meta: Meta<TextareaArgs> = {
|
|
18
|
+
component: Input,
|
|
19
|
+
title: 'Komponenter/Textarea',
|
|
20
|
+
decorators: [
|
|
21
|
+
moduleMetadata({
|
|
22
|
+
imports: [Label, Field, Input],
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
export default meta
|
|
27
|
+
type Story = StoryObj<TextareaArgs>
|
|
28
|
+
|
|
29
|
+
export const Preview: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
readonly: false,
|
|
32
|
+
disabled: false,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
render: (args) => ({
|
|
36
|
+
props: args,
|
|
37
|
+
template: `
|
|
38
|
+
<div style="
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--ds-size-2);
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
width: 20rem
|
|
44
|
+
" >
|
|
45
|
+
<ksd-field>
|
|
46
|
+
<ksd-label>Label</ksd-label>
|
|
47
|
+
<textarea ksd-input type="text" ${argsToTemplate(args)}></textarea>
|
|
48
|
+
</ksd-field>
|
|
49
|
+
</div>
|
|
50
|
+
`,
|
|
51
|
+
}),
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ValidationMessage } from './validation-message'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Directive } from '@angular/core'
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
5
|
+
selector: '[ksd-validation-message]',
|
|
6
|
+
host: {
|
|
7
|
+
class: 'ds-validation-message',
|
|
8
|
+
'data-field': 'validation',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class ValidationMessage {}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './components/alert'
|
|
2
|
+
export * from './components/button'
|
|
3
|
+
export * from './components/card'
|
|
4
|
+
export * from './components/common-inputs'
|
|
5
|
+
export * from './components/details'
|
|
6
|
+
export * from './components/field'
|
|
7
|
+
export * from './components/fieldset'
|
|
8
|
+
export * from './components/input'
|
|
9
|
+
export * from './components/label'
|
|
10
|
+
export * from './components/paragraph'
|
|
11
|
+
export * from './components/popover'
|
|
12
|
+
export * from './components/search'
|
|
13
|
+
export * from './components/spinner'
|
|
14
|
+
export * from './components/validation-message'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@analogjs/vitest-angular/setup-zone'
|
|
2
|
+
|
|
3
|
+
import { getTestBed } from '@angular/core/testing'
|
|
4
|
+
import {
|
|
5
|
+
BrowserTestingModule,
|
|
6
|
+
platformBrowserTesting,
|
|
7
|
+
} from '@angular/platform-browser/testing'
|
|
8
|
+
|
|
9
|
+
getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting())
|
|
10
|
+
|
|
11
|
+
// Need jest-dom for matchers like expect.toHaveAttribute
|
|
12
|
+
import '@testing-library/jest-dom'
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"forceConsistentCasingInFileNames": true,
|
|
5
|
+
"strict": true,
|
|
6
|
+
"noImplicitOverride": true,
|
|
7
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
8
|
+
"noImplicitReturns": true,
|
|
9
|
+
"noFallthroughCasesInSwitch": true
|
|
10
|
+
},
|
|
11
|
+
"files": [],
|
|
12
|
+
"include": [],
|
|
13
|
+
"references": [
|
|
14
|
+
{
|
|
15
|
+
"path": "./tsconfig.lib.json"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "./tsconfig.spec.json"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "./.storybook/tsconfig.json"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"extends": "../../tsconfig.base.json",
|
|
25
|
+
"angularCompilerOptions": {
|
|
26
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
27
|
+
"strictInputAccessModifiers": true,
|
|
28
|
+
"strictInjectionParameters": true,
|
|
29
|
+
"strictTemplates": true,
|
|
30
|
+
"extendedDiagnostics": {
|
|
31
|
+
"defaultCategory": "error"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"inlineSources": true,
|
|
8
|
+
"types": []
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*.ts", "src/typings.d.ts"],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"vite.config.ts",
|
|
13
|
+
"vite.config.mts",
|
|
14
|
+
"vitest.config.ts",
|
|
15
|
+
"vitest.config.mts",
|
|
16
|
+
"src/**/*.spec.ts",
|
|
17
|
+
"src/test-setup.ts",
|
|
18
|
+
"jest.config.ts",
|
|
19
|
+
"src/**/*.test.ts",
|
|
20
|
+
"src/**/*.test.tsx",
|
|
21
|
+
"src/**/*.spec.tsx",
|
|
22
|
+
"src/**/*.test.js",
|
|
23
|
+
"src/**/*.spec.js",
|
|
24
|
+
"src/**/*.test.jsx",
|
|
25
|
+
"src/**/*.spec.jsx",
|
|
26
|
+
"src/test-setup.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"vitest/globals",
|
|
7
|
+
"vitest/importMeta",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"node",
|
|
10
|
+
"vitest",
|
|
11
|
+
"@testing-library/jest-dom"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"vite.config.ts",
|
|
16
|
+
"vite.config.mts",
|
|
17
|
+
"vitest.config.ts",
|
|
18
|
+
"vitest.config.mts",
|
|
19
|
+
"src/**/*.test.ts",
|
|
20
|
+
"src/**/*.spec.ts",
|
|
21
|
+
"src/**/*.test.tsx",
|
|
22
|
+
"src/**/*.spec.tsx",
|
|
23
|
+
"src/**/*.test.js",
|
|
24
|
+
"src/**/*.spec.js",
|
|
25
|
+
"src/**/*.test.jsx",
|
|
26
|
+
"src/**/*.spec.jsx",
|
|
27
|
+
"src/**/*.d.ts"
|
|
28
|
+
],
|
|
29
|
+
"files": ["src/test-setup.ts"]
|
|
30
|
+
}
|
package/vite.config.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import angular from '@analogjs/vite-plugin-angular'
|
|
3
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'
|
|
4
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'
|
|
5
|
+
import * as path from 'path'
|
|
6
|
+
import { defineConfig } from 'vite'
|
|
7
|
+
import dts from 'vite-plugin-dts'
|
|
8
|
+
|
|
9
|
+
export default defineConfig(() => ({
|
|
10
|
+
root: __dirname,
|
|
11
|
+
cacheDir: '../../node_modules/.vite/packages/angular',
|
|
12
|
+
plugins: [
|
|
13
|
+
angular({
|
|
14
|
+
inlineStylesExtension: 'scss',
|
|
15
|
+
}),
|
|
16
|
+
nxViteTsPaths(),
|
|
17
|
+
nxCopyAssetsPlugin(['*.md']),
|
|
18
|
+
dts({
|
|
19
|
+
entryRoot: 'src',
|
|
20
|
+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
test: {
|
|
24
|
+
watch: false,
|
|
25
|
+
globals: true,
|
|
26
|
+
environment: 'jsdom',
|
|
27
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
28
|
+
setupFiles: ['src/test-setup.ts'],
|
|
29
|
+
reporters: ['default'],
|
|
30
|
+
coverage: {
|
|
31
|
+
reportsDirectory: '../../coverage/packages/angular',
|
|
32
|
+
provider: 'v8' as const,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}))
|
package/dist/README.md
DELETED
|
@@ -1,55 +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 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
|
-
```ts
|
|
37
|
-
import { Button } from '@ks-digital/designsystem-angular'
|
|
38
|
-
|
|
39
|
-
@Component({
|
|
40
|
-
imports: [Button],
|
|
41
|
-
template: `
|
|
42
|
-
<button ksd-button>
|
|
43
|
-
Click me
|
|
44
|
-
</button>
|
|
45
|
-
`,
|
|
46
|
-
})
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Example
|
|
50
|
-
|
|
51
|
-
A complete example setup is available in the `angular-demo` located under the `apps` folder.
|
|
52
|
-
|
|
53
|
-
## Development
|
|
54
|
-
|
|
55
|
-
`pnpm nx run @ks-digital/designsystem-angular:storybook`
|