@explorer02/cfm-survey-sdk 0.3.3 → 0.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer02/cfm-survey-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -16,14 +16,34 @@ import {
16
16
  mcqSelectedAccentVar,
17
17
  mcqSelectedBgVar,
18
18
  } from '@/lib/surveyUi/selectionStyles';
19
- import { csatColumnLabelStyle } from '@/lib/surveyUi/labelStyles';
19
+ import { csatColumnLabelStyle, ratingColumnLabelStyle } from '@/lib/surveyUi/labelStyles';
20
20
 
21
21
  const MATRIX_ROW_LABEL_WIDTH = 'var(--cfm-matrix-row-width, 180px)';
22
22
 
23
23
  type CsatMatrixQuestion = CsatQuestion | RatingMatrixQuestion;
24
24
 
25
- function GraphicsColumnLabelsRow({ scaleColumns }: { scaleColumns: ScaleColumn[] }) {
25
+ function anchorLabelStyle(question: CsatMatrixQuestion) {
26
+ return question.type === 'RATING_MATRIX' ? ratingColumnLabelStyle() : csatColumnLabelStyle();
27
+ }
28
+
29
+ function columnHeaderLabelStyle(question: CsatMatrixQuestion) {
30
+ if (question.type === 'RATING_MATRIX') {
31
+ return { fontSize: '13px', fontWeight: 500, textAlign: 'center' as const, lineHeight: 1.2, color: '#4b5563' };
32
+ }
33
+ return { fontSize: '13px', fontWeight: 500, textAlign: 'center' as const, lineHeight: 1.2, ...csatColumnLabelStyle() };
34
+ }
35
+
36
+ function GraphicsColumnLabelsRow({
37
+ scaleColumns,
38
+ question,
39
+ }: {
40
+ scaleColumns: ScaleColumn[];
41
+ question: CsatMatrixQuestion;
42
+ }) {
26
43
  if (scaleColumns.length === 0) return null;
44
+ const labelStyle = question.type === 'RATING_MATRIX'
45
+ ? { fontSize: '12px', fontWeight: 500, lineHeight: 1.2, wordBreak: 'break-word' as const, color: '#4b5563' }
46
+ : { fontSize: '12px', fontWeight: 500, lineHeight: 1.2, wordBreak: 'break-word' as const, ...csatColumnLabelStyle() };
27
47
 
28
48
  return (
29
49
  <div style={{ flex: 1, padding: '0 24px' }}>
@@ -39,15 +59,10 @@ function GraphicsColumnLabelsRow({ scaleColumns }: { scaleColumns: ScaleColumn[]
39
59
  transform: 'translateX(-50%)',
40
60
  bottom: 0,
41
61
  textAlign: 'center',
42
- fontSize: '12px',
43
- fontWeight: 500,
44
- color: '#4b5563',
45
- lineHeight: 1.2,
46
- wordBreak: 'break-word',
47
62
  width: '64px',
48
63
  }}
49
64
  >
50
- <span dangerouslySetInnerHTML={{ __html: col.label }} />
65
+ <span style={labelStyle} dangerouslySetInnerHTML={{ __html: col.label }} />
51
66
  </div>
52
67
  );
53
68
  })}
@@ -214,7 +229,8 @@ function CsatMatrixGrid({
214
229
  left: `${percent}%`,
215
230
  transform: 'translateX(-50%)',
216
231
  textAlign: 'center', fontSize: '13px', fontWeight: 600,
217
- color: '#4b5563', lineHeight: 1.3, whiteSpace: 'nowrap'
232
+ lineHeight: 1.3, whiteSpace: 'nowrap',
233
+ ...anchorLabelStyle(question),
218
234
  }}>
219
235
  {label}
220
236
  </div>
