@politiet/sheriff-web-components 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Sheriff Design System Web Component Library
2
+
3
+ ## Alpha Release
4
+
5
+ This library is currently in an early alpha stage and should be considered highly experimental and unstable. It's under active development, and we're working to add more components and improve stability.
6
+
7
+ ## ⚠️ Disclaimer
8
+
9
+ This version is intended for testing and feedback purposes only. It is not suitable for production use at this stage. Features and components may change significantly. We appreciate your interest and contributions, but please use it with caution.
10
+
11
+ ### Prerequisites
12
+
13
+ To visually adhere to the Sheriff design system you need to include the Roboto font in your application.
14
+
15
+ ### Installation
16
+
17
+ ```bash
18
+ # Using npm
19
+ npm install @politiet/sheriff-web-components --save
20
+
21
+ # Using yarn
22
+ yarn add @politiet/sheriff-web-components
23
+ ```
24
+
25
+ Note: As this is an alpha release, expect frequent updates and breaking changes. We recommend using it for experimental projects only.
26
+
27
+ ### Usage
28
+
29
+ To start using the components in your project, import them as follows:
30
+
31
+ All components:
32
+
33
+ ```javascript
34
+ import '@politiet/sheriff-web-components';
35
+ ```
36
+
37
+ Spesific components:
38
+
39
+ ```javascript
40
+ import '@politiet/sheriff-web-components/dist/s-button';
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ We welcome contributions! Whether it's reporting bugs, feature requests, or contributing code, please feel free to reach out.
46
+
47
+ ## Feedback
48
+
49
+ Your feedback is invaluable to us. Please submit any feedback or issues you encounter through our GitHub issue tracker.
50
+
51
+ ## License
52
+
53
+ This project is licensed under the ISC License.
@@ -0,0 +1,2 @@
1
+ export * from './s-button/s-button';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './s-button/s-button';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './s-button/s-button';\n"]}
@@ -0,0 +1,16 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class SButton extends LitElement {
3
+ static styles: import("lit").CSSResult[];
4
+ name: string;
5
+ type: 'button' | 'submit' | 'reset';
6
+ variant: 'primary' | 'secondary' | 'tertiary';
7
+ size: 'large' | 'medium' | 'small';
8
+ disabled: boolean;
9
+ render(): import("lit-html").TemplateResult<1>;
10
+ }
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 's-button': SButton;
14
+ }
15
+ }
16
+ //# sourceMappingURL=s-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s-button.d.ts","sourceRoot":"","sources":["../../src/s-button/s-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,qBACa,OAAQ,SAAQ,UAAU;IAEtC,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG/C,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAa;IAG1D,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAW;IAG7C,QAAQ,UAAS;IAER,MAAM;CAmBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,OAAO,CAAC;KACpB;CACD"}
@@ -0,0 +1,59 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { classMap } from 'lit/directives/class-map.js';
10
+ import { styles } from './s-button.styles';
11
+ let SButton = class SButton extends LitElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.type = 'button';
15
+ this.variant = 'primary';
16
+ this.size = 'large';
17
+ this.disabled = false;
18
+ }
19
+ render() {
20
+ const buttonClasses = {
21
+ 's-button--secondary': this.variant === 'secondary',
22
+ 's-button--tertiary': this.variant === 'tertiary',
23
+ 's-button--medium': this.size === 'medium',
24
+ 's-button--small': this.size === 'small',
25
+ };
26
+ return html `
27
+ <button
28
+ class="s-button${classMap(buttonClasses)}"
29
+ type="${this.type}"
30
+ name="${this.name}"
31
+ ?disabled="${this.disabled}"
32
+ >
33
+ <slot></slot>
34
+ </button>
35
+ `;
36
+ }
37
+ };
38
+ // Styling
39
+ SButton.styles = [styles];
40
+ __decorate([
41
+ property({ type: String })
42
+ ], SButton.prototype, "name", void 0);
43
+ __decorate([
44
+ property({ type: String })
45
+ ], SButton.prototype, "type", void 0);
46
+ __decorate([
47
+ property({ type: String })
48
+ ], SButton.prototype, "variant", void 0);
49
+ __decorate([
50
+ property({ type: String })
51
+ ], SButton.prototype, "size", void 0);
52
+ __decorate([
53
+ property({ type: Boolean })
54
+ ], SButton.prototype, "disabled", void 0);
55
+ SButton = __decorate([
56
+ customElement('s-button')
57
+ ], SButton);
58
+ export { SButton };
59
+ //# sourceMappingURL=s-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s-button.js","sourceRoot":"","sources":["../../src/s-button/s-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,O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AuCnB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './s-button.styles';\n\n@customElement('s-button')\nexport class SButton extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tname!: string;\n\n\t@property({ type: String })\n\ttype: 'button' | 'submit' | 'reset' = 'button';\n\n\t@property({ type: String })\n\tvariant: 'primary' | 'secondary' | 'tertiary' = 'primary';\n\n\t@property({ type: String })\n\tsize: 'large' | 'medium' | 'small' = 'large';\n\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\toverride render() {\n\t\tconst buttonClasses = {\n\t\t\t's-button--secondary': this.variant === 'secondary',\n\t\t\t's-button--tertiary': this.variant === 'tertiary',\n\t\t\t's-button--medium': this.size === 'medium',\n\t\t\t's-button--small': this.size === 'small',\n\t\t};\n\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tclass=\"s-button${classMap(buttonClasses)}\"\n\t\t\t\ttype=\"${this.type}\"\n\t\t\t\tname=\"${this.name}\"\n\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t</button>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t's-button': SButton;\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=s-button.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s-button.styles.d.ts","sourceRoot":"","sources":["../../src/s-button/s-button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgHlB,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ .s-button {
4
+ align-items: center;
5
+ display: inline-flex;
6
+ gap: var(--sds-spacing-3, 8px);
7
+ justify-content: center;
8
+ padding: var(--sds-spacing-3) var(--sds-spacing-4);
9
+
10
+ background-color: var(--sds-color-semantic-surface-action-default);
11
+ border: 2px solid var(--sds-color-semantic-border-action);
12
+ border-radius: var(--sds-radius-4);
13
+ cursor: pointer;
14
+
15
+ color: var(--sds-color-semantic-text-on-action);
16
+ font-family: 'Roboto';
17
+ font-size: 1rem;
18
+ font-weight: 500;
19
+ line-height: 1.5;
20
+ text-align: center;
21
+
22
+ &:focus {
23
+ background-color: var(--sds-color-semantic-surface-action-default);
24
+ outline: 2px solid var(--sds-color-semantic-surface-action-default);
25
+ outline-offset: 1px;
26
+ }
27
+
28
+ &:hover {
29
+ background-color: var(--sds-color-semantic-surface-action-hover);
30
+ border: 2px solid var(--sds-color-semantic-surface-action-hover);
31
+ }
32
+
33
+ &:active {
34
+ background-color: var(--sds-color-semantic-surface-action-active);
35
+ border: 2px solid var(--sds-color-semantic-surface-action-active);
36
+ outline: 0;
37
+ }
38
+
39
+ &:disabled {
40
+ background-color: var(--sds-color-semantic-surface-disabled);
41
+ border: 2px solid var(--sds-color-semantic-surface-disabled);
42
+ cursor: not-allowed;
43
+ }
44
+ }
45
+
46
+ .s-button--secondary {
47
+ background-color: var(--sds-color-semantic-surface-action-inverted);
48
+ border: 2px solid var(--sds-color-semantic-border-action);
49
+ color: var(--sds-color-semantic-text-default);
50
+
51
+ &:focus {
52
+ background-color: var(--sds-color-semantic-surface-action-inverted);
53
+ border: 2px solid var(--sds-color-semantic-border-action);
54
+ }
55
+
56
+ &:hover {
57
+ background-color: var(--sds-color-semantic-surface-action-subtle);
58
+ }
59
+
60
+ &:active {
61
+ background-color: var(--sds-color-semantic-surface-action-active);
62
+ border: 2px solid var(--sds-color-semantic-surface-action-active);
63
+ color: var(--sds-color-semantic-text-on-action);
64
+ outline: 0;
65
+ }
66
+
67
+ &:disabled {
68
+ border: 2px solid var(--sds-color-semantic-border-disabled);
69
+ background: var(--sds-color-semantic-surface-action-inverted);
70
+ color: var(--sds-color-semantic-text-disabled);
71
+ }
72
+ }
73
+
74
+ .s-button--tertiary {
75
+ background-color: transparent;
76
+ border: 2px solid transparent;
77
+ color: var(--sds-color-semantic-text-action-default);
78
+
79
+ &:focus {
80
+ background-color: transparent;
81
+ border: 2px solid transparent;
82
+ text-decoration: underline;
83
+ }
84
+
85
+ &:hover {
86
+ background-color: var(--sds-color-semantic-surface-action-subtle);
87
+ }
88
+
89
+ &:active {
90
+ background-color: var(--sds-color-semantic-surface-action-active);
91
+ border: 2px solid var(--sds-color-semantic-surface-action-active);
92
+ color: var(--sds-color-semantic-text-on-action);
93
+ outline: 0;
94
+ position: relative;
95
+ text-decoration: underline;
96
+ }
97
+
98
+ &:disabled {
99
+ border: 2px solid transparent;
100
+ background: transparent;
101
+ color: var(--sds-color-semantic-text-disabled);
102
+ text-decoration: underline;
103
+ }
104
+ }
105
+
106
+ .s-button--medium {
107
+ padding: var(--sds-spacing-1) var(--sds-spacing-3);
108
+ }
109
+
110
+ .s-button--small {
111
+ font-size: 0.875rem;
112
+ padding: 0 var(--sds-spacing-3);
113
+ }
114
+ `;
115
+ //# sourceMappingURL=s-button.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s-button.styles.js","sourceRoot":"","sources":["../../src/s-button/s-button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgHxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t.s-button {\n\t\talign-items: center;\n\t\tdisplay: inline-flex;\n\t\tgap: var(--sds-spacing-3, 8px);\n\t\tjustify-content: center;\n\t\tpadding: var(--sds-spacing-3) var(--sds-spacing-4);\n\n\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tborder-radius: var(--sds-radius-4);\n\t\tcursor: pointer;\n\n\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\tfont-family: 'Roboto';\n\t\tfont-size: 1rem;\n\t\tfont-weight: 500;\n\t\tline-height: 1.5;\n\t\ttext-align: center;\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\t\toutline: 2px solid var(--sds-color-semantic-surface-action-default);\n\t\t\toutline-offset: 1px;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-hover);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-hover);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-disabled);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-disabled);\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n\n\t.s-button--secondary {\n\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tcolor: var(--sds-color-semantic-text-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-disabled);\n\t\t\tbackground: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t}\n\t}\n\n\t.s-button--tertiary {\n\t\tbackground-color: transparent;\n\t\tborder: 2px solid transparent;\n\t\tcolor: var(--sds-color-semantic-text-action-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: transparent;\n\t\t\tborder: 2px solid transparent;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t\tposition: relative;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid transparent;\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t\ttext-decoration: underline;\n\t\t}\n\t}\n\n\t.s-button--medium {\n\t\tpadding: var(--sds-spacing-1) var(--sds-spacing-3);\n\t}\n\n\t.s-button--small {\n\t\tfont-size: 0.875rem;\n\t\tpadding: 0 var(--sds-spacing-3);\n\t}\n`;\n"]}
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@politiet/sheriff-web-components",
3
+ "version": "0.0.1",
4
+ "description": "Sheriff Design System Web Components Library",
5
+ "main": "dist/sheriff.js",
6
+ "module": "dist/sheriff.js",
7
+ "type": "module",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "author": "Politiets IT-enhet",
13
+ "license": "ISC"
14
+ }