mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
parent
be7bbeda03
commit
e75be23a49
4 changed files with 22 additions and 2 deletions
|
@ -21,6 +21,10 @@ export const Default = () => ({
|
||||||
"[data-modal-primary-focus]"
|
"[data-modal-primary-focus]"
|
||||||
),
|
),
|
||||||
size: select("Size (size)", sizes, "sm"),
|
size: select("Size (size)", sizes, "sm"),
|
||||||
|
preventCloseOnClickOutside: boolean(
|
||||||
|
"Prevent the modal from closing when clicking outside (preventCloseOnClickOutside)",
|
||||||
|
false
|
||||||
|
),
|
||||||
},
|
},
|
||||||
modalHeader: {
|
modalHeader: {
|
||||||
label: text("Optional Label (label in <ModalHeader>)", "Optional Label"),
|
label: text("Optional Label (label in <ModalHeader>)", "Optional Label"),
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
*/
|
*/
|
||||||
export let danger = false;
|
export let danger = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to `true` to prevent the modal from closing when clicking outside
|
||||||
|
* @type {boolean} [preventCloseOnClickOutside=false]
|
||||||
|
*/
|
||||||
|
export let preventCloseOnClickOutside = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify a class for the inner modal
|
* Specify a class for the inner modal
|
||||||
* @type {string} [containerClass=""]
|
* @type {string} [containerClass=""]
|
||||||
|
@ -104,7 +110,7 @@
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:click="{() => {
|
on:click="{() => {
|
||||||
if (!didClickInnerModal) open = false;
|
if (!didClickInnerModal && !preventCloseOnClickOutside) open = false;
|
||||||
didClickInnerModal = false;
|
didClickInnerModal = false;
|
||||||
}}"
|
}}"
|
||||||
on:mouseover
|
on:mouseover
|
||||||
|
|
|
@ -44,6 +44,10 @@ export const Default = () => ({
|
||||||
"[data-modal-primary-focus]"
|
"[data-modal-primary-focus]"
|
||||||
),
|
),
|
||||||
size: select("Size (size)", sizes),
|
size: select("Size (size)", sizes),
|
||||||
|
preventCloseOnClickOutside: boolean(
|
||||||
|
"Prevent the modal from closing when clicking outside (preventCloseOnClickOutside)",
|
||||||
|
false
|
||||||
|
),
|
||||||
iconDescription: text(
|
iconDescription: text(
|
||||||
"Close icon description (iconDescription)",
|
"Close icon description (iconDescription)",
|
||||||
"Close the modal"
|
"Close the modal"
|
||||||
|
|
|
@ -89,6 +89,12 @@
|
||||||
*/
|
*/
|
||||||
export let selectorPrimaryFocus = "[data-modal-primary-focus]";
|
export let selectorPrimaryFocus = "[data-modal-primary-focus]";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to `true` to prevent the modal from closing when clicking outside
|
||||||
|
* @type {boolean} [preventCloseOnClickOutside=false]
|
||||||
|
*/
|
||||||
|
export let preventCloseOnClickOutside = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an id for the top-level element
|
* Set an id for the top-level element
|
||||||
* @type {string} [id]
|
* @type {string} [id]
|
||||||
|
@ -167,7 +173,7 @@
|
||||||
}}"
|
}}"
|
||||||
on:click
|
on:click
|
||||||
on:click="{() => {
|
on:click="{() => {
|
||||||
if (!didClickInnerModal) open = false;
|
if (!didClickInnerModal && !preventCloseOnClickOutside) open = false;
|
||||||
didClickInnerModal = false;
|
didClickInnerModal = false;
|
||||||
}}"
|
}}"
|
||||||
on:mouseover
|
on:mouseover
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue