@progressive-development/pd-forms 0.2.15 → 0.5.0

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 (75) hide show
  1. package/dist/index.js +26 -0
  2. package/dist/locales/be.js +12 -0
  3. package/dist/locales/de.js +12 -0
  4. package/dist/locales/en.js +12 -0
  5. package/dist/pd-button.js +4 -0
  6. package/dist/pd-checkbox.js +4 -0
  7. package/dist/pd-form-container.js +4 -0
  8. package/dist/pd-form-row.js +4 -0
  9. package/dist/pd-hover-box.js +4 -0
  10. package/dist/pd-input-area.js +4 -0
  11. package/dist/pd-input-file.js +4 -0
  12. package/dist/pd-input.js +4 -0
  13. package/dist/pd-radio-group.js +4 -0
  14. package/dist/pd-range.js +4 -0
  15. package/dist/pd-select.js +4 -0
  16. package/{src → dist/src}/PdBaseInputElement.js +23 -42
  17. package/{src → dist/src}/PdBaseUi.js +11 -13
  18. package/dist/src/PdBaseUiInput.js +229 -0
  19. package/{src → dist/src}/PdButton.js +42 -48
  20. package/{src → dist/src}/PdCheckbox.js +16 -75
  21. package/{src → dist/src}/PdFormContainer.js +51 -79
  22. package/{src → dist/src}/PdFormRow.js +8 -17
  23. package/{src → dist/src}/PdHoverBox.js +20 -42
  24. package/dist/src/PdInput.js +79 -0
  25. package/dist/src/PdInputArea.js +61 -0
  26. package/dist/src/PdInputFile.js +73 -0
  27. package/dist/src/PdRadioGroup.js +72 -0
  28. package/{src → dist/src}/PdRange.js +38 -47
  29. package/{src → dist/src}/PdSelect.js +16 -65
  30. package/{src → dist/src}/shared-input-field-styles.js +6 -8
  31. package/{src → dist/src}/shared-input-styles.js +5 -8
  32. package/package.json +46 -25
  33. package/.editorconfig +0 -29
  34. package/.storybook/main.js +0 -13
  35. package/.storybook/preview-head.html +0 -4
  36. package/.storybook/preview.js +0 -14
  37. package/demo/index.html +0 -29
  38. package/index.js +0 -0
  39. package/lit-localize.json +0 -18
  40. package/pd-button.js +0 -3
  41. package/pd-checkbox.js +0 -3
  42. package/pd-form-container.js +0 -3
  43. package/pd-form-row.js +0 -3
  44. package/pd-hover-box.js +0 -3
  45. package/pd-input-area.js +0 -3
  46. package/pd-input-file.js +0 -3
  47. package/pd-input.js +0 -3
  48. package/pd-radio-group.js +0 -3
  49. package/pd-range.js +0 -3
  50. package/pd-select.js +0 -3
  51. package/src/PdBaseUiInput.js +0 -248
  52. package/src/PdInput.js +0 -146
  53. package/src/PdInputArea.js +0 -104
  54. package/src/PdInputFile.js +0 -121
  55. package/src/PdRadioGroup.js +0 -88
  56. package/src/PdRange copy.js +0 -197
  57. package/src/generated/locale/be.js +0 -19
  58. package/src/generated/locale/en.js +0 -19
  59. package/src/generated/locale-codes.js +0 -25
  60. package/src/stories/01_index.stories.js +0 -268
  61. package/src/stories/button.stories.js +0 -15
  62. package/src/stories/checkbox.stories.js +0 -103
  63. package/src/stories/form-container.stories.js +0 -100
  64. package/src/stories/form-row.stories.js +0 -23
  65. package/src/stories/input-area.stories.js +0 -129
  66. package/src/stories/input-file.stories.js +0 -111
  67. package/src/stories/input.stories.js +0 -179
  68. package/src/stories/radio-group.stories.js +0 -54
  69. package/src/stories/range.stories.js +0 -105
  70. package/src/stories/select.stories.js +0 -116
  71. package/test/pd-forms.test.js +0 -32
  72. package/web-dev-server.config.mjs +0 -27
  73. package/web-test-runner.config.mjs +0 -41
  74. package/xliff/be.xlf +0 -37
  75. package/xliff/en.xlf +0 -31
