@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,233 @@
|
|
|
1
|
-
const
|
|
1
|
+
const SIZES = ['s', 'm', 'l'];
|
|
2
|
+
class DbTextarea extends HTMLElement {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.built = false;
|
|
6
|
+
this.handleInput = (event) => {
|
|
7
|
+
event.stopPropagation();
|
|
8
|
+
if (!this.field)
|
|
9
|
+
return;
|
|
10
|
+
this.updateCharacterCount();
|
|
11
|
+
this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
12
|
+
this.dispatchEvent(new CustomEvent('db-input', {
|
|
13
|
+
detail: { value: this.field.value, nativeEvent: event },
|
|
14
|
+
bubbles: true,
|
|
15
|
+
composed: true,
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
this.handleChange = (event) => {
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
if (!this.field)
|
|
21
|
+
return;
|
|
22
|
+
const nextValue = this.field.value;
|
|
23
|
+
if (this.getAttribute('value') !== nextValue) {
|
|
24
|
+
this.setAttribute('value', nextValue);
|
|
25
|
+
}
|
|
26
|
+
this.updateCharacterCount();
|
|
27
|
+
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
28
|
+
this.dispatchEvent(new CustomEvent('db-change', {
|
|
29
|
+
detail: { value: nextValue, nativeEvent: event },
|
|
30
|
+
bubbles: true,
|
|
31
|
+
composed: true,
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static get observedAttributes() {
|
|
36
|
+
return [
|
|
37
|
+
'label',
|
|
38
|
+
'placeholder',
|
|
39
|
+
'value',
|
|
40
|
+
'default-value',
|
|
41
|
+
'name',
|
|
42
|
+
'size',
|
|
43
|
+
'rows',
|
|
44
|
+
'max-length',
|
|
45
|
+
'show-character-count',
|
|
46
|
+
'character-count-position',
|
|
47
|
+
'disabled',
|
|
48
|
+
'readonly',
|
|
49
|
+
'required',
|
|
50
|
+
'error',
|
|
51
|
+
'error-message',
|
|
52
|
+
'helper-text',
|
|
53
|
+
'full-width',
|
|
54
|
+
'resizable',
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
get value() {
|
|
58
|
+
return this.field?.value ?? this.getAttribute('value') ?? '';
|
|
59
|
+
}
|
|
60
|
+
set value(value) {
|
|
61
|
+
this.setAttribute('value', value);
|
|
62
|
+
if (this.field) {
|
|
63
|
+
this.field.value = value;
|
|
64
|
+
this.updateCharacterCount();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
get size() {
|
|
68
|
+
return this.getAttribute('size') || 'm';
|
|
69
|
+
}
|
|
70
|
+
set size(value) {
|
|
71
|
+
this.setAttribute('size', value);
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
if (!this.built) {
|
|
75
|
+
this.build();
|
|
76
|
+
}
|
|
77
|
+
this.syncState();
|
|
78
|
+
}
|
|
79
|
+
attributeChangedCallback(name) {
|
|
80
|
+
if (!this.built)
|
|
81
|
+
return;
|
|
82
|
+
if (name === 'value' && this.field) {
|
|
83
|
+
const next = this.getAttribute('value') || '';
|
|
84
|
+
if (this.field.value !== next) {
|
|
85
|
+
this.field.value = next;
|
|
86
|
+
}
|
|
87
|
+
this.updateCharacterCount();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.syncState();
|
|
91
|
+
}
|
|
92
|
+
focus() {
|
|
93
|
+
this.field?.focus();
|
|
94
|
+
}
|
|
95
|
+
get showCharacterCount() {
|
|
96
|
+
return this.hasAttribute('show-character-count');
|
|
97
|
+
}
|
|
98
|
+
get characterCountPosition() {
|
|
99
|
+
return this.getAttribute('character-count-position') || 'bottom';
|
|
100
|
+
}
|
|
101
|
+
build() {
|
|
102
|
+
const id = this.getAttribute('id') || `db-textarea-${Math.random().toString(36).slice(2)}`;
|
|
103
|
+
if (!this.hasAttribute('id'))
|
|
104
|
+
this.setAttribute('id', id);
|
|
105
|
+
this.labelEl = document.createElement('label');
|
|
106
|
+
this.labelEl.className = 'designbase-wc-textarea__label';
|
|
107
|
+
this.labelEl.htmlFor = id;
|
|
108
|
+
this.countTop = document.createElement('div');
|
|
109
|
+
this.countTop.className = 'designbase-wc-textarea__character-count designbase-wc-textarea__character-count--top';
|
|
110
|
+
this.countTop.hidden = true;
|
|
111
|
+
const wrapper = document.createElement('div');
|
|
112
|
+
wrapper.className = 'designbase-wc-textarea__wrapper';
|
|
113
|
+
this.field = document.createElement('textarea');
|
|
114
|
+
this.field.id = id;
|
|
115
|
+
this.field.className = 'designbase-wc-textarea__field';
|
|
116
|
+
this.field.addEventListener('input', this.handleInput);
|
|
117
|
+
this.field.addEventListener('change', this.handleChange);
|
|
118
|
+
wrapper.appendChild(this.field);
|
|
119
|
+
this.footerEl = document.createElement('div');
|
|
120
|
+
this.footerEl.className = 'designbase-wc-textarea__footer';
|
|
121
|
+
this.errorEl = document.createElement('div');
|
|
122
|
+
this.errorEl.className = 'designbase-wc-textarea__error-message';
|
|
123
|
+
this.errorEl.setAttribute('role', 'alert');
|
|
124
|
+
this.helperEl = document.createElement('div');
|
|
125
|
+
this.helperEl.className = 'designbase-wc-textarea__helper-text';
|
|
126
|
+
this.countBottom = document.createElement('div');
|
|
127
|
+
this.countBottom.className = 'designbase-wc-textarea__character-count designbase-wc-textarea__character-count--bottom';
|
|
128
|
+
this.countBottom.hidden = true;
|
|
129
|
+
this.footerEl.append(this.errorEl, this.helperEl, this.countBottom);
|
|
130
|
+
this.append(this.labelEl, this.countTop, wrapper, this.footerEl);
|
|
131
|
+
this.built = true;
|
|
132
|
+
}
|
|
133
|
+
syncState() {
|
|
134
|
+
if (!this.field)
|
|
135
|
+
return;
|
|
136
|
+
const size = SIZES.includes(this.size) ? this.size : 'm';
|
|
137
|
+
const label = this.getAttribute('label') || '';
|
|
138
|
+
const helperText = this.getAttribute('helper-text') || '';
|
|
139
|
+
const errorMessage = this.getAttribute('error-message') || '';
|
|
140
|
+
const hasError = this.hasAttribute('error');
|
|
141
|
+
const value = this.getAttribute('value') ?? this.getAttribute('default-value') ?? '';
|
|
142
|
+
this.className = [
|
|
143
|
+
'designbase-wc-textarea',
|
|
144
|
+
`designbase-wc-textarea--${size}`,
|
|
145
|
+
hasError && 'designbase-wc-textarea--error',
|
|
146
|
+
this.hasAttribute('disabled') && 'designbase-wc-textarea--disabled',
|
|
147
|
+
this.hasAttribute('readonly') && 'designbase-wc-textarea--readonly',
|
|
148
|
+
this.hasAttribute('full-width') && 'designbase-wc-textarea--full-width',
|
|
149
|
+
this.hasAttribute('resizable') ? '' : 'designbase-wc-textarea--not-resizable',
|
|
150
|
+
].filter(Boolean).join(' ');
|
|
151
|
+
if (this.labelEl) {
|
|
152
|
+
const requiredMark = this.hasAttribute('required') ? '<span aria-hidden="true"> *</span>' : '';
|
|
153
|
+
this.labelEl.innerHTML = label ? `${this.escape(label)}${requiredMark}` : '';
|
|
154
|
+
this.labelEl.hidden = !label;
|
|
155
|
+
}
|
|
156
|
+
this.field.placeholder = this.getAttribute('placeholder') || '';
|
|
157
|
+
this.field.name = this.getAttribute('name') || '';
|
|
158
|
+
if (this.field.value !== value) {
|
|
159
|
+
this.field.value = value;
|
|
160
|
+
}
|
|
161
|
+
this.field.rows = Number(this.getAttribute('rows') || 4);
|
|
162
|
+
this.field.disabled = this.hasAttribute('disabled');
|
|
163
|
+
this.field.readOnly = this.hasAttribute('readonly');
|
|
164
|
+
this.field.required = this.hasAttribute('required');
|
|
165
|
+
this.field.setAttribute('aria-invalid', String(hasError));
|
|
166
|
+
const maxLength = this.getAttribute('max-length');
|
|
167
|
+
if (maxLength)
|
|
168
|
+
this.field.maxLength = Number(maxLength);
|
|
169
|
+
else
|
|
170
|
+
this.field.removeAttribute('maxLength');
|
|
171
|
+
const helperId = `${this.getAttribute('id')}-helper`;
|
|
172
|
+
const errorId = `${this.getAttribute('id')}-error`;
|
|
173
|
+
if (hasError && errorMessage) {
|
|
174
|
+
this.errorEl.id = errorId;
|
|
175
|
+
this.errorEl.textContent = errorMessage;
|
|
176
|
+
this.errorEl.hidden = false;
|
|
177
|
+
this.helperEl.hidden = true;
|
|
178
|
+
this.field.setAttribute('aria-describedby', errorId);
|
|
179
|
+
}
|
|
180
|
+
else if (helperText) {
|
|
181
|
+
this.helperEl.id = helperId;
|
|
182
|
+
this.helperEl.textContent = helperText;
|
|
183
|
+
this.helperEl.hidden = false;
|
|
184
|
+
this.errorEl.hidden = true;
|
|
185
|
+
this.field.setAttribute('aria-describedby', helperId);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
this.helperEl.hidden = true;
|
|
189
|
+
this.errorEl.hidden = true;
|
|
190
|
+
this.field.removeAttribute('aria-describedby');
|
|
191
|
+
}
|
|
192
|
+
this.updateCharacterCount();
|
|
193
|
+
}
|
|
194
|
+
updateCharacterCount() {
|
|
195
|
+
if (!this.field || !this.countTop || !this.countBottom)
|
|
196
|
+
return;
|
|
197
|
+
const currentLength = this.field.value.length;
|
|
198
|
+
const maxLength = this.getAttribute('max-length');
|
|
199
|
+
const isOverLimit = Boolean(maxLength && currentLength > Number(maxLength));
|
|
200
|
+
const countText = `${currentLength}${maxLength ? ` / ${maxLength}` : ''}`;
|
|
201
|
+
const renderCount = (host) => {
|
|
202
|
+
host.innerHTML = `<span class="designbase-wc-textarea__character-count-text${isOverLimit ? ' designbase-wc-textarea__character-count-text--error' : ''}">${countText}</span>`;
|
|
203
|
+
};
|
|
204
|
+
if (this.showCharacterCount && this.characterCountPosition === 'top') {
|
|
205
|
+
renderCount(this.countTop);
|
|
206
|
+
this.countTop.hidden = false;
|
|
207
|
+
this.countBottom.hidden = true;
|
|
208
|
+
}
|
|
209
|
+
else if (this.showCharacterCount) {
|
|
210
|
+
renderCount(this.countBottom);
|
|
211
|
+
this.countBottom.hidden = false;
|
|
212
|
+
this.countTop.hidden = true;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.countTop.hidden = true;
|
|
216
|
+
this.countBottom.hidden = true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
escape(value) {
|
|
220
|
+
return value.replace(/[&<>"']/g, (char) => ({
|
|
221
|
+
'&': '&',
|
|
222
|
+
'<': '<',
|
|
223
|
+
'>': '>',
|
|
224
|
+
'"': '"',
|
|
225
|
+
"'": ''',
|
|
226
|
+
}[char] || char));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!customElements.get('db-textarea')) {
|
|
230
|
+
customElements.define('db-textarea', DbTextarea);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export { DbTextarea };
|