@cas-smartdesign/field-validation-message 5.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-validation-message.mjs","sources":["../error.svg","../suggest.svg","../warn.svg","../field-validation-message.ts"],"sourcesContent":["export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cstyle%20id='style3'%3e%20.st0{fill:%23fff}.st1{fill:%23c00}%20%3c/style%3e%3cg%20id='g5'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20id='path9'/%3e%3c/g%3e%3cg%20id='g11'%3e%3cpath%20class='st0'%20id='rect13'%20d='M5.5%202.5h1v4h-1z'/%3e%3cpath%20class='st1'%20d='M6%203v3-3m1-1H5v5h2V2z'%20id='path15'/%3e%3c/g%3e%3cg%20id='g17'%3e%3cpath%20class='st0'%20id='rect19'%20d='M5.5%208.5h1v1h-1z'/%3e%3cpath%20class='st1'%20id='polygon21'%20d='M7%208H5v2h2V8z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20id='Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cstyle%3e%20.st0{fill:%23bf8800}%20%3c/style%3e%3cpath%20class='st0'%20d='M12%20.8l11%2019.8v1.3H1v-1.3L12%20.8zm.8-.6h-1.6L0%2020v3h24v-3L12.8.2z'/%3e%3cpath%20class='st0'%20d='M11%208h2v8h-2zm0%2010h2v2h-2z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20fill='%23555'/%3e%3cpath%20d='M6%209V6v3m-1%201h2V5H5v5zm2-8H5v2h2z'%20class='st1'%20fill='%23555'/%3e%3c/svg%3e\"","import { LitElement, html, PropertyValues, unsafeCSS, TemplateResult, ComplexAttributeConverter, css } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport style from \"./style.scss?inline\";\n\nimport error from \"./error.svg\";\nimport suggest from \"./suggest.svg\";\nimport warn from \"./warn.svg\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [SDFieldValidationMessage.ID]: SDFieldValidationMessage;\n }\n}\n\nexport default class SDFieldValidationMessage extends LitElement {\n public static readonly ID = \"sd-field-validation-message\";\n\n public static parseLevel(value: string): ValidationLevel {\n if (value) {\n const correspondingEnumKey = Object.keys(ValidationLevel).find(\n (level) => level.toLowerCase() === value.toLowerCase(),\n );\n return correspondingEnumKey && ValidationLevel[correspondingEnumKey];\n }\n }\n public static levelConverter = {\n fromAttribute(value: string): ValidationLevel {\n return SDFieldValidationMessage.parseLevel(value);\n },\n toAttribute(value: ValidationLevel): string {\n return value && value.toLowerCase();\n },\n } as ComplexAttributeConverter;\n\n @property({ type: String, attribute: true })\n public message: string;\n @property({ type: String, attribute: true })\n public icon: string;\n @property({\n converter: SDFieldValidationMessage.levelConverter,\n reflect: true,\n })\n public level: ValidationLevel;\n\n private _defaultIconPath: string;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n // prettier-ignore\n render(): TemplateResult {\n return html`${this.iconToUse && html`<img class=\"icon\" src=\"${this.iconToUse}\">`}${this.message}`;\n }\n\n private get iconToUse(): string {\n return this.icon || this._defaultIconPath;\n }\n\n shouldUpdate(changedProperties: PropertyValues): boolean {\n if (changedProperties.has(\"level\")) {\n this._defaultIconPath = this.iconForLevel;\n if (!this.icon) {\n return true;\n }\n }\n return super.shouldUpdate(changedProperties);\n }\n\n private get iconForLevel(): string {\n switch (SDFieldValidationMessage.parseLevel(this.level)) {\n case ValidationLevel.Warn:\n return warn;\n case ValidationLevel.Suggest:\n return suggest;\n case ValidationLevel.Error:\n return error;\n default:\n return null;\n }\n }\n}\n\nexport enum ValidationLevel {\n Warn = \"warn\",\n Suggest = \"suggest\",\n Error = \"error\",\n}\n\nif (!customElements.get(SDFieldValidationMessage.ID)) {\n customElements.define(SDFieldValidationMessage.ID, SDFieldValidationMessage);\n}\n"],"names":["error","suggest","warn","_SDFieldValidationMessage","_a","LitElement","value","correspondingEnumKey","ValidationLevel","level","css","unsafeCSS","style","html","changedProperties","__decorateClass","property","SDFieldValidationMessage"],"mappings":";;mdAAeA,IAAA,uuBCAAC,IAAA,iVCAAC,IAAA;;;;;;ACcf,MAAqBC,KAArBC,IAAA,cAAsDC,EAAW;AAAA,EAG7D,OAAc,WAAWC,GAAgC;AACrD,QAAIA,GAAO;AACP,YAAMC,IAAuB,OAAO,KAAKC,CAAe,EAAE;AAAA,QACtD,CAACC,MAAUA,EAAM,YAAY,MAAMH,EAAM,YAAY;AAAA,MAAA;AAElD,aAAAC,KAAwBC,EAAgBD,CAAoB;AAAA,IACvE;AAAA,EACJ;AAAA,EAsBA,WAAW,SAAS;AACT,WAAA;AAAA,MACHG;AAAA,kBACMC,EAAUC,CAAK,CAAC;AAAA;AAAA,IAAA;AAAA,EAG9B;AAAA;AAAA,EAGA,SAAyB;AACd,WAAAC,IAAO,KAAK,aAAaA,2BAA8B,KAAK,SAAS,IAAI,GAAG,KAAK,OAAO;AAAA,EACnG;AAAA,EAEA,IAAY,YAAoB;AACrB,WAAA,KAAK,QAAQ,KAAK;AAAA,EAC7B;AAAA,EAEA,aAAaC,GAA4C;AACjD,WAAAA,EAAkB,IAAI,OAAO,MAC7B,KAAK,mBAAmB,KAAK,cACzB,CAAC,KAAK,QACC,KAGR,MAAM,aAAaA,CAAiB;AAAA,EAC/C;AAAA,EAEA,IAAY,eAAuB;AAC/B,YAAQV,EAAyB,WAAW,KAAK,KAAK,GAAG;AAAA,MACrD,KAAK;AACM,eAAAF;AAAA,MACX,KAAK;AACM,eAAAD;AAAA,MACX,KAAK;AACM,eAAAD;AAAA,MACX;AACW,eAAA;AAAA,IACf;AAAA,EACJ;AACJ,GAtEII,EAAuB,KAAK,+BAU5BA,EAAc,iBAAiB;AAAA,EAC3B,cAAcE,GAAgC;AACnC,WAAAF,EAAyB,WAAWE,CAAK;AAAA,EACpD;AAAA,EACA,YAAYA,GAAgC;AACjC,WAAAA,KAASA,EAAM;EAC1B;AAAA,GAjBRF;AAqBWW,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM;AAAA,GApB1Bb,EAqBV,WAAA,WAAA,CAAA;AAEAY,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM;AAAA,GAtB1Bb,EAuBV,WAAA,QAAA,CAAA;AAKAY,EAAA;AAAA,EAJNC,EAAS;AAAA,IACN,WAAWb,EAAyB;AAAA,IACpC,SAAS;AAAA,EAAA,CACZ;AAAA,GA3BgBA,EA4BV,WAAA,SAAA,CAAA;AA5BX,IAAqBc,IAArBd;AAyEY,IAAAK,sBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,QAAQ,SAHAA,IAAAA,KAAA,CAAA,CAAA;AAMP,eAAe,IAAIS,EAAyB,EAAE,KAChC,eAAA,OAAOA,EAAyB,IAAIA,CAAwB;"}
@@ -0,0 +1,192 @@
1
+ {
2
+ "@cypress/vite-dev-server@5.0.7": {
3
+ "licenses": "MIT",
4
+ "repository": "https://github.com/cypress-io/cypress",
5
+ "licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
6
+ },
7
+ "@rollup/plugin-node-resolve@15.2.3": {
8
+ "licenses": "MIT",
9
+ "repository": "https://github.com/rollup/plugins",
10
+ "licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
11
+ },
12
+ "@types/node@20.10.6": {
13
+ "licenses": "MIT",
14
+ "repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
15
+ "licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
16
+ },
17
+ "@types/postcss-prefix-selector@1.16.3": {
18
+ "licenses": "MIT",
19
+ "repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
20
+ "licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
21
+ },
22
+ "@typescript-eslint/eslint-plugin@6.17.0": {
23
+ "licenses": "MIT",
24
+ "repository": "https://github.com/typescript-eslint/typescript-eslint",
25
+ "licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
26
+ },
27
+ "@typescript-eslint/parser@6.17.0": {
28
+ "licenses": "BSD-2-Clause",
29
+ "repository": "https://github.com/typescript-eslint/typescript-eslint",
30
+ "licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
31
+ },
32
+ "@vitest/coverage-v8@1.1.1": {
33
+ "licenses": "MIT",
34
+ "repository": "https://github.com/vitest-dev/vitest",
35
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
36
+ },
37
+ "@vitest/ui@1.1.1": {
38
+ "licenses": "MIT",
39
+ "repository": "https://github.com/vitest-dev/vitest",
40
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
41
+ },
42
+ "axe-core@4.8.3": {
43
+ "licenses": "MPL-2.0",
44
+ "repository": "https://github.com/dequelabs/axe-core",
45
+ "licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
46
+ },
47
+ "cypress-axe@1.5.0": {
48
+ "licenses": "MIT",
49
+ "repository": "https://github.com/component-driven/cypress-axe",
50
+ "licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
51
+ },
52
+ "cypress-real-events@1.13.0": {
53
+ "licenses": "MIT",
54
+ "repository": "https://github.com/dmtrKovalenko/cypress-real-events",
55
+ "licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
56
+ },
57
+ "cypress@13.6.2": {
58
+ "licenses": "MIT",
59
+ "repository": "https://github.com/cypress-io/cypress",
60
+ "licenseUrl": "https://cypress.io"
61
+ },
62
+ "esbuild@0.19.11": {
63
+ "licenses": "MIT",
64
+ "repository": "https://github.com/evanw/esbuild",
65
+ "licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
66
+ },
67
+ "eslint-config-google@0.14.0": {
68
+ "licenses": "Apache-2.0",
69
+ "repository": "https://github.com/google/eslint-config-google",
70
+ "licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
71
+ },
72
+ "eslint-config-prettier@9.1.0": {
73
+ "licenses": "MIT",
74
+ "repository": "https://github.com/prettier/eslint-config-prettier",
75
+ "licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
76
+ },
77
+ "eslint@8.56.0": {
78
+ "licenses": "MIT",
79
+ "repository": "https://github.com/eslint/eslint",
80
+ "licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
81
+ },
82
+ "github-markdown-css@5.5.0": {
83
+ "licenses": "MIT",
84
+ "repository": "https://github.com/sindresorhus/github-markdown-css",
85
+ "licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
86
+ },
87
+ "highlight.js@11.9.0": {
88
+ "licenses": "BSD-3-Clause",
89
+ "repository": "https://github.com/highlightjs/highlight.js",
90
+ "licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
91
+ },
92
+ "junit-report-builder@3.1.0": {
93
+ "licenses": "MIT",
94
+ "repository": "https://github.com/davidparsson/junit-report-builder",
95
+ "licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
96
+ },
97
+ "lint-staged@15.2.0": {
98
+ "licenses": "MIT",
99
+ "repository": "https://github.com/okonet/lint-staged",
100
+ "licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
101
+ },
102
+ "lit@2.8.0": {
103
+ "licenses": "BSD-3-Clause",
104
+ "repository": "https://github.com/lit/lit",
105
+ "licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
106
+ },
107
+ "marked@11.1.1": {
108
+ "licenses": "MIT",
109
+ "repository": "https://github.com/markedjs/marked",
110
+ "licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
111
+ },
112
+ "postcss-prefix-selector@1.16.0": {
113
+ "licenses": "MIT",
114
+ "repository": "https://github.com/RadValentin/postcss-prefix-selector",
115
+ "licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
116
+ },
117
+ "postcss@8.4.32": {
118
+ "licenses": "MIT",
119
+ "repository": "https://github.com/postcss/postcss",
120
+ "licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
121
+ },
122
+ "prettier@3.1.1": {
123
+ "licenses": "MIT",
124
+ "repository": "https://github.com/prettier/prettier",
125
+ "licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
126
+ },
127
+ "resolve-pkg@2.0.0": {
128
+ "licenses": "MIT",
129
+ "repository": "https://github.com/sindresorhus/resolve-pkg",
130
+ "licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
131
+ },
132
+ "sass@1.69.6": {
133
+ "licenses": "MIT",
134
+ "repository": "https://github.com/sass/dart-sass",
135
+ "licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
136
+ },
137
+ "stylelint-config-recommended-scss@14.0.0": {
138
+ "licenses": "MIT",
139
+ "repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
140
+ "licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
141
+ },
142
+ "stylelint-config-standard@36.0.0": {
143
+ "licenses": "MIT",
144
+ "repository": "https://github.com/stylelint/stylelint-config-standard",
145
+ "licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
146
+ },
147
+ "stylelint-scss@6.0.0": {
148
+ "licenses": "MIT",
149
+ "repository": "https://github.com/stylelint-scss/stylelint-scss",
150
+ "licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
151
+ },
152
+ "stylelint@16.1.0": {
153
+ "licenses": "MIT",
154
+ "repository": "https://github.com/stylelint/stylelint",
155
+ "licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
156
+ },
157
+ "tsup@8.0.1": {
158
+ "licenses": "MIT",
159
+ "repository": "https://github.com/egoist/tsup",
160
+ "licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
161
+ },
162
+ "turbo@1.11.2": {
163
+ "licenses": "MPL-2.0",
164
+ "repository": "https://github.com/vercel/turbo",
165
+ "licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
166
+ },
167
+ "typescript@5.3.3": {
168
+ "licenses": "Apache-2.0",
169
+ "repository": "https://github.com/Microsoft/TypeScript",
170
+ "licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
171
+ },
172
+ "vite-tsconfig-paths@4.2.3": {
173
+ "licenses": "MIT",
174
+ "repository": "https://github.com/aleclarson/vite-tsconfig-paths",
175
+ "licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
176
+ },
177
+ "vite@5.0.10": {
178
+ "licenses": "MIT",
179
+ "repository": "https://github.com/vitejs/vite",
180
+ "licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
181
+ },
182
+ "vitest@1.1.1": {
183
+ "licenses": "MIT",
184
+ "repository": "https://github.com/vitest-dev/vitest",
185
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
186
+ },
187
+ "yargs@17.7.2": {
188
+ "licenses": "MIT",
189
+ "repository": "https://github.com/yargs/yargs",
190
+ "licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
191
+ }
192
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@cas-smartdesign/field-validation-message",
3
+ "version": "5.0.1",
4
+ "description": "An inline message box with some predefined modes",
5
+ "main": "dist/field-validation-message-with-externals.js",
6
+ "module": "dist/field-validation-message.mjs",
7
+ "types": "dist/field-validation-message.d.ts",
8
+ "license": "SEE LICENSE IN LICENSE",
9
+ "dependencies": {
10
+ "lit": "^2.8.0",
11
+ "@cas-smartdesign/styles": "^3.6.1"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "npm-third-party-licenses.json"
16
+ ],
17
+ "publishConfig": {
18
+ "registry": "https://registry.npmjs.org/",
19
+ "access": "public"
20
+ },
21
+ "devDependencies": {
22
+ "@cas-smartdesign/element-preview": "^0.2.1",
23
+ "@cas-smartdesign/license-generator": "^1.6.1"
24
+ },
25
+ "scripts": {
26
+ "version": "pnpm version",
27
+ "generate-declaration": "tsc -p tsconfig.types.json",
28
+ "build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
29
+ "build": "pnpm generate-license && pnpm build:no-license",
30
+ "watch": "vite build --watch",
31
+ "dev": "vite",
32
+ "generate-license": "sd-license-generator --r ../../"
33
+ }
34
+ }
package/readme.md ADDED
@@ -0,0 +1,9 @@
1
+ # @cas-smartdesign/field-validation-message
2
+
3
+ This tiny element can be used to add inline validation message for "field" elements with a SmartDesign look and feel.
4
+
5
+ ## Requirements
6
+
7
+ The main entry point requires ES6 & support for Custom Elements v1
8
+
9
+ ## Examples