lightning-base-components 1.16.3-alpha → 1.16.4-alpha
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/metadata/raptor.json +106 -0
- package/package.json +57 -1
- package/scopedImports/@salesforce-label-LightningForm.cancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.closeError.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.edit.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.editErrorHelp.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.error.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.errorPopoverHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.preview.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.previewHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.reload.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.save.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.saveFieldErrorSummary.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.undo.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.messageWhenMissingInformation.js +1 -0
- package/src/lightning/button/__docs__/button.md +13 -0
- package/src/lightning/button/button.slds.css +155 -11
- package/src/lightning/buttonGroup/button-group.slds.css +35 -59
- package/src/lightning/buttonIcon/button-icon.slds.css +287 -122
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +224 -39
- package/src/lightning/buttonStateful/button-stateful.slds.css +3269 -0
- package/src/lightning/card/card.slds.css +50 -0
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +180 -364
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +46 -413
- package/src/lightning/datatable/datatable.js +2 -2
- package/src/lightning/datatable/rowSelection.js +21 -4
- package/src/lightning/datetimepicker/datetimepicker.html +1 -3
- package/src/lightning/datetimepicker/datetimepicker.js +5 -0
- package/src/lightning/fileDownload/__docs__/fileDownload.md +41 -0
- package/src/lightning/helptext/help-text.slds.css +184 -39
- package/src/lightning/icon/icon.slds.css +823 -3
- package/src/lightning/input/input-checkbox.slds.css +291 -32
- package/src/lightning/input/input-text.slds.css +70 -7
- package/src/lightning/inputAddress/__docs__/inputAddress.md +1 -1
- package/src/lightning/inputAddress/inputAddress.js +2 -1
- package/src/lightning/internationalizationLibrary/datetime/intlFormat.js +20 -2
- package/src/lightning/iso8601Utils/iso8601Utils.js +2 -3
- package/src/lightning/modal/__docs__/migration.md +158 -0
- package/src/lightning/modal/__docs__/modal.md +414 -0
- package/src/lightning/modal/__examples__disabled/all/all.css +7 -0
- package/src/lightning/modal/__examples__disabled/all/all.html +9 -0
- package/src/lightning/modal/__examples__disabled/all/all.js +25 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.css +7 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.html +9 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.js +49 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.html +24 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.js +12 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.html +9 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.js +27 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.html +15 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.html +26 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.css +3 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.html +146 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.js +240 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.html +17 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.js +11 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.html +20 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.js +12 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.css +7 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.html +9 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.js +19 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.css +7 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.html +9 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.js +27 -0
- package/src/lightning/modal/modal.html +3 -0
- package/src/lightning/modal/modal.js +93 -0
- package/src/lightning/modal/modal.js-meta.xml +6 -0
- package/src/lightning/modalBody/__docs__/modalBody.md +61 -0
- package/src/lightning/modalBody/modalBody.html +13 -0
- package/src/lightning/modalBody/modalBody.js +203 -0
- package/src/lightning/modalBody/modalBody.js-meta.xml +6 -0
- package/src/lightning/modalFooter/__docs__/modalFooter.md +72 -0
- package/src/lightning/modalFooter/modalFooter.html +8 -0
- package/src/lightning/modalFooter/modalFooter.js +161 -0
- package/src/lightning/modalFooter/modalFooter.js-meta.xml +6 -0
- package/src/lightning/modalHeader/__docs__/modalHeader.md +64 -0
- package/src/lightning/modalHeader/modalHeader.html +16 -0
- package/src/lightning/modalHeader/modalHeader.js +204 -0
- package/src/lightning/modalHeader/modalHeader.js-meta.xml +6 -0
- package/src/lightning/primitiveBubble/tooltip.slds.css +45 -1
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -12
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +2994 -319
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +14 -11
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +1 -0
- package/src/lightning/primitiveIcon/icon.slds.css +823 -3
- package/src/lightning/radioGroup/input-radio-group.slds.css +168 -379
- package/src/lightning/spinner/spinner.slds.css +8 -2
- package/src/lightning/timepicker/timepicker.html +1 -4
- package/src/lightning/timepicker/timepicker.js +9 -5
- package/src/lightning/treeGrid/treeGrid.js +66 -1
- package/src/lightning/formattedAddress/__component__/formattedAddress.spec.js +0 -61
- package/src/lightning/formattedAddress/__component__/formattedAddressDisabled.spec.js +0 -20
- package/src/lightning/formattedAddress/__component__/x/basic/basic.html +0 -10
- package/src/lightning/formattedAddress/__component__/x/basic/basic.js +0 -17
- package/src/lightning/input/__component__/inputCheckbox.spec.js +0 -60
- package/src/lightning/input/__component__/inputDateTimePicker.spec.js +0 -60
- package/src/lightning/input/__component__/inputNumber.spec.js +0 -75
- package/src/lightning/input/__component__/inputSelection.spec.js +0 -83
- package/src/lightning/input/__component__/x/tall/tall.css +0 -5
- package/src/lightning/input/__component__/x/tall/tall.html +0 -5
- package/src/lightning/input/__component__/x/tall/tall.js +0 -7
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { LightningElement } from 'lwc';
|
|
2
|
+
import { classSet } from 'lightning/utils';
|
|
3
|
+
import { findAllTabbableElements, filterTooltips } from 'lightning/focusUtils';
|
|
4
|
+
|
|
5
|
+
// SLDS Modal Footer classes
|
|
6
|
+
const footerClass = 'slds-modal__footer';
|
|
7
|
+
const hideClass = 'slds-hide';
|
|
8
|
+
// selectors
|
|
9
|
+
const footerSelector = `.${footerClass}`;
|
|
10
|
+
const footerSlotSelector = '[data-footer-slot]';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The modal footer component to display footer content in lightning modal.
|
|
14
|
+
* */
|
|
15
|
+
export default class LightningModalFooter extends LightningElement {
|
|
16
|
+
// tracked private state
|
|
17
|
+
initialRender = true;
|
|
18
|
+
initialSlotRender = true;
|
|
19
|
+
hideFooter = false;
|
|
20
|
+
unregisterCallback = null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Handle the default slot change event
|
|
24
|
+
* Always register with parent every slot change
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
handleDefaultSlotChange() {
|
|
28
|
+
// Set this once so that parent can know slot
|
|
29
|
+
// has rendered
|
|
30
|
+
if (this.initialSlotRender) {
|
|
31
|
+
this.initialSlotRender = false;
|
|
32
|
+
}
|
|
33
|
+
this.registerWithParent();
|
|
34
|
+
this.hideFooter = !this.isDefaultSlotPopulated;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Gets the CSS classes applicable to the modal footer element.
|
|
39
|
+
* Hidden classes are set when the footer is hidden
|
|
40
|
+
* @returns {string} CSS class applied to modal footer
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
get footerCssClasses() {
|
|
44
|
+
const classes = classSet(footerClass);
|
|
45
|
+
classes.add({
|
|
46
|
+
[hideClass]: this.hideFooter,
|
|
47
|
+
});
|
|
48
|
+
return classes.toString();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get the height of outer wrapper of modal footer
|
|
53
|
+
* @returns {number} represents a height value in pixels
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
get footerHeight() {
|
|
57
|
+
const divElem = this.template.querySelector(footerSelector);
|
|
58
|
+
const footerRect = divElem ? divElem.getBoundingClientRect() : {};
|
|
59
|
+
const { height } = footerRect;
|
|
60
|
+
return height || 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get an element reference to the modal footer's slot element
|
|
65
|
+
* @returns {(HTMLElement|null)}
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
get defaultSlotElement() {
|
|
69
|
+
return this.template.querySelector(footerSlotSelector);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Determine whether the default slot is populated
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
get isDefaultSlotPopulated() {
|
|
78
|
+
const slotElement = this.defaultSlotElement;
|
|
79
|
+
if (slotElement && slotElement.assignedNodes) {
|
|
80
|
+
return slotElement.assignedNodes().length > 0;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get first tabbable element within modalFooter's slot, if exists
|
|
87
|
+
* This is passed to parent in order to possibly be used for autoFocus
|
|
88
|
+
* @returns {(HTMLElement|null)}
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
get firstTabbableElement() {
|
|
92
|
+
let firstElem = null;
|
|
93
|
+
if (this.isDefaultSlotPopulated) {
|
|
94
|
+
const filteredElements = filterTooltips(
|
|
95
|
+
findAllTabbableElements(this.defaultSlotElement)
|
|
96
|
+
);
|
|
97
|
+
if (filteredElements.length > 0) {
|
|
98
|
+
firstElem = filteredElements[0];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return firstElem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Register modalFooter with modal parent, including callbacks to
|
|
106
|
+
* unregister the modal footer
|
|
107
|
+
* this will get called multiple times over component lifecycle
|
|
108
|
+
* @type {CustomEvent}
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
registerWithParent() {
|
|
112
|
+
const evtRegister = new CustomEvent('privatemodalfooterregister', {
|
|
113
|
+
bubbles: true,
|
|
114
|
+
composed: true,
|
|
115
|
+
detail: {
|
|
116
|
+
footerHeight: this.footerHeight,
|
|
117
|
+
defaultSlotIsPopulated: this.isDefaultSlotPopulated,
|
|
118
|
+
defaultSlotHasRendered: !this.initialSlotRender,
|
|
119
|
+
firstTabbableElemRef: this.firstTabbableElement,
|
|
120
|
+
unRegisterCallback: (unregisterCallback) => {
|
|
121
|
+
this.unregisterCallback = unregisterCallback;
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
this.dispatchEvent(evtRegister);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* When modal footer is being created, initialize
|
|
130
|
+
* private tracked modal footer state
|
|
131
|
+
* This is need because modal footer can be added back to
|
|
132
|
+
* the DOM, after being removed, and need to re-initialize state values
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
initState() {
|
|
136
|
+
this.initialRender = true;
|
|
137
|
+
this.initialSlotRender = true;
|
|
138
|
+
this.hideFooter = false;
|
|
139
|
+
this.unregisterCallback = null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
connectedCallback() {
|
|
143
|
+
// handle case where modalFooter is added/removed/added to DOM
|
|
144
|
+
// so registerWithParent gets called
|
|
145
|
+
this.initState();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
disconnectedCallback() {
|
|
149
|
+
if (this.unregisterCallback) {
|
|
150
|
+
this.unregisterCallback();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
renderedCallback() {
|
|
155
|
+
if (this.initialRender) {
|
|
156
|
+
this.registerWithParent();
|
|
157
|
+
this.initialRender = false;
|
|
158
|
+
}
|
|
159
|
+
this.hideFooter = !this.isDefaultSlotPopulated;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
The `lightning-modal-header` component displays header text in a panel at the top of a modal dialog.
|
|
2
|
+
Use of a header is optional, but when you provide a header you must specify the header text with the `label` attribute.
|
|
3
|
+
|
|
4
|
+
If you don't use the `lightning-modal-header` component, you must set a label
|
|
5
|
+
in the modal you create by extending `LightningModal`. A label is required for accessibility.
|
|
6
|
+
|
|
7
|
+
The modal components render in the order they appear in the template. Place the `lightning-modal-header`
|
|
8
|
+
component before the `lightning-modal-body` component in the template.
|
|
9
|
+
|
|
10
|
+
`lightning-modal-header` supports optional tagline text, which displays in smaller text below the heading. Enclose the
|
|
11
|
+
tagline text directly in the `lightning-modal-header` component, no HTML tag or attribute is needed. You can include links with `<a>`
|
|
12
|
+
tags, which are the only HTML elements permitted. If the header text is too long to fit on one line, it wraps in the modal header.
|
|
13
|
+
|
|
14
|
+
This sample code shows the expected order of the modal components. The modal content is
|
|
15
|
+
created in a separate component extended from `LightningModal`. See
|
|
16
|
+
[Lightning Web Components Developer Guide](docs/component-library/documentation/en/lwc/)
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<!-- my/modalDialog.html -->
|
|
20
|
+
<template>
|
|
21
|
+
<lightning-modal-header label="My Modal">
|
|
22
|
+
Tagline can be descriptive content with <a href="https://www.example.com">links</a> and can wrap to multiple lines.
|
|
23
|
+
</lightning-modal-header>
|
|
24
|
+
<lightning-modal-body>
|
|
25
|
+
<!-- modal content specified in LightningModal component -->
|
|
26
|
+
</lightning-modal-body>
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
29
|
+
#### Component Styling
|
|
30
|
+
|
|
31
|
+
`lightning-modal-header` implements the [modals](https://www.lightningdesignsystem.com/components/modals/) blueprint in the Salesforce Lightning Design System (SLDS).
|
|
32
|
+
|
|
33
|
+
To apply custom styling, use the `:host` selector or define a custom class using the `class` attribute.
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<lightning-modal-header label="My Modal" class="my-modal-header">
|
|
37
|
+
|
|
38
|
+
</lightning-modal-header>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use SLDS styling hooks to customize the component's styles. Several `--sds-c-modal-header-*` and `--sds-c-modal-heading-*` hooks
|
|
42
|
+
enable you to customize the header.
|
|
43
|
+
|
|
44
|
+
For example, specify the background color on the button using the `sds-c-modal-header-color-background` custom property.
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
.my-modal-header {
|
|
48
|
+
--sds-c-modal-header-color-background: LightGray;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
See the modal blueprint's [Styling Hooks Overview](https://www.lightningdesignsystem.com/components/modals/#Styling-Hooks-Overview) for a list of CSS custom properties.
|
|
53
|
+
|
|
54
|
+
For more information, see [Style Components Using Lightning Design System Styling Hooks](docs/component-library/documentation/lwc/lwc.create_components_css_custom_properties) in the Lightning Web Components Developer Guide.
|
|
55
|
+
|
|
56
|
+
#### Accessibility
|
|
57
|
+
|
|
58
|
+
When you use `lightning-modal-header` in your modal, the rendered modal provides an `aria-labelledby` attribute set to the ID of the header element.
|
|
59
|
+
If you don't use `lightning-modal-header`, the accessible label is provided using `aria-label` set to the label you provide in the modal.
|
|
60
|
+
|
|
61
|
+
When the modal opens, focus goes to the first interactive element in the modal. If the header includes a link in tagline text, the link
|
|
62
|
+
gets initial focus.
|
|
63
|
+
|
|
64
|
+
See [Lightning Web Components Developer Guide](docs/component-library/documentation/en/lwc/) for more information about accessibility in modals.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="slds-modal__header">
|
|
3
|
+
<template if:true={label}>
|
|
4
|
+
<h1
|
|
5
|
+
id="modal-label"
|
|
6
|
+
class="slds-modal__title slds-hyphenate"
|
|
7
|
+
tabindex="-1"
|
|
8
|
+
data-label
|
|
9
|
+
>{label}</h1>
|
|
10
|
+
</template>
|
|
11
|
+
<slot
|
|
12
|
+
data-default-slot
|
|
13
|
+
onslotchange={handleDefaultSlotChange}
|
|
14
|
+
></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { api, LightningElement } from 'lwc';
|
|
2
|
+
import { getRealDOMId } from 'lightning/utilsPrivate';
|
|
3
|
+
import { findAllTabbableElements, filterTooltips } from 'lightning/focusUtils';
|
|
4
|
+
|
|
5
|
+
// selectors
|
|
6
|
+
const modalHeaderSelector = '.slds-modal__header';
|
|
7
|
+
const labelSelector = '[data-label]';
|
|
8
|
+
const slotWrapperSelector = '[data-slot-wrapper]';
|
|
9
|
+
const defaultSlotSelector = '[data-default-slot]';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a header to display the heading and tagline at the top of a modal.
|
|
13
|
+
* */
|
|
14
|
+
export default class LightningModalHeader extends LightningElement {
|
|
15
|
+
// tracked private state
|
|
16
|
+
initialRender = true;
|
|
17
|
+
initialSlotRender = true;
|
|
18
|
+
unregisterCallback = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Text to display as the heading at the top of the modal
|
|
22
|
+
*/
|
|
23
|
+
@api label = '';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Handle the default slot change event
|
|
27
|
+
* Always register with parent every slot change
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
handleDefaultSlotChange() {
|
|
31
|
+
// Set this once so that parent can know slot has rendered
|
|
32
|
+
if (this.initialSlotRender) {
|
|
33
|
+
this.initialSlotRender = false;
|
|
34
|
+
}
|
|
35
|
+
this.registerWithParent();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the height of outer wrapper of modal header
|
|
40
|
+
* @returns {number} represents a height value in pixels
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
get headerHeight() {
|
|
44
|
+
const divElem = this.template.querySelector(modalHeaderSelector);
|
|
45
|
+
const headerRect = divElem ? divElem.getBoundingClientRect() : {};
|
|
46
|
+
const { height } = headerRect;
|
|
47
|
+
return height || 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get an element reference to the modal's title element, currently H1
|
|
52
|
+
* This get passed to the parent as a fallback element for autofocus
|
|
53
|
+
* @returns {(HTMLElement|null)}
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
get modalTitleElement() {
|
|
57
|
+
return this.template.querySelector(labelSelector);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get the ID value of the modalTitleElement, currently H1
|
|
62
|
+
* This value is passed to parent in order to use for aria-labelledby
|
|
63
|
+
* @returns {(string|null)}
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
get modalLabelId() {
|
|
67
|
+
const labelElem = this.modalTitleElement;
|
|
68
|
+
return getRealDOMId(labelElem);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get first tabbable element within modalHeader's slot, if exists
|
|
73
|
+
* This is passed to parent in order to possibly be used for autoFocus
|
|
74
|
+
* @returns {(HTMLElement|null)}
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
get firstTabbableElement() {
|
|
78
|
+
let firstElem = null;
|
|
79
|
+
if (this.isDefaultSlotPopulated) {
|
|
80
|
+
const tabbableElements = findAllTabbableElements(
|
|
81
|
+
this.defaultSlotElement
|
|
82
|
+
);
|
|
83
|
+
const filteredElements = filterTooltips(tabbableElements);
|
|
84
|
+
if (filteredElements.length > 0) {
|
|
85
|
+
firstElem = filteredElements[0];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return firstElem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get an element reference to the modal body's default slot's wrapper element
|
|
93
|
+
* Currently this is a P tag, representing the tagline within the header
|
|
94
|
+
* @returns {(HTMLElement|null)}
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
get defaultSlotWrapperElement() {
|
|
98
|
+
return this.template.querySelector(slotWrapperSelector);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the ID value for the slot wrapper (p tag)
|
|
103
|
+
* Future TODO: potentially wire up to aria-describedby
|
|
104
|
+
* - when there is a better identified reproducible pattern
|
|
105
|
+
* @returns {(string|null)}
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
get defaultSlotWrapperId() {
|
|
109
|
+
return getRealDOMId(this.defaultSlotWrapperElement);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get an element reference to the modal body's slot element
|
|
114
|
+
* @returns {(HTMLElement|null)}
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
get defaultSlotElement() {
|
|
118
|
+
return this.template.querySelector(defaultSlotSelector);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Determine whether the default slot is populated
|
|
123
|
+
* @returns {boolean}
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
get isDefaultSlotPopulated() {
|
|
127
|
+
const slotElement = this.defaultSlotElement;
|
|
128
|
+
if (slotElement && slotElement.assignedNodes) {
|
|
129
|
+
const slotPopulated = slotElement.assignedNodes().length > 0;
|
|
130
|
+
this.defaultSlotPopulated = slotPopulated;
|
|
131
|
+
return slotPopulated;
|
|
132
|
+
}
|
|
133
|
+
this.defaultSlotPopulated = false;
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Determine whether the developer provided label value is valid or not
|
|
139
|
+
* Label value is required value, so console.error when not valid
|
|
140
|
+
* @returns {boolean}
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
get isLabelPopulated() {
|
|
144
|
+
return (this.label && this.label.trim().length > 0) || false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Register modalHeader with modal parent, including callbacks to
|
|
149
|
+
* unregister the modal header
|
|
150
|
+
* this will get called multiple times over component lifecycle
|
|
151
|
+
* @type {CustomEvent}
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
registerWithParent() {
|
|
155
|
+
const evtRegister = new CustomEvent('privatemodalheaderregister', {
|
|
156
|
+
bubbles: true,
|
|
157
|
+
composed: true,
|
|
158
|
+
detail: {
|
|
159
|
+
labelId: this.modalLabelId,
|
|
160
|
+
labelIsPopulated: this.isLabelPopulated,
|
|
161
|
+
headerHeight: this.headerHeight,
|
|
162
|
+
defaultSlotWrapperId: this.defaultSlotWrapperId,
|
|
163
|
+
defaultSlotIsPopulated: this.isDefaultSlotPopulated,
|
|
164
|
+
defaultSlotHasRendered: !this.initialSlotRender,
|
|
165
|
+
unRegisterCallback: (unregisterCallback) => {
|
|
166
|
+
this.unregisterCallback = unregisterCallback;
|
|
167
|
+
},
|
|
168
|
+
headerRef: this.modalTitleElement,
|
|
169
|
+
firstTabbableElemRef: this.firstTabbableElement,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
this.dispatchEvent(evtRegister);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* When modal header is being created, initialize
|
|
177
|
+
* private tracked modal header state
|
|
178
|
+
* This is need because modal header can be added back to
|
|
179
|
+
* the DOM, after being removed, and need to re-initialize state values
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
182
|
+
initState() {
|
|
183
|
+
this.initialRender = true;
|
|
184
|
+
this.initialSlotRender = true;
|
|
185
|
+
this.unregisterCallback = null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
connectedCallback() {
|
|
189
|
+
this.initState();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
renderedCallback() {
|
|
193
|
+
if (this.initialRender) {
|
|
194
|
+
this.registerWithParent();
|
|
195
|
+
this.initialRender = false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
disconnectedCallback() {
|
|
200
|
+
if (this.unregisterCallback) {
|
|
201
|
+
this.unregisterCallback();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
|
|
2
|
+
Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
3
|
+
|
|
4
|
+
:host([data-render-mode="shadow"]) [part~='overlay'] {
|
|
5
|
+
background-color: var(
|
|
6
|
+
--sds-c-overlay-color-background,
|
|
7
|
+
var(--sds-s-popup-color-background, var(--sds-g-color-neutral-base-1))
|
|
8
|
+
);
|
|
9
|
+
color: var(
|
|
10
|
+
--sds-c-overlay-text-color,
|
|
11
|
+
var(--sds-s-popup-text-color, var(--sds-g-color-neutral-base-contrast-4))
|
|
12
|
+
);
|
|
13
|
+
border-radius: var(
|
|
14
|
+
--sds-c-overlay-radius-border,
|
|
15
|
+
var(--sds-s-popup-radius-border, var(--sds-g-radius-border-2, 0.25rem))
|
|
16
|
+
);
|
|
17
|
+
border-width: var(
|
|
18
|
+
--sds-c-overlay-sizing-border,
|
|
19
|
+
var(--sds-s-popup-sizing-border, var(--sds-g-sizing-border-1, 1px))
|
|
20
|
+
);
|
|
21
|
+
border-color: var(
|
|
22
|
+
--sds-c-overlay-color-border,
|
|
23
|
+
var(--sds-s-popup-color-border, var(--sds-g-color-border-base-1, #c9c9c9))
|
|
24
|
+
);
|
|
25
|
+
box-shadow: var(--sds-c-overlay-shadow, var(--sds-s-popup-shadow, var(--sds-g-shadow-1, 0 0 2px 0 #18181814, 0 2px 4px 1px #18181828)));
|
|
26
|
+
|
|
27
|
+
/* TODO: consider semantics of the shared hook for overlays/popups. */
|
|
28
|
+
padding-left: var(
|
|
29
|
+
--sds-c-overlay-spacing-inline-start,
|
|
30
|
+
var(--sds-c-overlay-spacing-inline, var(--sds-s-popup-spacing-inline, var(--sds-g-spacing-3, 0.75rem)))
|
|
31
|
+
);
|
|
32
|
+
padding-right: var(
|
|
33
|
+
--sds-c-overlay-spacing-inline-end,
|
|
34
|
+
var(--sds-c-overlay-spacing-inline, var(--sds-s-popup-spacing-inline, var(--sds-g-spacing-3, 0.75rem)))
|
|
35
|
+
);
|
|
36
|
+
padding-top: var(
|
|
37
|
+
--sds-c-overlay-spacing-block-start,
|
|
38
|
+
var(--sds-c-overlay-spacing-block, var(--sds-s-popup-spacing-block, var(--sds-g-spacing-3, 0.75rem)))
|
|
39
|
+
);
|
|
40
|
+
padding-bottom: var(
|
|
41
|
+
--sds-c-overlay-spacing-block-end,
|
|
42
|
+
var(--sds-c-overlay-spacing-block, var(--sds-s-popup-spacing-block, var(--sds-g-spacing-3, 0.75rem)))
|
|
43
|
+
);
|
|
44
|
+
}
|
|
1
45
|
|
|
2
46
|
/**
|
|
3
47
|
* @Note: Static fallbacks are in place until SLDS adopts SDS. Without static
|
|
@@ -37,7 +81,7 @@
|
|
|
37
81
|
* Opinion of subsystem, not supported in base SDS component
|
|
38
82
|
*/
|
|
39
83
|
font-size: var(--slds-c-tooltip-font-size, 0.75rem);
|
|
40
|
-
max-width: var(--slds-c-tooltip-sizing-max
|
|
84
|
+
max-width: var(--slds-c-tooltip-sizing-width-max, 20rem);
|
|
41
85
|
position: relative;
|
|
42
86
|
}
|
|
43
87
|
}
|
|
@@ -326,19 +326,11 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
get dateValue() {
|
|
329
|
-
// Supported values can be passed directly to lightning-formatted-date-time
|
|
330
|
-
//
|
|
331
|
-
//
|
|
329
|
+
// Supported values can be passed directly to lightning-formatted-date-time but
|
|
330
|
+
// non-supported formats need to be passed through Date constructor to avoid
|
|
331
|
+
// customer breakages for the time being. Ideally the use of toDate here will be
|
|
332
332
|
// temporary and we can remove use of the Date constructor in the future
|
|
333
|
-
|
|
334
|
-
toDate(this.value); // will throw error if value isn't supported
|
|
335
|
-
return this.value;
|
|
336
|
-
} catch (err) {
|
|
337
|
-
console.warn(
|
|
338
|
-
`'${this.value}' does not follow a supported date format. Please use either a timestamp, ISO8601 string, or Date object to avoid risking inconsistencies and breakages.`
|
|
339
|
-
);
|
|
340
|
-
return new Date(this.value);
|
|
341
|
-
}
|
|
333
|
+
return toDate(this.value);
|
|
342
334
|
}
|
|
343
335
|
|
|
344
336
|
get computedDateLocalDay() {
|