@designbasekorea/ui-wc 0.5.3 → 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.d.ts +1 -1
- package/dist/react/index.esm.js +39373 -1
- package/package.json +1 -1
- package/dist/chunks/lottie-2d1f6278.js +0 -1
- package/dist/react/chunks/lottie-14e7addb.js +0 -1
|
@@ -1 +1,139 @@
|
|
|
1
|
-
import{createDbIcon
|
|
1
|
+
import { createDbIcon } from './db-icons.js';
|
|
2
|
+
|
|
3
|
+
const SIZES = ['s', 'm', 'l'];
|
|
4
|
+
const VARIANTS = ['primary', 'secondary', 'tertiary'];
|
|
5
|
+
const CIRCULAR_SPINNER_HTML = '<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>';
|
|
6
|
+
const ICON_SIZE = {
|
|
7
|
+
s: 12,
|
|
8
|
+
m: 16,
|
|
9
|
+
l: 20,
|
|
10
|
+
};
|
|
11
|
+
const SPINNER_SIZE = {
|
|
12
|
+
s: 'xs',
|
|
13
|
+
m: 's',
|
|
14
|
+
l: 'm',
|
|
15
|
+
};
|
|
16
|
+
class DbFloatingActionButton extends HTMLElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.handleClick = (event) => {
|
|
20
|
+
if (this.disabled || this.loading) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.dispatchEvent(new CustomEvent('db-click', { bubbles: true, composed: true }));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static get observedAttributes() {
|
|
29
|
+
return ['size', 'variant', 'icon', 'loading', 'disabled', 'aria-label'];
|
|
30
|
+
}
|
|
31
|
+
get size() {
|
|
32
|
+
const raw = this.getAttribute('size') || 'm';
|
|
33
|
+
return SIZES.includes(raw) ? raw : 'm';
|
|
34
|
+
}
|
|
35
|
+
set size(value) {
|
|
36
|
+
this.setAttribute('size', value);
|
|
37
|
+
}
|
|
38
|
+
get variant() {
|
|
39
|
+
const raw = this.getAttribute('variant') || 'primary';
|
|
40
|
+
return VARIANTS.includes(raw) ? raw : 'primary';
|
|
41
|
+
}
|
|
42
|
+
set variant(value) {
|
|
43
|
+
this.setAttribute('variant', value);
|
|
44
|
+
}
|
|
45
|
+
get loading() {
|
|
46
|
+
return this.hasAttribute('loading');
|
|
47
|
+
}
|
|
48
|
+
set loading(value) {
|
|
49
|
+
this.toggleAttribute('loading', Boolean(value));
|
|
50
|
+
}
|
|
51
|
+
get disabled() {
|
|
52
|
+
return this.hasAttribute('disabled');
|
|
53
|
+
}
|
|
54
|
+
set disabled(value) {
|
|
55
|
+
this.toggleAttribute('disabled', Boolean(value));
|
|
56
|
+
}
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
if (this.getAttribute('role') !== 'button') {
|
|
59
|
+
this.setAttribute('role', 'button');
|
|
60
|
+
}
|
|
61
|
+
if (!this.hasAttribute('type')) {
|
|
62
|
+
this.setAttribute('type', 'button');
|
|
63
|
+
}
|
|
64
|
+
this.addEventListener('click', this.handleClick);
|
|
65
|
+
this.sync();
|
|
66
|
+
}
|
|
67
|
+
disconnectedCallback() {
|
|
68
|
+
this.removeEventListener('click', this.handleClick);
|
|
69
|
+
}
|
|
70
|
+
attributeChangedCallback() {
|
|
71
|
+
if (this.isConnected)
|
|
72
|
+
this.sync();
|
|
73
|
+
}
|
|
74
|
+
resolveIconName(icon) {
|
|
75
|
+
if (!icon)
|
|
76
|
+
return undefined;
|
|
77
|
+
const known = {
|
|
78
|
+
plus: 1,
|
|
79
|
+
search: 1,
|
|
80
|
+
settings: 1,
|
|
81
|
+
edit: 1,
|
|
82
|
+
close: 1,
|
|
83
|
+
};
|
|
84
|
+
return icon in known ? icon : undefined;
|
|
85
|
+
}
|
|
86
|
+
sync() {
|
|
87
|
+
this.className = [
|
|
88
|
+
'designbase-wc-fab',
|
|
89
|
+
`designbase-wc-fab--${this.size}`,
|
|
90
|
+
`designbase-wc-fab--${this.variant}`,
|
|
91
|
+
this.disabled && 'designbase-wc-fab--disabled',
|
|
92
|
+
this.loading && 'designbase-wc-fab--loading',
|
|
93
|
+
]
|
|
94
|
+
.filter(Boolean)
|
|
95
|
+
.join(' ');
|
|
96
|
+
const label = this.getAttribute('aria-label') || 'Floating action button';
|
|
97
|
+
if (this.getAttribute('aria-label') !== label) {
|
|
98
|
+
this.setAttribute('aria-label', label);
|
|
99
|
+
}
|
|
100
|
+
const busy = String(this.loading);
|
|
101
|
+
if (this.getAttribute('aria-busy') !== busy) {
|
|
102
|
+
this.setAttribute('aria-busy', busy);
|
|
103
|
+
}
|
|
104
|
+
const ariaDisabled = String(this.disabled || this.loading);
|
|
105
|
+
if (this.getAttribute('aria-disabled') !== ariaDisabled) {
|
|
106
|
+
this.setAttribute('aria-disabled', ariaDisabled);
|
|
107
|
+
}
|
|
108
|
+
let iconHost = this.querySelector(':scope > .designbase-wc-fab__icon');
|
|
109
|
+
if (!iconHost) {
|
|
110
|
+
iconHost = document.createElement('div');
|
|
111
|
+
iconHost.className = 'designbase-wc-fab__icon';
|
|
112
|
+
this.append(iconHost);
|
|
113
|
+
}
|
|
114
|
+
iconHost.replaceChildren();
|
|
115
|
+
if (this.loading) {
|
|
116
|
+
const spinner = document.createElement('span');
|
|
117
|
+
spinner.className = `designbase-wc-spinner designbase-wc-spinner--circular designbase-wc-spinner--${SPINNER_SIZE[this.size]}`;
|
|
118
|
+
spinner.setAttribute('aria-hidden', 'true');
|
|
119
|
+
spinner.innerHTML = CIRCULAR_SPINNER_HTML;
|
|
120
|
+
iconHost.append(spinner);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const iconAttr = this.getAttribute('icon');
|
|
124
|
+
const iconName = this.resolveIconName(iconAttr);
|
|
125
|
+
if (iconName) {
|
|
126
|
+
iconHost.append(createDbIcon(iconName, ICON_SIZE[this.size]));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const slottedIcon = Array.from(this.children).find((child) => child !== iconHost && !child.hasAttribute('data-wc-internal'));
|
|
130
|
+
if (slottedIcon && !slottedIcon.isConnected) {
|
|
131
|
+
iconHost.append(slottedIcon);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!customElements.get('db-floating-action-button')) {
|
|
136
|
+
customElements.define('db-floating-action-button', DbFloatingActionButton);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { DbFloatingActionButton };
|
|
@@ -1 +1,385 @@
|
|
|
1
|
-
import{createShareIcon
|
|
1
|
+
import { createShareIcon } from './db-share-icons.js';
|
|
2
|
+
|
|
3
|
+
const VARIANTS = ['default', 'compact', 'minimal'];
|
|
4
|
+
const SIZES = ['s', 'm', 'l'];
|
|
5
|
+
const SOCIAL_ICON_MAP = {
|
|
6
|
+
youtube: 'youtube',
|
|
7
|
+
instagram: 'instagram',
|
|
8
|
+
x: 'x',
|
|
9
|
+
linkedin: 'linkedin',
|
|
10
|
+
facebook: 'facebook',
|
|
11
|
+
email: 'mail',
|
|
12
|
+
};
|
|
13
|
+
function parseJson(raw, fallback) {
|
|
14
|
+
if (!raw)
|
|
15
|
+
return fallback;
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(raw);
|
|
18
|
+
return parsed ?? fallback;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return fallback;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class DbFooter extends HTMLElement {
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return [
|
|
27
|
+
'columns',
|
|
28
|
+
'legal-links',
|
|
29
|
+
'social-links',
|
|
30
|
+
'company-info',
|
|
31
|
+
'family-sites',
|
|
32
|
+
'tagline',
|
|
33
|
+
'copyright',
|
|
34
|
+
'logo-type',
|
|
35
|
+
'variant',
|
|
36
|
+
'size',
|
|
37
|
+
'full-width',
|
|
38
|
+
'show-logo',
|
|
39
|
+
'show-social',
|
|
40
|
+
'family-site-label',
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
this.render();
|
|
45
|
+
}
|
|
46
|
+
attributeChangedCallback() {
|
|
47
|
+
if (!this.isConnected)
|
|
48
|
+
return;
|
|
49
|
+
this.render();
|
|
50
|
+
}
|
|
51
|
+
get columns() {
|
|
52
|
+
return parseJson(this.getAttribute('columns'), []);
|
|
53
|
+
}
|
|
54
|
+
set columns(value) {
|
|
55
|
+
this.setAttribute('columns', typeof value === 'string' ? value : JSON.stringify(value));
|
|
56
|
+
}
|
|
57
|
+
get legalLinks() {
|
|
58
|
+
return parseJson(this.getAttribute('legal-links'), []);
|
|
59
|
+
}
|
|
60
|
+
set legalLinks(value) {
|
|
61
|
+
this.setAttribute('legal-links', typeof value === 'string' ? value : JSON.stringify(value));
|
|
62
|
+
}
|
|
63
|
+
get socialLinks() {
|
|
64
|
+
return parseJson(this.getAttribute('social-links'), []);
|
|
65
|
+
}
|
|
66
|
+
set socialLinks(value) {
|
|
67
|
+
this.setAttribute('social-links', typeof value === 'string' ? value : JSON.stringify(value));
|
|
68
|
+
}
|
|
69
|
+
get companyInfo() {
|
|
70
|
+
return parseJson(this.getAttribute('company-info'), {});
|
|
71
|
+
}
|
|
72
|
+
set companyInfo(value) {
|
|
73
|
+
this.setAttribute('company-info', typeof value === 'string' ? value : JSON.stringify(value));
|
|
74
|
+
}
|
|
75
|
+
get familySites() {
|
|
76
|
+
return parseJson(this.getAttribute('family-sites'), []);
|
|
77
|
+
}
|
|
78
|
+
set familySites(value) {
|
|
79
|
+
this.setAttribute('family-sites', typeof value === 'string' ? value : JSON.stringify(value));
|
|
80
|
+
}
|
|
81
|
+
syncHostClasses() {
|
|
82
|
+
const size = this.getAttribute('size') || 'm';
|
|
83
|
+
const variant = this.getAttribute('variant') || 'default';
|
|
84
|
+
const safeSize = SIZES.includes(size) ? size : 'm';
|
|
85
|
+
const safeVariant = VARIANTS.includes(variant) ? variant : 'default';
|
|
86
|
+
this.className = [
|
|
87
|
+
'designbase-wc-footer',
|
|
88
|
+
`designbase-wc-footer--${safeSize}`,
|
|
89
|
+
`designbase-wc-footer--${safeVariant}`,
|
|
90
|
+
this.hasAttribute('full-width') && 'designbase-wc-footer--full-width',
|
|
91
|
+
]
|
|
92
|
+
.filter(Boolean)
|
|
93
|
+
.join(' ');
|
|
94
|
+
}
|
|
95
|
+
dispatchLinkClick(link, source) {
|
|
96
|
+
this.dispatchEvent(new CustomEvent('db-link-click', {
|
|
97
|
+
bubbles: true,
|
|
98
|
+
composed: true,
|
|
99
|
+
detail: { link, source },
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
createLink(link, className, source) {
|
|
103
|
+
const anchor = document.createElement('a');
|
|
104
|
+
anchor.href = link.href || '#';
|
|
105
|
+
anchor.className = [
|
|
106
|
+
className,
|
|
107
|
+
link.emphasize && `${className}--emphasize`,
|
|
108
|
+
]
|
|
109
|
+
.filter(Boolean)
|
|
110
|
+
.join(' ');
|
|
111
|
+
anchor.textContent = link.label;
|
|
112
|
+
if (link.external) {
|
|
113
|
+
anchor.target = '_blank';
|
|
114
|
+
anchor.rel = 'noopener noreferrer';
|
|
115
|
+
}
|
|
116
|
+
anchor.addEventListener('click', (event) => {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
this.dispatchLinkClick(link, source);
|
|
119
|
+
});
|
|
120
|
+
return anchor;
|
|
121
|
+
}
|
|
122
|
+
createSocialLink(link, iconPx) {
|
|
123
|
+
const anchor = document.createElement('a');
|
|
124
|
+
anchor.href = link.href;
|
|
125
|
+
anchor.className = 'designbase-wc-footer__social-link';
|
|
126
|
+
anchor.target = '_blank';
|
|
127
|
+
anchor.rel = 'noopener noreferrer';
|
|
128
|
+
anchor.setAttribute('aria-label', link.label || link.platform);
|
|
129
|
+
const iconName = SOCIAL_ICON_MAP[link.platform] || 'share-alt';
|
|
130
|
+
anchor.append(createShareIcon(iconName, iconPx));
|
|
131
|
+
anchor.addEventListener('click', (event) => {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
this.dispatchEvent(new CustomEvent('db-social-click', {
|
|
134
|
+
bubbles: true,
|
|
135
|
+
composed: true,
|
|
136
|
+
detail: { link },
|
|
137
|
+
}));
|
|
138
|
+
});
|
|
139
|
+
return anchor;
|
|
140
|
+
}
|
|
141
|
+
createCompanyInfoRows(info) {
|
|
142
|
+
const rows = [];
|
|
143
|
+
const line1 = [];
|
|
144
|
+
if (info.companyName)
|
|
145
|
+
line1.push(info.companyName);
|
|
146
|
+
if (info.representative)
|
|
147
|
+
line1.push(`대표: ${info.representative}`);
|
|
148
|
+
if (info.businessNumber)
|
|
149
|
+
line1.push(`사업자등록번호: ${info.businessNumber}`);
|
|
150
|
+
if (line1.length)
|
|
151
|
+
rows.push(line1.join(' | '));
|
|
152
|
+
const line2 = [];
|
|
153
|
+
if (info.address)
|
|
154
|
+
line2.push(info.address);
|
|
155
|
+
if (info.phone)
|
|
156
|
+
line2.push(`대표전화: ${info.phone}`);
|
|
157
|
+
if (info.customerCenter)
|
|
158
|
+
line2.push(`고객센터: ${info.customerCenter}`);
|
|
159
|
+
if (line2.length)
|
|
160
|
+
rows.push(line2.join(' | '));
|
|
161
|
+
const line3 = [];
|
|
162
|
+
if (info.email)
|
|
163
|
+
line3.push(`이메일: ${info.email}`);
|
|
164
|
+
if (info.mailOrderNumber)
|
|
165
|
+
line3.push(`통신판매업신고: ${info.mailOrderNumber}`);
|
|
166
|
+
if (info.hostingProvider)
|
|
167
|
+
line3.push(`호스팅: ${info.hostingProvider}`);
|
|
168
|
+
if (line3.length)
|
|
169
|
+
rows.push(line3.join(' | '));
|
|
170
|
+
return rows;
|
|
171
|
+
}
|
|
172
|
+
showLogo() {
|
|
173
|
+
return !this.hasAttribute('show-logo') || this.getAttribute('show-logo') !== 'false';
|
|
174
|
+
}
|
|
175
|
+
createLogo() {
|
|
176
|
+
const logoWrap = document.createElement('div');
|
|
177
|
+
logoWrap.className = 'designbase-wc-footer__logo';
|
|
178
|
+
const logo = document.createElement('db-logo');
|
|
179
|
+
logo.setAttribute('type', this.getAttribute('logo-type') || 'designbase');
|
|
180
|
+
logo.setAttribute('size', 's');
|
|
181
|
+
logo.setAttribute('clickable', '');
|
|
182
|
+
logo.addEventListener('db-click', () => {
|
|
183
|
+
this.dispatchEvent(new CustomEvent('db-logo-click', { bubbles: true, composed: true }));
|
|
184
|
+
});
|
|
185
|
+
logoWrap.append(logo);
|
|
186
|
+
return logoWrap;
|
|
187
|
+
}
|
|
188
|
+
renderBrand(iconPx, options = {}) {
|
|
189
|
+
const { showTagline = true } = options;
|
|
190
|
+
const brand = document.createElement('div');
|
|
191
|
+
brand.className = 'designbase-wc-footer__brand';
|
|
192
|
+
if (this.showLogo()) {
|
|
193
|
+
brand.append(this.createLogo());
|
|
194
|
+
}
|
|
195
|
+
const tagline = this.getAttribute('tagline');
|
|
196
|
+
if (showTagline && tagline) {
|
|
197
|
+
const taglineEl = document.createElement('p');
|
|
198
|
+
taglineEl.className = 'designbase-wc-footer__tagline';
|
|
199
|
+
taglineEl.textContent = tagline;
|
|
200
|
+
brand.append(taglineEl);
|
|
201
|
+
}
|
|
202
|
+
const socialLinks = this.socialLinks;
|
|
203
|
+
if (socialLinks.length && (!this.hasAttribute('show-social') || this.getAttribute('show-social') !== 'false')) {
|
|
204
|
+
const social = document.createElement('div');
|
|
205
|
+
social.className = 'designbase-wc-footer__social';
|
|
206
|
+
socialLinks.forEach((link) => social.append(this.createSocialLink(link, iconPx)));
|
|
207
|
+
brand.append(social);
|
|
208
|
+
}
|
|
209
|
+
return brand;
|
|
210
|
+
}
|
|
211
|
+
renderColumns(columns) {
|
|
212
|
+
if (!columns.length)
|
|
213
|
+
return null;
|
|
214
|
+
const wrap = document.createElement('div');
|
|
215
|
+
wrap.className = 'designbase-wc-footer__columns';
|
|
216
|
+
wrap.style.setProperty('--db-footer-columns', String(Math.min(columns.length, 4)));
|
|
217
|
+
columns.forEach((column) => {
|
|
218
|
+
const col = document.createElement('div');
|
|
219
|
+
col.className = 'designbase-wc-footer__column';
|
|
220
|
+
const title = document.createElement('h3');
|
|
221
|
+
title.className = 'designbase-wc-footer__column-title';
|
|
222
|
+
title.textContent = column.title;
|
|
223
|
+
col.append(title);
|
|
224
|
+
const list = document.createElement('ul');
|
|
225
|
+
list.className = 'designbase-wc-footer__column-list';
|
|
226
|
+
column.items.forEach((item) => {
|
|
227
|
+
const li = document.createElement('li');
|
|
228
|
+
li.append(this.createLink(item, 'designbase-wc-footer__column-link', 'column'));
|
|
229
|
+
list.append(li);
|
|
230
|
+
});
|
|
231
|
+
col.append(list);
|
|
232
|
+
wrap.append(col);
|
|
233
|
+
});
|
|
234
|
+
return wrap;
|
|
235
|
+
}
|
|
236
|
+
createLegalNav(legalLinks) {
|
|
237
|
+
const nav = document.createElement('nav');
|
|
238
|
+
nav.className = 'designbase-wc-footer__legal-nav';
|
|
239
|
+
nav.setAttribute('aria-label', '법적 고지');
|
|
240
|
+
const list = document.createElement('ul');
|
|
241
|
+
list.className = 'designbase-wc-footer__legal-list';
|
|
242
|
+
legalLinks.forEach((link, index) => {
|
|
243
|
+
const li = document.createElement('li');
|
|
244
|
+
li.append(this.createLink(link, 'designbase-wc-footer__legal-link', 'legal'));
|
|
245
|
+
list.append(li);
|
|
246
|
+
if (index < legalLinks.length - 1) {
|
|
247
|
+
const divider = document.createElement('span');
|
|
248
|
+
divider.className = 'designbase-wc-footer__legal-divider';
|
|
249
|
+
divider.setAttribute('aria-hidden', 'true');
|
|
250
|
+
divider.textContent = '|';
|
|
251
|
+
li.append(divider);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
nav.append(list);
|
|
255
|
+
return nav;
|
|
256
|
+
}
|
|
257
|
+
renderLegalBar(legalLinks, familySites) {
|
|
258
|
+
if (!legalLinks.length && !familySites.length)
|
|
259
|
+
return null;
|
|
260
|
+
const bar = document.createElement('div');
|
|
261
|
+
bar.className = 'designbase-wc-footer__legal-bar';
|
|
262
|
+
if (legalLinks.length) {
|
|
263
|
+
bar.append(this.createLegalNav(legalLinks));
|
|
264
|
+
}
|
|
265
|
+
if (familySites.length) {
|
|
266
|
+
const familyWrap = document.createElement('div');
|
|
267
|
+
familyWrap.className = 'designbase-wc-footer__family-site';
|
|
268
|
+
const select = document.createElement('select');
|
|
269
|
+
select.className = 'designbase-wc-footer__family-select';
|
|
270
|
+
select.setAttribute('aria-label', this.getAttribute('family-site-label') || '패밀리 사이트');
|
|
271
|
+
const placeholder = document.createElement('option');
|
|
272
|
+
placeholder.value = '';
|
|
273
|
+
placeholder.textContent = this.getAttribute('family-site-label') || '패밀리 사이트';
|
|
274
|
+
placeholder.disabled = true;
|
|
275
|
+
placeholder.selected = true;
|
|
276
|
+
select.append(placeholder);
|
|
277
|
+
familySites.forEach((site) => {
|
|
278
|
+
const option = document.createElement('option');
|
|
279
|
+
option.value = site.href;
|
|
280
|
+
option.textContent = site.label;
|
|
281
|
+
option.dataset.id = site.id;
|
|
282
|
+
select.append(option);
|
|
283
|
+
});
|
|
284
|
+
select.addEventListener('change', () => {
|
|
285
|
+
const selected = familySites.find((site) => site.href === select.value);
|
|
286
|
+
if (!selected)
|
|
287
|
+
return;
|
|
288
|
+
select.selectedIndex = 0;
|
|
289
|
+
this.dispatchEvent(new CustomEvent('db-family-site-change', {
|
|
290
|
+
bubbles: true,
|
|
291
|
+
composed: true,
|
|
292
|
+
detail: { site: selected },
|
|
293
|
+
}));
|
|
294
|
+
});
|
|
295
|
+
familyWrap.append(select);
|
|
296
|
+
bar.append(familyWrap);
|
|
297
|
+
}
|
|
298
|
+
return bar;
|
|
299
|
+
}
|
|
300
|
+
renderCompanyInfo(info) {
|
|
301
|
+
const rows = this.createCompanyInfoRows(info);
|
|
302
|
+
if (!rows.length)
|
|
303
|
+
return null;
|
|
304
|
+
const wrap = document.createElement('div');
|
|
305
|
+
wrap.className = 'designbase-wc-footer__company';
|
|
306
|
+
rows.forEach((row) => {
|
|
307
|
+
const line = document.createElement('p');
|
|
308
|
+
line.className = 'designbase-wc-footer__company-line';
|
|
309
|
+
line.textContent = row;
|
|
310
|
+
wrap.append(line);
|
|
311
|
+
});
|
|
312
|
+
return wrap;
|
|
313
|
+
}
|
|
314
|
+
createCopyright(copyright) {
|
|
315
|
+
const bottom = document.createElement('div');
|
|
316
|
+
bottom.className = 'designbase-wc-footer__bottom';
|
|
317
|
+
const copyrightEl = document.createElement('p');
|
|
318
|
+
copyrightEl.className = 'designbase-wc-footer__copyright';
|
|
319
|
+
copyrightEl.textContent = copyright;
|
|
320
|
+
bottom.append(copyrightEl);
|
|
321
|
+
return bottom;
|
|
322
|
+
}
|
|
323
|
+
renderMinimal(container, legalLinks, copyright) {
|
|
324
|
+
const bar = document.createElement('div');
|
|
325
|
+
bar.className = 'designbase-wc-footer__minimal-bar';
|
|
326
|
+
const start = document.createElement('div');
|
|
327
|
+
start.className = 'designbase-wc-footer__minimal-start';
|
|
328
|
+
if (this.showLogo())
|
|
329
|
+
start.append(this.createLogo());
|
|
330
|
+
bar.append(start);
|
|
331
|
+
if (legalLinks.length) {
|
|
332
|
+
const legalWrap = document.createElement('div');
|
|
333
|
+
legalWrap.className = 'designbase-wc-footer__minimal-legal';
|
|
334
|
+
legalWrap.append(this.createLegalNav(legalLinks));
|
|
335
|
+
bar.append(legalWrap);
|
|
336
|
+
}
|
|
337
|
+
container.append(bar);
|
|
338
|
+
container.append(this.createCopyright(copyright));
|
|
339
|
+
}
|
|
340
|
+
render() {
|
|
341
|
+
this.syncHostClasses();
|
|
342
|
+
this.setAttribute('role', 'contentinfo');
|
|
343
|
+
const variant = this.getAttribute('variant') || 'default';
|
|
344
|
+
const size = this.getAttribute('size') || 'm';
|
|
345
|
+
const iconPx = size === 's' ? 18 : size === 'l' ? 22 : 20;
|
|
346
|
+
const columns = variant === 'default' ? this.columns : [];
|
|
347
|
+
const legalLinks = this.legalLinks;
|
|
348
|
+
const companyInfo = this.companyInfo;
|
|
349
|
+
const familySites = this.familySites;
|
|
350
|
+
const copyright = this.getAttribute('copyright') || `© ${new Date().getFullYear()} Designbase. All rights reserved.`;
|
|
351
|
+
this.replaceChildren();
|
|
352
|
+
const container = document.createElement('div');
|
|
353
|
+
container.className = [
|
|
354
|
+
'designbase-wc-footer__container',
|
|
355
|
+
this.hasAttribute('full-width') && 'designbase-wc-footer__container--full-width',
|
|
356
|
+
]
|
|
357
|
+
.filter(Boolean)
|
|
358
|
+
.join(' ');
|
|
359
|
+
if (variant === 'minimal') {
|
|
360
|
+
this.renderMinimal(container, legalLinks, copyright);
|
|
361
|
+
this.append(container);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const top = document.createElement('div');
|
|
365
|
+
top.className = 'designbase-wc-footer__top';
|
|
366
|
+
top.append(this.renderBrand(iconPx, { showTagline: variant !== 'compact' }));
|
|
367
|
+
const columnsEl = this.renderColumns(columns);
|
|
368
|
+
if (columnsEl)
|
|
369
|
+
top.append(columnsEl);
|
|
370
|
+
container.append(top);
|
|
371
|
+
const legalBar = this.renderLegalBar(legalLinks, familySites);
|
|
372
|
+
if (legalBar)
|
|
373
|
+
container.append(legalBar);
|
|
374
|
+
const companyEl = this.renderCompanyInfo(companyInfo);
|
|
375
|
+
if (companyEl)
|
|
376
|
+
container.append(companyEl);
|
|
377
|
+
container.append(this.createCopyright(copyright));
|
|
378
|
+
this.append(container);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (!customElements.get('db-footer')) {
|
|
382
|
+
customElements.define('db-footer', DbFooter);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export { DbFooter };
|