@politiet/sheriff-web-components 1.0.3-alpha.0 → 1.2.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.
- package/dist/playwright-util/custom-matchers.d.ts +1 -0
- package/dist/playwright-util/custom-matchers.d.ts.map +1 -1
- package/dist/playwright-util/custom-matchers.js +10 -0
- package/dist/playwright-util/custom-matchers.js.map +1 -1
- package/dist/playwright-util/form.d.ts +1 -1
- package/dist/playwright-util/form.d.ts.map +1 -1
- package/dist/playwright-util/form.js +12 -7
- package/dist/playwright-util/form.js.map +1 -1
- package/dist/react-wrappers/SDSTextFieldWrapper.js +1 -1
- package/dist/react-wrappers/SDSTextFieldWrapper.js.map +1 -1
- package/dist/sds-button/sds-button.d.ts +5 -0
- package/dist/sds-button/sds-button.d.ts.map +1 -1
- package/dist/sds-button/sds-button.js +19 -0
- package/dist/sds-button/sds-button.js.map +1 -1
- package/dist/sds-button/sds-button.spec.js +36 -0
- package/dist/sds-button/sds-button.spec.js.map +1 -1
- package/dist/sds-button/sds-button.styles.d.ts.map +1 -1
- package/dist/sds-button/sds-button.styles.js +11 -7
- package/dist/sds-button/sds-button.styles.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.d.ts +1 -0
- package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.js +6 -11
- package/dist/sds-checkbox/sds-checkbox.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.spec.js +18 -12
- package/dist/sds-checkbox/sds-checkbox.spec.js.map +1 -1
- package/dist/sds-chip/sds-chip.d.ts +2 -0
- package/dist/sds-chip/sds-chip.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.js +10 -1
- package/dist/sds-chip/sds-chip.js.map +1 -1
- package/dist/sds-chip/sds-chip.styles.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.styles.js +9 -8
- package/dist/sds-chip/sds-chip.styles.js.map +1 -1
- package/dist/sds-radio/sds-radio.d.ts +1 -0
- package/dist/sds-radio/sds-radio.d.ts.map +1 -1
- package/dist/sds-radio/sds-radio.js +9 -4
- package/dist/sds-radio/sds-radio.js.map +1 -1
- package/dist/sds-radio/sds-radio.spec.d.ts +2 -0
- package/dist/sds-radio/sds-radio.spec.d.ts.map +1 -0
- package/dist/sds-radio/sds-radio.spec.js +71 -0
- package/dist/sds-radio/sds-radio.spec.js.map +1 -0
- package/dist/sds-radio/sds-radio.styles.js +1 -1
- package/dist/sds-radio/sds-radio.styles.js.map +1 -1
- package/dist/sds-textfield/sds-textfield.spec.d.ts +2 -0
- package/dist/sds-textfield/sds-textfield.spec.d.ts.map +1 -0
- package/dist/sds-textfield/sds-textfield.spec.js +139 -0
- package/dist/sds-textfield/sds-textfield.spec.js.map +1 -0
- package/dist/sheriff-web-components.js +64 -32
- package/dist/utils/guarded-custom-element.d.ts +3 -5
- package/dist/utils/guarded-custom-element.d.ts.map +1 -1
- package/dist/utils/guarded-custom-element.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
import { expect as sdsExpect } from '../playwright-util/custom-matchers';
|
|
3
|
+
const textfieldIds = [
|
|
4
|
+
'textfield-name',
|
|
5
|
+
'textfield-label',
|
|
6
|
+
'textfield-placeholder',
|
|
7
|
+
'textfield-helptext',
|
|
8
|
+
'textfield-disabled',
|
|
9
|
+
'textfield-readonly',
|
|
10
|
+
'textfield-required',
|
|
11
|
+
'textfield-error',
|
|
12
|
+
'textfield-icon',
|
|
13
|
+
'textfield-autocomplete-off',
|
|
14
|
+
'textfield-autocomplete-on',
|
|
15
|
+
'textfield-pattern',
|
|
16
|
+
'textfield-min',
|
|
17
|
+
'textfield-max',
|
|
18
|
+
];
|
|
19
|
+
const pageUrl = 'iframe.html?viewMode=docs&id=test-textfield--docs';
|
|
20
|
+
test.describe('textfield-component', () => {
|
|
21
|
+
test.beforeEach(async ({ page }) => {
|
|
22
|
+
await page.goto(pageUrl);
|
|
23
|
+
});
|
|
24
|
+
test('visibility', async ({ page }) => {
|
|
25
|
+
for (const id of textfieldIds) {
|
|
26
|
+
await expect(page.locator(`#${id}`)).toBeVisible();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
test('design-implementation', async ({ page }) => {
|
|
30
|
+
await page.reload();
|
|
31
|
+
for (const id of textfieldIds) {
|
|
32
|
+
// Default state
|
|
33
|
+
await expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}.png`);
|
|
34
|
+
// Hover state
|
|
35
|
+
page.locator(`#${id}`).hover();
|
|
36
|
+
await expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}-hover.png`);
|
|
37
|
+
// Focus state
|
|
38
|
+
await page.evaluate((id) => {
|
|
39
|
+
const element = document.getElementById(id);
|
|
40
|
+
if (element) {
|
|
41
|
+
const parentDiv = document.createElement('div');
|
|
42
|
+
parentDiv.style.padding = '10px';
|
|
43
|
+
parentDiv.style.backgroundColor = 'white';
|
|
44
|
+
element.parentNode?.insertBefore(parentDiv, element);
|
|
45
|
+
parentDiv.appendChild(element);
|
|
46
|
+
}
|
|
47
|
+
}, id);
|
|
48
|
+
page.locator(`#${id}`).focus();
|
|
49
|
+
const parentDiv = await page.locator(`#${id}`).locator('xpath=..');
|
|
50
|
+
await expect(parentDiv).toHaveScreenshot(`${id}-focus.png`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
test('form-submission', async ({ page }) => {
|
|
54
|
+
let requestUrl;
|
|
55
|
+
page.on('request', (request) => {
|
|
56
|
+
if (request.url().includes('iframe.html?name=John')) {
|
|
57
|
+
requestUrl = new URL(request.url());
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
await page.locator('#textfield-name').pressSequentially('John');
|
|
61
|
+
await page.locator('#submit-button').click();
|
|
62
|
+
await expect(requestUrl?.searchParams.get('name')).toBe('John');
|
|
63
|
+
});
|
|
64
|
+
test('form-reset', async ({ page }) => {
|
|
65
|
+
await page.locator('#textfield-name').pressSequentially('John');
|
|
66
|
+
await page.locator('#reset-button').click();
|
|
67
|
+
const value = await page.locator('#textfield-name').getAttribute('value');
|
|
68
|
+
expect(value).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
test('minlength', async ({ page }) => {
|
|
71
|
+
const textfield = page.locator('#textfield-min');
|
|
72
|
+
await textfield.pressSequentially('abc');
|
|
73
|
+
const isValidShort = await textfield.evaluate((el) => el.checkValidity());
|
|
74
|
+
expect(isValidShort).toBe(false);
|
|
75
|
+
await page.goto(pageUrl);
|
|
76
|
+
await textfield.pressSequentially('abcd');
|
|
77
|
+
const isValidExact = await textfield.evaluate((el) => el.checkValidity());
|
|
78
|
+
expect(isValidExact).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
test('maxlength', async ({ page }) => {
|
|
81
|
+
const textfield = page.locator('#textfield-max');
|
|
82
|
+
await textfield.pressSequentially('abcdef');
|
|
83
|
+
await sdsExpect(textfield).toHaveValue('abcd');
|
|
84
|
+
});
|
|
85
|
+
test('pattern', async ({ page }) => {
|
|
86
|
+
const textfield = page.locator('#textfield-pattern');
|
|
87
|
+
// Non-digits → invalid
|
|
88
|
+
await textfield.pressSequentially('abcd');
|
|
89
|
+
let isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
90
|
+
expect(isValid).toBe(false);
|
|
91
|
+
// Too few digits → invalid
|
|
92
|
+
await page.goto(pageUrl);
|
|
93
|
+
await textfield.pressSequentially('123');
|
|
94
|
+
isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
95
|
+
expect(isValid).toBe(false);
|
|
96
|
+
// Exactly 4 digits → valid
|
|
97
|
+
await page.goto(pageUrl);
|
|
98
|
+
await textfield.pressSequentially('1234');
|
|
99
|
+
isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
100
|
+
expect(isValid).toBe(true);
|
|
101
|
+
// Too many digits → invalid
|
|
102
|
+
await page.goto(pageUrl);
|
|
103
|
+
await textfield.pressSequentially('12345');
|
|
104
|
+
isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
105
|
+
expect(isValid).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
test('required', async ({ page }) => {
|
|
108
|
+
const textfield = page.locator('#textfield-required');
|
|
109
|
+
// No value → invalid
|
|
110
|
+
let isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
111
|
+
expect(isValid).toBe(false);
|
|
112
|
+
// Has value → valid
|
|
113
|
+
await page.goto(pageUrl);
|
|
114
|
+
await textfield.pressSequentially('abc');
|
|
115
|
+
isValid = await textfield.evaluate((el) => el.checkValidity());
|
|
116
|
+
expect(isValid).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
test('readonly', async ({ page }) => {
|
|
119
|
+
const textfield = page.locator('#textfield-readonly');
|
|
120
|
+
await textfield.pressSequentially('abc');
|
|
121
|
+
await sdsExpect(textfield).toHaveValue('Kan ikke endres');
|
|
122
|
+
});
|
|
123
|
+
test('autocomplete on/off', async ({ page }) => {
|
|
124
|
+
const textfields = [
|
|
125
|
+
{ id: 'textfield-autocomplete-off', expected: 'off' },
|
|
126
|
+
{ id: 'textfield-autocomplete-on', expected: 'on' },
|
|
127
|
+
];
|
|
128
|
+
for (const { id, expected } of textfields) {
|
|
129
|
+
const host = page.locator(`#${id}`);
|
|
130
|
+
await expect(host).toHaveAttribute('autocomplete', expected);
|
|
131
|
+
const shadowDomInput = await host.evaluate((el) => {
|
|
132
|
+
const input = el.shadowRoot?.querySelector('input');
|
|
133
|
+
return input?.autocomplete ?? null;
|
|
134
|
+
});
|
|
135
|
+
expect(shadowDomInput).toBe(expected);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=sds-textfield.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-textfield.spec.js","sourceRoot":"","sources":["../../src/sds-textfield/sds-textfield.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,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AAC,QAAQ,CAAC,CAAC;QACvC,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from '@playwright/test';\nimport { expect as sdsExpect } from '../playwright-util/custom-matchers';\n\nconst textfieldIds = [\n\t'textfield-name',\n\t'textfield-label',\n\t'textfield-placeholder',\n\t'textfield-helptext',\n\t'textfield-disabled',\n\t'textfield-readonly',\n\t'textfield-required',\n\t'textfield-error',\n\t'textfield-icon',\n\t'textfield-autocomplete-off',\n\t'textfield-autocomplete-on',\n\t'textfield-pattern',\n\t'textfield-min',\n\t'textfield-max',\n];\n\nconst pageUrl = 'iframe.html?viewMode=docs&id=test-textfield--docs';\n\ntest.describe('textfield-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto(pageUrl);\n\t});\n\n\ttest('visibility', async ({ page }) => {\n\t\tfor (const id of textfieldIds) {\n\t\t\tawait expect(page.locator(`#${id}`)).toBeVisible();\n\t\t}\n\t});\n\n\ttest('design-implementation', async ({ page }) => {\n\t\tawait page.reload();\n\n\t\tfor (const id of textfieldIds) {\n\t\t\t// Default state\n\t\t\tawait expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}.png`);\n\t\t\t// Hover state\n\t\t\tpage.locator(`#${id}`).hover();\n\t\t\tawait expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}-hover.png`);\n\t\t\t// Focus state\n\t\t\tawait page.evaluate((id) => {\n\t\t\t\tconst element = document.getElementById(id);\n\t\t\t\tif (element) {\n\t\t\t\t\tconst parentDiv = document.createElement('div');\n\t\t\t\t\tparentDiv.style.padding = '10px';\n\t\t\t\t\tparentDiv.style.backgroundColor = 'white';\n\t\t\t\t\telement.parentNode?.insertBefore(parentDiv, element);\n\t\t\t\t\tparentDiv.appendChild(element);\n\t\t\t\t}\n\t\t\t}, id);\n\t\t\tpage.locator(`#${id}`).focus();\n\t\t\tconst parentDiv = await page.locator(`#${id}`).locator('xpath=..');\n\t\t\tawait expect(parentDiv).toHaveScreenshot(`${id}-focus.png`);\n\t\t}\n\t});\n\n\ttest('form-submission', async ({ page }) => {\n\t\tlet requestUrl: URL | undefined;\n\t\tpage.on('request', (request) => {\n\t\t\tif (request.url().includes('iframe.html?name=John')) {\n\t\t\t\trequestUrl = new URL(request.url());\n\t\t\t}\n\t\t});\n\n\t\tawait page.locator('#textfield-name').pressSequentially('John');\n\t\tawait page.locator('#submit-button').click();\n\t\tawait expect(requestUrl?.searchParams.get('name')).toBe('John');\n\t});\n\n\ttest('form-reset', async ({ page }) => {\n\t\tawait page.locator('#textfield-name').pressSequentially('John');\n\t\tawait page.locator('#reset-button').click();\n\t\tconst value = await page.locator('#textfield-name').getAttribute('value');\n\t\texpect(value).toBeNull();\n\t});\n\n\ttest('minlength', async ({ page }) => {\n\t\tconst textfield = page.locator('#textfield-min');\n\n\t\tawait textfield.pressSequentially('abc');\n\t\tconst isValidShort = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValidShort).toBe(false);\n\n\t\tawait page.goto(pageUrl);\n\t\tawait textfield.pressSequentially('abcd');\n\t\tconst isValidExact = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValidExact).toBe(true);\n\t});\n\n\ttest('maxlength', async ({ page }) => {\n\t\tconst textfield = page.locator('#textfield-max');\n\n\t\tawait textfield.pressSequentially('abcdef');\n\t\tawait sdsExpect(textfield).toHaveValue('abcd');\n\t});\n\n\ttest('pattern', async ({ page }) => {\n\t\tconst textfield = page.locator('#textfield-pattern');\n\n\t\t// Non-digits → invalid\n\t\tawait textfield.pressSequentially('abcd');\n\t\tlet isValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(false);\n\n\t\t// Too few digits → invalid\n\t\tawait page.goto(pageUrl);\n\t\tawait textfield.pressSequentially('123');\n\t\tisValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(false);\n\n\t\t// Exactly 4 digits → valid\n\t\tawait page.goto(pageUrl);\n\t\tawait textfield.pressSequentially('1234');\n\t\tisValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(true);\n\n\t\t// Too many digits → invalid\n\t\tawait page.goto(pageUrl);\n\t\tawait textfield.pressSequentially('12345');\n\t\tisValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(false);\n\t});\n\n\ttest('required', async ({ page }) => {\n\t\tconst textfield = page.locator('#textfield-required');\n\n\t\t// No value → invalid\n\t\tlet isValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(false);\n\n\t\t// Has value → valid\n\t\tawait page.goto(pageUrl);\n\t\tawait textfield.pressSequentially('abc');\n\t\tisValid = await textfield.evaluate((el: HTMLInputElement) => el.checkValidity());\n\t\texpect(isValid).toBe(true);\n\t});\n\n\ttest('readonly', async ({ page }) => {\n\t\tconst textfield = page.locator('#textfield-readonly');\n\t\tawait textfield.pressSequentially('abc');\n\t\tawait sdsExpect(textfield).toHaveValue('Kan ikke endres');\n\t});\n\n\ttest('autocomplete on/off', async ({ page }) => {\n\t\tconst textfields = [\n\t\t\t{ id: 'textfield-autocomplete-off', expected: 'off' },\n\t\t\t{ id: 'textfield-autocomplete-on', expected: 'on' },\n\t\t];\n\n\t\tfor (const { id, expected } of textfields) {\n\t\t\tconst host = page.locator(`#${id}`);\n\n\t\t\tawait expect(host).toHaveAttribute('autocomplete', expected);\n\t\t\tconst shadowDomInput = await host.evaluate((el: HTMLElement) => {\n\t\t\t\tconst input = el.shadowRoot?.querySelector('input') as HTMLInputElement | null;\n\t\t\t\treturn input?.autocomplete ?? null;\n\t\t\t});\n\t\t\texpect(shadowDomInput).toBe(expected);\n\t\t}\n\t});\n});\n"]}
|
|
@@ -679,6 +679,12 @@ const styles$h = i$4`
|
|
|
679
679
|
border: 2px solid var(--sds-color-semantic-surface-action-hover);
|
|
680
680
|
}
|
|
681
681
|
|
|
682
|
+
&:focus {
|
|
683
|
+
background-color: var(--sds-color-semantic-surface-action-default);
|
|
684
|
+
outline: 2px solid var(--sds-color-semantic-surface-action-default);
|
|
685
|
+
outline-offset: 1px;
|
|
686
|
+
}
|
|
687
|
+
|
|
682
688
|
&:active {
|
|
683
689
|
background-color: var(--sds-color-semantic-surface-action-active);
|
|
684
690
|
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
@@ -693,13 +699,6 @@ const styles$h = i$4`
|
|
|
693
699
|
}
|
|
694
700
|
}
|
|
695
701
|
|
|
696
|
-
.sds-button:focus,
|
|
697
|
-
:host(:focus) .give-focus {
|
|
698
|
-
background-color: var(--sds-color-semantic-surface-action-default);
|
|
699
|
-
outline: 2px solid var(--sds-color-semantic-surface-action-default);
|
|
700
|
-
outline-offset: 1px;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
702
|
.sds-button--secondary {
|
|
704
703
|
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
705
704
|
border: 2px solid var(--sds-color-semantic-border-action);
|
|
@@ -793,6 +792,11 @@ const styles$h = i$4`
|
|
|
793
792
|
font-size: 0.875rem;
|
|
794
793
|
padding: 0 var(--sds-spacing-3);
|
|
795
794
|
}
|
|
795
|
+
|
|
796
|
+
.sds-button--as-link {
|
|
797
|
+
inline-size: auto;
|
|
798
|
+
text-decoration: none;
|
|
799
|
+
}
|
|
796
800
|
`;
|
|
797
801
|
var __defProp$h = Object.defineProperty;
|
|
798
802
|
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
@@ -882,8 +886,21 @@ let SDSButton = class extends i$1 {
|
|
|
882
886
|
"sds-button--tertiary": this.variant === "tertiary",
|
|
883
887
|
"sds-button--critical": this.variant === "critical",
|
|
884
888
|
"sds-button--medium": this.size === "medium",
|
|
885
|
-
"sds-button--small": this.size === "small"
|
|
889
|
+
"sds-button--small": this.size === "small",
|
|
890
|
+
"sds-button--as-link": !!this.href
|
|
886
891
|
};
|
|
892
|
+
if (this.href) {
|
|
893
|
+
return x` <a
|
|
894
|
+
id="link"
|
|
895
|
+
class="${e$1(buttonClasses)}"
|
|
896
|
+
href="${this.href}"
|
|
897
|
+
target="${o$1(this.target)}"
|
|
898
|
+
>
|
|
899
|
+
<slot name="before"></slot>
|
|
900
|
+
<slot></slot>
|
|
901
|
+
<slot name="after"></slot>
|
|
902
|
+
</a>`;
|
|
903
|
+
}
|
|
887
904
|
return x`
|
|
888
905
|
<button
|
|
889
906
|
id="control"
|
|
@@ -925,6 +942,12 @@ __decorateClass$h([
|
|
|
925
942
|
__decorateClass$h([
|
|
926
943
|
n2({ type: String, reflect: true })
|
|
927
944
|
], SDSButton.prototype, "form", 2);
|
|
945
|
+
__decorateClass$h([
|
|
946
|
+
n2({ type: String, reflect: true })
|
|
947
|
+
], SDSButton.prototype, "href", 2);
|
|
948
|
+
__decorateClass$h([
|
|
949
|
+
n2({ type: String, reflect: true })
|
|
950
|
+
], SDSButton.prototype, "target", 2);
|
|
928
951
|
SDSButton = __decorateClass$h([
|
|
929
952
|
guardedCustomElement("sds-button")
|
|
930
953
|
], SDSButton);
|
|
@@ -1060,7 +1083,7 @@ let SDSCheckbox = class extends i$1 {
|
|
|
1060
1083
|
if (!this.disabled) {
|
|
1061
1084
|
const elem = event.target;
|
|
1062
1085
|
this.checked = elem.checked;
|
|
1063
|
-
this.internals.setFormValue(elem.checked ? elem.value :
|
|
1086
|
+
this.internals.setFormValue(elem.checked ? elem.value : null);
|
|
1064
1087
|
this._validate();
|
|
1065
1088
|
this.dispatchEvent(
|
|
1066
1089
|
new CustomEvent("change", {
|
|
@@ -1101,16 +1124,8 @@ let SDSCheckbox = class extends i$1 {
|
|
|
1101
1124
|
super.connectedCallback();
|
|
1102
1125
|
this._initialChecked = this.checked;
|
|
1103
1126
|
this.internals.role = "checkbox";
|
|
1104
|
-
if ("FormDataEvent" in window) {
|
|
1105
|
-
this.internals.form?.addEventListener("formdata", (event) => {
|
|
1106
|
-
if (this.disabled || !this.name || !this.checked) {
|
|
1107
|
-
return;
|
|
1108
|
-
}
|
|
1109
|
-
event.formData.set(this.name, this.value ?? "on");
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
1127
|
if (this.checked) {
|
|
1113
|
-
this.internals.setFormValue(this.value
|
|
1128
|
+
this.internals.setFormValue(this.value ?? "on");
|
|
1114
1129
|
}
|
|
1115
1130
|
}
|
|
1116
1131
|
firstUpdated(_changedProperties) {
|
|
@@ -1125,7 +1140,7 @@ let SDSCheckbox = class extends i$1 {
|
|
|
1125
1140
|
if (this.control) {
|
|
1126
1141
|
this.control.checked = this._initialChecked;
|
|
1127
1142
|
}
|
|
1128
|
-
const resetValue = this.checked
|
|
1143
|
+
const resetValue = this.checked ? this.value ?? "on" : null;
|
|
1129
1144
|
this.internals.setFormValue(resetValue);
|
|
1130
1145
|
this._validate();
|
|
1131
1146
|
}
|
|
@@ -1154,6 +1169,9 @@ let SDSCheckbox = class extends i$1 {
|
|
|
1154
1169
|
this._validate();
|
|
1155
1170
|
}
|
|
1156
1171
|
}
|
|
1172
|
+
get type() {
|
|
1173
|
+
return "checkbox";
|
|
1174
|
+
}
|
|
1157
1175
|
render() {
|
|
1158
1176
|
const checkboxClasses = {
|
|
1159
1177
|
"sds-checkbox": true,
|
|
@@ -1519,32 +1537,29 @@ const styles$d = i$4`
|
|
|
1519
1537
|
line-height: 1.25;
|
|
1520
1538
|
text-align: center;
|
|
1521
1539
|
|
|
1522
|
-
user-select:
|
|
1540
|
+
user-select: text;
|
|
1523
1541
|
cursor: pointer;
|
|
1524
1542
|
|
|
1525
|
-
&:has(
|
|
1543
|
+
&:has(:checked) {
|
|
1526
1544
|
background-color: var(--sds-color-semantic-surface-action-default);
|
|
1527
1545
|
border-color: var(--sds-color-semantic-surface-action-default);
|
|
1528
1546
|
color: var(--sds-color-semantic-text-on-action);
|
|
1529
1547
|
}
|
|
1530
1548
|
|
|
1531
|
-
&:has(
|
|
1532
|
-
input[type='checkbox'][disabled],
|
|
1533
|
-
input[type='checkbox']:checked[disabled]
|
|
1534
|
-
) {
|
|
1549
|
+
&:has(input[type='checkbox'][disabled], input[type='checkbox']:checked[disabled]) {
|
|
1535
1550
|
background-color: var(--sds-color-semantic-surface-disabled);
|
|
1536
1551
|
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
1537
1552
|
color: var(--sds-color-semantic-text-disabled);
|
|
1538
1553
|
cursor: not-allowed;
|
|
1539
1554
|
}
|
|
1540
1555
|
|
|
1541
|
-
&:hover {
|
|
1556
|
+
&:not(:has([readonly])):hover {
|
|
1542
1557
|
background-color: var(--sds-color-semantic-surface-action-hover);
|
|
1543
1558
|
border-color: var(--sds-color-semantic-surface-action-hover);
|
|
1544
1559
|
color: var(--sds-color-semantic-text-on-action);
|
|
1545
1560
|
}
|
|
1546
1561
|
|
|
1547
|
-
&:active {
|
|
1562
|
+
&:not(:has([readonly])):active {
|
|
1548
1563
|
background-color: var(--sds-color-semantic-surface-action-active);
|
|
1549
1564
|
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
1550
1565
|
}
|
|
@@ -1555,6 +1570,10 @@ const styles$d = i$4`
|
|
|
1555
1570
|
outline-offset: 2px;
|
|
1556
1571
|
}
|
|
1557
1572
|
|
|
1573
|
+
&:has([readonly]) {
|
|
1574
|
+
cursor: default;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1558
1577
|
&.sds-chip--small {
|
|
1559
1578
|
font-size: 0.875rem;
|
|
1560
1579
|
line-height: 1.125rem;
|
|
@@ -1592,10 +1611,12 @@ let SDSChip = class extends i$1 {
|
|
|
1592
1611
|
this.size = "large";
|
|
1593
1612
|
this.checked = false;
|
|
1594
1613
|
this.disabled = false;
|
|
1614
|
+
this.readonly = false;
|
|
1595
1615
|
this._initialChecked = false;
|
|
1596
1616
|
this._toggle = (event) => {
|
|
1597
1617
|
event.preventDefault();
|
|
1598
1618
|
event.stopImmediatePropagation();
|
|
1619
|
+
if (this.disabled || this.readonly) return;
|
|
1599
1620
|
this.checked = !this.checked;
|
|
1600
1621
|
this.internals.setFormValue(this.checked && this.value ? this.value : "");
|
|
1601
1622
|
this.dispatchEvent(
|
|
@@ -1606,6 +1627,7 @@ let SDSChip = class extends i$1 {
|
|
|
1606
1627
|
);
|
|
1607
1628
|
};
|
|
1608
1629
|
this._remove = () => {
|
|
1630
|
+
if (this.disabled || this.readonly) return;
|
|
1609
1631
|
this.dispatchEvent(
|
|
1610
1632
|
new CustomEvent("sds-remove", {
|
|
1611
1633
|
bubbles: true,
|
|
@@ -1643,7 +1665,7 @@ let SDSChip = class extends i$1 {
|
|
|
1643
1665
|
"sds-chip": true,
|
|
1644
1666
|
"sds-chip--small": this.size === "small"
|
|
1645
1667
|
};
|
|
1646
|
-
if (this.variant === "removable") {
|
|
1668
|
+
if (this.variant === "removable" && !this.readonly) {
|
|
1647
1669
|
return x`<button class="${e$1(chipClasses)}" @click=${this._remove}>
|
|
1648
1670
|
<slot></slot>
|
|
1649
1671
|
<sds-icon name="close-material-outlined" size="s"></sds-icon>
|
|
@@ -1657,6 +1679,7 @@ let SDSChip = class extends i$1 {
|
|
|
1657
1679
|
value="${o$1(this.value)}"
|
|
1658
1680
|
?checked="${this.checked}"
|
|
1659
1681
|
?disabled="${this.disabled}"
|
|
1682
|
+
?readonly="${this.readonly}"
|
|
1660
1683
|
/>
|
|
1661
1684
|
<slot></slot>
|
|
1662
1685
|
</label>`;
|
|
@@ -1682,6 +1705,9 @@ __decorateClass$d([
|
|
|
1682
1705
|
__decorateClass$d([
|
|
1683
1706
|
n2({ type: Boolean, reflect: true })
|
|
1684
1707
|
], SDSChip.prototype, "disabled", 2);
|
|
1708
|
+
__decorateClass$d([
|
|
1709
|
+
n2({ type: Boolean, reflect: true })
|
|
1710
|
+
], SDSChip.prototype, "readonly", 2);
|
|
1685
1711
|
__decorateClass$d([
|
|
1686
1712
|
e$3("#control")
|
|
1687
1713
|
], SDSChip.prototype, "control", 2);
|
|
@@ -2692,7 +2718,7 @@ const styles$4 = i$4`
|
|
|
2692
2718
|
align-items: flex-start;
|
|
2693
2719
|
cursor: pointer;
|
|
2694
2720
|
color: var(--sds-color-semantic-text-default);
|
|
2695
|
-
display:
|
|
2721
|
+
display: flex;
|
|
2696
2722
|
font-family: var(--sds-typography-font-family);
|
|
2697
2723
|
font-size: 1rem;
|
|
2698
2724
|
font-weight: 400;
|
|
@@ -2855,6 +2881,12 @@ let SDSRadio = class extends i$1 {
|
|
|
2855
2881
|
event.stopImmediatePropagation();
|
|
2856
2882
|
this.dispatchEvent(new CustomEvent("blur", { bubbles: true, composed: true }));
|
|
2857
2883
|
};
|
|
2884
|
+
this._handleClick = (event) => {
|
|
2885
|
+
event.stopImmediatePropagation();
|
|
2886
|
+
if (event.currentTarget === event.target && !this.disabled) {
|
|
2887
|
+
this.shadowRoot?.querySelector("input")?.click();
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2858
2890
|
this.internals = this.attachInternals();
|
|
2859
2891
|
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
2860
2892
|
}
|
|
@@ -2905,7 +2937,7 @@ let SDSRadio = class extends i$1 {
|
|
|
2905
2937
|
formResetCallback() {
|
|
2906
2938
|
this.checked = this._initialChecked;
|
|
2907
2939
|
this.control.checked = this._initialChecked;
|
|
2908
|
-
this.internals.setFormValue(this.checked ? this.value ?? "on" :
|
|
2940
|
+
this.internals.setFormValue(this.checked ? this.value ?? "on" : null);
|
|
2909
2941
|
this._updateGroupValidation();
|
|
2910
2942
|
}
|
|
2911
2943
|
updated(changedProperties) {
|
|
@@ -2942,7 +2974,7 @@ let SDSRadio = class extends i$1 {
|
|
|
2942
2974
|
return this.internals.form;
|
|
2943
2975
|
}
|
|
2944
2976
|
get type() {
|
|
2945
|
-
return
|
|
2977
|
+
return "radio";
|
|
2946
2978
|
}
|
|
2947
2979
|
get validity() {
|
|
2948
2980
|
return this.internals.validity;
|
|
@@ -2985,7 +3017,7 @@ let SDSRadio = class extends i$1 {
|
|
|
2985
3017
|
"sds-radio__input--error": Boolean(this.error)
|
|
2986
3018
|
};
|
|
2987
3019
|
return x`
|
|
2988
|
-
<div class="${e$1(radioClasses)}">
|
|
3020
|
+
<div class="${e$1(radioClasses)}" @click="${this._handleClick}">
|
|
2989
3021
|
<label class="sds-radio__label">
|
|
2990
3022
|
<input
|
|
2991
3023
|
id="control"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
type NonEmptyString
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type SdsTagName = `sds-${NonEmptyString}`;
|
|
5
|
-
export declare function guardedCustomElement<Tag extends `sds-${string}`>(tagName: Tag): ClassDecorator;
|
|
1
|
+
type NonEmptyString<T extends string> = '' extends T ? never : T;
|
|
2
|
+
export type SdsTagName<T extends string> = `sds-${NonEmptyString<T>}`;
|
|
3
|
+
export declare function guardedCustomElement<Tag extends string>(tagName: SdsTagName<Tag>): ClassDecorator;
|
|
6
4
|
export {};
|
|
7
5
|
//# sourceMappingURL=guarded-custom-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guarded-custom-element.d.ts","sourceRoot":"","sources":["../../src/utils/guarded-custom-element.ts"],"names":[],"mappings":"AAEA,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"guarded-custom-element.d.ts","sourceRoot":"","sources":["../../src/utils/guarded-custom-element.ts"],"names":[],"mappings":"AAEA,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,EAAE,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,OAAO,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AAEtE,wBAAgB,oBAAoB,CAAC,GAAG,SAAS,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,cAAc,CAMjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guarded-custom-element.js","sourceRoot":"","sources":["../../src/utils/guarded-custom-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,MAAM,UAAU,oBAAoB,
|
|
1
|
+
{"version":3,"file":"guarded-custom-element.js","sourceRoot":"","sources":["../../src/utils/guarded-custom-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,MAAM,UAAU,oBAAoB,CAAqB,OAAwB;IAChF,OAAO,CAAC,GAAG,EAAE,EAAE;QACd,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { customElement as litCustomElement } from 'lit/decorators.js';\n\ntype NonEmptyString<T extends string> = '' extends T ? never : T;\nexport type SdsTagName<T extends string> = `sds-${NonEmptyString<T>}`;\n\nexport function guardedCustomElement<Tag extends string>(tagName: SdsTagName<Tag>): ClassDecorator {\n\treturn (cls) => {\n\t\tif (!customElements.get(tagName)) {\n\t\t\tlitCustomElement(tagName)(cls);\n\t\t}\n\t};\n}\n"]}
|