@@ -231,7 +247,7 @@ function CsatMatrixGrid({
231
247
  <div style={{ display: 'flex', alignItems: 'flex-end', marginBottom: showLabels ? '8px' : '16px', minHeight: '24px' }}>
232
248
  <div style={{ width: MATRIX_ROW_LABEL_WIDTH, flexShrink: 0 }} />
233
249
  <div style={{ flex: 1, display: 'flex' }}>
234
- <GraphicsColumnLabelsRow scaleColumns={scaleColumns} />
250
+ <GraphicsColumnLabelsRow scaleColumns={scaleColumns} question={question} />
235
251
  {hasNotApplicable && (
236
252
  <div style={{ width: '56px', flexShrink: 0 }} />
237
253
  )}
@@ -248,7 +264,7 @@ function CsatMatrixGrid({
248
264
  {scaleColumns.map(col => (
249
265
  <div key={col.id} style={{ display: 'flex', justifyContent: 'center', padding: '0 4px' }}>
250
266
  <span
251
- style={{ fontSize: '13px', fontWeight: 500, textAlign: 'center', lineHeight: 1.2, ...csatColumnLabelStyle() }}
267
+ style={columnHeaderLabelStyle(question)}
252
268
  dangerouslySetInnerHTML={{ __html: col.label }}
253
269
  />
254
270
  </div>
@@ -444,7 +460,8 @@ function CsatMatrixCarousel({
444
460
  <div key={i} style={{
445
461
  position: 'absolute', left: `${percent}%`, transform: 'translateX(-50%)',
446
462
  textAlign: 'center', fontSize: '13px', fontWeight: 600,
447
- color: '#4b5563', lineHeight: 1.3, whiteSpace: 'nowrap'
463
+ lineHeight: 1.3, whiteSpace: 'nowrap',
464
+ ...anchorLabelStyle(question),
448
465
  }}>
449
466
  {label}
450
467
  </div>
@@ -455,7 +472,7 @@ function CsatMatrixCarousel({
455
472
 
456
473
  {isGraphics && scaleColumns.length > 0 && (
457
474
  <div style={{ width: '100%', maxWidth: '800px', marginBottom: showLabels ? '8px' : '16px' }}>
458
- <GraphicsColumnLabelsRow scaleColumns={scaleColumns} />
475
+ <GraphicsColumnLabelsRow scaleColumns={scaleColumns} question={question} />
459
476
  </div>
460
477
  )}
461
478
 
@@ -519,7 +536,7 @@ function CsatMatrixCarousel({
519
536
  >
520
537
  {(EmojiNode ?? StarNode ?? (isNumbered ? (displayIdx + 1) : RadioNode)) as React.ReactNode}
521
538
  </button>
522
- <span style={{ fontSize: '13px', fontWeight: 500, color: '#4b5563', textAlign: 'center', lineHeight: 1.2 }}
539
+ <span style={columnHeaderLabelStyle(question)}
523
540
  dangerouslySetInnerHTML={{ __html: col.label }} />
524
541
  </div>
525
542
  );
@@ -4,7 +4,21 @@
4
4
  */
5
5
  'use client';
6
6
 
7
+ import {
8
+ getFooterCopyright,
9
+ getFooterLinks,
10
+ getLayoutFlags,
11
+ getLogoSrc,
12
+ } from '@/lib/uiConfig';
13
+
14
+ const seedLogoSrc = getLogoSrc({ staticExport: true });
15
+ const seedCopyright = getFooterCopyright();
16
+ const seedLinks = getFooterLinks();
17
+ const { showFooterLogo } = getLayoutFlags();
18
+
7
19
  export default function Footer() {
20
+ const showLogo = showFooterLogo && Boolean(seedLogoSrc);
21
+
8
22
  return (
9
23
  <footer
10
24
  className="cfm-footer w-full"
@@ -15,57 +29,56 @@ export default function Footer() {
15
29
  }}
16
30
  >
17
31
  <div
18
- className="cfm-footer-inner mx-auto grid w-full max-w-4xl items-end gap-6"
19
- style={{
20
- display: 'var(--cfm-footer-inner-display, grid)',
21
- flexDirection: 'var(--cfm-footer-inner-direction, row)' as React.CSSProperties['flexDirection'],
22
- gridTemplateColumns: '1fr 1fr 1fr',
23
- }}
32
+ className="cfm-footer-inner mx-auto w-full"
33
+ style={{ maxWidth: 'var(--cfm-max-width, 48rem)' }}
24
34
  >
25
- <div
26
- className="space-y-3"
27
- style={{
28
- gridColumn: 'var(--cfm-footer-logo-col, 1)',
29
- justifySelf: 'var(--cfm-footer-logo-justify, start)',
30
- }}
31
- >
35
+ {showLogo ? (
36
+ <div className="cfm-footer-logo-slot">
37
+ <img
38
+ data-cfm-footer-logo
39
+ data-cfm-logo
40
+ src={seedLogoSrc!}
41
+ alt=""
42
+ className="object-contain"
43
+ style={{
44
+ width: 'var(--cfm-footer-logo-width, 120px)',
45
+ height: 'var(--cfm-footer-logo-height, 32px)',
46
+ }}
47
+ />
48
+ </div>
49
+ ) : (
32
50
  <img
33
51
  data-cfm-footer-logo
34
52
  data-cfm-logo
35
- src="./logo.svg"
53
+ src=""
36
54
  alt=""
37
- style={{
38
- display: 'none',
39
- width: 'var(--cfm-footer-logo-width, 120px)',
40
- height: 'var(--cfm-footer-logo-height, 32px)',
41
- objectFit: 'contain',
42
- }}
55
+ style={{ display: 'none' }}
43
56
  />
44
- <p
45
- data-cfm-copyright
46
- className="text-xs"
47
- style={{ color: 'var(--cfm-footer-text, #9ca3af)' }}
48
- >
49
- © Company
57
+ )}
58
+
59
+ {seedCopyright ? (
60
+ <p data-cfm-copyright className="cfm-footer-copyright text-xs">
61
+ {seedCopyright}
50
62
  </p>
51
- </div>
63
+ ) : (
64
+ <p data-cfm-copyright className="cfm-footer-copyright text-xs" style={{ display: 'none' }} />
65
+ )}
52
66
 
53
- <nav
54
- data-cfm-footer-links
55
- className="flex flex-wrap gap-x-6 gap-y-2 text-xs"
56
- style={{
57
- gridColumn: 'var(--cfm-footer-links-col, 3)',
58
- justifySelf: 'var(--cfm-footer-links-justify, end)',
59
- }}
60
- >
61
- <a
62
- href="#"
63
- className="transition-colors hover:opacity-80"
64
- style={{ color: 'var(--cfm-footer-link, #9ca3af)' }}
65
- >
66
- Privacy
67
- </a>
68
- </nav>
67
+ {seedLinks.length > 0 ? (
68
+ <nav data-cfm-footer-links className="cfm-footer-links flex flex-wrap gap-x-6 gap-y-2 text-xs">
69
+ {seedLinks.map((link, i) => (
70
+ <a
71
+ key={`${link.label}-${i}`}
72
+ href={link.url || '#'}
73
+ className="cfm-footer-link transition-colors hover:opacity-80"
74
+ >
75
+ {link.label}
76
+ </a>
77
+ ))}
78
+ </nav>
79
+ ) : (
80
+ <nav data-cfm-footer-links className="cfm-footer-links" style={{ display: 'none' }} />
81
+ )}
69
82
  </div>
70
83
  </footer>
71
84
  );
@@ -26,26 +26,18 @@ export default function Header({ embedded = false }: HeaderProps) {
26
26
  <header
27
27
  className={`cfm-header relative w-full ${embedded ? '' : 'z-10 shadow-[0_2px_8px_rgba(0,0,0,0.06)]'}`}
28
28
  style={{
29
- height: 'var(--cfm-header-height, 120px)',
30
29
  background: 'var(--cfm-header-bg, #fff)',
31
30
  borderBottom: '1px solid var(--cfm-header-border, #e5e7eb)',
32
31
  boxShadow: embedded ? undefined : 'var(--cfm-header-shadow, 0 2px 8px rgba(0,0,0,0.06))',
33
32
  }}
34
33
  >
35
34
  <div
36
- className="cfm-header-inner grid h-full w-full items-center"
37
- style={{
38
- gridTemplateColumns: '1fr 1fr 1fr',
39
- padding: `0 var(--cfm-header-padding-x, 40px)`,
40
- }}
35
+ className="cfm-header-inner mx-auto w-full"
36
+ style={{ maxWidth: 'var(--cfm-max-width, 48rem)' }}
41
37
  >
42
38
  <div
43
39
  className="cfm-header-brand flex items-center"
44
- style={{
45
- gridColumn: 'var(--cfm-header-logo-col, 1)',
46
- justifySelf: 'var(--cfm-header-logo-justify, start)',
47
- gap: 'var(--cfm-header-brand-gap, 16px)',
48
- }}
40
+ style={{ gap: 'var(--cfm-header-brand-gap, 16px)' }}
49
41
  >
50
42
  {hasLogoFile ? (
51
43
  <img
@@ -56,9 +48,9 @@ export default function Header({ embedded = false }: HeaderProps) {
56
48
  style={{
57
49
  width: 'var(--cfm-header-logo-width, 120px)',
58
50
  height: 'var(--cfm-header-logo-height, 120px)',
59
- maxHeight: 'calc(var(--cfm-header-height, 120px) - 8px)',
60
51
  padding: 'var(--cfm-header-logo-padding, 10px)',
61
52
  background: 'transparent',
53
+ boxSizing: 'border-box',
62
54
  }}
63
55
  />
64
56
  ) : (
@@ -84,26 +76,19 @@ export default function Header({ embedded = false }: HeaderProps) {
84
76
  {seedCompany}
85
77
  </span>
86
78
 
87
- <span
88
- data-cfm-company
89
- className="font-semibold"
90
- style={{
91
- display:
92
- seedShowCompany && (hasLogoFile || seedCompany)
93
- ? hasLogoFile
94
- ? ''
95
- : 'none'
96
- : 'none',
97
- marginTop: 'var(--cfm-header-company-margin-top, 0)',
98
- marginLeft: 'var(--cfm-header-company-margin-left, 0)',
99
- marginRight: 'var(--cfm-header-company-margin-right, 0)',
100
- color: 'var(--cfm-header-company-color, var(--cfm-text))',
101
- fontSize: 'var(--cfm-header-company-size, 18px)',
102
- fontWeight: 'var(--cfm-header-company-weight, 600)',
103
- }}
104
- >
105
- {seedCompany}
106
- </span>
79
+ {seedShowCompany && hasLogoFile && seedCompany ? (
80
+ <span
81
+ data-cfm-company
82
+ className="font-semibold"
83
+ style={{
84
+ color: 'var(--cfm-header-company-color, var(--cfm-text))',
85
+ fontSize: 'var(--cfm-header-company-size, 18px)',
86
+ fontWeight: 'var(--cfm-header-company-weight, 600)',
87
+ }}
88
+ >
89
+ {seedCompany}
90
+ </span>
91
+ ) : null}
107
92
  </div>
108
93
  </div>
109
94
  </header>
@@ -219,7 +219,7 @@ function LikertMatrixGridLayout({
219
219
  position: 'absolute', left: leftPos, transform: 'translateX(-50%)',
220
220
  bottom: 0, display: 'flex', justifyContent: 'center', whiteSpace: 'nowrap'
221
221
  }}>
222
- <span style={{ fontSize: '13px', fontWeight: 600, color: '#111827' }}>{lbl}</span>
222
+ <span style={{ fontSize: '13px', fontWeight: 600, ...matrixColumnLabelStyle() }}>{lbl}</span>
223
223
  </div>
224
224
  );
225
225
  })}
@@ -259,7 +259,7 @@ function LikertMatrixGridLayout({
259
259
  <div style={{
260
260
  display: 'flex', alignItems: 'center', borderRadius: '8px',
261
261
  padding: 'var(--cfm-matrix-cell-padding, 12px) 0',
262
- ...(!repeatColumnHeaders ? matrixRowBackgroundStyle(rowIdx) : { backgroundColor: '#fff' }),
262
+ ...matrixRowBackgroundStyle(rowIdx),
263
263
  boxSizing: 'border-box',
264
264
  }}>
265
265
  <div style={{ flex: isBipolar ? `0 0 ${BIPOLAR_COL_WIDTH}` : `0 0 ${MATRIX_ROW_LABEL_WIDTH}`, padding: '0 16px', boxSizing: 'border-box' }}>
@@ -88,9 +88,7 @@ export function SliderMatrixScale({ question, selectedValue = {}, onSelect }: Sl
88
88
  >
89
89
  {labels.map((lbl, idx) => (
90
90
  <div key={idx} style={{ width: 0, display: 'flex', justifyContent: 'center' }}>
91
- <span
92
- style={{ ...hintLabelStyle(), padding: '2px 8px', borderRadius: '4px', whiteSpace: 'nowrap' }}
93
- >
91
+ <span style={hintLabelStyle()}>
94
92
  {lbl}
95
93
  </span>
96
94
  </div>
@@ -4,30 +4,63 @@
4
4
  */
5
5
  import type { CSSProperties } from 'react';
6
6
 
7
- export function hintLabelStyle(): CSSProperties {
7
+ type LabelPillScope = 'matrix' | 'csat' | 'rating' | 'hint' | 'sliderTick';
8
+
9
+ const PILL_SCOPE_VARS: Record<LabelPillScope, { color: string; bg: string }> = {
10
+ matrix: {
11
+ color: '--cfm-matrix-column-label-color',
12
+ bg: '--cfm-matrix-column-label-bg',
13
+ },
14
+ csat: {
15
+ color: '--cfm-csat-column-label-color',
16
+ bg: '--cfm-csat-column-label-bg',
17
+ },
18
+ rating: {
19
+ color: '--cfm-rating-column-label-color',
20
+ bg: '--cfm-rating-column-label-bg',
21
+ },
22
+ hint: {
23
+ color: '--cfm-hint-label-color',
24
+ bg: '--cfm-hint-label-bg',
25
+ },
26
+ sliderTick: {
27
+ color: '--cfm-slider-tick-label-color',
28
+ bg: '--cfm-slider-tick-label-bg',
29
+ },
30
+ };
31
+
32
+ export function columnLabelPillStyle(scope: LabelPillScope): CSSProperties {
33
+ const vars = PILL_SCOPE_VARS[scope];
8
34
  return {
9
- color: 'var(--cfm-hint-label-color, #6b7280)',
10
- backgroundColor: 'var(--cfm-hint-label-bg, transparent)',
35
+ display: 'inline-flex',
36
+ alignItems: 'center',
37
+ justifyContent: 'center',
38
+ padding: '4px 10px',
39
+ borderRadius: 'var(--cfm-border-radius, 6px)',
40
+ textAlign: 'center',
41
+ lineHeight: 1.2,
42
+ whiteSpace: 'nowrap',
43
+ color: `var(${vars.color}, #4b5563)`,
44
+ backgroundColor: `var(${vars.bg}, transparent)`,
11
45
  };
12
46
  }
13
47
 
48
+ export function hintLabelStyle(): CSSProperties {
49
+ return columnLabelPillStyle('hint');
50
+ }
51
+
14
52
  export function matrixColumnLabelStyle(): CSSProperties {
15
- return {
16
- color: 'var(--cfm-matrix-column-label-color, #4b5563)',
17
- backgroundColor: 'var(--cfm-matrix-column-label-bg, transparent)',
18
- };
53
+ return columnLabelPillStyle('matrix');
19
54
  }
20
55
 
21
56
  export function csatColumnLabelStyle(): CSSProperties {
22
- return {
23
- color: 'var(--cfm-csat-column-label-color, #4b5563)',
24
- backgroundColor: 'var(--cfm-csat-column-label-bg, transparent)',
25
- };
57
+ return columnLabelPillStyle('csat');
58
+ }
59
+
60
+ export function ratingColumnLabelStyle(): CSSProperties {
61
+ return columnLabelPillStyle('rating');
26
62
  }
27
63
 
28
64
  export function sliderTickLabelStyle(): CSSProperties {
29
- return {
30
- color: 'var(--cfm-slider-tick-label-color, #4b5563)',
31
- backgroundColor: 'var(--cfm-slider-tick-label-bg, transparent)',
32
- };
65
+ return columnLabelPillStyle('sliderTick');
33
66
  }
@@ -31,7 +31,7 @@ for (let i = 0; i < 11; i++) {
31
31
  const Icon = FACE_ICONS[i];
32
32
  CsatEmojiSet[i + 1] = React.createElement(Icon as React.ElementType, {
33
33
  className: 'transition-transform',
34
- style: { color: EMOJI_COLORS[i], fontSize: '28px' },
34
+ style: { color: EMOJI_COLORS[i], fontSize: 'var(--cfm-csat-emoji-size, 28px)' },
35
35
  });
36
36
  }
37
37
 
@@ -25,10 +25,7 @@
25
25
  --cfm-header-company-weight: 600;
26
26
  --cfm-header-border: #e5e7eb;
27
27
  --cfm-header-padding-x: 40px;
28
- --cfm-header-logo-col: 1;
29
- --cfm-header-logo-justify: start;
30
- --cfm-header-company-col: 1;
31
- --cfm-header-company-justify: start;
28
+ --cfm-header-padding-y: 12px;
32
29
  --cfm-header-brand-gap: 16px;
33
30
  --cfm-header-company-margin-top: 0;
34
31
  --cfm-header-company-margin-left: 0;
@@ -42,6 +39,7 @@
42
39
  --cfm-footer-logo-height: 32px;
43
40
  --cfm-footer-padding-y: 24px;
44
41
  --cfm-footer-padding-x: 40px;
42
+ --cfm-footer-logo-copyright-gap: 12px;
45
43
  --cfm-footer-inner-display: grid;
46
44
  --cfm-footer-inner-direction: row;
47
45
  --cfm-footer-inner-align: end;
@@ -186,38 +184,21 @@ body {
186
184
  }
187
185
 
188
186
  .cfm-header-inner {
189
- display: grid;
190
- grid-template-columns: 1fr auto 1fr;
187
+ display: flex;
191
188
  align-items: center;
192
189
  gap: var(--cfm-header-brand-gap, 16px);
193
190
  padding-left: var(--cfm-header-padding-x);
194
191
  padding-right: var(--cfm-header-padding-x);
195
- padding-top: 12px;
196
- padding-bottom: 12px;
192
+ padding-top: var(--cfm-header-padding-y, 12px);
193
+ padding-bottom: var(--cfm-header-padding-y, 12px);
197
194
  min-height: var(--cfm-header-height);
198
195
  box-sizing: border-box;
199
196
  }
200
197
 
201
- .cfm-header-logo-slot {
202
- grid-column: var(--cfm-header-logo-col, 1);
203
- grid-row: 1;
204
- justify-self: var(--cfm-header-logo-justify, start);
205
- width: var(--cfm-header-logo-width);
206
- height: var(--cfm-header-logo-height);
207
- }
208
-
209
- .cfm-header-company-slot {
210
- grid-column: var(--cfm-header-company-col, 1);
211
- grid-row: 1;
212
- justify-self: var(--cfm-header-company-justify, start);
213
- align-self: center;
214
- color: var(--cfm-header-company-color);
215
- font-size: var(--cfm-header-company-size);
216
- font-weight: var(--cfm-header-company-weight);
217
- margin-top: var(--cfm-header-company-margin-top, 0);
218
- margin-left: var(--cfm-header-company-margin-left, 0);
219
- margin-right: var(--cfm-header-company-margin-right, 0);
220
- line-height: 1.2;
198
+ .cfm-header-brand {
199
+ display: flex;
200
+ align-items: center;
201
+ gap: var(--cfm-header-brand-gap, 16px);
221
202
  }
222
203
 
223
204
  .cfm-footer-inner {
@@ -236,7 +217,7 @@ body {
236
217
  justify-self: start;
237
218
  align-self: end;
238
219
  color: var(--cfm-footer-text);
239
- margin: 0;
220
+ margin: var(--cfm-footer-logo-copyright-gap, 12px) 0 0;
240
221
  }
241
222
 
242
223
  .cfm-footer-logo-slot {
@@ -1 +1 @@
1
- import{u as x,j as e}from"./index-pKQOivEa.js";import{b as t}from"./vendor-BwkXDkd3.js";function p(d=150){const l=x(r=>r.config),[a,s]=t.useState(l);return t.useEffect(()=>{const r=window.setTimeout(()=>s(l),d);return()=>window.clearTimeout(r)},[l,d]),a}const h=t.memo(function(){const l=p(150),a=x(n=>n.logoPreviewDataUrl),{global:s}=l,{layout:r,colorScheme:o,buttons:c}=s,m=t.useMemo(()=>r.borderStyle==="sharp"?"rounded-none":r.borderStyle==="pill"?"rounded-[32px]":"rounded-2xl",[r.borderStyle]),i=t.useMemo(()=>r.fontStyle==="serif"?"Georgia, serif":r.fontStyle==="system"?"system-ui, sans-serif":"Inter, sans-serif",[r.fontStyle]),u=a??s.logo.url,f=t.useMemo(()=>({backgroundColor:o.background,color:o.text,borderColor:o.secondary,fontFamily:i}),[o,i]);return e.jsxs("div",{className:`overflow-hidden border shadow-md ${m}`,style:f,children:[r.showHeader&&e.jsxs("div",{className:"flex items-center gap-3 border-b px-5 py-4",style:{borderColor:o.secondary},children:[u&&e.jsx("img",{src:u,alt:"Logo",className:"max-h-6 w-auto object-contain",loading:"lazy"}),e.jsx("span",{className:"text-xs font-semibold tracking-wider",children:s.companyName})]}),e.jsxs("div",{className:"space-y-6 p-6",children:[r.showProgressBar&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex justify-between text-[10px] font-semibold text-slate-400",children:[e.jsx("span",{children:"Progress"}),e.jsx("span",{children:"35%"})]}),e.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-slate-100",children:e.jsx("div",{className:"h-full w-[35%] rounded-full",style:{backgroundColor:o.accent}})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"flex items-start gap-1.5 text-sm font-bold leading-snug",children:[r.showQuestionNumbers&&e.jsx("span",{className:"font-medium text-slate-400",children:"Q1."}),e.jsx("span",{children:s.surveyTitle}),r.showRequiredAsterisk&&e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("p",{className:"text-[11px] text-slate-400",children:"How would you rate your overall experience?"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:[1,2,3,4,5].map(n=>e.jsx("div",{className:`flex h-9 items-center justify-center border text-xs font-semibold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:n===1?{backgroundColor:o.secondary,borderColor:o.primary,color:o.primary}:{backgroundColor:o.background,borderColor:o.secondary,color:o.text},children:n},n))})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t bg-slate-50/50 px-6 py-4",children:[r.showBackButton&&e.jsx("span",{className:`border px-3 py-1.5 text-[10px] font-semibold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:{borderColor:o.secondary,color:o.text},children:c.back}),e.jsx("div",{className:"flex-1"}),r.showNextButton&&e.jsx("span",{className:`px-4 py-1.5 text-[10px] font-bold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:{backgroundColor:o.primary,color:o.buttonText},children:c.next})]})]})});export{h as PreviewMock};
1
+ import{u as x,j as e}from"./index-DWWkuRUU.js";import{b as t}from"./vendor-BwkXDkd3.js";function p(d=150){const l=x(r=>r.config),[a,s]=t.useState(l);return t.useEffect(()=>{const r=window.setTimeout(()=>s(l),d);return()=>window.clearTimeout(r)},[l,d]),a}const h=t.memo(function(){const l=p(150),a=x(n=>n.logoPreviewDataUrl),{global:s}=l,{layout:r,colorScheme:o,buttons:c}=s,m=t.useMemo(()=>r.borderStyle==="sharp"?"rounded-none":r.borderStyle==="pill"?"rounded-[32px]":"rounded-2xl",[r.borderStyle]),i=t.useMemo(()=>r.fontStyle==="serif"?"Georgia, serif":r.fontStyle==="system"?"system-ui, sans-serif":"Inter, sans-serif",[r.fontStyle]),u=a??s.logo.url,f=t.useMemo(()=>({backgroundColor:o.background,color:o.text,borderColor:o.secondary,fontFamily:i}),[o,i]);return e.jsxs("div",{className:`overflow-hidden border shadow-md ${m}`,style:f,children:[r.showHeader&&e.jsxs("div",{className:"flex items-center gap-3 border-b px-5 py-4",style:{borderColor:o.secondary},children:[u&&e.jsx("img",{src:u,alt:"Logo",className:"max-h-6 w-auto object-contain",loading:"lazy"}),e.jsx("span",{className:"text-xs font-semibold tracking-wider",children:s.companyName})]}),e.jsxs("div",{className:"space-y-6 p-6",children:[r.showProgressBar&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex justify-between text-[10px] font-semibold text-slate-400",children:[e.jsx("span",{children:"Progress"}),e.jsx("span",{children:"35%"})]}),e.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-slate-100",children:e.jsx("div",{className:"h-full w-[35%] rounded-full",style:{backgroundColor:o.accent}})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"flex items-start gap-1.5 text-sm font-bold leading-snug",children:[r.showQuestionNumbers&&e.jsx("span",{className:"font-medium text-slate-400",children:"Q1."}),e.jsx("span",{children:s.surveyTitle}),r.showRequiredAsterisk&&e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("p",{className:"text-[11px] text-slate-400",children:"How would you rate your overall experience?"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:[1,2,3,4,5].map(n=>e.jsx("div",{className:`flex h-9 items-center justify-center border text-xs font-semibold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:n===1?{backgroundColor:o.secondary,borderColor:o.primary,color:o.primary}:{backgroundColor:o.background,borderColor:o.secondary,color:o.text},children:n},n))})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t bg-slate-50/50 px-6 py-4",children:[r.showBackButton&&e.jsx("span",{className:`border px-3 py-1.5 text-[10px] font-semibold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:{borderColor:o.secondary,color:o.text},children:c.back}),e.jsx("div",{className:"flex-1"}),r.showNextButton&&e.jsx("span",{className:`px-4 py-1.5 text-[10px] font-bold ${r.borderStyle==="pill"?"rounded-full":r.borderStyle==="sharp"?"rounded-none":"rounded-lg"}`,style:{backgroundColor:o.primary,color:o.buttonText},children:c.next})]})]})});export{h as PreviewMock};
@@ -0,0 +1 @@
1
+ import{u as m,j as e,T as R,S as C,R as d,C as i,N as t,a as z,M as A}from"./index-DWWkuRUU.js";import"./vendor-BwkXDkd3.js";function b({values:n,onPatch:r}){return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{label:"Label text color",value:n.columnLabelColor,onChange:a=>r({columnLabelColor:a})}),e.jsx(i,{label:"Label background",value:n.columnLabelBgColor,onChange:a=>r({columnLabelBgColor:a})})]})}function k({values:n,onPatch:r}){return e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"space-y-1 sm:col-span-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Min hint label"}),e.jsx("input",{className:"w-full rounded-lg border border-white/10 bg-slate-950/50 px-3 py-2 text-sm text-white",value:n.hintMinText,onChange:a=>r({hintMinText:a.target.value})})]}),e.jsxs("label",{className:"space-y-1 sm:col-span-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Max hint label"}),e.jsx("input",{className:"w-full rounded-lg border border-white/10 bg-slate-950/50 px-3 py-2 text-sm text-white",value:n.hintMaxText,onChange:a=>r({hintMaxText:a.target.value})})]}),e.jsx(i,{label:"Hint text color",value:n.hintLabelColor,onChange:a=>r({hintLabelColor:a})}),e.jsx(i,{label:"Hint label background",value:n.hintLabelBgColor,onChange:a=>r({hintLabelBgColor:a})})]})}function j({values:n,onPatch:r,count:a=11}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{label:"Number label style",value:n.numberLabelMode,onChange:c=>r({numberLabelMode:c}),options:[{value:"traffic",label:"Traffic light (default)"},{value:"monochrome",label:"Monochrome (one color)"},{value:"individual",label:"Individual per number"}]}),n.numberLabelMode==="monochrome"&&e.jsx(i,{label:"Monochrome color",value:n.monochromeNumberColor,onChange:c=>r({monochromeNumberColor:c})}),n.numberLabelMode==="individual"&&e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:Array.from({length:a},(c,h)=>e.jsx(i,{label:`#${h}`,value:n.individualNumberColors[h]??"#9CA3AF",onChange:v=>{const u=[...n.individualNumberColors];u[h]=v,r({individualNumberColors:u})}},h))})]})}function s({title:n,children:r}){return e.jsxs("div",{className:"space-y-3 rounded-xl border border-white/5 bg-slate-950/20 p-4",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:n}),r]})}function O({type:n,activeFormat:r}){const a=m(l=>l.config.questionTypes[n]),c=m(l=>l.updateQuestionType),h=m(l=>l.previewMultiStatementByType),v=m(l=>l.setPreviewMultiStatementForType),u=m(l=>l.heatmapPreviewPin);if(!a)return e.jsx("p",{className:"text-sm text-slate-500",children:"No configuration available for this type."});const o=l=>c(n,l),f=A.includes(n),y=!!h[n],x=r.includes("star"),g=r.includes("emoji"),T=r.includes("numbered"),w=r.includes("drag"),S=r.includes("dropdown"),M=r.includes("radio"),B=r==="CFM_bipolar",N=r.includes("graphics"),p=g||x||T||M,P=a.optionStyle??a.cardStyle??"outlined",L=a.buttonStyle??"numbered";return e.jsxs("div",{className:"space-y-4",children:[f&&e.jsx(R,{label:"Preview multiple statements",checked:y,onChange:l=>v(n,l)}),n==="MCQ"&&"optionGap"in a&&e.jsx(s,{title:"Option style",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(C,{label:"Option style",value:a.optionStyle??a.cardStyle??"outlined",onChange:l=>o({optionStyle:l}),options:[{value:"outlined",label:"Outlined"},{value:"filled",label:"Filled"},{value:"minimal",label:"Minimal"}]}),e.jsx(d,{label:"Option gap",value:a.optionGap,onChange:l=>o({optionGap:l}),min:0,max:32}),e.jsx(d,{label:"Border radius",value:a.borderRadius,onChange:l=>o({borderRadius:l}),min:0,max:24}),e.jsx(d,{label:"Option padding",value:a.optionPadding??12,onChange:l=>o({optionPadding:l}),min:4,max:24}),e.jsx(i,{label:"Hover border",value:a.hoverBorderColor,onChange:l=>o({hoverBorderColor:l})}),P==="filled"&&e.jsx(i,{label:"Unselected fill color",value:a.filledOptionBg??"#F9FAFB",onChange:l=>o({filledOptionBg:l})})]})}),n==="TEXTFIELD"&&"defaultPlaceholder"in a&&e.jsx(s,{title:"Text input",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"space-y-1 sm:col-span-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Default placeholder"}),e.jsx("input",{className:"w-full rounded-lg border border-white/10 bg-slate-950/50 px-3 py-2 text-sm text-white",value:a.defaultPlaceholder,onChange:l=>o({defaultPlaceholder:l.target.value})})]}),e.jsx(t,{label:"Input radius (px)",value:a.inputRadius,onChange:l=>o({inputRadius:l}),min:0,max:24}),e.jsx(i,{label:"Border color",value:a.borderColor,onChange:l=>o({borderColor:l})}),e.jsx(i,{label:"Placeholder color",value:a.placeholderColor,onChange:l=>o({placeholderColor:l})}),e.jsx(t,{label:"Input height (px)",value:a.inputHeight,onChange:l=>o({inputHeight:l}),min:32,max:64}),e.jsx(t,{label:"Input padding (px)",value:a.inputPadding,onChange:l=>o({inputPadding:l}),min:8,max:24})]})}),n==="NPS_SCALE"&&"buttonStyle"in a&&e.jsxs(e.Fragment,{children:[e.jsxs(s,{title:"NPS buttons",children:[e.jsx(C,{label:"Button style",value:a.buttonStyle,onChange:l=>o({buttonStyle:l}),options:[{value:"standard",label:"Radio"},{value:"numbered",label:"Numbered badges"}]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Selected cell and focus ring come from Theme → Question card."})]}),e.jsx(s,{title:"Hint labels",children:e.jsx(k,{values:a,onPatch:o})}),L==="numbered"&&e.jsx(s,{title:"Number labels",children:e.jsx(j,{values:a,onPatch:o})}),e.jsx(s,{title:"Track & cells",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(t,{label:"Cell size (px)",value:a.cellSize,onChange:l=>o({cellSize:l}),min:24,max:56}),e.jsx(t,{label:"Cell gap (px)",value:a.cellGap,onChange:l=>o({cellGap:l}),min:0,max:16}),e.jsx(i,{label:"Track bar",value:a.trackBarColor,onChange:l=>o({trackBarColor:l})}),e.jsx(i,{label:"Track highlight",value:a.trackHighlightColor,onChange:l=>o({trackHighlightColor:l})})]})})]}),n==="CFM_MATRIX"&&"rowLabelWidth"in a&&e.jsxs(e.Fragment,{children:[e.jsx(s,{title:"Matrix layout",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(t,{label:"Row label width (px)",value:a.rowLabelWidth,onChange:l=>o({rowLabelWidth:l}),min:120,max:280}),B&&e.jsx(t,{label:"Bipolar column width (%)",value:a.bipolarColumnWidthPercent,onChange:l=>o({bipolarColumnWidthPercent:l}),min:15,max:40}),e.jsx(t,{label:"Cell padding (px)",value:a.cellPadding,onChange:l=>o({cellPadding:l}),min:4,max:24})]})}),e.jsx(s,{title:"Label items",children:e.jsx(b,{values:a,onPatch:o})})]}),n==="CSAT_MATRIX"&&"emojiSize"in a&&e.jsxs(e.Fragment,{children:[(g||p||x)&&e.jsxs(s,{title:`${z.CSAT_MATRIX} — ${r.replace("CSAT_","")}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g&&e.jsx(t,{label:"Emoji size (px)",value:a.emojiSize,onChange:l=>o({emojiSize:l}),min:16,max:40}),x&&e.jsx(i,{label:"Star color",value:a.accentColor,onChange:l=>o({accentColor:l})}),p&&e.jsx(d,{label:"Unselected opacity",value:Math.round(a.unselectedOpacity*100),onChange:l=>o({unselectedOpacity:l/100}),min:10,max:100})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Selected cell color and focus ring come from Theme → Question card. Column labels appear above stars in the star format preview."})]}),e.jsxs(s,{title:"Label items",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Applies to column header labels in the preview layout for this format."}),e.jsx(b,{values:a,onPatch:o})]}),N&&e.jsx(s,{title:"Graphics track",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{label:"Track color",value:a.graphicsTrackColor,onChange:l=>o({graphicsTrackColor:l})}),e.jsx(i,{label:"Thumb color",value:a.graphicsThumbColor,onChange:l=>o({graphicsThumbColor:l})})]})}),T&&e.jsx(s,{title:"Number labels",children:e.jsx(j,{values:a,onPatch:o,count:10})})]}),n==="RATING_MATRIX"&&"unselectedStarOpacity"in a&&e.jsxs(e.Fragment,{children:[(g||p||x)&&e.jsxs(s,{title:`Rating — ${r.replace("RATING_","")}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g&&e.jsx(t,{label:"Emoji size (px)",value:a.emojiSize,onChange:l=>o({emojiSize:l}),min:16,max:40}),x&&e.jsx(i,{label:"Star color",value:a.starColor,onChange:l=>o({starColor:l})}),p&&e.jsx(d,{label:"Unselected opacity",value:Math.round(a.unselectedStarOpacity*100),onChange:l=>o({unselectedStarOpacity:l/100}),min:10,max:100})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Selected cell color and focus ring come from Theme → Question card."})]}),e.jsxs(s,{title:"Label items",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Applies to anchor label pills where the preview already shows them — not numeric column headers."}),e.jsx(b,{values:a,onPatch:o})]}),N&&e.jsx(s,{title:"Graphics track",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{label:"Track color",value:a.graphicsTrackColor,onChange:l=>o({graphicsTrackColor:l})}),e.jsx(i,{label:"Thumb color",value:a.graphicsThumbColor,onChange:l=>o({graphicsThumbColor:l})})]})}),T&&e.jsx(s,{title:"Number labels",children:e.jsx(j,{values:a,onPatch:o,count:10})})]}),n==="SLIDER_MATRIX"&&"trackColor"in a&&e.jsxs(e.Fragment,{children:[e.jsx(s,{title:"Slider track",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{label:"Track",value:a.trackColor,onChange:l=>o({trackColor:l})}),e.jsx(i,{label:"Thumb",value:a.thumbColor,onChange:l=>o({thumbColor:l})}),e.jsx(t,{label:"Row label width (px)",value:a.rowLabelWidth,onChange:l=>o({rowLabelWidth:l}),min:120,max:280}),e.jsx(i,{label:"Row band",value:a.rowBandColor,onChange:l=>o({rowBandColor:l})}),e.jsx(t,{label:"Tick badge size (px)",value:a.tickBadgeSize,onChange:l=>o({tickBadgeSize:l}),min:20,max:40})]})}),e.jsx(s,{title:"Anchor hint labels",children:e.jsx(k,{values:a,onPatch:o})}),e.jsx(s,{title:"Tick label items",children:e.jsx(b,{values:a,onPatch:o})}),e.jsx(s,{title:"Tick number labels",children:e.jsx(j,{values:a,onPatch:o,count:11})})]}),n==="FILE_UPLOAD"&&"dropzoneStyle"in a&&e.jsx(s,{title:"Dropzone",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(C,{label:"Dropzone border",value:a.dropzoneStyle,onChange:l=>o({dropzoneStyle:l}),options:[{value:"dashed",label:"Dashed"},{value:"solid",label:"Solid"}]}),e.jsx(i,{label:"Border color",value:a.borderColor??a.accentColor,onChange:l=>o({borderColor:l})}),e.jsx(i,{label:"Fill color",value:a.dropzoneFillColor,onChange:l=>o({dropzoneFillColor:l})}),e.jsx(t,{label:"Padding (px)",value:a.dropzonePadding,onChange:l=>o({dropzonePadding:l}),min:12,max:48})]})}),n==="TEXT_AND_MEDIA"&&"mediaMaxWidth"in a&&e.jsx(s,{title:"Text & media",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{label:"Media max width (%)",value:a.mediaMaxWidth,onChange:l=>o({mediaMaxWidth:l}),min:50,max:100}),e.jsx(d,{label:"Media corner radius",value:a.mediaRadius,onChange:l=>o({mediaRadius:l}),min:0,max:24}),e.jsx(i,{label:"Caption color",value:a.captionColor,onChange:l=>o({captionColor:l})}),e.jsx(t,{label:"Caption size (px)",value:a.captionSize,onChange:l=>o({captionSize:l}),min:10,max:24})]})}),n==="HEATMAP"&&"pinColor"in a&&e.jsx(s,{title:"Heatmap pin",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{label:"Pin color",value:a.pinColor,onChange:l=>o({pinColor:l})}),e.jsx(i,{label:"Pin border",value:a.pinBorderColor,onChange:l=>o({pinBorderColor:l})}),e.jsx(d,{label:"Pin size",value:a.pinSize,onChange:l=>o({pinSize:l}),min:8,max:32}),e.jsx(d,{label:"Overlay opacity",value:Math.round(a.overlayOpacity*100),onChange:l=>o({overlayOpacity:l/100}),min:0,max:80}),e.jsxs("p",{className:"text-xs text-slate-500 sm:col-span-2",children:["Click the heatmap image in the preview to place a pin and see styling update live. Pin preview position: ",Math.round(u.x*100),"%, ",Math.round(u.y*100),"%"]})]})}),n==="RANK_ORDER"&&"drag"in a&&e.jsx(s,{title:w?"Drag & drop":S?"Dropdown rank":"Rank order",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[w&&e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"Item background",value:a.drag.itemBg,onChange:l=>o({drag:{...a.drag,itemBg:l}})}),e.jsx(i,{label:"Drag handle",value:a.drag.dragHandleColor,onChange:l=>o({drag:{...a.drag,dragHandleColor:l}})}),e.jsx(i,{label:"Rank badge",value:a.drag.rankBadgeColor,onChange:l=>o({drag:{...a.drag,rankBadgeColor:l}})})]}),S&&e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"Item background",value:a.dropdown.itemBg,onChange:l=>o({dropdown:{...a.dropdown,itemBg:l}})}),e.jsx(i,{label:"List hover background",value:a.dropdown.itemHoverBg??"#F3F4F6",onChange:l=>o({dropdown:{...a.dropdown,itemHoverBg:l}})}),e.jsx(i,{label:"Select border",value:a.dropdown.selectBorderColor,onChange:l=>o({dropdown:{...a.dropdown,selectBorderColor:l}})}),e.jsx(i,{label:"Rank badge",value:a.dropdown.rankBadgeColor,onChange:l=>o({dropdown:{...a.dropdown,rankBadgeColor:l}})})]})]})})]})}export{O as TypePanel};