@@ -1,105 +0,0 @@
1
- import { html } from 'lit';
2
- import '../../pd-range.js';
3
- import '../../pd-form-container.js';
4
- import '../../pd-form-row.js';
5
-
6
- export default {
7
- title: 'PdForms/Range',
8
- component: 'pd-range',
9
- argTypes: {
10
- primaryColor: { control: 'color' },
11
- secondaryColor: { control: 'color' },
12
- textColor: { control: 'color' },
13
- highlightColor: { control: 'color' },
14
- errorColor: { control: 'color' },
15
- errorBackgroundColor: { control: 'color' },
16
- borderRadius: { control: 'text' },
17
- displayFont: { control: 'text' },
18
- fontSize: { control: 'text' },
19
- },
20
- };
21
-
22
- const OPTIONS_GENRE = {
23
- 0: "Keine Auswahl",
24
- 1: "No-Go",
25
- 2: "Wenig",
26
- 3: "Mittel",
27
- 4: "Viel",
28
- };
29
-
30
-
31
- function Template() {
32
- return html`
33
- <h3>Default Input Range</h3>
34
- <pd-form-container id="testFormContainerId" requiredFieldInfo>
35
- <pd-form-row>
36
- <pd-range id="range5060Id"
37
- class="quarter4"
38
- label="50er/60er"
39
- required
40
- max="4"
41
- value="0"
42
- .optionValueMapper="${OPTIONS_GENRE}">
43
- </pd-range>
44
- </pd-form-row>
45
- <pd-form-row>
46
- <pd-range id="range5060Id"
47
- class="quarter4"
48
- label="50er/60er"
49
- helperTxt="Absolut kurz."
50
- required
51
- max="4"
52
- value="0"
53
- .optionValueMapper="${OPTIONS_GENRE}">
54
- </pd-range>
55
- </pd-form-row>
56
- <pd-form-row>
57
- <pd-range id="range5060Id"
58
- class="quarter4"
59
- label="50er/60er"
60
- helperTxt="Hier steht ein Hilfstext, mit etwas Text."
61
- required
62
- max="4"
63
- value="0"
64
- .optionValueMapper="${OPTIONS_GENRE}">
65
- </pd-range>
66
- </pd-form-row>
67
- <pd-form-row>
68
- <pd-range id="range5060Id"
69
- class="quarter4"
70
- label="50er/60er"
71
- helperTxt="Hier steht ein Hilfstext, oder aber auch ein etwas längeres Element. Mit mehr als nur etwas Text. Man weiß es nicht genau."
72
- required
73
- max="4"
74
- value="0"
75
- .optionValueMapper="${OPTIONS_GENRE}">
76
- </pd-range>
77
- </pd-form-row>
78
- <pd-form-row>
79
- <pd-range id="range5060Id"
80
- class="quarter4"
81
- label="50er/60er"
82
- helperTxt="Hier steht ein Hilfstext, oder aber auch ein etwas längeres Element. Mit mehr als nur etwas Text. Man weiß es nicht genau. Aber jetzt mal etwas länger. Man weiß ja nie was hier so alles geschrieben wird."
83
- required
84
- max="4"
85
- value="0"
86
- .optionValueMapper="${OPTIONS_GENRE}">
87
- </pd-range>
88
- </pd-form-row>
89
- </pd-form-container>
90
-
91
- <h2>Test Validation</h2>
92
- <button
93
- @click="${() => {
94
- document.getElementById('testFormContainerId').dispatchEvent(
95
- new CustomEvent("validate-form", {detail: {errorMap: new Map()}})
96
- );
97
- }}"
98
- >
99
- Test Validate
100
- </button>
101
- `;
102
- }
103
-
104
- export const Range = Template.bind({});
105
- Range.args = {};
@@ -1,116 +0,0 @@
1
- import { html } from 'lit';
2
- import '../../pd-select.js';
3
- import '../../pd-form-container.js';
4
- import '../../pd-form-row.js';
5
-
6
- export default {
7
- title: 'PdForms/Select',
8
- component: 'pd-select',
9
- argTypes: {
10
- primaryColor: { control: 'color' },
11
- secondaryColor: { control: 'color' },
12
- textColor: { control: 'color' },
13
- highlightColor: { control: 'color' },
14
- errorColor: { control: 'color' },
15
- errorBackgroundColor: { control: 'color' },
16
- borderRadius: { control: 'text' },
17
- displayFont: { control: 'text' },
18
- fontSize: { control: 'text' },
19
- },
20
- };
21
-
22
- function Template({
23
- selectVals,
24
- }) {
25
- /*
26
- let style = '';
27
- if (primaryColor) {
28
- style += `--squi-primary-color:${primaryColor};`;
29
- }
30
- if (secondaryColor) {
31
- style += `--squi-secondary-color:${secondaryColor};`;
32
- }
33
- if (textColor) {
34
- style += `--squi-text-color:${textColor};`;
35
- }
36
- if (highlightColor) {
37
- style += `--squi-highlight-color:${highlightColor};`;
38
- }
39
- if (errorColor) {
40
- style += `--squi-error-color:${errorColor};`;
41
- }
42
- if (errorBackgroundColor) {
43
- style += `--squi-error-background-color:${errorBackgroundColor};`;
44
- }
45
- if (borderRadius) {
46
- style += `--squi-border-radius:${borderRadius};`;
47
- }
48
- if (displayFont) {
49
- style += `--squi-display-font:${displayFont};`;
50
- }
51
- if (fontSize) {
52
- style += `--squi-font-size:${fontSize};`;
53
- }
54
- */
55
-
56
- return html`
57
- <h3>Select default</h3>
58
- <pd-select
59
- id="testId1"
60
- .values="${selectVals}"
61
- ></pd-select>
62
-
63
- <h3>Select with label</h3>
64
- <pd-select
65
- id="testId2"
66
- .values="${selectVals}"
67
- label="Label for Select"
68
- ></pd-select>
69
-
70
- <h3>Select with label - disabled</h3>
71
- <pd-select
72
- id="testId2"
73
- .values="${selectVals}"
74
- label="Label for Select"
75
- ?disabled="${true}"
76
- ></pd-select>
77
-
78
- <h3>Select with label - error</h3>
79
- <pd-form-container id="testSelectContainerId">
80
-
81
- <pd-form-row>
82
- <pd-select
83
- id="testId2"
84
- .values="${selectVals}"
85
- label="Label for Select"
86
- required
87
- ></pd-select>
88
- </pd-form-row>
89
- </pd-form-container>
90
-
91
- <h2>Test Validation</h2>
92
- <button
93
- @click="${() => {
94
- document
95
- .getElementById('testSelectContainerId')
96
- .dispatchEvent(
97
- new CustomEvent('validate-form', {
98
- detail: { errorMap: new Map() },
99
- })
100
- );
101
- }}"
102
- >
103
- Test Validate
104
- </button>
105
- `;
106
- }
107
-
108
- export const Select = Template.bind({});
109
- Select.args = {
110
- selectVals: [
111
- { name: 'Auswahl treffen', value: undefined },
112
- { name: 'Option 1', value: 1 },
113
- { name: 'Option 2', value: 2 },
114
- { name: 'Option 3', value: 3 },
115
- ],
116
- };
@@ -1,32 +0,0 @@
1
- import { html } from 'lit';
2
- import { fixture, expect } from '@open-wc/testing';
3
-
4
- import '../pd-forms.js';
5
-
6
- describe('PdForms', () => {
7
- it('has a default title "Hey there" and counter 5', async () => {
8
- const el = await fixture(html`<pd-forms></pd-forms>`);
9
-
10
- expect(el.title).to.equal('Hey there');
11
- expect(el.counter).to.equal(5);
12
- });
13
-
14
- it('increases the counter on button click', async () => {
15
- const el = await fixture(html`<pd-forms></pd-forms>`);
16
- el.shadowRoot.querySelector('button').click();
17
-
18
- expect(el.counter).to.equal(6);
19
- });
20
-
21
- it('can override the title via attribute', async () => {
22
- const el = await fixture(html`<pd-forms title="attribute title"></pd-forms>`);
23
-
24
- expect(el.title).to.equal('attribute title');
25
- });
26
-
27
- it('passes the a11y audit', async () => {
28
- const el = await fixture(html`<pd-forms></pd-forms>`);
29
-
30
- await expect(el).shadowDom.to.be.accessible();
31
- });
32
- });
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });
package/xliff/be.xlf DELETED
@@ -1,37 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3
- <file target-language="be" source-language="de" original="lit-localize-inputs" datatype="plaintext">
4
- <body>
5
- <trans-unit id="s82000595de0f83d0">
6
- <source>Format mail@test.de verwenden</source>
7
- <target>Ongeldig e-mailadres, gebruik mail@test.be</target>
8
- <note>#pd.form.field.invalid.mail#</note>
9
- </trans-unit>
10
- <trans-unit id="s8716290d3f8456dd">
11
- <source>Nur Zahlen erlaubt</source>
12
- <target>Alleen nummers toegestaan</target>
13
- <note>#pd.form.field.invalid.number#</note>
14
- </trans-unit>
15
- <trans-unit id="s5b7e33463603827f">
16
- <source>Format +49123 123456 verwenden</source>
17
- <target>Ongeldig telefoonnummer, gebruik +32 494 667085</target>
18
- <note>#pd.form.field.invalid.phone#</note>
19
- </trans-unit>
20
- <trans-unit id="s570d46ddb2a278ce">
21
- <source>Format DE0123456789 verwenden</source>
22
- <target>Ongeldig VAT, gebruik BE0123456789</target>
23
- <note>#pd.form.field.invalid.vat#</note>
24
- </trans-unit>
25
- <trans-unit id="s441bc7f34cdb5af3">
26
- <source>Eingabe erforderlich</source>
27
- <target>Vul dit veld in</target>
28
- <note>#pd.form.field.required#</note>
29
- </trans-unit>
30
- <trans-unit id="s369cb9ac30f626a2">
31
- <source>* Pflichtfeld</source>
32
- <target>* Verplichte in te vullen</target>
33
- <note>#pd.form.required.info#</note>
34
- </trans-unit>
35
- </body>
36
- </file>
37
- </xliff>
package/xliff/en.xlf DELETED
@@ -1,31 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3
- <file target-language="en" source-language="de" original="lit-localize-inputs" datatype="plaintext">
4
- <body>
5
- <trans-unit id="s82000595de0f83d0">
6
- <source>Format mail@test.de verwenden</source>
7
- <note>#pd.form.field.invalid.mail#</note>
8
- </trans-unit>
9
- <trans-unit id="s8716290d3f8456dd">
10
- <source>Nur Zahlen erlaubt</source>
11
- <note>#pd.form.field.invalid.number#</note>
12
- </trans-unit>
13
- <trans-unit id="s5b7e33463603827f">
14
- <source>Format +49123 123456 verwenden</source>
15
- <note>#pd.form.field.invalid.phone#</note>
16
- </trans-unit>
17
- <trans-unit id="s570d46ddb2a278ce">
18
- <source>Format DE0123456789 verwenden</source>
19
- <note>#pd.form.field.invalid.vat#</note>
20
- </trans-unit>
21
- <trans-unit id="s441bc7f34cdb5af3">
22
- <source>Eingabe erforderlich</source>
23
- <note>#pd.form.field.required#</note>
24
- </trans-unit>
25
- <trans-unit id="s369cb9ac30f626a2">
26
- <source>* Pflichtfeld</source>
27
- <note>#pd.form.required.info#</note>
28
- </trans-unit>
29
- </body>
30
- </file>
31
- </xliff>