lightning-base-components 1.19.1-alpha → 1.19.2-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 +488 -0
- package/package.json +1 -1
- package/src/lightning/alert/__docs__/alert.md +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +8 -1
- package/src/lightning/combobox/combobox.css +2 -0
- package/src/lightning/combobox/combobox.html +1 -1
- package/src/lightning/combobox/combobox.js +0 -2
- package/src/lightning/confirm/__docs__/confirm.md +1 -1
- package/src/lightning/datepicker/datepicker.html +2 -2
- package/src/lightning/datepicker/datepicker.js +29 -25
- package/src/lightning/datetimepicker/datetimepicker.html +1 -1
- package/src/lightning/f6Controller/f6Controller.js +9 -9
- package/src/lightning/formattedAddress/formattedAddress.js +0 -4
- package/src/lightning/input/__docs__/input.md +11 -0
- package/src/lightning/input/__examples__/file/file.html +1 -1
- package/src/lightning/input/input.css +2 -0
- package/src/lightning/input/input.html +2 -1
- package/src/lightning/input/input.js +38 -1
- package/src/lightning/menuSubheader/menuSubheader.js +1 -1
- package/src/lightning/modal/__docs__/modal.md +10 -0
- package/src/lightning/overlayContainer/overlayContainer.js +5 -6
- package/src/lightning/overlayUtils/overlayUtils.js +59 -0
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +1 -1
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +2 -4
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +1 -1
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +2 -4
- package/src/lightning/primitiveInputColor/primitiveInputColor.html +1 -1
- package/src/lightning/primitiveInputColor/primitiveInputColor.js +2 -4
- package/src/lightning/primitiveInputFile/primitiveInputFile.html +1 -1
- package/src/lightning/primitiveInputFile/primitiveInputFile.js +2 -4
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +1 -1
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +2 -2
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +3 -8
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +1 -1
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +2 -4
- package/src/lightning/progressBar/progressBar.html +4 -3
- package/src/lightning/prompt/__docs__/prompt.md +1 -1
- package/src/lightning/sldsGenAiUtils/sldsGenAiUtils.css +4 -0
- package/src/lightning/tab/tab.js +2 -4
- package/src/lightning/textarea/textarea.css +2 -0
- package/src/lightning/textarea/textarea.html +1 -1
- package/src/lightning/textarea/textarea.js +1 -4
- package/src/lightning/timepicker/timepicker.html +1 -1
- package/src/lightning/toast/__docs__/toast.md +18 -20
- package/src/lightning/toast/toast.js-meta.xml +1 -1
- package/src/lightning/toastContainer/toastContainer.js-meta.xml +1 -1
- package/src/lightning/utilsPrivate/videoUtils.js +12 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
The `LightningToast` component displays a toast notification with an icon, label, message, and links. Use a toast to convey small pieces of information to the user
|
|
2
|
-
|
|
3
|
-
This component is for internal use only.
|
|
1
|
+
The `LightningToast` component displays a toast notification with an icon, label, message, and links. Use a toast to convey small pieces of information to the user, providing feedback and confirmation after the user takes an action. Toasts can disappear after a certain duration or until the user clicks the close button.
|
|
4
2
|
|
|
5
3
|
### Show a Toast
|
|
6
4
|
|
|
7
|
-
To show a toast,
|
|
5
|
+
To show a toast, call the static function `show(config, comp)` from `lightning/toast` and provide a toast configuration and a reference of the local component as parameters.
|
|
8
6
|
The function also creates a single page-level toast container if one does not exist.
|
|
9
7
|
|
|
10
8
|
```javascript
|
|
11
9
|
// c/myComponent.js
|
|
12
10
|
import { LightningElement } from 'lwc';
|
|
13
|
-
import
|
|
11
|
+
import Toast from 'lightning/toast';
|
|
14
12
|
|
|
15
13
|
export default class MyComponent extends LightningElement {
|
|
16
14
|
...
|
|
@@ -42,28 +40,28 @@ export default class MyComponent extends LightningElement {
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
```
|
|
45
|
-
|
|
43
|
+
In this example, the toast configuration uses two ways to specify links (see note below). The toast displays a sticky mode informational toast message with a `label` string as the toast title and a `message` string as the toast message. The `{0}`, `{1}`, `{salesforceLink}`, and `{slackLink}` placeholders are replaced with their `url` specified links.
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
A page-level [`LightningToastContainer` component](/docs/component-library/bundle/lightning-toast-container/documentation) manages and displays the toast component.
|
|
48
46
|
|
|
49
47
|
**_NOTE:_** `label` can have index-based or name-based link placeholders. In the case of index-based link placeholders, `labelLinks` must be defined as an array, otherwise, `labelLinks` must be defined as a map. Same applies to `message`.
|
|
50
48
|
|
|
51
49
|
### Component Styling
|
|
52
50
|
|
|
53
|
-
`LightningToast` implements the [toast](https://www.lightningdesignsystem.com/components/toast/) blueprint in the Salesforce Lightning Design System (SLDS).
|
|
51
|
+
`LightningToast` implements the [toast](https://www.lightningdesignsystem.com/components/toast/) blueprint in the Salesforce Lightning Design System (SLDS). [SLDS styling hooks](https://www.lightningdesignsystem.com/components/toast/#Styling-Hooks-Overview) aren't supported with programmatic creation of toasts via `Toast.show()`.
|
|
54
52
|
|
|
55
53
|
### `config` attributes
|
|
56
54
|
|
|
57
|
-
Attribute |
|
|
55
|
+
Attribute | Description |
|
|
58
56
|
|----------| ------------ |
|
|
59
|
-
| `label` (required) |
|
|
60
|
-
| `labelLinks` | [{url, label}], which
|
|
61
|
-
| `message` |
|
|
62
|
-
| `messageLinks` | [{url, label}], which
|
|
63
|
-
| `variant` |
|
|
64
|
-
| `mode` |
|
|
57
|
+
| `label` (required) | Title of the toast, it can contain placeholders in the form of `{0} ... {N}` (index-based) or `{name} ... {someOtherName}` (name-based). The placeholders are replaced with the links on `labelLinks`. |
|
|
58
|
+
| `labelLinks` | [{url, label}], which replaces the `{0} ... {N}` indexed placeholders in `label` or `{ name: {url, label} }`, which replaces the `{name} ... {someOtherName}` named placeholders in `label`. |
|
|
59
|
+
| `message` | Description of the toast, it can contain placeholders in the form of `{0} ... {N}` (index-based) or `{name} ... {someOtherName}` (name-based). The placeholders are replaced with the links on `messageLinks`. |
|
|
60
|
+
| `messageLinks` | [{url, label}], which replaces the `{0} ... {N}` indexed placeholders in `message` or `{ name: {url, label} }`, which replaces the `{name} ... {someOtherName}` named placeholders in `message`. |
|
|
61
|
+
| `variant` | Appearance of the toast. |
|
|
62
|
+
| `mode` | Persistence of the toast. |
|
|
65
63
|
|
|
66
|
-
**_NOTE:_** When `labelLinks` (or `messageLinks`) is
|
|
64
|
+
**_NOTE:_** When `labelLinks` (or `messageLinks`) is passed to the `config` parameter, the content of `label` (or `message`) is rendered using [`lightning-formatted-rich-text`](https://developer.salesforce.com/docs/component-library/bundle/lightning-formatted-rich-text/documentation). consult the documentation for expected result when link presents.
|
|
67
65
|
|
|
68
66
|
#### `variant` attribute
|
|
69
67
|
|
|
@@ -82,8 +80,8 @@ The `mode` attribute sets the component's dismissal. It supports these values.
|
|
|
82
80
|
- `dismissible` - The component automatically disappears after a certain duration. The user can dismiss it early by clicking the close button. The time duration for `dismissible` is 4.8 seconds, or 9.6 seconds if the toast contains a link.
|
|
83
81
|
- `sticky` - The component stays on screen until the user clicks the close button.
|
|
84
82
|
|
|
85
|
-
##### Default Mode
|
|
86
|
-
If
|
|
83
|
+
##### Default Mode
|
|
84
|
+
If a `mode` value isn't provided, the default `mode` is determined by the value of `variant` and whether the `toast` has a link or links present in `label` or `message`.
|
|
87
85
|
|
|
88
86
|
| Variant | Has link? | Default Mode |
|
|
89
87
|
| --- | --- | --- |
|
|
@@ -98,6 +96,6 @@ If no `mode` is provided, the default `mode` will be determined by the value of
|
|
|
98
96
|
|
|
99
97
|
#### Small screen / Mobile environment
|
|
100
98
|
|
|
101
|
-
`LightningToast` is
|
|
99
|
+
`LightningToast` is responsive to your screen resolution. For smaller screens or mobile environments, the toast's **icon** and **description** (i.e. text stored in `message`, and `messageLinks`) is **not shown** due to the screen's width limitation (see [Toast blueprint screen variants](https://www.lightningdesignsystem.com/guidelines/messaging/components/toasts/#flavor-variants-screen).
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
On small screens and mobile environments, we recommend that you provide links in the toast's title (ie `label` and `labelLinks`) in order to have links visible and interactive.
|
|
@@ -20,6 +20,7 @@ const ALLOWED_DOMAINS = new Set([
|
|
|
20
20
|
's1.adis.ws',
|
|
21
21
|
'scormanywhere.secure.force.com',
|
|
22
22
|
'appiniummastertrial.secure.force.com',
|
|
23
|
+
'embed.app.guidde.com',
|
|
23
24
|
]);
|
|
24
25
|
|
|
25
26
|
export function hasOnlyAllowedVideoIframes(htmlString) {
|
|
@@ -44,5 +45,15 @@ function isUrlAllowed(url) {
|
|
|
44
45
|
const anchor = document.createElement('a');
|
|
45
46
|
anchor.href = url;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
if (anchor.protocol !== 'https:') {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (anchor.hostname === 'vimeo.com') {
|
|
53
|
+
const path = anchor.pathname;
|
|
54
|
+
const regex = /^\/showcase\/\d+\/embed$/;
|
|
55
|
+
return path.match(regex) !== null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return ALLOWED_DOMAINS.has(anchor.hostname);
|
|
48
59
|
}
|