@politiet/sheriff-web-components 2.6.1 → 2.7.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/custom-elements.json +620 -292
- package/dist/frameworks/preact.d.ts +7 -1
- package/dist/frameworks/preact.d.ts.map +1 -1
- package/dist/frameworks/react.d.ts +22 -11
- package/dist/frameworks/react.d.ts.map +1 -1
- package/dist/frameworks/solidjs.d.ts +2 -0
- package/dist/frameworks/solidjs.d.ts.map +1 -1
- package/dist/frameworks/svelte.d.ts +2 -0
- package/dist/frameworks/svelte.d.ts.map +1 -1
- package/dist/frameworks/vue.d.ts +2 -0
- package/dist/frameworks/vue.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mixins/sds-dialog-target-mixin.d.ts +2 -0
- package/dist/mixins/sds-dialog-target-mixin.d.ts.map +1 -1
- package/dist/mixins/sds-dialog-target-mixin.js +31 -15
- package/dist/mixins/sds-dialog-target-mixin.js.map +1 -1
- package/dist/mixins/sds-form-control-mixin.d.ts +5 -0
- package/dist/mixins/sds-form-control-mixin.d.ts.map +1 -1
- package/dist/mixins/sds-form-control-mixin.js +1 -1
- package/dist/mixins/sds-form-control-mixin.js.map +1 -1
- package/dist/react-wrappers/SDSDetailsGroupWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSDetailsGroupWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSDetailsGroupWrapper.js +9 -0
- package/dist/react-wrappers/SDSDetailsGroupWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSDetailsWrapper.d.ts.map +1 -1
- package/dist/react-wrappers/SDSDetailsWrapper.js +1 -1
- package/dist/react-wrappers/SDSDetailsWrapper.js.map +1 -1
- package/dist/react-wrappers/SDSPopoverWrapper.d.ts +4 -1
- package/dist/react-wrappers/SDSPopoverWrapper.d.ts.map +1 -1
- package/dist/react-wrappers/SDSPopoverWrapper.js +3 -1
- package/dist/react-wrappers/SDSPopoverWrapper.js.map +1 -1
- package/dist/react-wrappers/SDSTooltipWrapper.d.ts +6 -0
- package/dist/react-wrappers/SDSTooltipWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSTooltipWrapper.js +12 -0
- package/dist/react-wrappers/SDSTooltipWrapper.js.map +1 -0
- package/dist/react-wrappers/index.d.ts +2 -0
- package/dist/react-wrappers/index.d.ts.map +1 -1
- package/dist/react-wrappers/index.js +2 -0
- package/dist/react-wrappers/index.js.map +1 -1
- package/dist/sds-alert/sds-alert.component.js +1 -1
- package/dist/sds-alert/sds-alert.component.js.map +1 -1
- package/dist/sds-button/sds-button.component.d.ts +1 -0
- package/dist/sds-button/sds-button.component.d.ts.map +1 -1
- package/dist/sds-button/sds-button.component.js +6 -1
- package/dist/sds-button/sds-button.component.js.map +1 -1
- package/dist/sds-button/sds-button.spec.js +1 -1
- package/dist/sds-button/sds-button.spec.js.map +1 -1
- package/dist/sds-card/sds-card.js +1 -1
- package/dist/sds-card/sds-card.js.map +1 -1
- package/dist/sds-card/sds-card.styles.d.ts.map +1 -1
- package/dist/sds-card/sds-card.styles.js +24 -21
- package/dist/sds-card/sds-card.styles.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.d.ts +2 -2
- package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.js +6 -3
- package/dist/sds-checkbox/sds-checkbox.js.map +1 -1
- package/dist/sds-checkbox-group/sds-checkbox-group.d.ts.map +1 -1
- package/dist/sds-checkbox-group/sds-checkbox-group.js +5 -3
- package/dist/sds-checkbox-group/sds-checkbox-group.js.map +1 -1
- package/dist/sds-chip/sds-chip.d.ts +7 -5
- package/dist/sds-chip/sds-chip.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.js +29 -16
- package/dist/sds-chip/sds-chip.js.map +1 -1
- package/dist/sds-details/sds-details.d.ts +3 -2
- package/dist/sds-details/sds-details.d.ts.map +1 -1
- package/dist/sds-details/sds-details.js +11 -2
- package/dist/sds-details/sds-details.js.map +1 -1
- package/dist/sds-details/sds-details.styles.d.ts.map +1 -1
- package/dist/sds-details/sds-details.styles.js +10 -5
- package/dist/sds-details/sds-details.styles.js.map +1 -1
- package/dist/sds-details-group/sds-details-group.d.ts +24 -0
- package/dist/sds-details-group/sds-details-group.d.ts.map +1 -0
- package/dist/sds-details-group/sds-details-group.js +73 -0
- package/dist/sds-details-group/sds-details-group.js.map +1 -0
- package/dist/sds-details-group/sds-details-group.styles.d.ts +2 -0
- package/dist/sds-details-group/sds-details-group.styles.d.ts.map +1 -0
- package/dist/sds-details-group/sds-details-group.styles.js +30 -0
- package/dist/sds-details-group/sds-details-group.styles.js.map +1 -0
- package/dist/sds-dialog/sds-dialog.component.js +1 -1
- package/dist/sds-dialog/sds-dialog.component.js.map +1 -1
- package/dist/sds-dialog/sds-dialog.spec.js +17 -3
- package/dist/sds-dialog/sds-dialog.spec.js.map +1 -1
- package/dist/sds-heading/sds-heading.styles.d.ts.map +1 -1
- package/dist/sds-heading/sds-heading.styles.js +8 -2
- package/dist/sds-heading/sds-heading.styles.js.map +1 -1
- package/dist/sds-popover/sds-popover.d.ts +3 -1
- package/dist/sds-popover/sds-popover.d.ts.map +1 -1
- package/dist/sds-popover/sds-popover.js +18 -4
- package/dist/sds-popover/sds-popover.js.map +1 -1
- package/dist/sds-process-step/sds-process-step.styles.d.ts.map +1 -1
- package/dist/sds-process-step/sds-process-step.styles.js +6 -2
- package/dist/sds-process-step/sds-process-step.styles.js.map +1 -1
- package/dist/sds-radio/sds-radio.d.ts +2 -2
- package/dist/sds-radio/sds-radio.d.ts.map +1 -1
- package/dist/sds-radio/sds-radio.js +5 -2
- package/dist/sds-radio/sds-radio.js.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.js +5 -3
- package/dist/sds-radio-group/sds-radio-group.js.map +1 -1
- package/dist/sds-select/sds-select.component.d.ts +2 -2
- package/dist/sds-select/sds-select.component.d.ts.map +1 -1
- package/dist/sds-select/sds-select.component.js +5 -3
- package/dist/sds-select/sds-select.component.js.map +1 -1
- package/dist/sds-switch/sds-switch.d.ts +2 -2
- package/dist/sds-switch/sds-switch.d.ts.map +1 -1
- package/dist/sds-switch/sds-switch.js.map +1 -1
- package/dist/sds-text/sds-text.styles.d.ts.map +1 -1
- package/dist/sds-text/sds-text.styles.js +193 -54
- package/dist/sds-text/sds-text.styles.js.map +1 -1
- package/dist/sds-textarea/sds-textarea.d.ts +2 -2
- package/dist/sds-textarea/sds-textarea.d.ts.map +1 -1
- package/dist/sds-textarea/sds-textarea.js +7 -3
- package/dist/sds-textarea/sds-textarea.js.map +1 -1
- package/dist/sds-textfield/sds-textfield.d.ts +2 -2
- package/dist/sds-textfield/sds-textfield.d.ts.map +1 -1
- package/dist/sds-textfield/sds-textfield.js +5 -2
- package/dist/sds-textfield/sds-textfield.js.map +1 -1
- package/dist/sds-tooltip/assets/tooltip-styles.d.ts +3 -0
- package/dist/sds-tooltip/assets/tooltip-styles.d.ts.map +1 -0
- package/dist/sds-tooltip/assets/tooltip-styles.js +3 -0
- package/dist/sds-tooltip/assets/tooltip-styles.js.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.d.ts +35 -0
- package/dist/sds-tooltip/sds-tooltip.d.ts.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.js +140 -0
- package/dist/sds-tooltip/sds-tooltip.js.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.spec.d.ts +2 -0
- package/dist/sds-tooltip/sds-tooltip.spec.d.ts.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.spec.js +35 -0
- package/dist/sds-tooltip/sds-tooltip.spec.js.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.styles.d.ts +2 -0
- package/dist/sds-tooltip/sds-tooltip.styles.d.ts.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.styles.js +87 -0
- package/dist/sds-tooltip/sds-tooltip.styles.js.map +1 -0
- package/dist/shared/positioning.d.ts +2 -0
- package/dist/shared/positioning.d.ts.map +1 -0
- package/dist/shared/positioning.js +2 -0
- package/dist/shared/positioning.js.map +1 -0
- package/dist/sheriff-web-components.js +576 -297
- package/package.json +14 -4
- package/web-types.json +460 -11
- /package/dist/{sds-popover → shared}/assets/positioning.js +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
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 { property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
|
+
import { guardedCustomElement } from '../utils/guarded-custom-element';
|
|
10
|
+
import { styles } from './sds-details-group.styles';
|
|
11
|
+
let SDSDetailsGroup = class SDSDetailsGroup extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.outlined = false;
|
|
15
|
+
this._toggleListeners = new Map();
|
|
16
|
+
}
|
|
17
|
+
updated(changedProperties) {
|
|
18
|
+
if (changedProperties.has('name')) {
|
|
19
|
+
this._syncChildren();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
disconnectedCallback() {
|
|
23
|
+
super.disconnectedCallback();
|
|
24
|
+
this._removeListeners();
|
|
25
|
+
}
|
|
26
|
+
_handleSlotChange() {
|
|
27
|
+
this._syncChildren();
|
|
28
|
+
}
|
|
29
|
+
_syncChildren() {
|
|
30
|
+
this._removeListeners();
|
|
31
|
+
const children = this._detailsChildren;
|
|
32
|
+
children.forEach(child => {
|
|
33
|
+
child.name = this.name;
|
|
34
|
+
if (this.name) {
|
|
35
|
+
const listener = (event) => {
|
|
36
|
+
const { open } = event.detail;
|
|
37
|
+
if (open) {
|
|
38
|
+
children.forEach(sibling => {
|
|
39
|
+
if (sibling !== child && sibling.open)
|
|
40
|
+
sibling.open = false;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
child.addEventListener('toggle', listener);
|
|
45
|
+
this._toggleListeners.set(child, listener);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
_removeListeners() {
|
|
50
|
+
this._toggleListeners.forEach((listener, child) => {
|
|
51
|
+
child.removeEventListener('toggle', listener);
|
|
52
|
+
});
|
|
53
|
+
this._toggleListeners.clear();
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return html `<div><slot @slotchange="${this._handleSlotChange}"></slot></div>`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
SDSDetailsGroup.styles = [styles];
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: Boolean, reflect: true })
|
|
62
|
+
], SDSDetailsGroup.prototype, "outlined", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: String, reflect: true })
|
|
65
|
+
], SDSDetailsGroup.prototype, "name", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
queryAssignedElements({ selector: 'sds-details' })
|
|
68
|
+
], SDSDetailsGroup.prototype, "_detailsChildren", void 0);
|
|
69
|
+
SDSDetailsGroup = __decorate([
|
|
70
|
+
guardedCustomElement('sds-details-group')
|
|
71
|
+
], SDSDetailsGroup);
|
|
72
|
+
export { SDSDetailsGroup };
|
|
73
|
+
//# sourceMappingURL=sds-details-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-details-group.js","sourceRoot":"","sources":["../../src/sds-details-group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AAI;gCAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;wBAC7D,CAAC,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC,CAAC;gBACF,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAC3C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5C,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACvB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;YACjD,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAA,2BAA2B,IAAI,CAAC,iBAAiB,iBAAiB,CAAC;IAC/E,CAAC;;AA3De,sBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACQ;AAGnD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACP;AAG3B;IADP,qBAAqB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;yDACN;AAVjC,eAAe;IAD3B,oBAAoB,CAAC,mBAAmB,CAAC;GAC7B,eAAe,CA6D3B","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-details-group.styles';\nimport type { SDSDetails } from '../sds-details/sds-details';\n\nexport interface SDSDetailsGroupProps {\n\toutlined?: boolean;\n\tname?: string;\n}\n\n@guardedCustomElement('sds-details-group')\nexport class SDSDetailsGroup extends LitElement {\n\tstatic override styles = [styles];\n\n\t@property({ type: Boolean, reflect: true })\n\toutlined: SDSDetailsGroupProps['outlined'] = false;\n\n\t@property({ type: String, reflect: true })\n\tname: SDSDetailsGroupProps['name'];\n\n\t@queryAssignedElements({ selector: 'sds-details' })\n\tprivate _detailsChildren!: Array<SDSDetails>;\n\tprivate _toggleListeners = new Map<SDSDetails, EventListener>();\n\n\toverride updated(changedProperties: Map<string, unknown>) {\n\t\tif (changedProperties.has('name')) {\n\t\t\tthis._syncChildren();\n\t\t}\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\tthis._removeListeners();\n\t}\n\n\tprivate _handleSlotChange() {\n\t\tthis._syncChildren();\n\t}\n\n\tprivate _syncChildren() {\n\t\tthis._removeListeners();\n\n\t\tconst children = this._detailsChildren;\n\n\t\tchildren.forEach(child => {\n\t\t\tchild.name = this.name;\n\n\t\t\tif (this.name) {\n\t\t\t\tconst listener: EventListener = (event: Event) => {\n\t\t\t\t\tconst { open } = (event as CustomEvent<{ open: boolean }>).detail;\n\t\t\t\t\tif (open) {\n\t\t\t\t\t\tchildren.forEach(sibling => {\n\t\t\t\t\t\t\tif (sibling !== child && sibling.open) sibling.open = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tchild.addEventListener('toggle', listener);\n\t\t\t\tthis._toggleListeners.set(child, listener);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _removeListeners() {\n\t\tthis._toggleListeners.forEach((listener, child) => {\n\t\t\tchild.removeEventListener('toggle', listener);\n\t\t});\n\t\tthis._toggleListeners.clear();\n\t}\n\n\toverride render() {\n\t\treturn html`<div><slot @slotchange=\"${this._handleSlotChange}\"></slot></div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-details-group': SDSDetailsGroup;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-details-group.styles.d.ts","sourceRoot":"","sources":["../../src/sds-details-group/sds-details-group.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA2BlB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
div ::slotted(sds-details:not(:last-child)) {
|
|
8
|
+
--sds-details-border-bottom: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([outlined]) div {
|
|
12
|
+
border: 1px solid var(--sds-color-border-subtle, var(--sds-color-main-border-subtle));
|
|
13
|
+
border-radius: var(--sds-radius-md);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([outlined]) div ::slotted(sds-details:first-child) {
|
|
17
|
+
--sds-details-border-top: 0;
|
|
18
|
+
--sds-details-summary-border-radius: var(--sds-radius-md) var(--sds-radius-md) 0 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([outlined]) div ::slotted(sds-details:last-child) {
|
|
22
|
+
--sds-details-border-bottom: 0;
|
|
23
|
+
--sds-details-summary-border-radius: 0 0 var(--sds-radius-md) var(--sds-radius-md);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([outlined]) div ::slotted(sds-details:last-child[open]) {
|
|
27
|
+
--sds-details-summary-border-radius: 0;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=sds-details-group.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-details-group.styles.js","sourceRoot":"","sources":["../../src/sds-details-group/sds-details-group.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\tdisplay: block;\n\t}\n\n\tdiv ::slotted(sds-details:not(:last-child)) {\n\t\t--sds-details-border-bottom: 0;\n\t}\n\n\t:host([outlined]) div {\n\t\tborder: 1px solid var(--sds-color-border-subtle, var(--sds-color-main-border-subtle));\n\t\tborder-radius: var(--sds-radius-md);\n\t}\n\n\t:host([outlined]) div ::slotted(sds-details:first-child) {\n\t\t--sds-details-border-top: 0;\n\t\t--sds-details-summary-border-radius: var(--sds-radius-md) var(--sds-radius-md) 0 0;\n\t}\n\n\t:host([outlined]) div ::slotted(sds-details:last-child) {\n\t\t--sds-details-border-bottom: 0;\n\t\t--sds-details-summary-border-radius: 0 0 var(--sds-radius-md) var(--sds-radius-md);\n\t}\n\n\t:host([outlined]) div ::slotted(sds-details:last-child[open]) {\n\t\t--sds-details-summary-border-radius: 0;\n\t}\n`;\n"]}
|
|
@@ -147,7 +147,7 @@ export class SDSDialogComponent extends SDSEventDispatcherMixin(LitElement) {
|
|
|
147
147
|
<slot name="header" @slotchange=${this._handleHeaderSlotChange}></slot>
|
|
148
148
|
${this.closeButtonLabel
|
|
149
149
|
? html `
|
|
150
|
-
<sds-button class="sds-dialog__close-button" icon variant="tertiary" size="md"
|
|
150
|
+
<sds-button class="sds-dialog__close-button" icon variant="tertiary" size="md" command="close" label="${this.closeButtonLabel}">
|
|
151
151
|
<sds-icon name="close-material-outlined" size="md"></sds-icon>
|
|
152
152
|
</sds-button>
|
|
153
153
|
`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-dialog.component.js","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBA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;;;GAKZ,CAAC;IACH,CAAC;;AAhLe,yBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAEU;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAuB;AACtB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAwB;AACxB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAqC;AAClB;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;4DAA+C;AAElF;IAAxB,KAAK,CAAC,QAAQ,CAAC;mDAAqC;AAEpC;IAAhB,KAAK,EAAE;8DAA4C","sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { styles } from './sds-dialog.styles';\nimport { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';\n\ntype ClosedBy = 'none' | 'closerequest' | 'any';\n\nexport interface SDSDialogProps {\n\topen?: boolean;\n\t/**\n\t * Set if dialog opens as a modal or not\n\t *\n\t * If non-modal, the user is allowed to interact with content outside of the dialog.\n\t * If modal, the dialog is placed in the top layer with a ::backdrop pseudo-element.\n\t *\n\t * Docs:\n\t * - https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/show\n\t * - https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal\n\t */\n\tmodal?: boolean;\n\t/**\n\t * Set what type of dismiss behavior closes the dialog\n\t * - 'none': Dialog can only be closed programmatically\n\t * - 'closerequest': Dialog closes on ESC key (default)\n\t * - 'any': Dialog closes on ESC key or clicking outside\n\t *\n\t * Docs: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy\n\t */\n\tclosedby?: ClosedBy;\n\t'close-button-label'?: string;\n}\n\nexport class SDSDialogComponent extends SDSEventDispatcherMixin(LitElement) {\n\tstatic override styles = [styles];\n\n\t@property({ type: Boolean, reflect: true }) open: boolean = false;\n\t@property({ type: Boolean, reflect: true }) modal: boolean = false;\n\t@property({ type: String, reflect: true }) closedby: ClosedBy = 'closerequest';\n\t@property({ type: String, attribute: 'close-button-label' }) closeButtonLabel: string = 'Lukk dialogvindu';\n\n\t@query('dialog') private _dialog!: HTMLDialogElement;\n\n\t@state() private _isHeaderSlotEmpty: boolean = true;\n\n\t// Safari closedBy=any polyfill state\n\tprivate _pointerDownInside = false;\n\n\toverride firstUpdated(): void {\n\t\tthis._setupEventListeners();\n\t\tif (this.open) {\n\t\t\tthis._openDialog();\n\t\t}\n\t}\n\n\toverride updated(changedProperties: PropertyValues): void {\n\t\tif (!changedProperties.has('open')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis._openDialog();\n\t\t} else {\n\t\t\tthis._closeDialog();\n\t\t}\n\t}\n\n\tprivate _setupEventListeners(): void {\n\t\tthis._dialog.addEventListener('close', this._handleClose);\n\t\tthis._dialog.addEventListener('cancel', this._handleCancel);\n\t\tthis._dialog.addEventListener('click', this._handleClick);\n\t\tthis._dialog.addEventListener('pointerdown', this._handlePointerDown);\n\t\tthis._dialog.addEventListener('pointerup', this._handlePointerUp);\n\t\tthis._dialog.addEventListener('animationend', this._handleAutoFocus);\n\t}\n\n\tprivate _openDialog(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.modal) {\n\t\t\tthis._dialog.showModal();\n\t\t} else {\n\t\t\tthis._dialog.show();\n\t\t}\n\t}\n\n\tprivate _closeDialog(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\t\tthis._dialog.close();\n\t}\n\n\tprivate readonly _handleClose = (): void => {\n\t\tthis.open = false;\n\t\tthis.dispatchSheriffEvent('sds-close');\n\t};\n\n\tprivate readonly _handleClick = (event: MouseEvent): void => {\n\t\tconst target = event.target as Element | null;\n\n\t\tif (target?.closest('[data-command=\"close\"],[command=\"close\"]')) {\n\t\t\tthis._closeDialog();\n\t\t}\n\t};\n\n\t// Safari closedBy=\"any\" polyfill\n\t// Calculate whether the user's pointer down event is outside or inside dialog\n\t// If outside, close the dialog\n\tprivate readonly _handlePointerDown = (event: PointerEvent): void => {\n\t\tconst rect = this._dialog.getBoundingClientRect();\n\t\tconst { clientX: x, clientY: y } = event;\n\t\tthis._pointerDownInside = rect.top <= y && y <= rect.bottom && rect.left <= x && x <= rect.right;\n\t};\n\n\tprivate readonly _handlePointerUp = (event: PointerEvent): void => {\n\t\tconst wasDownInside = this._pointerDownInside;\n\t\tthis._pointerDownInside = false;\n\n\t\tif (this.closedby !== 'any' || wasDownInside) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clicking the backdrop will have the dialog as the target in Safari/Chrome.\n\t\t// Firefox does not fire this callback when ::backdrop is clicked.\n\t\tif (event.target !== this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Use requestAnimationFrame to let the browser handle native closedBy first.\n\t\t// This avoids checking for the closedBy property, which Safari 26.2 exposes\n\t\t// without implementing.\n\t\trequestAnimationFrame(() => {\n\t\t\tif (this._dialog && this._dialog.open) {\n\t\t\t\tthis._closeDialog();\n\t\t\t}\n\t\t});\n\t};\n\n\tprivate readonly _handleCancel = (event: Event): void => {\n\t\tif (this.closedby === 'none') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tprivate readonly _handleHeaderSlotChange = (event: Event): void => {\n\t\tconst slot = event.target as HTMLSlotElement;\n\t\tthis._isHeaderSlotEmpty = slot.assignedElements().length === 0;\n\t};\n\n\tprivate readonly _handleAutoFocus = (): void => {\n\t\t// slot:not([name]) finds the default nameless slot\n\t\tconst contentSlotElements = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])')?.assignedElements({ flatten: true });\n\t\tif (!contentSlotElements || contentSlotElements.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementToFocus = contentSlotElements.find((element) => {\n\t\t\treturn element.getAttribute('autofocus') != null;\n\t\t});\n\n\t\tif (!(elementToFocus instanceof HTMLElement)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (document.activeElement !== elementToFocus) {\n\t\t\telementToFocus.focus();\n\t\t}\n\t};\n\n\tpublic show(): void {\n\t\tthis.open = true;\n\t}\n\n\tpublic showModal(): void {\n\t\tthis.modal = true;\n\t\tthis.open = true;\n\t}\n\n\tpublic close(): void {\n\t\tthis.open = false;\n\t}\n\n\tpublic requestClose(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dialog.requestClose();\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t<dialog .closedBy=\"${this.closedby}\" class=${this._isHeaderSlotEmpty ? 'sds-dialog__empty-header' : ''}>\n\t\t\t\t<div class=\"sds-dialog__header\">\n\t\t\t\t\t<slot name=\"header\" @slotchange=${this._handleHeaderSlotChange}></slot>\n\t\t\t\t\t${this.closeButtonLabel\n\t\t\t\t\t\t? html`\n\t\t\t\t\t\t\t\t<sds-button class=\"sds-dialog__close-button\" icon variant=\"tertiary\" size=\"md\" data-command=\"close\" aria-label=\"${this.closeButtonLabel}\">\n\t\t\t\t\t\t\t\t\t<sds-icon name=\"close-material-outlined\" size=\"md\"></sds-icon>\n\t\t\t\t\t\t\t\t</sds-button>\n\t\t\t\t\t\t\t`\n\t\t\t\t\t\t: nothing}\n\t\t\t\t</div>\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"footer\"></slot>\n\t\t\t</dialog>\n\t\t`;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sds-dialog.component.js","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EA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,CAAC,gBAAgB;;;QAG7H;YACF,CAAC,CAAC,OAAO;;;;;GAKZ,CAAC;IACH,CAAC;;AAhLe,yBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAEU;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAuB;AACtB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAwB;AACxB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAqC;AAClB;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;4DAA+C;AAElF;IAAxB,KAAK,CAAC,QAAQ,CAAC;mDAAqC;AAEpC;IAAhB,KAAK,EAAE;8DAA4C","sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { styles } from './sds-dialog.styles';\nimport { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';\n\ntype ClosedBy = 'none' | 'closerequest' | 'any';\n\nexport interface SDSDialogProps {\n\topen?: boolean;\n\t/**\n\t * Set if dialog opens as a modal or not\n\t *\n\t * If non-modal, the user is allowed to interact with content outside of the dialog.\n\t * If modal, the dialog is placed in the top layer with a ::backdrop pseudo-element.\n\t *\n\t * Docs:\n\t * - https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/show\n\t * - https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal\n\t */\n\tmodal?: boolean;\n\t/**\n\t * Set what type of dismiss behavior closes the dialog\n\t * - 'none': Dialog can only be closed programmatically\n\t * - 'closerequest': Dialog closes on ESC key (default)\n\t * - 'any': Dialog closes on ESC key or clicking outside\n\t *\n\t * Docs: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy\n\t */\n\tclosedby?: ClosedBy;\n\t'close-button-label'?: string;\n}\n\nexport class SDSDialogComponent extends SDSEventDispatcherMixin(LitElement) {\n\tstatic override styles = [styles];\n\n\t@property({ type: Boolean, reflect: true }) open: boolean = false;\n\t@property({ type: Boolean, reflect: true }) modal: boolean = false;\n\t@property({ type: String, reflect: true }) closedby: ClosedBy = 'closerequest';\n\t@property({ type: String, attribute: 'close-button-label' }) closeButtonLabel: string = 'Lukk dialogvindu';\n\n\t@query('dialog') private _dialog!: HTMLDialogElement;\n\n\t@state() private _isHeaderSlotEmpty: boolean = true;\n\n\t// Safari closedBy=any polyfill state\n\tprivate _pointerDownInside = false;\n\n\toverride firstUpdated(): void {\n\t\tthis._setupEventListeners();\n\t\tif (this.open) {\n\t\t\tthis._openDialog();\n\t\t}\n\t}\n\n\toverride updated(changedProperties: PropertyValues): void {\n\t\tif (!changedProperties.has('open')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis._openDialog();\n\t\t} else {\n\t\t\tthis._closeDialog();\n\t\t}\n\t}\n\n\tprivate _setupEventListeners(): void {\n\t\tthis._dialog.addEventListener('close', this._handleClose);\n\t\tthis._dialog.addEventListener('cancel', this._handleCancel);\n\t\tthis._dialog.addEventListener('click', this._handleClick);\n\t\tthis._dialog.addEventListener('pointerdown', this._handlePointerDown);\n\t\tthis._dialog.addEventListener('pointerup', this._handlePointerUp);\n\t\tthis._dialog.addEventListener('animationend', this._handleAutoFocus);\n\t}\n\n\tprivate _openDialog(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.modal) {\n\t\t\tthis._dialog.showModal();\n\t\t} else {\n\t\t\tthis._dialog.show();\n\t\t}\n\t}\n\n\tprivate _closeDialog(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\t\tthis._dialog.close();\n\t}\n\n\tprivate readonly _handleClose = (): void => {\n\t\tthis.open = false;\n\t\tthis.dispatchSheriffEvent('sds-close');\n\t};\n\n\tprivate readonly _handleClick = (event: MouseEvent): void => {\n\t\tconst target = event.target as Element | null;\n\n\t\tif (target?.closest('[data-command=\"close\"],[command=\"close\"]')) {\n\t\t\tthis._closeDialog();\n\t\t}\n\t};\n\n\t// Safari closedBy=\"any\" polyfill\n\t// Calculate whether the user's pointer down event is outside or inside dialog\n\t// If outside, close the dialog\n\tprivate readonly _handlePointerDown = (event: PointerEvent): void => {\n\t\tconst rect = this._dialog.getBoundingClientRect();\n\t\tconst { clientX: x, clientY: y } = event;\n\t\tthis._pointerDownInside = rect.top <= y && y <= rect.bottom && rect.left <= x && x <= rect.right;\n\t};\n\n\tprivate readonly _handlePointerUp = (event: PointerEvent): void => {\n\t\tconst wasDownInside = this._pointerDownInside;\n\t\tthis._pointerDownInside = false;\n\n\t\tif (this.closedby !== 'any' || wasDownInside) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clicking the backdrop will have the dialog as the target in Safari/Chrome.\n\t\t// Firefox does not fire this callback when ::backdrop is clicked.\n\t\tif (event.target !== this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Use requestAnimationFrame to let the browser handle native closedBy first.\n\t\t// This avoids checking for the closedBy property, which Safari 26.2 exposes\n\t\t// without implementing.\n\t\trequestAnimationFrame(() => {\n\t\t\tif (this._dialog && this._dialog.open) {\n\t\t\t\tthis._closeDialog();\n\t\t\t}\n\t\t});\n\t};\n\n\tprivate readonly _handleCancel = (event: Event): void => {\n\t\tif (this.closedby === 'none') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tprivate readonly _handleHeaderSlotChange = (event: Event): void => {\n\t\tconst slot = event.target as HTMLSlotElement;\n\t\tthis._isHeaderSlotEmpty = slot.assignedElements().length === 0;\n\t};\n\n\tprivate readonly _handleAutoFocus = (): void => {\n\t\t// slot:not([name]) finds the default nameless slot\n\t\tconst contentSlotElements = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])')?.assignedElements({ flatten: true });\n\t\tif (!contentSlotElements || contentSlotElements.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementToFocus = contentSlotElements.find((element) => {\n\t\t\treturn element.getAttribute('autofocus') != null;\n\t\t});\n\n\t\tif (!(elementToFocus instanceof HTMLElement)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (document.activeElement !== elementToFocus) {\n\t\t\telementToFocus.focus();\n\t\t}\n\t};\n\n\tpublic show(): void {\n\t\tthis.open = true;\n\t}\n\n\tpublic showModal(): void {\n\t\tthis.modal = true;\n\t\tthis.open = true;\n\t}\n\n\tpublic close(): void {\n\t\tthis.open = false;\n\t}\n\n\tpublic requestClose(): void {\n\t\tif (!this._dialog) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dialog.requestClose();\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t<dialog .closedBy=\"${this.closedby}\" class=${this._isHeaderSlotEmpty ? 'sds-dialog__empty-header' : ''}>\n\t\t\t\t<div class=\"sds-dialog__header\">\n\t\t\t\t\t<slot name=\"header\" @slotchange=${this._handleHeaderSlotChange}></slot>\n\t\t\t\t\t${this.closeButtonLabel\n\t\t\t\t\t\t? html`\n\t\t\t\t\t\t\t\t<sds-button class=\"sds-dialog__close-button\" icon variant=\"tertiary\" size=\"md\" command=\"close\" label=\"${this.closeButtonLabel}\">\n\t\t\t\t\t\t\t\t\t<sds-icon name=\"close-material-outlined\" size=\"md\"></sds-icon>\n\t\t\t\t\t\t\t\t</sds-button>\n\t\t\t\t\t\t\t`\n\t\t\t\t\t\t: nothing}\n\t\t\t\t</div>\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"footer\"></slot>\n\t\t\t</dialog>\n\t\t`;\n\t}\n}\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { test, expect } from '@playwright/test';
|
|
2
2
|
test.describe('dialog-component', () => {
|
|
3
|
-
test.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
test.beforeEach(async ({ page }) => {
|
|
4
|
+
await page.goto('iframe.html?viewMode=docs&id=test-dialog--docs');
|
|
5
|
+
await page.evaluate(async () => {
|
|
6
|
+
await customElements.whenDefined('sds-dialog');
|
|
6
7
|
});
|
|
8
|
+
});
|
|
9
|
+
test.describe('commandfor', () => {
|
|
7
10
|
test('sets aria-haspopup on the trigger button', async ({ page }) => {
|
|
8
11
|
const innerButton = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]').locator('button');
|
|
9
12
|
await expect(innerButton).toHaveAttribute('aria-haspopup', 'dialog');
|
|
@@ -46,5 +49,16 @@ test.describe('dialog-component', () => {
|
|
|
46
49
|
await expect(innerButton).toHaveAttribute('aria-expanded', 'false');
|
|
47
50
|
});
|
|
48
51
|
});
|
|
52
|
+
test.describe('also supports data-command', () => {
|
|
53
|
+
test('can open and close using data-command', async ({ page }) => {
|
|
54
|
+
const opener = page.locator('sds-button#trigger-data');
|
|
55
|
+
const closer = page.locator('sds-button#close-data');
|
|
56
|
+
const dialog = page.locator('sds-dialog#command-fixture-dialog');
|
|
57
|
+
await opener.click();
|
|
58
|
+
await expect(dialog).toHaveAttribute('open');
|
|
59
|
+
await closer.click();
|
|
60
|
+
await expect(dialog).not.toHaveAttribute('open');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
49
63
|
});
|
|
50
64
|
//# sourceMappingURL=sds-dialog.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-dialog.spec.js","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEhD,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACtC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"sds-dialog.spec.js","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from '@playwright/test';\n\ntest.describe('dialog-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto('iframe.html?viewMode=docs&id=test-dialog--docs');\n\n\t\tawait page.evaluate(async () => {\n\t\t\tawait customElements.whenDefined('sds-dialog');\n\t\t});\n\t});\n\n\ttest.describe('commandfor', () => {\n\t\ttest('sets aria-haspopup on the trigger button', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-haspopup', 'dialog');\n\t\t});\n\n\t\ttest('sets aria-controls on the trigger button', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-controls', 'dialog-example');\n\t\t});\n\n\t\ttest('aria-expanded is false before opening', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\n\t\ttest('clicking the trigger opens the dialog', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst dialog = page.locator('sds-dialog#dialog-example');\n\n\t\t\tawait trigger.click();\n\n\t\t\tawait expect(dialog).toHaveAttribute('open');\n\t\t});\n\n\t\ttest('aria-expanded is true when dialog is open', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\t\t});\n\n\t\ttest('closing via command=\"close\" resets aria-expanded', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\n\t\t\tconst closeButton = page.locator('sds-dialog#dialog-example sds-button[slot=\"footer\"][command=\"close\"]');\n\t\t\tawait closeButton.click();\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\n\t\ttest('closing via ESC resets aria-expanded', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\n\t\t\tawait page.keyboard.press('Escape');\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\t});\n\n\ttest.describe('also supports data-command', () => {\n\t\ttest('can open and close using data-command', async ({ page }) => {\n\t\t\tconst opener = page.locator('sds-button#trigger-data');\n\t\t\tconst closer = page.locator('sds-button#close-data');\n\t\t\tconst dialog = page.locator('sds-dialog#command-fixture-dialog');\n\n\t\t\tawait opener.click();\n\t\t\tawait expect(dialog).toHaveAttribute('open');\n\n\t\t\tawait closer.click();\n\t\t\tawait expect(dialog).not.toHaveAttribute('open');\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-heading.styles.d.ts","sourceRoot":"","sources":["../../src/sds-heading/sds-heading.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"sds-heading.styles.d.ts","sourceRoot":"","sources":["../../src/sds-heading/sds-heading.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA+JlB,CAAC"}
|
|
@@ -7,12 +7,15 @@ export const styles = css `
|
|
|
7
7
|
--_sds-heading-margin: var(--sds-heading-margin, 0);
|
|
8
8
|
--_sds-heading-padding: var(--sds-heading-padding, 0);
|
|
9
9
|
--_sds-heading-text-align: var(--sds-heading-text-align, left);
|
|
10
|
+
--_sds-heading-text-decoration: var(--sds-heading-text-decoration, inherit);
|
|
11
|
+
--_sds-heading-text-decoration-thickness: var(--sds-heading-text-decoration-thickness, var(--sds-typography-link-text-decoration-thickness));
|
|
12
|
+
--_sds-heading-text-underline-offset: var(--sds-heading-text-underline-offset, var(--sds-typography-link-text-underline-offset));
|
|
10
13
|
|
|
11
14
|
--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xl-mobile-font-size));
|
|
12
15
|
--_sds-heading-font-weight: var(--sds-heading-font-weight, var(--sds-typography-font-weight-bold));
|
|
13
16
|
--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xl-mobile-line-height));
|
|
14
17
|
|
|
15
|
-
display:
|
|
18
|
+
display: block;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
:host([data-palette]) {
|
|
@@ -27,7 +30,7 @@ export const styles = css `
|
|
|
27
30
|
h6,
|
|
28
31
|
.sds-heading {
|
|
29
32
|
color: var(--_sds-heading-text-color);
|
|
30
|
-
display:
|
|
33
|
+
display: inherit;
|
|
31
34
|
font-family: var(--_sds-heading-font-family);
|
|
32
35
|
font-size: var(--_sds-heading-font-size);
|
|
33
36
|
font-weight: var(--_sds-heading-font-weight);
|
|
@@ -36,6 +39,9 @@ export const styles = css `
|
|
|
36
39
|
max-width: var(--_sds-heading-max-line-width);
|
|
37
40
|
padding: var(--_sds-heading-padding);
|
|
38
41
|
text-align: var(--_sds-heading-text-align);
|
|
42
|
+
text-decoration: var(--_sds-heading-text-decoration);
|
|
43
|
+
text-decoration-thickness: var(--_sds-heading-text-decoration-thickness);
|
|
44
|
+
text-underline-offset: var(--_sds-heading-text-underline-offset);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
h1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-heading.styles.js","sourceRoot":"","sources":["../../src/sds-heading/sds-heading.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"sds-heading.styles.js","sourceRoot":"","sources":["../../src/sds-heading/sds-heading.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+JxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-heading-font-family: var(--sds-heading-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-heading-text-color: var(--sds-heading-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\t\t--_sds-heading-max-line-width: var(--sds-heading-max-line-width, var(--sds-typography-max-line-width));\n\t\t--_sds-heading-margin: var(--sds-heading-margin, 0);\n\t\t--_sds-heading-padding: var(--sds-heading-padding, 0);\n\t\t--_sds-heading-text-align: var(--sds-heading-text-align, left);\n\t\t--_sds-heading-text-decoration: var(--sds-heading-text-decoration, inherit);\n\t\t--_sds-heading-text-decoration-thickness: var(--sds-heading-text-decoration-thickness, var(--sds-typography-link-text-decoration-thickness));\n\t\t--_sds-heading-text-underline-offset: var(--sds-heading-text-underline-offset, var(--sds-typography-link-text-underline-offset));\n\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xl-mobile-font-size));\n\t\t--_sds-heading-font-weight: var(--sds-heading-font-weight, var(--sds-typography-font-weight-bold));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xl-mobile-line-height));\n\n\t\tdisplay: block;\n\t}\n\n\t:host([data-palette]) {\n\t\t--_sds-heading-text-color: var(--sds-heading-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\t}\n\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\t.sds-heading {\n\t\tcolor: var(--_sds-heading-text-color);\n\t\tdisplay: inherit;\n\t\tfont-family: var(--_sds-heading-font-family);\n\t\tfont-size: var(--_sds-heading-font-size);\n\t\tfont-weight: var(--_sds-heading-font-weight);\n\t\tline-height: var(--_sds-heading-line-height);\n\t\tmargin: var(--_sds-heading-margin);\n\t\tmax-width: var(--_sds-heading-max-line-width);\n\t\tpadding: var(--_sds-heading-padding);\n\t\ttext-align: var(--_sds-heading-text-align);\n\t\ttext-decoration: var(--_sds-heading-text-decoration);\n\t\ttext-decoration-thickness: var(--_sds-heading-text-decoration-thickness);\n\t\ttext-underline-offset: var(--_sds-heading-text-underline-offset);\n\t}\n\n\th1,\n\t.sds-heading--xl {\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xl-mobile-font-size));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xl-mobile-line-height));\n\t}\n\n\t@media (min-width: 640px) {\n\t\th1,\n\t\t.sds-heading--xl {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xl-tablet-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xl-tablet-line-height));\n\t\t}\n\t}\n\n\t@media (min-width: 1024px) {\n\t\th1,\n\t\t.sds-heading--xl {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xl-desktop-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xl-desktop-line-height));\n\t\t}\n\t}\n\n\th2,\n\t.sds-heading--lg {\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-lg-mobile-font-size));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-lg-mobile-line-height));\n\t}\n\n\t@media (min-width: 640px) {\n\t\th2,\n\t\t.sds-heading--lg {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-lg-tablet-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-lg-tablet-line-height));\n\t\t}\n\t}\n\n\t@media (min-width: 1024px) {\n\t\th2,\n\t\t.sds-heading--lg {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-lg-desktop-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-lg-desktop-line-height));\n\t\t}\n\t}\n\n\th3,\n\t.sds-heading--md {\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-md-mobile-font-size));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-md-mobile-line-height));\n\t}\n\n\t@media (min-width: 640px) {\n\t\th3,\n\t\t.sds-heading--md {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-md-tablet-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-md-tablet-line-height));\n\t\t}\n\t}\n\n\t@media (min-width: 1024px) {\n\t\th3,\n\t\t.sds-heading--md {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-md-desktop-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-md-desktop-line-height));\n\t\t}\n\t}\n\n\th4,\n\t.sds-heading--sm {\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-sm-mobile-font-size));\n\t\t--_sds-heading-font-weight: var(--sds-heading-font-weight, var(--sds-typography-font-weight-semibold));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-sm-mobile-line-height));\n\t}\n\n\t@media (min-width: 640px) {\n\t\th4,\n\t\t.sds-heading--sm {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-sm-tablet-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-sm-tablet-line-height));\n\t\t}\n\t}\n\n\t@media (min-width: 1024px) {\n\t\th4,\n\t\t.sds-heading--sm {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-sm-desktop-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-sm-desktop-line-height));\n\t\t}\n\t}\n\n\th5,\n\th6,\n\t.sds-heading--xs {\n\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xs-mobile-font-size));\n\t\t--_sds-heading-font-weight: var(--sds-heading-font-weight, var(--sds-typography-font-weight-semibold));\n\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xs-mobile-line-height));\n\t}\n\n\t@media (min-width: 640px) {\n\t\th5,\n\t\th6,\n\t\t.sds-heading--xs {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xs-tablet-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xs-tablet-line-height));\n\t\t}\n\t}\n\n\t@media (min-width: 1024px) {\n\t\th5,\n\t\th6,\n\t\t.sds-heading--xs {\n\t\t\t--_sds-heading-font-size: var(--sds-heading-font-size, var(--sds-typography-heading-xs-desktop-font-size));\n\t\t\t--_sds-heading-line-height: var(--sds-heading-line-height, var(--sds-typography-heading-xs-desktop-line-height));\n\t\t}\n\t}\n`;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import '
|
|
2
|
+
import '../shared/positioning.js';
|
|
3
3
|
type SDSPopoverPlacement = 'top' | 'bottom' | 'left' | 'right' | 'none';
|
|
4
4
|
type SDSPopoverAutoPlacement = 'true' | 'false';
|
|
5
5
|
type SDSPopoverOverscroll = 'contain';
|
|
@@ -14,6 +14,8 @@ export declare class SDSPopover extends LitElement {
|
|
|
14
14
|
autoPlacement: SDSPopoverProps['autoPlacement'];
|
|
15
15
|
overscroll: SDSPopoverProps['overscroll'];
|
|
16
16
|
connectedCallback(): void;
|
|
17
|
+
updated(changed: Map<string, unknown>): void;
|
|
18
|
+
private syncDataAttributes;
|
|
17
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
20
|
}
|
|
19
21
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-popover.d.ts","sourceRoot":"","sources":["../../src/sds-popover/sds-popover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,OAAO,
|
|
1
|
+
{"version":3,"file":"sds-popover.d.ts","sourceRoot":"","sources":["../../src/sds-popover/sds-popover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,OAAO,0BAA0B,CAAC;AAElC,KAAK,mBAAmB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AACxE,KAAK,uBAAuB,GAAG,MAAM,GAAG,OAAO,CAAC;AAChD,KAAK,oBAAoB,GAAG,SAAS,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC/B,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,UAAU,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,qBACa,UAAW,SAAQ,UAAU;IACzC,OAAgB,MAAM,4BAAY;IAGlC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAS;IAGhD,aAAa,EAAE,eAAe,CAAC,eAAe,CAAC,CAAa;IAG5D,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAa;IAE7C,iBAAiB,IAAI,IAAI;IAUzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAM9C,OAAO,CAAC,kBAAkB;IAMjB,MAAM;CAGf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,aAAa,EAAE,UAAU,CAAC;KAC1B;CACD"}
|
|
@@ -8,7 +8,7 @@ import { LitElement, html } from 'lit';
|
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { guardedCustomElement } from '../utils/guarded-custom-element';
|
|
10
10
|
import { styles } from './sds-popover.styles';
|
|
11
|
-
import '
|
|
11
|
+
import '../shared/positioning.js';
|
|
12
12
|
let SDSPopover = class SDSPopover extends LitElement {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
@@ -21,6 +21,20 @@ let SDSPopover = class SDSPopover extends LitElement {
|
|
|
21
21
|
if (!this.hasAttribute('popover')) {
|
|
22
22
|
this.setAttribute('popover', 'auto');
|
|
23
23
|
}
|
|
24
|
+
this.syncDataAttributes();
|
|
25
|
+
}
|
|
26
|
+
updated(changed) {
|
|
27
|
+
if (changed.has('placement') || changed.has('autoPlacement') || changed.has('overscroll')) {
|
|
28
|
+
this.syncDataAttributes();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
syncDataAttributes() {
|
|
32
|
+
if (this.placement)
|
|
33
|
+
this.dataset.placement = this.placement;
|
|
34
|
+
if (this.autoPlacement)
|
|
35
|
+
this.dataset.autoplacement = this.autoPlacement;
|
|
36
|
+
if (this.overscroll)
|
|
37
|
+
this.dataset.overscroll = this.overscroll;
|
|
24
38
|
}
|
|
25
39
|
render() {
|
|
26
40
|
return html `<slot></slot>`;
|
|
@@ -28,13 +42,13 @@ let SDSPopover = class SDSPopover extends LitElement {
|
|
|
28
42
|
};
|
|
29
43
|
SDSPopover.styles = [styles];
|
|
30
44
|
__decorate([
|
|
31
|
-
property({ type: String,
|
|
45
|
+
property({ type: String, reflect: true })
|
|
32
46
|
], SDSPopover.prototype, "placement", void 0);
|
|
33
47
|
__decorate([
|
|
34
|
-
property({ type: String,
|
|
48
|
+
property({ type: String, reflect: true })
|
|
35
49
|
], SDSPopover.prototype, "autoPlacement", void 0);
|
|
36
50
|
__decorate([
|
|
37
|
-
property({ type: String,
|
|
51
|
+
property({ type: String, reflect: true })
|
|
38
52
|
], SDSPopover.prototype, "overscroll", void 0);
|
|
39
53
|
SDSPopover = __decorate([
|
|
40
54
|
guardedCustomElement('sds-popover')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-popover.js","sourceRoot":"","sources":["../../src/sds-popover/sds-popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"sds-popover.js","sourceRoot":"","sources":["../../src/sds-popover/sds-popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,0BAA0B,CAAC;AAa3B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACY;AAV1C,UAAU;IADtB,oBAAoB,CAAC,aAAa,CAAC;GACvB,UAAU,CAqCtB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-popover.styles';\nimport '../shared/positioning.js';\n\ntype SDSPopoverPlacement = 'top' | 'bottom' | 'left' | 'right' | 'none';\ntype SDSPopoverAutoPlacement = 'true' | 'false';\ntype SDSPopoverOverscroll = 'contain';\n\nexport interface SDSPopoverProps {\n\tplacement?: SDSPopoverPlacement;\n\tautoPlacement?: SDSPopoverAutoPlacement;\n\toverscroll?: SDSPopoverOverscroll;\n}\n\n@guardedCustomElement('sds-popover')\nexport class SDSPopover extends LitElement {\n\tstatic override styles = [styles];\n\n\t@property({ type: String, reflect: true })\n\tplacement: SDSPopoverProps['placement'] = 'top';\n\n\t@property({ type: String, reflect: true })\n\tautoPlacement: SDSPopoverProps['autoPlacement'] = undefined;\n\n\t@property({ type: String, reflect: true })\n\toverscroll: SDSPopoverProps['overscroll'] = undefined;\n\n\toverride connectedCallback(): void {\n\t\tsuper.connectedCallback();\n\n\t\tif (!this.hasAttribute('popover')) {\n\t\t\tthis.setAttribute('popover', 'auto');\n\t\t}\n\n\t\tthis.syncDataAttributes();\n\t}\n\n\toverride updated(changed: Map<string, unknown>) {\n\t\tif (changed.has('placement') || changed.has('autoPlacement') || changed.has('overscroll')) {\n\t\t\tthis.syncDataAttributes();\n\t\t}\n\t}\n\n\tprivate syncDataAttributes() {\n\t\tif (this.placement) this.dataset.placement = this.placement;\n\t\tif (this.autoPlacement) this.dataset.autoplacement = this.autoPlacement;\n\t\tif (this.overscroll) this.dataset.overscroll = this.overscroll;\n\t}\n\n\toverride render() {\n\t\treturn html`<slot></slot>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-popover': SDSPopover;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-process-step.styles.d.ts","sourceRoot":"","sources":["../../src/sds-process-step/sds-process-step.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"sds-process-step.styles.d.ts","sourceRoot":"","sources":["../../src/sds-process-step/sds-process-step.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgJlB,CAAC"}
|
|
@@ -20,6 +20,8 @@ export const styles = css `
|
|
|
20
20
|
|
|
21
21
|
--_sds-process-step-line-display: var(--sds-process-step-line-display, block);
|
|
22
22
|
--_sds-process-step-line-min-height: var(--sds-process-step-line-min-height, 2rem);
|
|
23
|
+
--_sds-process-step-line-width: var(--sds-process-step-line-width, 1px);
|
|
24
|
+
--_sds-process-step-line-color: var(--sds-process-step-line-color, var(--sds-color-neutral-border-subtle));
|
|
23
25
|
|
|
24
26
|
--_sds-process-step-heading-color: var(--sds-process-step-heading-color, var(--sds-color-neutral-text-default));
|
|
25
27
|
--_sds-process-step-heading-font-weight: var(--sds-process-step-heading-font-weight, var(--sds-typography-body-sm-strong-desktop-font-weight));
|
|
@@ -84,6 +86,7 @@ export const styles = css `
|
|
|
84
86
|
place-items: center;
|
|
85
87
|
line-height: 1;
|
|
86
88
|
display: inline-grid;
|
|
89
|
+
z-index: 2;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
.sds-process-step__content {
|
|
@@ -92,14 +95,15 @@ export const styles = css `
|
|
|
92
95
|
|
|
93
96
|
.sds-process-step__line {
|
|
94
97
|
display: var(--_sds-process-step-line-display);
|
|
95
|
-
|
|
98
|
+
background-color: var(--_sds-process-step-line-color);
|
|
96
99
|
grid-column: 1;
|
|
97
100
|
justify-self: center;
|
|
98
|
-
width:
|
|
101
|
+
width: var(--_sds-process-step-line-width);
|
|
99
102
|
min-height: var(--_sds-process-step-line-min-height);
|
|
100
103
|
grid-row: line-2;
|
|
101
104
|
position: relative;
|
|
102
105
|
top: var(--_sds-process-step-border-width);
|
|
106
|
+
z-index: 1;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
.sds-process-step__heading {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-process-step.styles.js","sourceRoot":"","sources":["../../src/sds-process-step/sds-process-step.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"sds-process-step.styles.js","sourceRoot":"","sources":["../../src/sds-process-step/sds-process-step.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-process-step-border-width: var(--sds-process-step-border-width, 2px);\n\t\t--_sds-process-step-border-color: var(--sds-process-step-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-process-step-marker-sm: var(--sds-process-step-marker-sm, 1rem);\n\t\t--_sds-process-step-marker-lg: var(--sds-process-step-marker-lg, 2rem);\n\t\t--_sds-process-step-marker-size: var(--_sds-process-step-marker-lg);\n\t\t--_sds-process-step-marker-base: var(--sds-process-step-marker-base, 2rem);\n\t\t--_sds-process-step-marker-text-color: var(--sds-process-step-marker-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-process-step-marker-background: var(--sds-process-step-marker-background, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));\n\t\t--_sds-process-step-marker-margin-block-start: var(--sds-process-step-marker-margin-block-start, calc((var(--_sds-process-step-marker-lg) - var(--_sds-process-step-marker-sm)) / 2));\n\t\t--_sds-process-step-marker-border-radius: var(--sds-process-step-marker-border-radius, var(--sds-radius-full));\n\t\t--_sds-process-step-grid-template-rows: var(--sds-process-step-grid-template-rows, [line-1] auto [step-start] var(--_sds-process-step-marker-size) [line-2 step-end] auto);\n\t\t--_sds-process-step-grid-template-columns: var(--sds-process-step-grid-template-columns, var(--_sds-process-step-marker-base) auto);\n\t\t--_sds-process-step-sub-step-margin-block-start: var(--sds-process-step-sub-step-margin-block-start, calc((var(--_sds-process-step-marker-sm) / 2) * -1));\n\n\t\t--_sds-process-step-item-grid-template-columns: var(--sds-process-step-item-grid-template-columns, [marker] var(--_sds-process-step-marker-base) [content] auto);\n\t\t--_sds-process-step-item-grid-area: var(--sds-process-step-item-grid-area, 2 / 1 / -1 / -1);\n\n\t\t--_sds-process-step-line-display: var(--sds-process-step-line-display, block);\n\t\t--_sds-process-step-line-min-height: var(--sds-process-step-line-min-height, 2rem);\n\t\t--_sds-process-step-line-width: var(--sds-process-step-line-width, 1px);\n\t\t--_sds-process-step-line-color: var(--sds-process-step-line-color, var(--sds-color-neutral-border-subtle));\n\n\t\t--_sds-process-step-heading-color: var(--sds-process-step-heading-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-process-step-heading-font-weight: var(--sds-process-step-heading-font-weight, var(--sds-typography-body-sm-strong-desktop-font-weight));\n\t\t--_sds-process-step-heading-font-size: var(--sds-process-step-heading-font-size, var(--sds-typography-body-md-desktop-font-size));\n\t\t--_sds-process-step-heading-line-height: var(--sds-process-step-heading-line-height, var(--sds-typography-body-md-strong-desktop-line-height));\n\t\t--_sds-process-step-heading-padding-block: var(--sds-process-step-heading-padding-block, var(--sds-spacing-3xs));\n\t\t--_sds-process-step-heading-margin-block: var(--sds-process-step-heading-margin-block, 0);\n\n\t\t--_sds-process-step-timestamp-color: var(--sds-process-step-timestamp-color, var(--sds-color-neutral-text-subtle));\n\t\t--_sds-process-step-timestamp-font-weight: var(--sds-process-step-timestamp-font-weight, var(--sds-typography-body-sm-desktop-font-weight));\n\t\t--_sds-process-step-timestamp-font-size: var(--sds-process-step-timestamp-font-size, var(--sds-typography-body-sm-desktop-font-size));\n\t\t--_sds-process-step-timestamp-line-height: var(--sds-process-step-timestamp-line-height, var(--sds-typography-body-sm-desktop-line-height));\n\t\t--_sds-process-step-timestamp-padding-block-start: var(--sds-process-step-timestamp-padding-block-start, var(--sds-spacing-zero));\n\t\t--_sds-process-step-timestamp-padding-block-end: var(--sds-process-step-timestamp-padding-block-end, var(--sds-spacing-3xs));\n\n\t\t--_sds-process-step-slot-content-padding-block: var(--sds-process-step-slot-content-padding-block, var(--sds-spacing-zero));\n\n\t\t--sds-icon-color: var(--_sds-process-step-marker-text-color);\n\t}\n\n\t.sds-process-step {\n\t\tdisplay: grid;\n\t\tfont-family: var(--sds-typography-font-family);\n\t\tgrid-template-rows: var(--_sds-process-step-grid-template-rows);\n\t\tgrid-template-columns: var(--_sds-process-step-grid-template-columns);\n\t\tjustify-items: flex-start;\n\t}\n\n\t.sds-process-step--sub-step {\n\t\t--_sds-process-step-marker-background: var(--sds-process-step-marker-background, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-process-step-marker-size: var(--_sds-process-step-marker-sm);\n\t\t--_sds-process-step-grid-template-rows: var(--sds-process-step-grid-template-rows, [line-1] auto [step-start] var(--_sds-process-step-marker-size) [line-2 step-end] auto);\n\t\tmargin-block-start: var(--_sds-process-step-sub-step-margin-block-start);\n\n\t\t.sds-process-step__marker {\n\t\t\tmargin-block-start: var(--_sds-process-step-marker-margin-block-start);\n\t\t}\n\t}\n\n\t.sds-process-step__item {\n\t\tgrid-area: var(--_sds-process-step-item-grid-area);\n\t\tgrid-template-columns: var(--_sds-process-step-item-grid-template-columns);\n\t\tgap: var(--sds-spacing-xs);\n\t\tpadding: var(--_sds-process-step-border-width);\n\t\tmargin: calc(var(--_sds-process-step-border-width) * -1) calc(var(--_sds-process-step-border-width) * -1) var(--sds-spacing-sm);\n\t\tjustify-content: flex-start;\n\t\twidth: 100%;\n\t\tdisplay: grid;\n\t}\n\n\t.sds-process-step__marker {\n\t\twidth: var(--_sds-process-step-marker-size);\n\t\theight: var(--_sds-process-step-marker-size);\n\t\tborder-radius: var(--_sds-process-step-marker-border-radius);\n\t\tborder: var(--_sds-process-step-border-width) solid;\n\t\tcolor: var(--_sds-process-step-marker-text-color);\n\t\tbackground-color: var(--_sds-process-step-marker-background);\n\t\tborder-color: var(--_sds-process-step-border-color);\n\t\tfont-weight: var(--sds-typography-body-sm-strong-desktop-font-weight);\n\t\tgrid-column: marker;\n\t\tplace-self: baseline center;\n\t\tplace-items: center;\n\t\tline-height: 1;\n\t\tdisplay: inline-grid;\n\t\tz-index: 2;\n\t}\n\n\t.sds-process-step__content {\n\t\tgrid-column: content;\n\t}\n\n\t.sds-process-step__line {\n\t\tdisplay: var(--_sds-process-step-line-display);\n\t\tbackground-color: var(--_sds-process-step-line-color);\n\t\tgrid-column: 1;\n\t\tjustify-self: center;\n\t\twidth: var(--_sds-process-step-line-width);\n\t\tmin-height: var(--_sds-process-step-line-min-height);\n\t\tgrid-row: line-2;\n\t\tposition: relative;\n\t\ttop: var(--_sds-process-step-border-width);\n\t\tz-index: 1;\n\t}\n\n\t.sds-process-step__heading {\n\t\tcolor: var(--_sds-process-step-heading-color);\n\t\tfont-weight: var(--_sds-process-step-heading-font-weight);\n\t\tfont-size: var(--_sds-process-step-heading-font-size);\n\t\tline-height: var(--_sds-process-step-heading-line-height);\n\t\tpadding-block: var(--_sds-process-step-heading-padding-block);\n\t\tmargin-block: var(--_sds-process-step-heading-margin-block);\n\t}\n\n\t.sds-process-step__timestamp {\n\t\tcolor: var(--_sds-process-step-timestamp-color);\n\t\tfont-weight: var(--_sds-process-step-timestamp-font-weight);\n\t\tfont-size: var(--_sds-process-step-timestamp-font-size);\n\t\tline-height: var(--_sds-process-step-timestamp-line-height);\n\t\tpadding-block-start: var(--_sds-process-step-timestamp-padding-block-start);\n\t\tpadding-block-end: var(--_sds-process-step-timestamp-padding-block-end);\n\n\t\t&:first-child {\n\t\t\t--_sds-process-step-timestamp-padding-block-start: var(--sds-process-step-timestamp-padding-block-start, var(--sds-spacing-3xs));\n\t\t}\n\n\t\t&:empty {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t.sds-process-step__slot-content {\n\t\tpadding-block: var(--_sds-process-step-slot-content-padding-block);\n\n\t\t&:first-child {\n\t\t\t--_sds-process-step-slot-content-padding-block: var(--sds-process-step-slot-content-padding-block, var(--sds-spacing-3xs));\n\t\t}\n\t}\n\n\t:host(:last-of-type) {\n\t\t--_sds-process-step-line-display: none;\n\t}\n`;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { SDS_SIZES } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SDSFormControlAttributes } from '../mixins/sds-form-control-mixin';
|
|
4
4
|
type RadioSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;
|
|
5
|
-
export interface SDSRadioProps extends
|
|
5
|
+
export interface SDSRadioProps extends SDSFormControlAttributes {
|
|
6
6
|
checked?: boolean;
|
|
7
7
|
error?: boolean;
|
|
8
8
|
'help-text'?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio.d.ts","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAC;AAMhE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sds-radio.d.ts","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"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ractionMixin(SDSEventDispat
|
|
|
229
229
|
'sds-radio__input': true,
|
|
230
230
|
'sds-radio__input--error': Boolean(this.error),
|
|
231
231
|
};
|
|
232
|
+
const describedBy = this.helpText ? 'help-text' : undefined;
|
|
232
233
|
return html `
|
|
233
234
|
<div class="${classMap(radioClasses)}">
|
|
234
235
|
<input
|
|
@@ -242,13 +243,15 @@ let SDSRadio = class SDSRadio extends SDSDelegateInteractionMixin(SDSEventDispat
|
|
|
242
243
|
.disabled="${this.disabled ?? false}"
|
|
243
244
|
?required="${this.required}"
|
|
244
245
|
?readonly="${this.readOnly}"
|
|
246
|
+
aria-describedby="${ifDefined(describedBy)}"
|
|
247
|
+
aria-invalid="${this.error ? 'true' : 'false'}"
|
|
245
248
|
@change="${this._handleChange}"
|
|
246
249
|
@focus="${this._handleFocus}"
|
|
247
250
|
@blur="${this._handleBlur}"
|
|
248
251
|
class="${classMap(inputClasses)}"
|
|
249
252
|
/>
|
|
250
253
|
${this.label ? html `<label class="sds-radio__label" for="control">${this.label}</label>` : nothing}
|
|
251
|
-
${this.helpText ? html `<span class="sds-radio__help-text">${this.helpText}</span>` : nothing}
|
|
254
|
+
${this.helpText ? html `<span id="help-text" class="sds-radio__help-text">${this.helpText}</span>` : nothing}
|
|
252
255
|
</div>
|
|
253
256
|
`;
|
|
254
257
|
}
|
|
@@ -280,7 +283,7 @@ __decorate([
|
|
|
280
283
|
property({ type: String, attribute: 'help-text' })
|
|
281
284
|
], SDSRadio.prototype, "helpText", void 0);
|
|
282
285
|
__decorate([
|
|
283
|
-
property({ type: Boolean })
|
|
286
|
+
property({ type: Boolean, reflect: true })
|
|
284
287
|
], SDSRadio.prototype, "disabled", null);
|
|
285
288
|
__decorate([
|
|
286
289
|
property({ type: Boolean, attribute: false })
|