@sellmate/design-system 1.0.36 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +124 -19
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sd-badge.cjs.entry.js +1 -1
- package/dist/cjs/{sd-button-v2.cjs.entry.js → sd-button-v2_2.cjs.entry.js} +184 -2
- package/dist/cjs/{sd-button_21.cjs.entry.js → sd-button_20.cjs.entry.js} +57 -79
- package/dist/cjs/sd-card.cjs.entry.js +1 -1
- package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +199 -0
- package/dist/cjs/sd-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/sd-dropdown-button.cjs.entry.js +29 -5
- package/dist/cjs/sd-file-picker.cjs.entry.js +3 -3
- package/dist/cjs/sd-guide.cjs.entry.js +2 -2
- package/dist/cjs/sd-modal-container.cjs.entry.js +263 -0
- package/dist/cjs/sd-popover.cjs.entry.js +2 -2
- package/dist/cjs/sd-progress.cjs.entry.js +2 -2
- package/dist/cjs/sd-radio-button-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-multiple-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-multiple.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-option-group.cjs.entry.js +3 -3
- package/dist/cjs/sd-select-v2-list-item_2.cjs.entry.js +5 -5
- package/dist/cjs/sd-select-v2-listbox_2.cjs.entry.js +3 -3
- package/dist/cjs/sd-select-v2.cjs.entry.js +30 -6
- package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast.cjs.entry.js +2 -2
- package/dist/cjs/sd-toggle-button.cjs.entry.js +1 -1
- package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/sd-badge/sd-badge.js +1 -1
- package/dist/collection/components/sd-button-v2/sd-button-v2.js +2 -2
- package/dist/collection/components/sd-card/sd-card.js +1 -1
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.config.js +17 -0
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.css +67 -0
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +384 -0
- package/dist/collection/components/sd-date-picker/sd-date-picker.js +1 -1
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +4 -4
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.css +4 -0
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.js +29 -4
- package/dist/collection/components/sd-field/sd-field.js +3 -3
- package/dist/collection/components/sd-file-picker/sd-file-picker.js +3 -3
- package/dist/collection/components/sd-floating-portal/sd-floating-portal.js +1 -1
- package/dist/collection/components/sd-guide/sd-guide.js +2 -2
- package/dist/collection/components/sd-icon/sd-icon.js +1 -1
- package/dist/collection/components/sd-input/sd-input.js +1 -1
- package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.js +1 -1
- package/dist/collection/components/sd-modal-container/sd-modal-container.config.js +1 -0
- package/dist/collection/components/sd-modal-container/sd-modal-container.css +58 -0
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +399 -0
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.config.js +3 -0
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.css +61 -0
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.js +324 -0
- package/dist/collection/components/sd-number-input/sd-number-input.js +4 -4
- package/dist/collection/components/sd-pagination/sd-pagination.js +2 -2
- package/dist/collection/components/sd-popover/sd-popover.js +2 -2
- package/dist/collection/components/sd-portal/sd-portal.js +24 -3
- package/dist/collection/components/sd-progress/sd-progress.js +2 -2
- package/dist/collection/components/sd-radio/sd-radio.js +1 -1
- package/dist/collection/components/sd-radio-button-group/sd-radio-button-group.js +1 -1
- package/dist/collection/components/sd-radio-group/sd-radio-group.js +1 -1
- package/dist/collection/components/sd-select/sd-select-dropdown/sd-select-dropdown.js +2 -2
- package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
- package/dist/collection/components/sd-select/sd-select-search-input/sd-select-search-input.js +3 -3
- package/dist/collection/components/sd-select/sd-select.js +1 -1
- package/dist/collection/components/sd-select-group/sd-select-group.js +1 -1
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.js +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.js +3 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +1 -1
- package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2.css +3 -0
- package/dist/collection/components/sd-select-v2/sd-select-v2.js +50 -25
- package/dist/collection/components/sd-table/sd-table.js +4 -4
- package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
- package/dist/collection/components/sd-tag/sd-tag.js +2 -2
- package/dist/collection/components/sd-textarea/sd-textarea.js +2 -2
- package/dist/collection/components/sd-toast/sd-toast.js +2 -2
- package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
- package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
- package/dist/collection/components/sd-toggle-button/sd-toggle-button.js +1 -1
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/modal.js +103 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-eM9OCX16.js → p-B0wG418y.js} +1 -1
- package/dist/components/{p-CyfWQr0q.js → p-BAghib4O.js} +1 -1
- package/dist/components/{p-D8OiOEB8.js → p-BCPAPvp8.js} +1 -1
- package/dist/components/{p-Cva7D7mF.js → p-BHLuiIDM.js} +1 -1
- package/dist/components/{p-BvBroZuS.js → p-BcrOYmsG.js} +1 -1
- package/dist/components/{p-CdOU_SOg.js → p-BdjLD8BG.js} +1 -1
- package/dist/components/{p-DKcKp__V.js → p-BiCK6R-J.js} +1 -1
- package/dist/components/{p-CXoqcDFa.js → p-BzS0YntY.js} +1 -1
- package/dist/components/{p-CpfPgt7c.js → p-BzUx5X3N.js} +1 -1
- package/dist/components/{p-gnF0_mDJ.js → p-CKi7RueC.js} +1 -1
- package/dist/components/{p-CgwiT7OF.js → p-CNUx4rbY.js} +1 -1
- package/dist/components/{p-BBpn_mYj.js → p-CQfrNtCG.js} +1 -1
- package/dist/components/p-CXKpL2GZ.js +1 -0
- package/dist/components/{p-CtOFXnU0.js → p-C_3U90D_.js} +1 -1
- package/dist/components/p-C_L-UaCP.js +1 -0
- package/dist/components/p-CyJZik9T.js +1 -0
- package/dist/components/p-D23gFKrT.js +1 -0
- package/dist/components/{p-72hNB1Fw.js → p-DASdfaPf.js} +1 -1
- package/dist/components/p-DEBuE-pW.js +1 -0
- package/dist/components/{p-CiHU8TZa.js → p-DEP3qjY2.js} +1 -1
- package/dist/components/{p-41grr69M.js → p-DNyoL0F-.js} +1 -1
- package/dist/components/{p-DOt_ptQc.js → p-DQhPxH3o.js} +1 -1
- package/dist/components/p-Di17TAvI.js +1 -0
- package/dist/components/{p-zUWRVubn.js → p-DjOSobI6.js} +1 -1
- package/dist/components/{p-CxT7-293.js → p-Dpi-ww3O.js} +1 -1
- package/dist/components/{p-C6uWXKpX.js → p-DyFykTJN.js} +1 -1
- package/dist/components/{p-dBp4oI6E.js → p-eZ82xLZt.js} +1 -1
- package/dist/components/{p-DkjKNMgx.js → p-iusjOpcc.js} +1 -1
- package/dist/components/sd-badge.js +1 -1
- package/dist/components/sd-button-v2.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-calendar.js +1 -1
- package/dist/components/sd-card.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/sd-confirm-modal.d.ts +11 -0
- package/dist/components/sd-confirm-modal.js +1 -0
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker.js +1 -1
- package/dist/components/sd-dropdown-button.js +1 -1
- package/dist/components/sd-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-floating-portal.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-icon.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/sd-loading-spinner.js +1 -1
- package/dist/components/sd-modal-container.d.ts +11 -0
- package/dist/components/sd-modal-container.js +1 -0
- package/dist/components/{sd-modal-card.d.ts → sd-notice-modal.d.ts} +4 -4
- package/dist/components/sd-notice-modal.js +1 -0
- package/dist/components/sd-number-input.js +1 -1
- package/dist/components/sd-pagination.js +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-portal.js +1 -1
- package/dist/components/sd-progress.js +1 -1
- package/dist/components/sd-radio-button-group.js +1 -1
- package/dist/components/sd-radio-group.js +1 -1
- package/dist/components/sd-radio.js +1 -1
- package/dist/components/sd-select-dropdown.js +1 -1
- package/dist/components/sd-select-group.js +1 -1
- package/dist/components/sd-select-multiple-group.js +1 -1
- package/dist/components/sd-select-multiple.js +1 -1
- package/dist/components/sd-select-option-group.js +1 -1
- package/dist/components/sd-select-option.js +1 -1
- package/dist/components/sd-select-search-input.js +1 -1
- package/dist/components/sd-select-v2-list-item-search.js +1 -1
- package/dist/components/sd-select-v2-list-item.js +1 -1
- package/dist/components/sd-select-v2-listbox.js +1 -1
- package/dist/components/sd-select-v2-trigger.js +1 -1
- package/dist/components/sd-select-v2.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-table.js +1 -1
- package/dist/components/sd-tabs.js +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-toast-container.js +1 -1
- package/dist/components/sd-toast.js +1 -1
- package/dist/components/sd-toggle-button.js +1 -1
- package/dist/components/sd-toggle.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/design-system/design-system.css +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/index.esm.js +1 -1
- package/dist/design-system/{p-a35adbbc.entry.js → p-021e4171.entry.js} +1 -1
- package/dist/design-system/{p-d817c235.entry.js → p-0cca5deb.entry.js} +1 -1
- package/dist/design-system/{p-5b2d9ef2.entry.js → p-12f04366.entry.js} +1 -1
- package/dist/design-system/{p-2119dddc.entry.js → p-13d4baf3.entry.js} +1 -1
- package/dist/design-system/{p-e4a19588.entry.js → p-1b80635f.entry.js} +1 -1
- package/dist/design-system/p-26fc1fc0.entry.js +1 -0
- package/dist/design-system/{p-270227ae.entry.js → p-29a60707.entry.js} +1 -1
- package/dist/design-system/{p-c4f9aeed.entry.js → p-37e9e161.entry.js} +1 -1
- package/dist/design-system/{p-b3473468.entry.js → p-6d9e16bd.entry.js} +1 -1
- package/dist/design-system/{p-a88dabbd.entry.js → p-72b09ede.entry.js} +1 -1
- package/dist/design-system/{p-fea7dbce.entry.js → p-812d7c00.entry.js} +1 -1
- package/dist/design-system/p-87a783a7.entry.js +1 -0
- package/dist/design-system/{p-97bfc75f.entry.js → p-9933475e.entry.js} +1 -1
- package/dist/design-system/{p-CdOU_SOg.js → p-BdjLD8BG.js} +1 -1
- package/dist/design-system/{p-0c2e44fb.entry.js → p-a4e87345.entry.js} +1 -1
- package/dist/design-system/{p-594dee9b.entry.js → p-acb529cb.entry.js} +1 -1
- package/dist/design-system/p-ba393cc8.entry.js +1 -0
- package/dist/design-system/p-c549e2c0.entry.js +1 -0
- package/dist/design-system/{p-1d7ea568.entry.js → p-c7c66261.entry.js} +1 -1
- package/dist/design-system/{p-2185ffaa.entry.js → p-cc837ebf.entry.js} +1 -1
- package/dist/design-system/p-d8b04e91.entry.js +1 -0
- package/dist/design-system/{p-01a7b38b.entry.js → p-e0ef7658.entry.js} +1 -1
- package/dist/design-system/{p-5875a54c.entry.js → p-e641f41f.entry.js} +1 -1
- package/dist/design-system/p-e8fbedcd.entry.js +1 -0
- package/dist/design-system/p-f186c0f4.entry.js +1 -0
- package/dist/design-system/p-f5460c6e.entry.js +1 -0
- package/dist/design-system/{p-a94ed4a3.entry.js → p-f7203145.entry.js} +1 -1
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/index.js +124 -20
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-badge.entry.js +1 -1
- package/dist/esm/{sd-button-v2.config-CRtF2Br0.js → sd-button-v2.config-Dtf44MOf.js} +1 -1
- package/dist/esm/{sd-button-v2.entry.js → sd-button-v2_2.entry.js} +185 -4
- package/dist/esm/{sd-button_21.entry.js → sd-button_20.entry.js} +58 -79
- package/dist/esm/sd-card.entry.js +1 -1
- package/dist/esm/sd-confirm-modal_2.entry.js +196 -0
- package/dist/esm/sd-date-picker.entry.js +1 -1
- package/dist/esm/sd-dropdown-button.entry.js +30 -6
- package/dist/esm/sd-file-picker.entry.js +3 -3
- package/dist/esm/sd-guide.entry.js +2 -2
- package/dist/esm/sd-modal-container.entry.js +261 -0
- package/dist/esm/sd-popover.entry.js +2 -2
- package/dist/esm/sd-progress.entry.js +2 -2
- package/dist/esm/sd-radio-button-group.entry.js +1 -1
- package/dist/esm/sd-radio-group.entry.js +1 -1
- package/dist/esm/sd-select-group.entry.js +1 -1
- package/dist/esm/sd-select-multiple-group.entry.js +1 -1
- package/dist/esm/sd-select-multiple.entry.js +1 -1
- package/dist/esm/sd-select-option-group.entry.js +3 -3
- package/dist/esm/sd-select-v2-list-item_2.entry.js +5 -5
- package/dist/esm/sd-select-v2-listbox_2.entry.js +3 -3
- package/dist/esm/sd-select-v2.entry.js +30 -6
- package/dist/esm/sd-tabs.entry.js +1 -1
- package/dist/esm/sd-toast-container.entry.js +1 -1
- package/dist/esm/sd-toast.entry.js +2 -2
- package/dist/esm/sd-toggle-button.entry.js +1 -1
- package/dist/esm/sd-toggle.entry.js +1 -1
- package/dist/types/components/sd-confirm-modal/sd-confirm-modal.config.d.ts +14 -0
- package/dist/types/components/sd-confirm-modal/sd-confirm-modal.d.ts +31 -0
- package/dist/types/components/sd-dropdown-button/sd-dropdown-button.d.ts +3 -0
- package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +45 -0
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +27 -0
- package/dist/types/components/sd-notice-modal/sd-notice-modal.config.d.ts +5 -0
- package/dist/types/components/sd-notice-modal/sd-notice-modal.d.ts +28 -0
- package/dist/types/components/sd-portal/sd-portal.d.ts +1 -0
- package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +5 -1
- package/dist/types/components.d.ts +210 -59
- package/dist/types/index.d.ts +2 -0
- package/dist/types/utils/modal.d.ts +12 -0
- package/hydrate/index.js +645 -123
- package/hydrate/index.mjs +645 -123
- package/package.json +1 -1
- package/dist/cjs/sd-tag.cjs.entry.js +0 -186
- package/dist/collection/components/sd-modal-card/sd-modal-card.css +0 -51
- package/dist/collection/components/sd-modal-card/sd-modal-card.js +0 -254
- package/dist/components/p-DV5ewRYP.js +0 -1
- package/dist/components/p-VX95YxcY.js +0 -1
- package/dist/components/sd-modal-card.js +0 -1
- package/dist/design-system/p-1370b0d8.entry.js +0 -1
- package/dist/design-system/p-35473290.entry.js +0 -1
- package/dist/design-system/p-62581abe.entry.js +0 -1
- package/dist/design-system/p-687f8414.entry.js +0 -1
- package/dist/design-system/p-e7654632.entry.js +0 -1
- package/dist/design-system/p-e8ebb400.entry.js +0 -1
- package/dist/design-system/p-ebee1495.entry.js +0 -1
- package/dist/esm/sd-tag.entry.js +0 -184
- package/dist/types/components/sd-modal-card/sd-modal-card.d.ts +0 -25
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, g as getElement, h } from './index-B8tGP77V.js';
|
|
2
|
+
|
|
3
|
+
const modal = {
|
|
4
|
+
title: {
|
|
5
|
+
icon: "32"
|
|
6
|
+
},
|
|
7
|
+
close: {
|
|
8
|
+
size: "20",
|
|
9
|
+
color: "#888888"
|
|
10
|
+
},
|
|
11
|
+
confirm: {
|
|
12
|
+
positive: {
|
|
13
|
+
icon: "#0075FF"
|
|
14
|
+
},
|
|
15
|
+
negative: {
|
|
16
|
+
icon: "#E30000"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var modalTokens = {
|
|
21
|
+
modal: modal
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const CONFIRM_MODAL_DEFAULT_BUTTON = {
|
|
25
|
+
positive: 'primary_md',
|
|
26
|
+
negative: 'danger_md',
|
|
27
|
+
};
|
|
28
|
+
const CONFIRM_MODAL_ICON_MAP = {
|
|
29
|
+
positive: 'notificationOutline',
|
|
30
|
+
negative: 'warningOutline',
|
|
31
|
+
};
|
|
32
|
+
const CONFIRM_MODAL_ICON_COLOR = {
|
|
33
|
+
positive: modalTokens.modal.confirm.positive.icon,
|
|
34
|
+
negative: modalTokens.modal.confirm.negative.icon,
|
|
35
|
+
};
|
|
36
|
+
const TITLE_ICON_SIZE = Number(modalTokens.modal.title.icon);
|
|
37
|
+
const CLOSE_ICON_SIZE = Number(modalTokens.modal.close.size);
|
|
38
|
+
const CLOSE_ICON_COLOR = modalTokens.modal.close.color;
|
|
39
|
+
const SUB_BUTTON_PRESET = 'neutral_outline_md';
|
|
40
|
+
|
|
41
|
+
const sdConfirmModalCss = () => `sd-confirm-modal{display:block;width:fit-content;min-width:520px}sd-confirm-modal .sd-confirm-modal{position:relative;padding:var(--sd-modal-modal-padding-y) var(--sd-modal-modal-padding-x);border-radius:var(--sd-modal-modal-radius);box-shadow:4px 4px 24px 4px rgba(0, 0, 0, 0.2);background:var(--sd-modal-modal-bg)}sd-confirm-modal .sd-confirm-modal__close-button{position:absolute;top:16px;right:16px;cursor:pointer}sd-confirm-modal .sd-confirm-modal__icon{display:block;width:var(--sd-modal-modal-title-icon);height:var(--sd-modal-modal-title-icon);margin:0 auto var(--sd-modal-modal-title-gap) auto}sd-confirm-modal .sd-confirm-modal__title{color:var(--sd-modal-modal-title-color);font-size:var(--sd-modal-modal-title-typography-font-size);font-weight:var(--sd-modal-modal-title-typography-font-weight);line-height:var(--sd-modal-modal-title-typography-line-height);text-align:center;margin:0 0 var(--sd-modal-modal-body-gap) 0}sd-confirm-modal .sd-confirm-modal__body{display:flex;flex-direction:column;gap:var(--sd-modal-modal-body-gap)}sd-confirm-modal .sd-confirm-modal__message-text{color:var(--sd-modal-modal-message-color);font-size:var(--sd-modal-modal-message-typography-font-size);font-weight:var(--sd-modal-modal-message-typography-font-weight);line-height:var(--sd-modal-modal-message-typography-line-height);text-align:center;margin:0}sd-confirm-modal .sd-confirm-modal__content-box{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 16px;border:1px solid #e1e1e1;border-radius:8px;background:white}sd-confirm-modal .sd-confirm-modal__slot-label{font-size:14px;font-weight:700;line-height:var(--sd-modal-modal-message-typography-line-height);color:var(--sd-modal-modal-message-color)}sd-confirm-modal .sd-confirm-modal__button{display:flex;justify-content:center;gap:var(--sd-modal-modal-button-gap);margin-top:32px}`;
|
|
42
|
+
|
|
43
|
+
const SdConfirmModal = class {
|
|
44
|
+
constructor(hostRef) {
|
|
45
|
+
registerInstance(this, hostRef);
|
|
46
|
+
this.close = createEvent(this, "sdClose");
|
|
47
|
+
this.confirm = createEvent(this, "sdConfirm");
|
|
48
|
+
}
|
|
49
|
+
get el() { return getElement(this); }
|
|
50
|
+
hasSlottedContent = false;
|
|
51
|
+
customContentRef;
|
|
52
|
+
slotObserver;
|
|
53
|
+
type = 'positive';
|
|
54
|
+
modalTitle = '';
|
|
55
|
+
titleClass = '';
|
|
56
|
+
topMessage = [];
|
|
57
|
+
bottomMessage = [];
|
|
58
|
+
mainButtonName;
|
|
59
|
+
mainButtonLabel = '확인';
|
|
60
|
+
subButtonLabel = '';
|
|
61
|
+
tagPreset;
|
|
62
|
+
tagLabel = '';
|
|
63
|
+
slotLabel = '';
|
|
64
|
+
tagContents;
|
|
65
|
+
close;
|
|
66
|
+
confirm;
|
|
67
|
+
componentWillLoad() {
|
|
68
|
+
this.syncHasSlottedContent();
|
|
69
|
+
}
|
|
70
|
+
componentDidLoad() {
|
|
71
|
+
if (typeof MutationObserver === 'undefined')
|
|
72
|
+
return;
|
|
73
|
+
this.slotObserver = new MutationObserver(() => this.syncHasSlottedContent());
|
|
74
|
+
this.slotObserver.observe(this.el, {
|
|
75
|
+
childList: true,
|
|
76
|
+
characterData: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
componentDidRender() {
|
|
80
|
+
if (this.customContentRef && this.tagContents instanceof HTMLElement) {
|
|
81
|
+
if (typeof this.customContentRef.replaceChildren === 'function') {
|
|
82
|
+
this.customContentRef.replaceChildren(this.tagContents);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.customContentRef.innerHTML = '';
|
|
86
|
+
this.customContentRef.appendChild(this.tagContents);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
this.slotObserver?.disconnect();
|
|
92
|
+
}
|
|
93
|
+
get resolvedMainButton() {
|
|
94
|
+
return this.mainButtonName ?? CONFIRM_MODAL_DEFAULT_BUTTON[this.type];
|
|
95
|
+
}
|
|
96
|
+
get hasTagContent() {
|
|
97
|
+
return !!(this.tagLabel && this.tagPreset);
|
|
98
|
+
}
|
|
99
|
+
get showContentBox() {
|
|
100
|
+
return !!this.tagContents || this.hasTagContent || this.hasSlottedContent;
|
|
101
|
+
}
|
|
102
|
+
syncHasSlottedContent() {
|
|
103
|
+
const hasSlottedContent = Array.from(this.el.childNodes).some(node => !(node.nodeType === Node.ELEMENT_NODE &&
|
|
104
|
+
node.classList.contains('sd-confirm-modal')) &&
|
|
105
|
+
(node.nodeType === Node.ELEMENT_NODE ||
|
|
106
|
+
(node.nodeType === Node.TEXT_NODE && node.textContent?.trim())));
|
|
107
|
+
if (hasSlottedContent !== this.hasSlottedContent) {
|
|
108
|
+
this.hasSlottedContent = hasSlottedContent;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
const iconName = CONFIRM_MODAL_ICON_MAP[this.type];
|
|
113
|
+
const iconColor = CONFIRM_MODAL_ICON_COLOR[this.type];
|
|
114
|
+
return (h("div", { key: '79b2bc6c82470f18097f709af199379b7f9c33e9', class: "sd-confirm-modal" }, h("sd-icon", { key: '20d09afc087d1f1d293295dfda2b7c0b65fca032', class: "sd-confirm-modal__close-button", name: "close", size: CLOSE_ICON_SIZE, color: CLOSE_ICON_COLOR, onClick: () => this.close.emit() }), h("sd-icon", { key: '7ef48200946dceef27e32bf51e2e57ee7db9e5c8', class: "sd-confirm-modal__icon", name: iconName, size: TITLE_ICON_SIZE, color: iconColor }), h("h2", { key: '7937da9ba581a59b6d33cef5c63ccaf01714cc71', class: `sd-confirm-modal__title ${this.titleClass}` }, this.modalTitle), h("div", { key: 'ded09b7f81f990fd5b4ce7bb78eebf4578012b41', class: "sd-confirm-modal__body" }, (this.topMessage ?? []).length > 0 && (h("div", { key: '25b0ad2313003f0fa5a119d63e80d1a96e1af5f5', class: "sd-confirm-modal__message" }, (this.topMessage ?? []).map(msg => (h("p", { class: "sd-confirm-modal__message-text", innerHTML: msg }))))), this.showContentBox && (h("div", { key: '51d76d5923a384ac82d1e4a463981ab25655037d', class: "sd-confirm-modal__content-box" }, this.tagContents ? (h("div", { class: "sd-confirm-modal__custom-content", ref: el => {
|
|
115
|
+
this.customContentRef = el;
|
|
116
|
+
} })) : (h("slot", { onSlotchange: () => this.syncHasSlottedContent() }, this.hasTagContent && h("sd-tag", { name: this.tagPreset, label: this.tagLabel }), this.slotLabel && h("span", { class: "sd-confirm-modal__slot-label" }, this.slotLabel))))), (this.bottomMessage ?? []).length > 0 && (h("div", { key: '8ef574ff752ccee7ba28cb4824fc7968bb86b344', class: "sd-confirm-modal__message" }, (this.bottomMessage ?? []).map(msg => (h("p", { class: "sd-confirm-modal__message-text", innerHTML: msg })))))), h("div", { key: 'bd5e3dc0bd36c33a7b47ce328121427d44d53a86', class: "sd-confirm-modal__button" }, this.subButtonLabel && (h("sd-button-v2", { key: 'ff8c7487883f2a4c740baa8966e641975bc4ba14', name: SUB_BUTTON_PRESET, label: this.subButtonLabel, onSdClick: () => this.close.emit() })), h("sd-button-v2", { key: '176cfe2404deb3d57e4a87206a339f797536b51c', name: this.resolvedMainButton, label: this.mainButtonLabel, onSdClick: () => this.confirm.emit() }))));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
SdConfirmModal.style = sdConfirmModalCss();
|
|
120
|
+
|
|
121
|
+
const NOTICE_BUTTON_PRESET = 'neutral_outline_md';
|
|
122
|
+
|
|
123
|
+
const sdNoticeModalCss = () => `sd-notice-modal{display:block;width:fit-content;min-width:520px}sd-notice-modal .sd-notice-modal{position:relative;padding:var(--sd-modal-modal-padding-y) var(--sd-modal-modal-padding-x);border-radius:var(--sd-modal-modal-radius);box-shadow:4px 4px 24px 4px rgba(0, 0, 0, 0.2);background:var(--sd-modal-modal-bg)}sd-notice-modal .sd-notice-modal__close-button{position:absolute;top:16px;right:16px;cursor:pointer}sd-notice-modal .sd-notice-modal__title{color:var(--sd-modal-modal-title-color);font-size:var(--sd-modal-modal-title-typography-font-size);font-weight:var(--sd-modal-modal-title-typography-font-weight);line-height:var(--sd-modal-modal-title-typography-line-height);text-align:center;margin:0 0 var(--sd-modal-modal-body-gap) 0}sd-notice-modal .sd-notice-modal__body{display:flex;flex-direction:column;gap:var(--sd-modal-modal-body-gap)}sd-notice-modal .sd-notice-modal__message-text{color:var(--sd-modal-modal-message-color);font-size:var(--sd-modal-modal-message-typography-font-size);font-weight:var(--sd-modal-modal-message-typography-font-weight);line-height:var(--sd-modal-modal-message-typography-line-height);text-align:center;margin:0}sd-notice-modal .sd-notice-modal__content-box{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 16px;border:1px solid #e1e1e1;border-radius:8px;background:white}sd-notice-modal .sd-notice-modal__slot-label{font-size:14px;font-weight:700;line-height:var(--sd-modal-modal-message-typography-line-height);color:var(--sd-modal-modal-message-color)}sd-notice-modal .sd-notice-modal__button{display:flex;justify-content:center;gap:var(--sd-modal-modal-button-gap);margin-top:32px}`;
|
|
124
|
+
|
|
125
|
+
const SdNoticeModal = class {
|
|
126
|
+
constructor(hostRef) {
|
|
127
|
+
registerInstance(this, hostRef);
|
|
128
|
+
this.close = createEvent(this, "sdClose");
|
|
129
|
+
this.confirm = createEvent(this, "sdConfirm");
|
|
130
|
+
}
|
|
131
|
+
get el() { return getElement(this); }
|
|
132
|
+
hasSlottedContent = false;
|
|
133
|
+
customContentRef;
|
|
134
|
+
slotObserver;
|
|
135
|
+
modalTitle = '';
|
|
136
|
+
titleClass = '';
|
|
137
|
+
topMessage = [];
|
|
138
|
+
bottomMessage = [];
|
|
139
|
+
mainButtonLabel = '확인';
|
|
140
|
+
subButtonLabel = '';
|
|
141
|
+
tagPreset;
|
|
142
|
+
tagLabel = '';
|
|
143
|
+
slotLabel = '';
|
|
144
|
+
tagContents;
|
|
145
|
+
close;
|
|
146
|
+
confirm;
|
|
147
|
+
componentWillLoad() {
|
|
148
|
+
this.syncHasSlottedContent();
|
|
149
|
+
}
|
|
150
|
+
componentDidLoad() {
|
|
151
|
+
if (typeof MutationObserver === 'undefined')
|
|
152
|
+
return;
|
|
153
|
+
this.slotObserver = new MutationObserver(() => this.syncHasSlottedContent());
|
|
154
|
+
this.slotObserver.observe(this.el, {
|
|
155
|
+
childList: true,
|
|
156
|
+
characterData: true,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
componentDidRender() {
|
|
160
|
+
if (this.customContentRef && this.tagContents instanceof HTMLElement) {
|
|
161
|
+
if (typeof this.customContentRef.replaceChildren === 'function') {
|
|
162
|
+
this.customContentRef.replaceChildren(this.tagContents);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.customContentRef.innerHTML = '';
|
|
166
|
+
this.customContentRef.appendChild(this.tagContents);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
disconnectedCallback() {
|
|
171
|
+
this.slotObserver?.disconnect();
|
|
172
|
+
}
|
|
173
|
+
get hasTagContent() {
|
|
174
|
+
return !!(this.tagLabel && this.tagPreset);
|
|
175
|
+
}
|
|
176
|
+
get showContentBox() {
|
|
177
|
+
return !!this.tagContents || this.hasTagContent || this.hasSlottedContent;
|
|
178
|
+
}
|
|
179
|
+
syncHasSlottedContent() {
|
|
180
|
+
const hasSlottedContent = Array.from(this.el.childNodes).some(node => !(node.nodeType === Node.ELEMENT_NODE &&
|
|
181
|
+
node.classList.contains('sd-notice-modal')) &&
|
|
182
|
+
(node.nodeType === Node.ELEMENT_NODE ||
|
|
183
|
+
(node.nodeType === Node.TEXT_NODE && node.textContent?.trim())));
|
|
184
|
+
if (hasSlottedContent !== this.hasSlottedContent) {
|
|
185
|
+
this.hasSlottedContent = hasSlottedContent;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
render() {
|
|
189
|
+
return (h("div", { key: '522489e0b0c0706b25f5e99215d8bb75e94f1596', class: "sd-notice-modal" }, h("sd-icon", { key: 'e6ca52391427d0f1a429feeb97337e716aae5920', class: "sd-notice-modal__close-button", name: "close", size: CLOSE_ICON_SIZE, color: CLOSE_ICON_COLOR, onClick: () => this.close.emit() }), h("h2", { key: '7c7f4c3ad01d421a7f75f14d93cc0ba58526bfd6', class: `sd-notice-modal__title ${this.titleClass}` }, this.modalTitle), h("div", { key: 'afc982ef15da5884f181e189f78a9986a467ff40', class: "sd-notice-modal__body" }, (this.topMessage ?? []).length > 0 && (h("div", { key: '028b03030a7a1b29ec54910807878da39f8ea156', class: "sd-notice-modal__message" }, (this.topMessage ?? []).map(msg => (h("p", { class: "sd-notice-modal__message-text", innerHTML: msg }))))), this.showContentBox && (h("div", { key: 'fa12a72c4ac271d6e57ec85415f6144f1b38b146', class: "sd-notice-modal__content-box" }, this.tagContents ? (h("div", { class: "sd-notice-modal__custom-content", ref: el => {
|
|
190
|
+
this.customContentRef = el;
|
|
191
|
+
} })) : (h("slot", { onSlotchange: () => this.syncHasSlottedContent() }, this.hasTagContent && h("sd-tag", { name: this.tagPreset, label: this.tagLabel }), this.slotLabel && h("span", { class: "sd-notice-modal__slot-label" }, this.slotLabel))))), (this.bottomMessage ?? []).length > 0 && (h("div", { key: '39008c0c41e84a92b02aa310e32dacf7b1b3ea83', class: "sd-notice-modal__message" }, (this.bottomMessage ?? []).map(msg => (h("p", { class: "sd-notice-modal__message-text", innerHTML: msg })))))), h("div", { key: '54062ddaf99170af5bcf8caa1f6d80ce3f24b4b2', class: "sd-notice-modal__button" }, this.subButtonLabel && (h("sd-button-v2", { key: 'c0365120540bf5e7f9e43955a8099e019837e4d6', name: NOTICE_BUTTON_PRESET, label: this.subButtonLabel, onSdClick: () => this.close.emit() })), h("sd-button-v2", { key: 'c51c93f72ebbe91e87aa0d0d561227f6b66b5e74', name: NOTICE_BUTTON_PRESET, label: this.mainButtonLabel, onSdClick: () => this.confirm.emit() }))));
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
SdNoticeModal.style = sdNoticeModalCss();
|
|
195
|
+
|
|
196
|
+
export { SdConfirmModal as sd_confirm_modal, SdNoticeModal as sd_notice_modal };
|
|
@@ -35,7 +35,7 @@ const SdDatePicker = class {
|
|
|
35
35
|
this.viewChange.emit(e.detail);
|
|
36
36
|
};
|
|
37
37
|
render() {
|
|
38
|
-
return (h("div", { key: '
|
|
38
|
+
return (h("div", { key: '9f1e5b391dec4623e6f628449a459ab1a6f6ec7d', class: { 'sd-date-picker': true, 'sd-date-picker--disabled': this.disabled } }, h("sd-input", { key: '5448efd4117535e96d1273395571e12bdf3063ea', ref: el => (this.inputEl = el), value: this.value, label: this.label, "inside-label": true, readonly: true, disabled: this.disabled, placeholder: this.placeholder, inputClass: "sd-date-picker__input", onClick: () => this.openMenu() }, h("sd-icon", { key: '97191fcbf8d9b1af8553ad867b38a189c480c6d8', slot: "prefix", name: "date", size: "16", color: this.disabled ? 'grey_65' : 'grey_70', class: "date-icon", onClick: () => this.openMenu() })), this.isOpen && (h("sd-portal", { key: '945477bd6ef69263a9cefae982474d6889dd8d58', open: this.isOpen, parentRef: this.inputEl, onSdClose: this.handleClose }, h("div", { key: '270188ccf5d174be496d31abcf9d8570e37a5ff0', class: "sd-date-picker__menu" }, h("sd-calendar", { key: 'f9d50e345744d0ce127028edba60ba4c17dba372', value: this.value, selectable: this.selectable, onSdSelect: this.handleSelect, onSdViewChange: this.handleViewChange }))))));
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
SdDatePicker.style = sdDatePickerCss();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, g as getElement, h } from './index-B8tGP77V.js';
|
|
2
2
|
import { B as BaseDropdownEvent } from './base-dropdown-event-CRdYeSBK.js';
|
|
3
|
-
import { B as BUTTON_CONFIG, g as getPresetName,
|
|
3
|
+
import { B as BUTTON_CONFIG, g as getPresetName, P as PRESET_BORDER_COLORS$1, a as PRESET_CONTENT_COLORS$1, b as PRESET_HOVER_BACKGROUNDS$1, c as BUTTON_FOCUS_RING_COLOR } from './sd-button-v2.config-Dtf44MOf.js';
|
|
4
4
|
import { b as buttonTokens } from './component.button-KOzU1j2w.js';
|
|
5
5
|
|
|
6
6
|
const color = {
|
|
@@ -66,7 +66,7 @@ const DROPDOWN_DISABLED_BORDER = buttonTokens.border.disabled;
|
|
|
66
66
|
const isDropdownButtonName = (value) => value in DROPDOWN_BUTTON_CONFIG;
|
|
67
67
|
const getDropdownButtonPreset = (value) => getPresetName(value);
|
|
68
68
|
|
|
69
|
-
const sdDropdownButtonCss = () => `sd-dropdown-button{display:inline-flex;width:fit-content;height:fit-content}.sd-dropdown-button{display:inline-flex;position:relative}.sd-dropdown-button__trigger{--sd-dropdown-button-height:var(--sd-button-md-height, 34px);--sd-dropdown-button-padding-x:var(--sd-button-md-padding-x, 20px);--sd-dropdown-button-gap:var(--sd-button-md-gap, 8px);--sd-dropdown-button-font-family:var(--sd-button-md-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-md-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-md-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-md-typography-text-decoration, none);--sd-dropdown-button-bg:#025497;--sd-dropdown-button-bg-hover:#004177;--sd-dropdown-button-border:transparent;--sd-dropdown-button-content:#ffffff;--sd-dropdown-button-current-content:var(--sd-dropdown-button-content);--sd-dropdown-button-divider:#006ac1;--sd-dropdown-button-accent:#006ac1;--sd-dropdown-button-min-width:106px;--sd-dropdown-button-disabled-bg:var(--sd-button-bg-disabled, $grey_30);--sd-dropdown-button-disabled-content:var(--sd-button-content-disabled, $grey_65);--sd-dropdown-button-disabled-border:var(--sd-button-border-disabled, $grey_45);display:inline-flex;align-items:stretch;justify-content:space-between;min-width:var(--sd-dropdown-button-min-width);min-height:var(--sd-dropdown-button-height);padding:0;border:var(--sd-button-border-width-default, 1px) solid var(--sd-dropdown-button-border);border-radius:var(--sd-button-radius-default, 4px);background:var(--sd-dropdown-button-bg);color:var(--sd-dropdown-button-current-content);cursor:pointer;box-sizing:border-box;font-family:var(--sd-dropdown-button-font-family);font-size:var(--sd-dropdown-button-font-size);font-weight:var(--sd-dropdown-button-font-weight);line-height:1;text-decoration:var(--sd-dropdown-button-text-decoration);transition:background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;white-space:nowrap}.sd-dropdown-button__trigger:hover:not(.sd-dropdown-button__trigger--disabled){background:var(--sd-dropdown-button-bg-hover)}.sd-dropdown-button__trigger:focus-visible{outline:0;box-shadow:0 0 0 2px var(--sd-dropdown-button-accent)}.sd-dropdown-button__trigger--xs{--sd-dropdown-button-height:var(--sd-button-xs-height, 24px);--sd-dropdown-button-padding-x:var(--sd-button-xs-padding-x, 8px);--sd-dropdown-button-gap:var(--sd-button-xs-gap, 4px);--sd-dropdown-button-font-family:var(--sd-button-xs-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-xs-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-xs-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-xs-typography-text-decoration, none)}.sd-dropdown-button__trigger--sm{--sd-dropdown-button-height:var(--sd-button-sm-height, 28px);--sd-dropdown-button-padding-x:var(--sd-button-sm-padding-x, 12px);--sd-dropdown-button-gap:var(--sd-button-sm-gap, 6px);--sd-dropdown-button-font-family:var(--sd-button-sm-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-sm-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-sm-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-sm-typography-text-decoration, none)}.sd-dropdown-button__trigger--md{--sd-dropdown-button-height:var(--sd-button-md-height, 34px);--sd-dropdown-button-padding-x:var(--sd-button-md-padding-x, 20px);--sd-dropdown-button-gap:var(--sd-button-md-gap, 8px);--sd-dropdown-button-font-family:var(--sd-button-md-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-md-typography-font-size, 16px);--sd-dropdown-button-font-weight:var(--sd-button-md-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-md-typography-text-decoration, none)}.sd-dropdown-button__trigger--disabled{border-color:var(--sd-dropdown-button-disabled-border);background:var(--sd-dropdown-button-disabled-bg);--sd-dropdown-button-current-content:var(--sd-dropdown-button-disabled-content);cursor:not-allowed}.sd-dropdown-button__trigger--disabled .sd-dropdown-button__trigger-divider{background:var(--sd-dropdown-button-disabled-border)}.sd-dropdown-button__trigger-label,.sd-dropdown-button__trigger-icon{display:inline-flex;align-items:center;justify-content:center}.sd-dropdown-button__trigger-label{flex:1 1 auto;min-width:0;padding:0 var(--sd-dropdown-button-padding-x)}.sd-dropdown-button__trigger-divider{align-self:stretch;width:1px;height:auto;background:var(--sd-dropdown-button-divider);opacity:0.9}.sd-dropdown-button__trigger-icon{flex:0 0 auto;min-width:calc(var(--sd-dropdown-button-height) - 2px);padding:0 calc(var(--sd-dropdown-button-gap) + 2px)}.sd-dropdown-button__menu{position:relative;display:grid;width:max-content;min-width:var(--sd-dropdown-button-menu-min-width, max-content);max-width:calc(100vw - 24px);padding:4px 0;border:0;border-radius:4px;background:#FFFFFF;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1019607843);box-sizing:border-box;overflow:hidden}.sd-dropdown-button__menu-item{--sd-dropdown-button-menu-item-current-color:var(--sd-dropdown-button-menu-item-color);display:inline-flex;align-items:center;gap:8px;min-height:28px;width:100%;padding:0 12px;border:0;border-radius:0;background:transparent;color:var(--sd-dropdown-button-menu-item-current-color);cursor:pointer;box-sizing:border-box;font:inherit;text-align:left;transition:background-color 0.15s ease, color 0.15s ease}.sd-dropdown-button__menu-item--active{background:var(--sd-dropdown-button-menu-item-active-bg);--sd-dropdown-button-menu-item-current-color:var( --sd-dropdown-button-menu-item-active-color )}.sd-dropdown-button__menu-item--disabled{--sd-dropdown-button-menu-item-current-color:var(--sd-dropdown-button-disabled-content);cursor:not-allowed}.sd-dropdown-button__menu-item-icon{flex:0 0 auto}.sd-dropdown-button__menu-item-label{display:inline-flex;align-items:center;min-width:0;white-space:nowrap;font-size:12px}`;
|
|
69
|
+
const sdDropdownButtonCss = () => `sd-dropdown-button{display:inline-flex;width:fit-content;height:fit-content}.sd-dropdown-button{display:inline-flex;position:relative}.sd-dropdown-button__trigger{--sd-dropdown-button-height:var(--sd-button-md-height, 34px);--sd-dropdown-button-padding-x:var(--sd-button-md-padding-x, 20px);--sd-dropdown-button-gap:var(--sd-button-md-gap, 8px);--sd-dropdown-button-font-family:var(--sd-button-md-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-md-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-md-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-md-typography-text-decoration, none);--sd-dropdown-button-bg:#025497;--sd-dropdown-button-bg-hover:#004177;--sd-dropdown-button-border:transparent;--sd-dropdown-button-content:#ffffff;--sd-dropdown-button-current-content:var(--sd-dropdown-button-content);--sd-dropdown-button-divider:#006ac1;--sd-dropdown-button-accent:#006ac1;--sd-dropdown-button-min-width:106px;--sd-dropdown-button-disabled-bg:var(--sd-button-bg-disabled, $grey_30);--sd-dropdown-button-disabled-content:var(--sd-button-content-disabled, $grey_65);--sd-dropdown-button-disabled-border:var(--sd-button-border-disabled, $grey_45);display:inline-flex;align-items:stretch;justify-content:space-between;min-width:var(--sd-dropdown-button-min-width);min-height:var(--sd-dropdown-button-height);padding:0;border:var(--sd-button-border-width-default, 1px) solid var(--sd-dropdown-button-border);border-radius:var(--sd-button-radius-default, 4px);background:var(--sd-dropdown-button-bg);color:var(--sd-dropdown-button-current-content);cursor:pointer;box-sizing:border-box;font-family:var(--sd-dropdown-button-font-family);font-size:var(--sd-dropdown-button-font-size);font-weight:var(--sd-dropdown-button-font-weight);line-height:1;text-decoration:var(--sd-dropdown-button-text-decoration);transition:background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;white-space:nowrap}.sd-dropdown-button__trigger:hover:not(.sd-dropdown-button__trigger--disabled){background:var(--sd-dropdown-button-bg-hover)}.sd-dropdown-button__trigger:focus-visible{outline:0;box-shadow:0 0 0 2px var(--sd-dropdown-button-accent)}.sd-dropdown-button__trigger--xs{--sd-dropdown-button-height:var(--sd-button-xs-height, 24px);--sd-dropdown-button-padding-x:var(--sd-button-xs-padding-x, 8px);--sd-dropdown-button-gap:var(--sd-button-xs-gap, 4px);--sd-dropdown-button-font-family:var(--sd-button-xs-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-xs-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-xs-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-xs-typography-text-decoration, none)}.sd-dropdown-button__trigger--sm{--sd-dropdown-button-height:var(--sd-button-sm-height, 28px);--sd-dropdown-button-padding-x:var(--sd-button-sm-padding-x, 12px);--sd-dropdown-button-gap:var(--sd-button-sm-gap, 6px);--sd-dropdown-button-font-family:var(--sd-button-sm-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-sm-typography-font-size, 12px);--sd-dropdown-button-font-weight:var(--sd-button-sm-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-sm-typography-text-decoration, none)}.sd-dropdown-button__trigger--md{--sd-dropdown-button-height:var(--sd-button-md-height, 34px);--sd-dropdown-button-padding-x:var(--sd-button-md-padding-x, 20px);--sd-dropdown-button-gap:var(--sd-button-md-gap, 8px);--sd-dropdown-button-font-family:var(--sd-button-md-typography-font-family, inherit);--sd-dropdown-button-font-size:var(--sd-button-md-typography-font-size, 16px);--sd-dropdown-button-font-weight:var(--sd-button-md-typography-font-weight, 500);--sd-dropdown-button-text-decoration:var(--sd-button-md-typography-text-decoration, none)}.sd-dropdown-button__trigger--disabled{border-color:var(--sd-dropdown-button-disabled-border);background:var(--sd-dropdown-button-disabled-bg);--sd-dropdown-button-current-content:var(--sd-dropdown-button-disabled-content);cursor:not-allowed}.sd-dropdown-button__trigger--disabled .sd-dropdown-button__trigger-divider{background:var(--sd-dropdown-button-disabled-border)}.sd-dropdown-button__trigger-label,.sd-dropdown-button__trigger-icon{display:inline-flex;align-items:center;justify-content:center}.sd-dropdown-button__trigger-label{flex:1 1 auto;min-width:0;padding:0 var(--sd-dropdown-button-padding-x)}.sd-dropdown-button__trigger-divider{align-self:stretch;width:1px;height:auto;background:var(--sd-dropdown-button-divider);opacity:0.9}.sd-dropdown-button__trigger-icon{flex:0 0 auto;min-width:calc(var(--sd-dropdown-button-height) - 2px);padding:0 calc(var(--sd-dropdown-button-gap) + 2px);transition:transform 0.2s ease}.sd-dropdown-button__trigger-icon--open{transform:rotate(180deg)}.sd-dropdown-button__menu{position:relative;display:grid;width:max-content;min-width:var(--sd-dropdown-button-menu-min-width, max-content);max-width:calc(100vw - 24px);padding:4px 0;border:0;border-radius:4px;background:#FFFFFF;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1019607843);box-sizing:border-box;overflow:hidden}.sd-dropdown-button__menu-item{--sd-dropdown-button-menu-item-current-color:var(--sd-dropdown-button-menu-item-color);display:inline-flex;align-items:center;gap:8px;min-height:28px;width:100%;padding:0 12px;border:0;border-radius:0;background:transparent;color:var(--sd-dropdown-button-menu-item-current-color);cursor:pointer;box-sizing:border-box;font:inherit;text-align:left;transition:background-color 0.15s ease, color 0.15s ease}.sd-dropdown-button__menu-item--active{background:var(--sd-dropdown-button-menu-item-active-bg);--sd-dropdown-button-menu-item-current-color:var( --sd-dropdown-button-menu-item-active-color )}.sd-dropdown-button__menu-item--disabled{--sd-dropdown-button-menu-item-current-color:var(--sd-dropdown-button-disabled-content);cursor:not-allowed}.sd-dropdown-button__menu-item-icon{flex:0 0 auto}.sd-dropdown-button__menu-item-label{display:inline-flex;align-items:center;min-width:0;white-space:nowrap;font-size:12px}`;
|
|
70
70
|
|
|
71
71
|
const SdDropdownButton = class extends BaseDropdownEvent {
|
|
72
72
|
constructor(hostRef) {
|
|
@@ -80,10 +80,13 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
80
80
|
label = '';
|
|
81
81
|
items = [];
|
|
82
82
|
disabled = false;
|
|
83
|
+
static CLOSE_ANIMATION_DURATION = 150;
|
|
83
84
|
isOpen = false;
|
|
85
|
+
isAnimatingOut = false;
|
|
84
86
|
itemIndex = -1;
|
|
85
87
|
triggerRef;
|
|
86
88
|
menuRef;
|
|
89
|
+
closeAnimationTimer;
|
|
87
90
|
click;
|
|
88
91
|
dropDownShow;
|
|
89
92
|
handleOpenChange(isOpen) {
|
|
@@ -98,6 +101,8 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
98
101
|
}
|
|
99
102
|
disconnectedCallback() {
|
|
100
103
|
this.cleanupEvent();
|
|
104
|
+
if (this.closeAnimationTimer)
|
|
105
|
+
clearTimeout(this.closeAnimationTimer);
|
|
101
106
|
}
|
|
102
107
|
async sdOpen() {
|
|
103
108
|
if (this.disabled || this.items.length === 0)
|
|
@@ -108,7 +113,15 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
108
113
|
this.closeDropdown();
|
|
109
114
|
}
|
|
110
115
|
closeDropdown = () => {
|
|
116
|
+
if (!this.isOpen)
|
|
117
|
+
return;
|
|
111
118
|
this.isOpen = false;
|
|
119
|
+
this.isAnimatingOut = true;
|
|
120
|
+
if (this.closeAnimationTimer)
|
|
121
|
+
clearTimeout(this.closeAnimationTimer);
|
|
122
|
+
this.closeAnimationTimer = setTimeout(() => {
|
|
123
|
+
this.isAnimatingOut = false;
|
|
124
|
+
}, SdDropdownButton.CLOSE_ANIMATION_DURATION);
|
|
112
125
|
};
|
|
113
126
|
handleDocumentClick(event) {
|
|
114
127
|
const target = event.target;
|
|
@@ -178,7 +191,15 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
178
191
|
if (this.disabled || this.items.length === 0) {
|
|
179
192
|
return;
|
|
180
193
|
}
|
|
181
|
-
this.isOpen
|
|
194
|
+
if (this.isOpen) {
|
|
195
|
+
this.closeDropdown();
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
if (this.closeAnimationTimer)
|
|
199
|
+
clearTimeout(this.closeAnimationTimer);
|
|
200
|
+
this.isAnimatingOut = false;
|
|
201
|
+
this.isOpen = true;
|
|
202
|
+
}
|
|
182
203
|
};
|
|
183
204
|
selectItem(item, event) {
|
|
184
205
|
event?.stopPropagation();
|
|
@@ -213,7 +234,7 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
213
234
|
return classes.join(' ');
|
|
214
235
|
}
|
|
215
236
|
renderDropdown(preset) {
|
|
216
|
-
if (!this.isOpen || !this.triggerRef)
|
|
237
|
+
if ((!this.isOpen && !this.isAnimatingOut) || !this.triggerRef)
|
|
217
238
|
return null;
|
|
218
239
|
return (h("sd-portal", { open: this.isOpen, parentRef: this.triggerRef, onSdClose: this.closeDropdown }, h("div", { style: { position: 'absolute', width: '0px', height: '0px' } }, h("div", { class: "sd-dropdown-button__menu", role: "menu", ref: el => (this.menuRef = el), style: {
|
|
219
240
|
'--sd-dropdown-button-menu-min-width': `${this.triggerRef.offsetWidth}px`,
|
|
@@ -234,7 +255,7 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
234
255
|
}
|
|
235
256
|
render() {
|
|
236
257
|
const { config, preset } = this.resolvedConfig;
|
|
237
|
-
return (h("div", { key: '
|
|
258
|
+
return (h("div", { key: 'd2c725861a4667633a2726b47101d604436c5c16', class: "sd-dropdown-button" }, h("button", { key: '51a4a2f049f53d61f45632a89e179c95f9cf9755', type: "button", class: this.getTriggerClasses(preset, config.size, this.disabled, this.isOpen), disabled: this.disabled, "aria-haspopup": "menu", "aria-expanded": String(this.isOpen), onClick: this.toggleDropdown, ref: el => (this.triggerRef = el), style: {
|
|
238
259
|
'--sd-dropdown-button-min-width': `${DROPDOWN_BUTTON_MIN_WIDTHS[config.size]}px`,
|
|
239
260
|
'--sd-dropdown-button-bg': config.color,
|
|
240
261
|
'--sd-dropdown-button-bg-hover': PRESET_HOVER_BACKGROUNDS[preset],
|
|
@@ -245,7 +266,10 @@ const SdDropdownButton = class extends BaseDropdownEvent {
|
|
|
245
266
|
'--sd-dropdown-button-disabled-bg': DROPDOWN_DISABLED_BACKGROUND,
|
|
246
267
|
'--sd-dropdown-button-disabled-content': DROPDOWN_DISABLED_CONTENT,
|
|
247
268
|
'--sd-dropdown-button-disabled-border': DROPDOWN_DISABLED_BORDER,
|
|
248
|
-
} }, h("span", { key: '
|
|
269
|
+
} }, h("span", { key: '595bf90d834102371492f478e23f7886ec7e5dcf', class: "sd-dropdown-button__trigger-label" }, this.label), h("span", { key: '79a12ecba11d82944e2563d60dfb76c5a9bb9a39', class: "sd-dropdown-button__trigger-divider", "aria-hidden": "true" }), h("span", { key: '7160b1e8f7e25d822c539a57ab19ee2572c7b146', class: {
|
|
270
|
+
'sd-dropdown-button__trigger-icon': true,
|
|
271
|
+
'sd-dropdown-button__trigger-icon--open': this.isOpen,
|
|
272
|
+
}, "aria-hidden": "true" }, h("sd-icon", { key: 'd041b1bfb0bb902f5b670fbf5524babfa0ee47ac', name: "arrowDown", size: 12, color: "var(--sd-dropdown-button-current-content)" }))), this.renderDropdown(preset)));
|
|
249
273
|
}
|
|
250
274
|
static get watchers() { return {
|
|
251
275
|
"isOpen": [{
|
|
@@ -98,15 +98,15 @@ const SdFilePicker = class {
|
|
|
98
98
|
render() {
|
|
99
99
|
const hasFiles = this.hasFiles();
|
|
100
100
|
const displayText = this.getDisplayText();
|
|
101
|
-
return (h("div", { key: '
|
|
101
|
+
return (h("div", { key: '598e284933fe6dbcbd1a1f77a8f530aa22be5456', class: {
|
|
102
102
|
'sd-file-picker': true,
|
|
103
103
|
[this.getStatusClass()]: true,
|
|
104
104
|
'sd-file-picker--inline': this.inline,
|
|
105
|
-
}, onClick: this.handleClick, onMouseEnter: () => (this.hovered = true), onMouseLeave: () => (this.hovered = false) }, h("input", { key: '
|
|
105
|
+
}, onClick: this.handleClick, onMouseEnter: () => (this.hovered = true), onMouseLeave: () => (this.hovered = false) }, h("input", { key: '3f84b668c107219a3acecb32c8d473f12c162e3f', ref: el => (this.fileInputRef = el), type: "file", class: "sd-file-picker__input", disabled: this.disabled, multiple: this.multiple, accept: this.accept, onInput: this.handleFileChange, "aria-label": this.placeholder }), h("sd-icon", { key: '0fcc77f108d858f0ede5043c4da71988e68d8bd0', name: "attachFile", size: 16, color: this.getIconColor(), class: "sd-file-picker__icon" }), h("div", { key: '5aeb75690a1922d765e19ada43cf7ab034f79979', ref: el => (this.fileNamesRef = el), class: {
|
|
106
106
|
'sd-file-picker__text': true,
|
|
107
107
|
'sd-file-picker__text--placeholder': !hasFiles,
|
|
108
108
|
'sd-file-picker__text--active': hasFiles,
|
|
109
|
-
} }, displayText), !this.disabled && hasFiles && (h("sd-icon", { key: '
|
|
109
|
+
} }, displayText), !this.disabled && hasFiles && (h("sd-icon", { key: '1da963ffaded05153eb72803b3ca4127e82b7386', name: "close", size: 12, color: "#888888", class: "sd-file-picker__clear-icon", onClick: this.handleClear })), this.showTooltip && hasFiles && this.hovered && (h("div", { key: 'd4fdd2e2ed990c17c35eca0164f93f3323ba728c', class: "sd-file-picker__tooltip" }, displayText))));
|
|
110
110
|
}
|
|
111
111
|
static get watchers() { return {
|
|
112
112
|
"value": [{
|
|
@@ -53,9 +53,9 @@ const SdGuide = class {
|
|
|
53
53
|
};
|
|
54
54
|
render() {
|
|
55
55
|
const { name: iconName, size: iconSize, color: iconColor } = GUIDE_ICON[this.type];
|
|
56
|
-
return (h("div", { key: '
|
|
56
|
+
return (h("div", { key: '6160f0e15482053eadd72d57a15f3396541b083a', class: "sd-guide", style: {
|
|
57
57
|
'--sd-guide-color': GUIDE_ICON[this.type].color,
|
|
58
|
-
} }, h("sd-button", { key: '
|
|
58
|
+
} }, h("sd-button", { key: 'cec37bacab4a2f2e932db6e55674d63cb4203ffd', ref: el => (this.guideRef = el), class: this.guideClass, variant: this.popupShow ? 'primary' : 'outline', label: this.label || GUIDE_LABEL[this.type], size: "sm", color: this.popupShow ? GUIDE_ICON[this.type].color : 'grey_45', icon: iconName, iconColor: this.popupShow ? 'white' : iconColor, iconSize: iconSize, noHover: this.popupShow, onSdClick: this.handleClickGuide }), this.type === 'help' && this.popupShow && (h("sd-portal", { key: 'be8e6a105b6cadbdccabb76d48c8077957da3a37', open: this.popupShow, parentRef: this.guideRef, onSdClose: this.closeDropdown, offset: [0, 4] }, h("div", { key: '321c6fd059d24d632b434abc77e19dfb552756a0', style: { position: 'absolute', width: '0px', height: '0px' } }, h("div", { key: '90e051c0c7609ba0b9cc5e654aba8d806b278b8a', class: "sd-guide__popup", style: { width: this.popupWidth ? this.popupWidth + 'px' : '426px' } }, h("sd-button", { key: '58712e7346d7482d6495394e981df5bfc42e1cdc', class: "sd-guide__popup__close", icon: "close", color: "grey_65", size: "md", variant: "ghost", noHover: true, onSdClick: this.closeDropdown }), h("div", { key: '55e4711ee0bee9a4fd11280aacee78a41e613f5b', class: "sd-guide__popup__header" }, h("sd-icon", { key: '461cea2bab8c257d192623068793af58f821d7c9', name: "helpOutline", size: 24, color: "green_65" }), h("h3", { key: '0240dc09042adef7da4c6c57f888e7e4923c595e', class: "sd-guide__popup__title" }, this.popupTitle || GUIDE_LABEL[this.type])), h("ul", { key: '906c5ac6ef8532482014478d360bdf892764acb0', class: "sd-guide__popup__list" }, this.renderListItem(this.message))))))));
|
|
59
59
|
}
|
|
60
60
|
// 현재 2depth까지만 스타일 적용
|
|
61
61
|
renderListItem(message, depth = 0) {
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { r as registerInstance, g as getElement, h } from './index-B8tGP77V.js';
|
|
2
|
+
|
|
3
|
+
const sdModalContainerCss = () => `sd-modal-container{display:block}sd-modal-container .sd-modal-container{position:fixed;inset:0;z-index:var(--sd-modal-container-z-index, 10000);display:flex;align-items:center;justify-content:center}sd-modal-container .sd-modal-container__backdrop{position:absolute;inset:0;background:rgba(0, 0, 0, 0.4);opacity:0;transition:opacity 0.3s ease-out}sd-modal-container .sd-modal-container__backdrop--visible{opacity:1}sd-modal-container .sd-modal-container__content{position:relative;z-index:1;display:grid;place-items:center}sd-modal-container .sd-modal-container__content>*{grid-row:1;grid-column:1}sd-modal-container .sd-modal-container__modal{opacity:0;transform:scale(0);transition:opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)}sd-modal-container .sd-modal-container__modal--visible{opacity:1;transform:scale(1)}sd-modal-container .sd-modal-container__modal--shake{animation:modal-shake 0.3s ease-out}@keyframes modal-shake{0%,100%{transform:scale(1)}25%{transform:scale(1.03)}50%{transform:scale(0.97)}75%{transform:scale(1.01)}}`;
|
|
4
|
+
|
|
5
|
+
let modalIdCounter = 0;
|
|
6
|
+
const ANIMATION_DURATION = 350;
|
|
7
|
+
const SdModalContainer = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
get el() { return getElement(this); }
|
|
12
|
+
entries = [];
|
|
13
|
+
isVisible = false;
|
|
14
|
+
isBackdropVisible = false;
|
|
15
|
+
contentRef;
|
|
16
|
+
containerDismissTimerId;
|
|
17
|
+
handleKeydown(e) {
|
|
18
|
+
if (e.key === 'Escape') {
|
|
19
|
+
const top = this.getTopEntry();
|
|
20
|
+
if (!top)
|
|
21
|
+
return;
|
|
22
|
+
if (top.persistent) {
|
|
23
|
+
this.shakeModal(top.modalEl);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.requestDismiss(top.id, 'cancel');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async open(options, chain) {
|
|
30
|
+
const id = `modal-${++modalIdCounter}`;
|
|
31
|
+
const modalEl = this.createConfirmModal(id, options);
|
|
32
|
+
if (this.containerDismissTimerId) {
|
|
33
|
+
clearTimeout(this.containerDismissTimerId);
|
|
34
|
+
this.containerDismissTimerId = undefined;
|
|
35
|
+
}
|
|
36
|
+
this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
|
|
37
|
+
this.isVisible = true;
|
|
38
|
+
// Append after the container renders, then wait until the modal can paint before starting transitions.
|
|
39
|
+
requestAnimationFrame(() => {
|
|
40
|
+
if (this.contentRef) {
|
|
41
|
+
this.contentRef.appendChild(modalEl);
|
|
42
|
+
this.waitForModalReady(modalEl).then(() => {
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
const currentEntry = (this.entries ?? []).find(item => item.id === id);
|
|
45
|
+
if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
|
|
46
|
+
return;
|
|
47
|
+
this.isBackdropVisible = true;
|
|
48
|
+
modalEl.classList.add('sd-modal-container__modal--visible');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return id;
|
|
54
|
+
}
|
|
55
|
+
async openNotice(options, chain) {
|
|
56
|
+
const id = `modal-${++modalIdCounter}`;
|
|
57
|
+
const modalEl = this.createNoticeModal(id, options);
|
|
58
|
+
if (this.containerDismissTimerId) {
|
|
59
|
+
clearTimeout(this.containerDismissTimerId);
|
|
60
|
+
this.containerDismissTimerId = undefined;
|
|
61
|
+
}
|
|
62
|
+
this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
|
|
63
|
+
this.isVisible = true;
|
|
64
|
+
requestAnimationFrame(() => {
|
|
65
|
+
if (this.contentRef) {
|
|
66
|
+
this.contentRef.appendChild(modalEl);
|
|
67
|
+
this.waitForModalReady(modalEl).then(() => {
|
|
68
|
+
requestAnimationFrame(() => {
|
|
69
|
+
const currentEntry = (this.entries ?? []).find(item => item.id === id);
|
|
70
|
+
if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
|
|
71
|
+
return;
|
|
72
|
+
this.isBackdropVisible = true;
|
|
73
|
+
modalEl.classList.add('sd-modal-container__modal--visible');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return id;
|
|
79
|
+
}
|
|
80
|
+
async update(id, props) {
|
|
81
|
+
const entry = (this.entries ?? []).find(e => e.id === id);
|
|
82
|
+
if (!entry || entry.closing)
|
|
83
|
+
return;
|
|
84
|
+
this.applyProps(entry.modalEl, props);
|
|
85
|
+
}
|
|
86
|
+
createConfirmModal(id, options) {
|
|
87
|
+
const el = document.createElement('sd-confirm-modal');
|
|
88
|
+
el.setAttribute('data-modal-id', id);
|
|
89
|
+
el.classList.add('sd-modal-container__modal');
|
|
90
|
+
this.applyProps(el, options);
|
|
91
|
+
el.addEventListener('sdConfirm', () => {
|
|
92
|
+
this.requestDismiss(id, 'confirm');
|
|
93
|
+
});
|
|
94
|
+
el.addEventListener('sdClose', () => {
|
|
95
|
+
this.requestDismiss(id, 'cancel');
|
|
96
|
+
});
|
|
97
|
+
return el;
|
|
98
|
+
}
|
|
99
|
+
applyProps(el, options) {
|
|
100
|
+
if (this.hasOwnProp(options, 'type'))
|
|
101
|
+
this.setAttr(el, 'type', options.type);
|
|
102
|
+
if (this.hasOwnProp(options, 'title'))
|
|
103
|
+
this.setAttr(el, 'modal-title', options.title);
|
|
104
|
+
if (this.hasOwnProp(options, 'titleClass'))
|
|
105
|
+
this.setAttr(el, 'title-class', options.titleClass);
|
|
106
|
+
if (this.hasOwnProp(options, 'mainButtonLabel')) {
|
|
107
|
+
this.setAttr(el, 'main-button-label', options.mainButtonLabel);
|
|
108
|
+
}
|
|
109
|
+
if (this.hasOwnProp(options, 'mainButtonName')) {
|
|
110
|
+
this.setAttr(el, 'main-button-name', options.mainButtonName);
|
|
111
|
+
}
|
|
112
|
+
if (this.hasOwnProp(options, 'subButtonLabel')) {
|
|
113
|
+
this.setAttr(el, 'sub-button-label', options.subButtonLabel);
|
|
114
|
+
}
|
|
115
|
+
if (this.hasOwnProp(options, 'tagPreset'))
|
|
116
|
+
this.setAttr(el, 'tag-preset', options.tagPreset);
|
|
117
|
+
if (this.hasOwnProp(options, 'tagLabel'))
|
|
118
|
+
this.setAttr(el, 'tag-label', options.tagLabel);
|
|
119
|
+
if (this.hasOwnProp(options, 'slotLabel'))
|
|
120
|
+
this.setAttr(el, 'slot-label', options.slotLabel);
|
|
121
|
+
if (this.hasOwnProp(options, 'topMessage'))
|
|
122
|
+
el.topMessage = options.topMessage ?? [];
|
|
123
|
+
if (this.hasOwnProp(options, 'bottomMessage'))
|
|
124
|
+
el.bottomMessage = options.bottomMessage ?? [];
|
|
125
|
+
if (this.hasOwnProp(options, 'tagContents'))
|
|
126
|
+
el.tagContents = options.tagContents;
|
|
127
|
+
}
|
|
128
|
+
createNoticeModal(id, options) {
|
|
129
|
+
const el = document.createElement('sd-notice-modal');
|
|
130
|
+
el.setAttribute('data-modal-id', id);
|
|
131
|
+
el.classList.add('sd-modal-container__modal');
|
|
132
|
+
this.applyNoticeProps(el, options);
|
|
133
|
+
el.addEventListener('sdConfirm', () => {
|
|
134
|
+
this.requestDismiss(id, 'confirm');
|
|
135
|
+
});
|
|
136
|
+
el.addEventListener('sdClose', () => {
|
|
137
|
+
this.requestDismiss(id, 'cancel');
|
|
138
|
+
});
|
|
139
|
+
return el;
|
|
140
|
+
}
|
|
141
|
+
applyNoticeProps(el, options) {
|
|
142
|
+
if (this.hasOwnProp(options, 'title'))
|
|
143
|
+
this.setAttr(el, 'modal-title', options.title);
|
|
144
|
+
if (this.hasOwnProp(options, 'titleClass'))
|
|
145
|
+
this.setAttr(el, 'title-class', options.titleClass);
|
|
146
|
+
if (this.hasOwnProp(options, 'mainButtonLabel')) {
|
|
147
|
+
this.setAttr(el, 'main-button-label', options.mainButtonLabel);
|
|
148
|
+
}
|
|
149
|
+
if (this.hasOwnProp(options, 'subButtonLabel')) {
|
|
150
|
+
this.setAttr(el, 'sub-button-label', options.subButtonLabel);
|
|
151
|
+
}
|
|
152
|
+
if (this.hasOwnProp(options, 'tagPreset'))
|
|
153
|
+
this.setAttr(el, 'tag-preset', options.tagPreset);
|
|
154
|
+
if (this.hasOwnProp(options, 'tagLabel'))
|
|
155
|
+
this.setAttr(el, 'tag-label', options.tagLabel);
|
|
156
|
+
if (this.hasOwnProp(options, 'slotLabel'))
|
|
157
|
+
this.setAttr(el, 'slot-label', options.slotLabel);
|
|
158
|
+
if (this.hasOwnProp(options, 'topMessage'))
|
|
159
|
+
el.topMessage = options.topMessage ?? [];
|
|
160
|
+
if (this.hasOwnProp(options, 'bottomMessage'))
|
|
161
|
+
el.bottomMessage = options.bottomMessage ?? [];
|
|
162
|
+
if (this.hasOwnProp(options, 'tagContents'))
|
|
163
|
+
el.tagContents = options.tagContents;
|
|
164
|
+
}
|
|
165
|
+
handleBackdropClick = () => {
|
|
166
|
+
const top = this.getTopEntry();
|
|
167
|
+
if (!top)
|
|
168
|
+
return;
|
|
169
|
+
if (top.persistent) {
|
|
170
|
+
this.shakeModal(top.modalEl);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.requestDismiss(top.id, 'cancel');
|
|
174
|
+
};
|
|
175
|
+
shakeModal(modalEl) {
|
|
176
|
+
const cls = 'sd-modal-container__modal--shake';
|
|
177
|
+
modalEl.classList.remove(cls);
|
|
178
|
+
modalEl.addEventListener('animationend', () => modalEl.classList.remove(cls), { once: true });
|
|
179
|
+
requestAnimationFrame(() => {
|
|
180
|
+
modalEl.classList.add(cls);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
disconnectedCallback() {
|
|
184
|
+
(this.entries ?? []).forEach(entry => {
|
|
185
|
+
if (entry.dismissTimerId)
|
|
186
|
+
clearTimeout(entry.dismissTimerId);
|
|
187
|
+
});
|
|
188
|
+
if (this.containerDismissTimerId)
|
|
189
|
+
clearTimeout(this.containerDismissTimerId);
|
|
190
|
+
}
|
|
191
|
+
getTopEntry() {
|
|
192
|
+
return [...(this.entries ?? [])].reverse().find(entry => !entry.closing);
|
|
193
|
+
}
|
|
194
|
+
requestDismiss(id, reason) {
|
|
195
|
+
const entry = (this.entries ?? []).find(item => item.id === id);
|
|
196
|
+
if (!entry || entry.closing)
|
|
197
|
+
return;
|
|
198
|
+
entry.modalEl.classList.remove('sd-modal-container__modal--visible');
|
|
199
|
+
// fade out backdrop simultaneously if this is the last active modal
|
|
200
|
+
const remainingActive = (this.entries ?? []).filter(item => item.id !== id && !item.closing);
|
|
201
|
+
if (remainingActive.length === 0) {
|
|
202
|
+
this.isBackdropVisible = false;
|
|
203
|
+
}
|
|
204
|
+
const dismissTimerId = setTimeout(() => {
|
|
205
|
+
this.finalizeDismiss(id);
|
|
206
|
+
}, ANIMATION_DURATION);
|
|
207
|
+
this.entries = (this.entries ?? []).map(item => item.id === id ? { ...item, closing: true, dismissTimerId } : item);
|
|
208
|
+
if (reason === 'confirm')
|
|
209
|
+
entry.chain._triggerOk();
|
|
210
|
+
if (reason === 'cancel')
|
|
211
|
+
entry.chain._triggerCancel();
|
|
212
|
+
}
|
|
213
|
+
finalizeDismiss(id) {
|
|
214
|
+
const entry = (this.entries ?? []).find(item => item.id === id);
|
|
215
|
+
if (!entry)
|
|
216
|
+
return;
|
|
217
|
+
if (entry.dismissTimerId)
|
|
218
|
+
clearTimeout(entry.dismissTimerId);
|
|
219
|
+
entry.modalEl.remove();
|
|
220
|
+
const nextEntries = (this.entries ?? []).filter(item => item.id !== id);
|
|
221
|
+
this.entries = nextEntries;
|
|
222
|
+
if (nextEntries.length === 0) {
|
|
223
|
+
this.containerDismissTimerId = setTimeout(() => {
|
|
224
|
+
if ((this.entries ?? []).length === 0) {
|
|
225
|
+
this.isVisible = false;
|
|
226
|
+
}
|
|
227
|
+
this.containerDismissTimerId = undefined;
|
|
228
|
+
}, ANIMATION_DURATION);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
waitForModalReady(modalEl) {
|
|
232
|
+
const componentOnReady = modalEl.componentOnReady;
|
|
233
|
+
if (typeof componentOnReady === 'function') {
|
|
234
|
+
return componentOnReady.call(modalEl).then(() => undefined);
|
|
235
|
+
}
|
|
236
|
+
return new Promise(resolve => {
|
|
237
|
+
requestAnimationFrame(() => {
|
|
238
|
+
requestAnimationFrame(() => resolve());
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
hasOwnProp(options, key) {
|
|
243
|
+
return Object.prototype.hasOwnProperty.call(options, key);
|
|
244
|
+
}
|
|
245
|
+
setAttr(el, name, value) {
|
|
246
|
+
if (value == null)
|
|
247
|
+
return;
|
|
248
|
+
el.setAttribute(name, value);
|
|
249
|
+
}
|
|
250
|
+
render() {
|
|
251
|
+
if (!this.isVisible)
|
|
252
|
+
return null;
|
|
253
|
+
return (h("div", { class: "sd-modal-container" }, h("div", { class: {
|
|
254
|
+
'sd-modal-container__backdrop': true,
|
|
255
|
+
'sd-modal-container__backdrop--visible': this.isBackdropVisible,
|
|
256
|
+
}, onClick: this.handleBackdropClick }), h("div", { class: "sd-modal-container__content", ref: el => { this.contentRef = el; } })));
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
SdModalContainer.style = sdModalContainerCss();
|
|
260
|
+
|
|
261
|
+
export { SdModalContainer as sd_modal_container };
|