@designbasekorea/ui-wc 0.5.5 → 0.5.6
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/chunks/lottie-e273b936.js +17032 -0
- package/dist/esm/components/animation-background/canvas-controller.js +121 -1
- package/dist/esm/components/animation-background/controls.js +180 -1
- package/dist/esm/components/animation-background/graphite-controller.js +196 -1
- package/dist/esm/components/animation-background/graphite-presets.js +42 -1
- package/dist/esm/components/animation-background/graphite-shader.js +111 -1
- package/dist/esm/components/animation-background/layers.js +369 -1
- package/dist/esm/components/animation-background/lumina-presets.js +53 -1
- package/dist/esm/components/animation-background/lumina-shaders.js +181 -1
- package/dist/esm/components/animation-background/lumina-utils.js +60 -1
- package/dist/esm/components/animation-background/particle-defaults.js +36 -1
- package/dist/esm/components/animation-background/renderers.js +167 -1
- package/dist/esm/components/animation-background/shader-controller.js +154 -1
- package/dist/esm/components/color-picker-utils.js +134 -1
- package/dist/esm/components/date-picker-utils.js +140 -1
- package/dist/esm/components/db-accordion.js +304 -1
- package/dist/esm/components/db-ad-banner.js +455 -1
- package/dist/esm/components/db-alert.js +149 -1
- package/dist/esm/components/db-animation-background.js +486 -1
- package/dist/esm/components/db-animation-text.js +601 -1
- package/dist/esm/components/db-app-badge.js +88 -1
- package/dist/esm/components/db-audio-player.js +752 -1
- package/dist/esm/components/db-avatar.js +188 -1
- package/dist/esm/components/db-backdrop.js +139 -1
- package/dist/esm/components/db-badge.js +91 -1
- package/dist/esm/components/db-banner.js +188 -1
- package/dist/esm/components/db-bottom-navigation.js +146 -1
- package/dist/esm/components/db-bottom-sheet.js +481 -1
- package/dist/esm/components/db-breadcrumbs.js +329 -1
- package/dist/esm/components/db-button.js +316 -1
- package/dist/esm/components/db-calendar.js +675 -1
- package/dist/esm/components/db-card.js +265 -1
- package/dist/esm/components/db-carousel.js +264 -1
- package/dist/esm/components/db-checkbox.js +202 -1
- package/dist/esm/components/db-chip.js +104 -1
- package/dist/esm/components/db-code-block.js +304 -1
- package/dist/esm/components/db-color-picker.js +746 -1
- package/dist/esm/components/db-confirm.js +191 -1
- package/dist/esm/components/db-container.js +39 -1
- package/dist/esm/components/db-context-menu.js +265 -1
- package/dist/esm/components/db-countdown.js +146 -1
- package/dist/esm/components/db-cursor-follower.js +173 -1
- package/dist/esm/components/db-date-picker.js +837 -1
- package/dist/esm/components/db-divider.js +66 -1
- package/dist/esm/components/db-drawer.js +245 -1
- package/dist/esm/components/db-dropdown.js +493 -1
- package/dist/esm/components/db-dropzone.js +266 -1
- package/dist/esm/components/db-empty-state.js +97 -1
- package/dist/esm/components/db-file-uploader.js +256 -1
- package/dist/esm/components/db-floating-action-button.js +139 -1
- package/dist/esm/components/db-footer.js +385 -1
- package/dist/esm/components/db-form.js +566 -1
- package/dist/esm/components/db-gantt.js +882 -1
- package/dist/esm/components/db-gradient.js +133 -1
- package/dist/esm/components/db-grid-background.js +909 -1
- package/dist/esm/components/db-grid.js +73 -1
- package/dist/esm/components/db-icons.js +82 -1
- package/dist/esm/components/db-image-list.js +214 -1
- package/dist/esm/components/db-image-placeholder.js +96 -1
- package/dist/esm/components/db-image.js +289 -1
- package/dist/esm/components/db-indicator.js +517 -1
- package/dist/esm/components/db-input.js +420 -1
- package/dist/esm/components/db-kanban.js +538 -1
- package/dist/esm/components/db-label.js +66 -1
- package/dist/esm/components/db-lightbox.js +372 -1
- package/dist/esm/components/db-list.js +340 -1
- package/dist/esm/components/db-logo-svg.js +72 -1
- package/dist/esm/components/db-logo.js +106 -1
- package/dist/esm/components/db-lottie.js +109 -1
- package/dist/esm/components/db-markdown-editor.js +458 -1
- package/dist/esm/components/db-marquee.js +402 -1
- package/dist/esm/components/db-masonry.js +94 -1
- package/dist/esm/components/db-menu-item.js +211 -1
- package/dist/esm/components/db-modal.js +522 -1
- package/dist/esm/components/db-navbar.js +680 -1
- package/dist/esm/components/db-onboarding-modal.js +322 -1
- package/dist/esm/components/db-page-header.js +312 -1
- package/dist/esm/components/db-pagination.js +271 -1
- package/dist/esm/components/db-popover.js +580 -1
- package/dist/esm/components/db-progress-step.js +166 -1
- package/dist/esm/components/db-progress.js +171 -1
- package/dist/esm/components/db-progressbar.js +72 -1
- package/dist/esm/components/db-radio.js +172 -1
- package/dist/esm/components/db-random-gradient.js +121 -1
- package/dist/esm/components/db-range-slider.js +811 -1
- package/dist/esm/components/db-rating.js +325 -1
- package/dist/esm/components/db-reorder.js +286 -1
- package/dist/esm/components/db-resizable-panels.js +282 -1
- package/dist/esm/components/db-scroll-area.js +126 -1
- package/dist/esm/components/db-search-bar.js +668 -1
- package/dist/esm/components/db-section-app-download.js +101 -1
- package/dist/esm/components/db-section-contact.js +102 -1
- package/dist/esm/components/db-section-cta.js +150 -1
- package/dist/esm/components/db-section-faq.js +120 -1
- package/dist/esm/components/db-section-feature-grid.js +137 -1
- package/dist/esm/components/db-section-feature.js +179 -1
- package/dist/esm/components/db-section-hero.js +243 -1
- package/dist/esm/components/db-section-logo-cloud.js +138 -1
- package/dist/esm/components/db-section-pricing.js +166 -1
- package/dist/esm/components/db-section-stats.js +129 -1
- package/dist/esm/components/db-section-testimonials.js +252 -1
- package/dist/esm/components/db-section.js +385 -1
- package/dist/esm/components/db-segment-control.js +231 -1
- package/dist/esm/components/db-select.js +571 -1
- package/dist/esm/components/db-share-icons.js +40 -1
- package/dist/esm/components/db-share.js +489 -1
- package/dist/esm/components/db-sidebar.js +1068 -1
- package/dist/esm/components/db-skeleton.js +94 -1
- package/dist/esm/components/db-spinner.js +102 -1
- package/dist/esm/components/db-split-view.js +297 -1
- package/dist/esm/components/db-stack.js +46 -1
- package/dist/esm/components/db-stat.js +218 -1
- package/dist/esm/components/db-stepper.js +398 -1
- package/dist/esm/components/db-table.js +412 -1
- package/dist/esm/components/db-tabs.js +335 -1
- package/dist/esm/components/db-testimonial.js +162 -1
- package/dist/esm/components/db-textarea.js +233 -1
- package/dist/esm/components/db-time-picker.js +523 -1
- package/dist/esm/components/db-timeline.js +174 -1
- package/dist/esm/components/db-toast.js +158 -1
- package/dist/esm/components/db-toggle.js +162 -1
- package/dist/esm/components/db-toolbar.js +94 -1
- package/dist/esm/components/db-tooltip.js +440 -1
- package/dist/esm/components/db-top-banner.js +121 -1
- package/dist/esm/components/db-tutorial.js +324 -1
- package/dist/esm/components/db-video-player.js +503 -1
- package/dist/esm/components/db-youtube-player.js +194 -1
- package/dist/esm/components/highlight-code.js +65 -1
- package/dist/esm/components/input-validation.js +50 -1
- package/dist/esm/components/marketing-block-host-utils.js +9 -1
- package/dist/esm/components/number-scrub.js +117 -1
- package/dist/esm/components/random-gradient-palettes.js +67 -1
- package/dist/esm/components/section-block-header-utils.js +48 -1
- package/dist/esm/helpers/confirm.js +52 -1
- package/dist/esm/helpers/toast.js +73 -1
- package/dist/esm/index.js +111 -1
- package/dist/esm/node_modules/prismjs/components/prism-bash.js +235 -1
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +31 -1
- package/dist/esm/node_modules/prismjs/components/prism-css.js +64 -1
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +172 -1
- package/dist/esm/node_modules/prismjs/components/prism-json.js +27 -1
- package/dist/esm/node_modules/prismjs/components/prism-jsx.js +143 -1
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +186 -1
- package/dist/esm/node_modules/prismjs/components/prism-scss.js +81 -1
- package/dist/esm/node_modules/prismjs/components/prism-tsx.js +15 -1
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +60 -1
- package/dist/index.cjs +55414 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +38284 -1
- package/dist/react/chunks/lottie-72a4c6d4.js +17032 -0
- package/dist/react/index.cjs +56503 -1
- package/dist/react/index.esm.js +39373 -1
- package/package.json +1 -1
- package/dist/chunks/lottie-2637aa0f.js +0 -1
- package/dist/react/chunks/lottie-14e7addb.js +0 -1
|
@@ -1 +1,179 @@
|
|
|
1
|
-
import{syncMarketingBlockHost
|
|
1
|
+
import { syncMarketingBlockHost } from './marketing-block-host-utils.js';
|
|
2
|
+
|
|
3
|
+
const CLASS = 'designbase-wc-section-feature';
|
|
4
|
+
class DbSectionFeature extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.built = false;
|
|
8
|
+
}
|
|
9
|
+
static get observedAttributes() {
|
|
10
|
+
return [
|
|
11
|
+
'headline',
|
|
12
|
+
'subtitle',
|
|
13
|
+
'description',
|
|
14
|
+
'badge',
|
|
15
|
+
'image',
|
|
16
|
+
'image-alt',
|
|
17
|
+
'media-position',
|
|
18
|
+
'actions',
|
|
19
|
+
'tinted',
|
|
20
|
+
'content-padding',
|
|
21
|
+
'size',
|
|
22
|
+
'full-width',
|
|
23
|
+
'full-height',
|
|
24
|
+
'overflow-visible',
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
this.style.display = 'block';
|
|
29
|
+
if (!this.built) {
|
|
30
|
+
this.built = true;
|
|
31
|
+
this.build();
|
|
32
|
+
}
|
|
33
|
+
this.updateUI();
|
|
34
|
+
}
|
|
35
|
+
attributeChangedCallback() {
|
|
36
|
+
if (!this.built)
|
|
37
|
+
return;
|
|
38
|
+
this.updateUI();
|
|
39
|
+
}
|
|
40
|
+
parseBadge() {
|
|
41
|
+
try {
|
|
42
|
+
const raw = this.getAttribute('badge');
|
|
43
|
+
if (!raw)
|
|
44
|
+
return null;
|
|
45
|
+
return JSON.parse(raw);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
get actions() {
|
|
52
|
+
return this.parseActions();
|
|
53
|
+
}
|
|
54
|
+
set actions(value) {
|
|
55
|
+
this.setAttribute('actions', typeof value === 'string' ? value : JSON.stringify(value));
|
|
56
|
+
}
|
|
57
|
+
parseActions() {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(this.getAttribute('actions') || '[]');
|
|
60
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
build() {
|
|
67
|
+
this.innerEl = document.createElement('div');
|
|
68
|
+
this.innerEl.className = `${CLASS}__inner`;
|
|
69
|
+
const content = document.createElement('div');
|
|
70
|
+
content.className = `${CLASS}__content`;
|
|
71
|
+
this.contentEl = content;
|
|
72
|
+
this.headlineEl = document.createElement('h2');
|
|
73
|
+
this.headlineEl.className = `${CLASS}__headline`;
|
|
74
|
+
this.subtitleEl = document.createElement('p');
|
|
75
|
+
this.subtitleEl.className = `${CLASS}__subtitle`;
|
|
76
|
+
this.descriptionEl = document.createElement('p');
|
|
77
|
+
this.descriptionEl.className = `${CLASS}__description`;
|
|
78
|
+
this.actionsEl = document.createElement('div');
|
|
79
|
+
this.actionsEl.className = `${CLASS}__actions`;
|
|
80
|
+
content.append(this.headlineEl, this.subtitleEl, this.descriptionEl, this.actionsEl);
|
|
81
|
+
this.mediaEl = document.createElement('div');
|
|
82
|
+
this.mediaEl.className = `${CLASS}__media`;
|
|
83
|
+
this.imageEl = document.createElement('img');
|
|
84
|
+
this.imageEl.className = `${CLASS}__image`;
|
|
85
|
+
this.mediaEl.append(this.imageEl);
|
|
86
|
+
this.innerEl.append(content, this.mediaEl);
|
|
87
|
+
this.append(this.innerEl);
|
|
88
|
+
}
|
|
89
|
+
updateUI() {
|
|
90
|
+
const headline = this.getAttribute('headline') || '';
|
|
91
|
+
const subtitle = this.getAttribute('subtitle') || '';
|
|
92
|
+
const description = this.getAttribute('description') || '';
|
|
93
|
+
const image = this.getAttribute('image') || '';
|
|
94
|
+
const imageAlt = this.getAttribute('image-alt') || headline || 'feature';
|
|
95
|
+
const mediaPosition = this.getAttribute('media-position') || 'right';
|
|
96
|
+
const contentPadding = this.getAttribute('content-padding') || 'l';
|
|
97
|
+
const tinted = this.hasAttribute('tinted');
|
|
98
|
+
const badge = this.parseBadge();
|
|
99
|
+
const actions = this.parseActions();
|
|
100
|
+
this.className = [
|
|
101
|
+
CLASS,
|
|
102
|
+
`${CLASS}--media-${mediaPosition}`,
|
|
103
|
+
`${CLASS}--padding-${contentPadding}`,
|
|
104
|
+
tinted && `${CLASS}--tinted`,
|
|
105
|
+
]
|
|
106
|
+
.filter(Boolean)
|
|
107
|
+
.join(' ');
|
|
108
|
+
syncMarketingBlockHost(this, CLASS);
|
|
109
|
+
if (this.contentEl && this.headlineEl) {
|
|
110
|
+
const badgeText = badge?.text?.trim();
|
|
111
|
+
if (badgeText) {
|
|
112
|
+
if (!this.badgeEl) {
|
|
113
|
+
this.badgeEl = document.createElement('db-badge');
|
|
114
|
+
this.badgeEl.className = `${CLASS}__badge`;
|
|
115
|
+
}
|
|
116
|
+
this.badgeEl.setAttribute('variant', badge.variant || 'primary');
|
|
117
|
+
this.badgeEl.setAttribute('badge-style', badge.style || 'text');
|
|
118
|
+
this.badgeEl.setAttribute('size', badge.size || 'm');
|
|
119
|
+
this.badgeEl.textContent = badgeText;
|
|
120
|
+
if (!this.badgeEl.isConnected) {
|
|
121
|
+
this.contentEl.insertBefore(this.badgeEl, this.headlineEl);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (this.badgeEl) {
|
|
125
|
+
this.badgeEl.remove();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (this.headlineEl)
|
|
129
|
+
this.headlineEl.textContent = headline;
|
|
130
|
+
if (this.subtitleEl) {
|
|
131
|
+
this.subtitleEl.textContent = subtitle;
|
|
132
|
+
this.subtitleEl.hidden = !subtitle;
|
|
133
|
+
}
|
|
134
|
+
if (this.descriptionEl) {
|
|
135
|
+
this.descriptionEl.textContent = description;
|
|
136
|
+
this.descriptionEl.hidden = !description;
|
|
137
|
+
}
|
|
138
|
+
if (this.mediaEl && this.imageEl) {
|
|
139
|
+
if (image) {
|
|
140
|
+
this.mediaEl.hidden = false;
|
|
141
|
+
this.imageEl.src = image;
|
|
142
|
+
this.imageEl.alt = imageAlt;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.mediaEl.hidden = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (this.actionsEl) {
|
|
149
|
+
this.actionsEl.replaceChildren();
|
|
150
|
+
if (actions.length > 0) {
|
|
151
|
+
actions.forEach((action) => {
|
|
152
|
+
const button = document.createElement('db-button');
|
|
153
|
+
button.setAttribute('variant', action.variant || 'primary');
|
|
154
|
+
button.setAttribute('size', action.size || 'm');
|
|
155
|
+
if (action.href)
|
|
156
|
+
button.setAttribute('href', action.href);
|
|
157
|
+
button.textContent = action.label;
|
|
158
|
+
button.addEventListener('click', (event) => {
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
this.dispatchEvent(new CustomEvent('db-action', {
|
|
161
|
+
detail: { action },
|
|
162
|
+
bubbles: true,
|
|
163
|
+
composed: true,
|
|
164
|
+
}));
|
|
165
|
+
});
|
|
166
|
+
this.actionsEl.append(button);
|
|
167
|
+
});
|
|
168
|
+
this.actionsEl.hidden = false;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.actionsEl.hidden = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (!customElements.get('db-section-feature'))
|
|
177
|
+
customElements.define('db-section-feature', DbSectionFeature);
|
|
178
|
+
|
|
179
|
+
export { DbSectionFeature };
|
|
@@ -1 +1,243 @@
|
|
|
1
|
-
const
|
|
1
|
+
const CLASS = 'designbase-wc-section-hero';
|
|
2
|
+
function mapButtonVariant(variant) {
|
|
3
|
+
if (variant === 'outline')
|
|
4
|
+
return 'tertiary';
|
|
5
|
+
if (variant === 'ghost')
|
|
6
|
+
return 'ghost';
|
|
7
|
+
if (variant === 'secondary')
|
|
8
|
+
return 'secondary';
|
|
9
|
+
if (variant === 'tertiary')
|
|
10
|
+
return 'tertiary';
|
|
11
|
+
return 'primary';
|
|
12
|
+
}
|
|
13
|
+
class DbSectionHero extends HTMLElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.built = false;
|
|
17
|
+
}
|
|
18
|
+
static get observedAttributes() {
|
|
19
|
+
return [
|
|
20
|
+
'title',
|
|
21
|
+
'subtitle',
|
|
22
|
+
'description',
|
|
23
|
+
'background-image',
|
|
24
|
+
'background-video',
|
|
25
|
+
'overlay-color',
|
|
26
|
+
'overlay-opacity',
|
|
27
|
+
'buttons',
|
|
28
|
+
'variant',
|
|
29
|
+
'theme',
|
|
30
|
+
'alignment',
|
|
31
|
+
'animated',
|
|
32
|
+
'full-height',
|
|
33
|
+
'min-height',
|
|
34
|
+
'max-height',
|
|
35
|
+
'content-max-width',
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
this.style.display = 'block';
|
|
40
|
+
if (!this.built) {
|
|
41
|
+
this.built = true;
|
|
42
|
+
this.build();
|
|
43
|
+
}
|
|
44
|
+
this.updateUI();
|
|
45
|
+
}
|
|
46
|
+
attributeChangedCallback() {
|
|
47
|
+
if (!this.built)
|
|
48
|
+
return;
|
|
49
|
+
this.updateUI();
|
|
50
|
+
}
|
|
51
|
+
get buttons() {
|
|
52
|
+
return this.parseButtons();
|
|
53
|
+
}
|
|
54
|
+
set buttons(value) {
|
|
55
|
+
this.setAttribute('buttons', typeof value === 'string' ? value : JSON.stringify(value));
|
|
56
|
+
}
|
|
57
|
+
parseButtons() {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(this.getAttribute('buttons') || '[]');
|
|
60
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
build() {
|
|
67
|
+
this.backgroundVideoEl = document.createElement('video');
|
|
68
|
+
this.backgroundVideoEl.className = `${CLASS}__background-video`;
|
|
69
|
+
this.backgroundVideoEl.autoplay = true;
|
|
70
|
+
this.backgroundVideoEl.muted = true;
|
|
71
|
+
this.backgroundVideoEl.loop = true;
|
|
72
|
+
this.backgroundVideoEl.playsInline = true;
|
|
73
|
+
this.backgroundVideoEl.hidden = true;
|
|
74
|
+
this.backgroundImageEl = document.createElement('div');
|
|
75
|
+
this.backgroundImageEl.className = `${CLASS}__background-image`;
|
|
76
|
+
this.backgroundImageEl.hidden = true;
|
|
77
|
+
this.overlayEl = document.createElement('div');
|
|
78
|
+
this.overlayEl.className = `${CLASS}__overlay`;
|
|
79
|
+
this.overlayEl.hidden = true;
|
|
80
|
+
const container = document.createElement('div');
|
|
81
|
+
container.className = `${CLASS}__container`;
|
|
82
|
+
const content = document.createElement('div');
|
|
83
|
+
content.className = `${CLASS}__content`;
|
|
84
|
+
this.titleEl = document.createElement('h1');
|
|
85
|
+
this.titleEl.className = `${CLASS}__title`;
|
|
86
|
+
this.subtitleEl = document.createElement('p');
|
|
87
|
+
this.subtitleEl.className = `${CLASS}__subtitle`;
|
|
88
|
+
this.descriptionEl = document.createElement('p');
|
|
89
|
+
this.descriptionEl.className = `${CLASS}__description`;
|
|
90
|
+
this.buttonsEl = document.createElement('div');
|
|
91
|
+
this.buttonsEl.className = `${CLASS}__buttons`;
|
|
92
|
+
content.append(this.titleEl, this.subtitleEl, this.descriptionEl, this.buttonsEl);
|
|
93
|
+
container.append(content);
|
|
94
|
+
this.append(this.backgroundVideoEl, this.backgroundImageEl, this.overlayEl, container);
|
|
95
|
+
}
|
|
96
|
+
updateUI() {
|
|
97
|
+
const title = this.getAttribute('title') || '';
|
|
98
|
+
const subtitle = this.getAttribute('subtitle') || '';
|
|
99
|
+
const description = this.getAttribute('description') || '';
|
|
100
|
+
const backgroundImage = this.getAttribute('background-image') || '';
|
|
101
|
+
const backgroundVideo = this.getAttribute('background-video') || '';
|
|
102
|
+
const overlayColor = this.getAttribute('overlay-color') || '';
|
|
103
|
+
const overlayOpacity = Number(this.getAttribute('overlay-opacity') || 0.5);
|
|
104
|
+
const variant = this.getAttribute('variant') || 'default';
|
|
105
|
+
const theme = this.getAttribute('theme') || 'light';
|
|
106
|
+
const alignment = this.getAttribute('alignment') || 'left';
|
|
107
|
+
const animated = this.hasAttribute('animated');
|
|
108
|
+
const fullHeight = this.hasAttribute('full-height');
|
|
109
|
+
const minHeight = this.getAttribute('min-height');
|
|
110
|
+
const maxHeight = this.getAttribute('max-height');
|
|
111
|
+
const contentMaxWidth = this.getAttribute('content-max-width');
|
|
112
|
+
const buttons = this.parseButtons();
|
|
113
|
+
const hasMediaBackground = Boolean(backgroundImage || backgroundVideo);
|
|
114
|
+
const isOnMedia = theme === 'dark' ||
|
|
115
|
+
theme === 'gradient' ||
|
|
116
|
+
(hasMediaBackground && (variant === 'overlay' || theme === 'image'));
|
|
117
|
+
this.className = [
|
|
118
|
+
CLASS,
|
|
119
|
+
`${CLASS}--variant-${variant}`,
|
|
120
|
+
`${CLASS}--theme-${theme}`,
|
|
121
|
+
`${CLASS}--alignment-${alignment}`,
|
|
122
|
+
animated && `${CLASS}--animated`,
|
|
123
|
+
fullHeight && `${CLASS}--full-height`,
|
|
124
|
+
isOnMedia && `${CLASS}--on-media`,
|
|
125
|
+
]
|
|
126
|
+
.filter(Boolean)
|
|
127
|
+
.join(' ');
|
|
128
|
+
this.style.minHeight = minHeight || '';
|
|
129
|
+
this.style.maxHeight = maxHeight || '';
|
|
130
|
+
if (this.titleEl)
|
|
131
|
+
this.titleEl.textContent = title;
|
|
132
|
+
if (this.subtitleEl) {
|
|
133
|
+
this.subtitleEl.textContent = subtitle;
|
|
134
|
+
this.subtitleEl.hidden = !subtitle;
|
|
135
|
+
}
|
|
136
|
+
if (this.descriptionEl) {
|
|
137
|
+
this.descriptionEl.textContent = description;
|
|
138
|
+
this.descriptionEl.hidden = !description;
|
|
139
|
+
}
|
|
140
|
+
const content = this.querySelector(`.${CLASS}__content`);
|
|
141
|
+
if (content) {
|
|
142
|
+
if (contentMaxWidth) {
|
|
143
|
+
content.style.maxWidth = /^\d+$/.test(contentMaxWidth) ? `${contentMaxWidth}px` : contentMaxWidth;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
content.style.removeProperty('max-width');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (this.backgroundVideoEl) {
|
|
150
|
+
if (backgroundVideo) {
|
|
151
|
+
this.backgroundVideoEl.hidden = false;
|
|
152
|
+
this.backgroundVideoEl.replaceChildren();
|
|
153
|
+
const source = document.createElement('source');
|
|
154
|
+
source.src = backgroundVideo;
|
|
155
|
+
source.type = 'video/mp4';
|
|
156
|
+
this.backgroundVideoEl.append(source);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.backgroundVideoEl.hidden = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (this.backgroundImageEl) {
|
|
163
|
+
if (backgroundImage) {
|
|
164
|
+
this.backgroundImageEl.hidden = false;
|
|
165
|
+
this.backgroundImageEl.style.backgroundImage = `url(${backgroundImage})`;
|
|
166
|
+
this.backgroundImageEl.style.backgroundSize = 'cover';
|
|
167
|
+
this.backgroundImageEl.style.backgroundPosition = 'center';
|
|
168
|
+
this.backgroundImageEl.style.backgroundRepeat = 'no-repeat';
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.backgroundImageEl.hidden = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (this.overlayEl) {
|
|
175
|
+
if (hasMediaBackground) {
|
|
176
|
+
this.overlayEl.hidden = false;
|
|
177
|
+
if (overlayColor) {
|
|
178
|
+
this.overlayEl.style.background = overlayColor;
|
|
179
|
+
this.overlayEl.style.opacity = String(overlayOpacity);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
this.overlayEl.style.background = `linear-gradient(180deg, rgba(0, 0, 0, ${overlayOpacity * 0.35}) 0%, rgba(0, 0, 0, ${overlayOpacity}) 100%)`;
|
|
183
|
+
this.overlayEl.style.opacity = '1';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.overlayEl.hidden = true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (this.buttonsEl) {
|
|
191
|
+
this.buttonsEl.replaceChildren();
|
|
192
|
+
if (buttons.length > 0) {
|
|
193
|
+
buttons.forEach((button) => {
|
|
194
|
+
const el = document.createElement('db-button');
|
|
195
|
+
el.setAttribute('variant', mapButtonVariant(button.variant));
|
|
196
|
+
el.setAttribute('size', button.size || 'm');
|
|
197
|
+
if (button.href)
|
|
198
|
+
el.setAttribute('href', button.href);
|
|
199
|
+
if (button.external) {
|
|
200
|
+
el.setAttribute('target', '_blank');
|
|
201
|
+
el.setAttribute('rel', 'noopener noreferrer');
|
|
202
|
+
}
|
|
203
|
+
if (button.startIcon) {
|
|
204
|
+
el.setAttribute('start-icon', button.startIcon);
|
|
205
|
+
el.textContent = button.text;
|
|
206
|
+
}
|
|
207
|
+
else if (button.icon) {
|
|
208
|
+
const content = document.createElement('span');
|
|
209
|
+
content.className = `${CLASS}__button-content`;
|
|
210
|
+
const iconSpan = document.createElement('span');
|
|
211
|
+
iconSpan.className = `${CLASS}__button-icon`;
|
|
212
|
+
iconSpan.setAttribute('aria-hidden', 'true');
|
|
213
|
+
iconSpan.textContent = button.icon;
|
|
214
|
+
const textSpan = document.createElement('span');
|
|
215
|
+
textSpan.textContent = button.text;
|
|
216
|
+
content.append(iconSpan, textSpan);
|
|
217
|
+
el.append(content);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
el.textContent = button.text;
|
|
221
|
+
}
|
|
222
|
+
el.addEventListener('click', (event) => {
|
|
223
|
+
event.stopPropagation();
|
|
224
|
+
this.dispatchEvent(new CustomEvent('db-button-click', {
|
|
225
|
+
detail: { button },
|
|
226
|
+
bubbles: true,
|
|
227
|
+
composed: true,
|
|
228
|
+
}));
|
|
229
|
+
});
|
|
230
|
+
this.buttonsEl.append(el);
|
|
231
|
+
});
|
|
232
|
+
this.buttonsEl.hidden = false;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.buttonsEl.hidden = true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (!customElements.get('db-section-hero'))
|
|
241
|
+
customElements.define('db-section-hero', DbSectionHero);
|
|
242
|
+
|
|
243
|
+
export { DbSectionHero };
|
|
@@ -1 +1,138 @@
|
|
|
1
|
-
import{applySectionBlockHeader
|
|
1
|
+
import { applySectionBlockHeader } from './section-block-header-utils.js';
|
|
2
|
+
import { syncMarketingBlockHost } from './marketing-block-host-utils.js';
|
|
3
|
+
|
|
4
|
+
const CLASS = 'designbase-wc-section-logo-cloud';
|
|
5
|
+
class DbSectionLogoCloud extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.built = false;
|
|
9
|
+
}
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return [
|
|
12
|
+
'headline',
|
|
13
|
+
'subtitle',
|
|
14
|
+
'description',
|
|
15
|
+
'badge',
|
|
16
|
+
'logos',
|
|
17
|
+
'variant',
|
|
18
|
+
'align',
|
|
19
|
+
'content-padding',
|
|
20
|
+
'size',
|
|
21
|
+
'full-width',
|
|
22
|
+
'full-height',
|
|
23
|
+
'overflow-visible',
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this.style.display = 'block';
|
|
28
|
+
if (!this.built) {
|
|
29
|
+
this.built = true;
|
|
30
|
+
this.build();
|
|
31
|
+
}
|
|
32
|
+
this.updateUI();
|
|
33
|
+
}
|
|
34
|
+
attributeChangedCallback() {
|
|
35
|
+
if (!this.built)
|
|
36
|
+
return;
|
|
37
|
+
this.updateUI();
|
|
38
|
+
}
|
|
39
|
+
parseLogos() {
|
|
40
|
+
try {
|
|
41
|
+
const parsed = JSON.parse(this.getAttribute('logos') || '[]');
|
|
42
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
parseBadge() {
|
|
49
|
+
try {
|
|
50
|
+
const raw = this.getAttribute('badge');
|
|
51
|
+
if (!raw)
|
|
52
|
+
return null;
|
|
53
|
+
return JSON.parse(raw);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
build() {
|
|
60
|
+
this.innerEl = document.createElement('div');
|
|
61
|
+
this.innerEl.className = `${CLASS}__inner`;
|
|
62
|
+
this.headerEl = document.createElement('div');
|
|
63
|
+
this.headerEl.className = 'designbase-wc-section-block-header';
|
|
64
|
+
this.headerEl.innerHTML = `
|
|
65
|
+
<db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>
|
|
66
|
+
<h2 class="designbase-wc-section-block-header__headline"></h2>
|
|
67
|
+
<p class="designbase-wc-section-block-header__subtitle"></p>
|
|
68
|
+
<p class="designbase-wc-section-block-header__description"></p>
|
|
69
|
+
`;
|
|
70
|
+
this.contentEl = document.createElement('div');
|
|
71
|
+
this.innerEl.append(this.headerEl, this.contentEl);
|
|
72
|
+
this.append(this.innerEl);
|
|
73
|
+
}
|
|
74
|
+
updateUI() {
|
|
75
|
+
const headline = this.getAttribute('headline') || '함께하는 파트너';
|
|
76
|
+
const subtitle = this.getAttribute('subtitle') || '';
|
|
77
|
+
const description = this.getAttribute('description') || '';
|
|
78
|
+
const variant = this.getAttribute('variant') || 'grid';
|
|
79
|
+
const contentPadding = this.getAttribute('content-padding') || 'm';
|
|
80
|
+
const align = this.getAttribute('align') || 'center';
|
|
81
|
+
const badge = this.parseBadge();
|
|
82
|
+
const logos = this.parseLogos();
|
|
83
|
+
this.className = [
|
|
84
|
+
CLASS,
|
|
85
|
+
`${CLASS}--${variant}`,
|
|
86
|
+
`${CLASS}--padding-${contentPadding}`,
|
|
87
|
+
].join(' ');
|
|
88
|
+
syncMarketingBlockHost(this, CLASS);
|
|
89
|
+
if (this.headerEl) {
|
|
90
|
+
applySectionBlockHeader(this.headerEl, {
|
|
91
|
+
headline,
|
|
92
|
+
subtitle,
|
|
93
|
+
description,
|
|
94
|
+
badge,
|
|
95
|
+
align,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (!this.contentEl)
|
|
99
|
+
return;
|
|
100
|
+
this.contentEl.replaceChildren();
|
|
101
|
+
if (variant === 'marquee') {
|
|
102
|
+
this.contentEl.className = `${CLASS}__marquee`;
|
|
103
|
+
const marquee = document.createElement('db-marquee');
|
|
104
|
+
marquee.setAttribute('items', JSON.stringify(logos.map((l) => l.label ?? l.alt)));
|
|
105
|
+
this.contentEl.append(marquee);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.contentEl.className = `${CLASS}__grid`;
|
|
109
|
+
logos.forEach((logo) => {
|
|
110
|
+
const item = document.createElement(logo.href ? 'a' : 'div');
|
|
111
|
+
item.className = `${CLASS}__item`;
|
|
112
|
+
if (logo.href && item instanceof HTMLAnchorElement) {
|
|
113
|
+
item.href = logo.href;
|
|
114
|
+
item.target = '_blank';
|
|
115
|
+
item.rel = 'noopener noreferrer';
|
|
116
|
+
}
|
|
117
|
+
if (logo.src) {
|
|
118
|
+
const img = document.createElement('img');
|
|
119
|
+
img.src = logo.src;
|
|
120
|
+
img.alt = logo.alt;
|
|
121
|
+
img.className = `${CLASS}__image`;
|
|
122
|
+
item.append(img);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const label = document.createElement('span');
|
|
126
|
+
label.className = `${CLASS}__label`;
|
|
127
|
+
label.textContent = logo.label ?? logo.alt;
|
|
128
|
+
item.append(label);
|
|
129
|
+
}
|
|
130
|
+
this.contentEl.append(item);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!customElements.get('db-section-logo-cloud')) {
|
|
135
|
+
customElements.define('db-section-logo-cloud', DbSectionLogoCloud);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { DbSectionLogoCloud };
|