@revova/hydrogen 1.0.1 → 1.1.0
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/README.md +87 -124
- package/dist/index.cjs +1139 -853
- package/dist/index.d.cts +52 -61
- package/dist/index.d.ts +52 -61
- package/dist/index.js +1112 -826
- package/dist/styles.css +629 -0
- package/package.json +4 -3
package/dist/styles.css
ADDED
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
/* @revova/hydrogen — widget styles
|
|
2
|
+
Import once in your app: import '@revova/hydrogen/styles.css' */
|
|
3
|
+
|
|
4
|
+
/* ── Tokens ─────────────────────────────────────────────────────────────── */
|
|
5
|
+
.rv-widget {
|
|
6
|
+
--rv-primary: #111827;
|
|
7
|
+
--rv-star: #f59e0b;
|
|
8
|
+
--rv-star-empty: #e5e7eb;
|
|
9
|
+
--rv-text: #111827;
|
|
10
|
+
--rv-sub: #6b7280;
|
|
11
|
+
--rv-bg: #ffffff;
|
|
12
|
+
--rv-border: #e5e7eb;
|
|
13
|
+
--rv-radius: 10px;
|
|
14
|
+
--rv-radius-lg: 16px;
|
|
15
|
+
--rv-shadow-sm: 0 1px 4px rgba(0,0,0,.04);
|
|
16
|
+
--rv-shadow: 0 4px 24px rgba(0,0,0,.08);
|
|
17
|
+
--rv-shadow-lg: 0 20px 60px rgba(0,0,0,.18);
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
color: var(--rv-text);
|
|
21
|
+
width: 100%;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
.rv-widget *, .rv-widget *::before, .rv-widget *::after { box-sizing: border-box; }
|
|
25
|
+
|
|
26
|
+
/* ── Animations ─────────────────────────────────────────────────────────── */
|
|
27
|
+
@keyframes rv-spin { to { transform: rotate(360deg); } }
|
|
28
|
+
@keyframes rv-ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
|
|
29
|
+
@keyframes rv-modal { from { opacity:0; transform: translateY(14px) scale(.98); }
|
|
30
|
+
to { opacity:1; transform: translateY(0) scale(1); } }
|
|
31
|
+
@keyframes rv-fade-up { from { opacity:0; transform: translateY(8px); }
|
|
32
|
+
to { opacity:1; transform: translateY(0); } }
|
|
33
|
+
@keyframes rv-dist { from { width: 0; } }
|
|
34
|
+
|
|
35
|
+
/* ── Loading / empty ────────────────────────────────────────────────────── */
|
|
36
|
+
.rv-loading {
|
|
37
|
+
display: flex; align-items: center; justify-content: center;
|
|
38
|
+
gap: 8px; padding: 32px 16px;
|
|
39
|
+
color: var(--rv-sub); font-size: 14px;
|
|
40
|
+
}
|
|
41
|
+
.rv-spinner {
|
|
42
|
+
width: 20px; height: 20px; border-radius: 50%;
|
|
43
|
+
border: 2px solid var(--rv-border); border-top-color: var(--rv-primary);
|
|
44
|
+
animation: rv-spin .7s linear infinite; flex-shrink: 0;
|
|
45
|
+
}
|
|
46
|
+
.rv-empty {
|
|
47
|
+
text-align: center; padding: 40px 16px;
|
|
48
|
+
color: var(--rv-sub); font-size: 14px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ── Stars ──────────────────────────────────────────────────────────────── */
|
|
52
|
+
.rv-stars {
|
|
53
|
+
display: inline-flex; gap: 2px; line-height: 1;
|
|
54
|
+
}
|
|
55
|
+
.rv-stars svg { display: block; flex-shrink: 0; }
|
|
56
|
+
|
|
57
|
+
/* ── Summary bar ────────────────────────────────────────────────────────── */
|
|
58
|
+
.rv-summary {
|
|
59
|
+
display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
|
|
60
|
+
padding: 24px 28px;
|
|
61
|
+
background: var(--rv-bg); border: 1px solid var(--rv-border);
|
|
62
|
+
border-radius: var(--rv-radius-lg); margin-bottom: 20px;
|
|
63
|
+
box-shadow: var(--rv-shadow-sm);
|
|
64
|
+
}
|
|
65
|
+
.rv-summary__gauge {
|
|
66
|
+
position: relative; width: 120px; height: 120px; flex-shrink: 0;
|
|
67
|
+
}
|
|
68
|
+
.rv-summary__gauge svg { display: block; }
|
|
69
|
+
.rv-summary__gauge-inner {
|
|
70
|
+
position: absolute; inset: 0;
|
|
71
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
72
|
+
gap: 2px; pointer-events: none;
|
|
73
|
+
}
|
|
74
|
+
.rv-summary__score { font-size: 32px; font-weight: 800; line-height: 1; }
|
|
75
|
+
.rv-summary__out-of { font-size: 11px; color: var(--rv-sub); }
|
|
76
|
+
.rv-summary__info { display: flex; flex-direction: column; gap: 7px; }
|
|
77
|
+
.rv-summary__count { font-size: 15px; font-weight: 600; margin: 0; }
|
|
78
|
+
.rv-summary__verified {
|
|
79
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
80
|
+
background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0;
|
|
81
|
+
border-radius: 99px; padding: 5px 13px; font-size: 12px; font-weight: 500;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
}
|
|
84
|
+
.rv-summary__divider {
|
|
85
|
+
width: 1px; height: 80px; background: var(--rv-border);
|
|
86
|
+
flex-shrink: 0; align-self: center;
|
|
87
|
+
}
|
|
88
|
+
.rv-dist { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; }
|
|
89
|
+
.rv-dist__row {
|
|
90
|
+
display: flex; align-items: center; gap: 10px;
|
|
91
|
+
font-size: 13px; color: var(--rv-sub);
|
|
92
|
+
}
|
|
93
|
+
.rv-dist__row > span:first-child { width: 10px; text-align: right; }
|
|
94
|
+
.rv-dist__bar-wrap {
|
|
95
|
+
flex: 1; height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
.rv-dist__bar {
|
|
98
|
+
height: 100%; background: var(--rv-star); border-radius: 4px;
|
|
99
|
+
transition: width .4s ease;
|
|
100
|
+
}
|
|
101
|
+
.rv-dist__count { width: 20px; text-align: right; font-size: 12px; }
|
|
102
|
+
|
|
103
|
+
/* ── AI summary ─────────────────────────────────────────────────────────── */
|
|
104
|
+
.rv-ai-summary {
|
|
105
|
+
display: flex; gap: 12px; align-items: flex-start;
|
|
106
|
+
background: #fffbeb; border: 1px solid #fde68a;
|
|
107
|
+
border-radius: var(--rv-radius); padding: 14px 16px; margin-bottom: 16px;
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
}
|
|
110
|
+
.rv-ai-summary__icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
|
|
111
|
+
.rv-ai-summary__label { font-weight: 700; margin-bottom: 4px; font-size: 12px; color: #92400e; }
|
|
112
|
+
.rv-ai-summary__text { margin: 0; color: var(--rv-text); line-height: 1.5; }
|
|
113
|
+
|
|
114
|
+
/* ── Toolbar ────────────────────────────────────────────────────────────── */
|
|
115
|
+
.rv-toolbar {
|
|
116
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
117
|
+
gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
|
|
118
|
+
}
|
|
119
|
+
.rv-sort-wrap {
|
|
120
|
+
display: inline-flex; align-items: center; gap: 8px;
|
|
121
|
+
border: 1px solid var(--rv-border); border-radius: 99px;
|
|
122
|
+
padding: 9px 16px; background: var(--rv-bg); cursor: pointer;
|
|
123
|
+
color: var(--rv-sub); font-size: 13px; font-weight: 500;
|
|
124
|
+
}
|
|
125
|
+
.rv-sort-wrap select {
|
|
126
|
+
background: transparent; border: none; outline: none;
|
|
127
|
+
font: inherit; color: inherit; cursor: pointer; padding: 0;
|
|
128
|
+
appearance: none; -webkit-appearance: none;
|
|
129
|
+
}
|
|
130
|
+
.rv-sort-wrap svg { flex-shrink: 0; }
|
|
131
|
+
|
|
132
|
+
/* ── Buttons ────────────────────────────────────────────────────────────── */
|
|
133
|
+
.rv-btn {
|
|
134
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
135
|
+
padding: 10px 22px; border-radius: 99px; font-size: 14px; font-weight: 600;
|
|
136
|
+
cursor: pointer; border: none; text-decoration: none;
|
|
137
|
+
transition: opacity .15s; white-space: nowrap; font-family: inherit;
|
|
138
|
+
}
|
|
139
|
+
.rv-btn--primary { background: var(--rv-primary); color: #fff; }
|
|
140
|
+
.rv-btn--primary:hover { opacity: .85; }
|
|
141
|
+
.rv-btn--outline {
|
|
142
|
+
background: transparent; color: var(--rv-primary);
|
|
143
|
+
border: 1px solid var(--rv-primary);
|
|
144
|
+
}
|
|
145
|
+
.rv-btn--outline:hover { background: #f9fafb; }
|
|
146
|
+
.rv-btn--sm { padding: 6px 16px; font-size: 12px; }
|
|
147
|
+
.rv-btn:disabled { opacity: .45; cursor: not-allowed; }
|
|
148
|
+
.rv-btn--submit {
|
|
149
|
+
width: 100%; padding: 16px; background: #1a6b3c; color: #fff;
|
|
150
|
+
border: none; border-radius: 14px; font-size: 16px; font-weight: 700;
|
|
151
|
+
cursor: pointer; transition: background .15s; margin-top: 4px; font-family: inherit;
|
|
152
|
+
}
|
|
153
|
+
.rv-btn--submit:hover { background: #155c33; }
|
|
154
|
+
.rv-btn--submit:disabled { opacity: .5; cursor: not-allowed; }
|
|
155
|
+
|
|
156
|
+
/* ── Review list / grid ─────────────────────────────────────────────────── */
|
|
157
|
+
.rv-list { display: flex; flex-direction: column; gap: 16px; }
|
|
158
|
+
.rv-grid {
|
|
159
|
+
display: grid; grid-template-columns: repeat(auto-fill, minmax(380px,1fr)); gap: 16px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* ── Review card ────────────────────────────────────────────────────────── */
|
|
163
|
+
.rv-card {
|
|
164
|
+
background: var(--rv-bg); border: 1px solid var(--rv-border);
|
|
165
|
+
border-radius: var(--rv-radius-lg); padding: 20px;
|
|
166
|
+
display: flex; gap: 14px; box-shadow: var(--rv-shadow-sm);
|
|
167
|
+
}
|
|
168
|
+
.rv-card__avatar {
|
|
169
|
+
width: 44px; height: 44px; border-radius: 50%;
|
|
170
|
+
display: flex; align-items: center; justify-content: center;
|
|
171
|
+
font-weight: 700; font-size: 17px; color: #fff; flex-shrink: 0; user-select: none;
|
|
172
|
+
}
|
|
173
|
+
.rv-card__content {
|
|
174
|
+
flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px;
|
|
175
|
+
}
|
|
176
|
+
.rv-card__top { display: flex; align-items: flex-start; gap: 8px; }
|
|
177
|
+
.rv-card__author-col { flex: 1; min-width: 0; }
|
|
178
|
+
.rv-card__author-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
|
|
179
|
+
.rv-card__author { font-weight: 700; font-size: 14px; }
|
|
180
|
+
.rv-card__dot { color: var(--rv-sub); }
|
|
181
|
+
.rv-card__date { font-size: 13px; color: var(--rv-sub); }
|
|
182
|
+
.rv-card__badges {
|
|
183
|
+
display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px;
|
|
184
|
+
}
|
|
185
|
+
.rv-badge--verified {
|
|
186
|
+
display: inline-flex; align-items: center; gap: 5px;
|
|
187
|
+
background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0;
|
|
188
|
+
border-radius: 99px; padding: 3px 11px; font-size: 12px; font-weight: 500;
|
|
189
|
+
white-space: nowrap;
|
|
190
|
+
}
|
|
191
|
+
.rv-badge--pinned {
|
|
192
|
+
display: inline-flex; align-items: center;
|
|
193
|
+
background: #fef3c7; color: #92400e;
|
|
194
|
+
border-radius: 99px; padding: 3px 11px; font-size: 12px; font-weight: 500;
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
}
|
|
197
|
+
.rv-card__title { font-weight: 700; font-size: 15px; margin: 2px 0 0; }
|
|
198
|
+
.rv-card__body { font-size: 14px; line-height: 1.6; margin: 0; }
|
|
199
|
+
.rv-card__variant { font-size: 12px; color: var(--rv-sub); }
|
|
200
|
+
.rv-card__translated { font-size: 12px; color: var(--rv-sub); }
|
|
201
|
+
.rv-card__media { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
|
|
202
|
+
.rv-card__media-img, .rv-card__media-vid {
|
|
203
|
+
width: 72px; height: 72px; object-fit: cover;
|
|
204
|
+
border-radius: calc(var(--rv-radius) / 1.5); cursor: pointer;
|
|
205
|
+
}
|
|
206
|
+
.rv-card__media-vid { background: #000; }
|
|
207
|
+
.rv-card__reply {
|
|
208
|
+
background: #f9fafb; border-left: 3px solid var(--rv-border);
|
|
209
|
+
border-radius: 0 var(--rv-radius) var(--rv-radius) 0;
|
|
210
|
+
padding: 10px 12px; margin-top: 4px; font-size: 13px;
|
|
211
|
+
}
|
|
212
|
+
.rv-card__reply-label { font-weight: 600; font-size: 12px; color: var(--rv-sub); margin-bottom: 4px; }
|
|
213
|
+
.rv-card__footer {
|
|
214
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
215
|
+
gap: 8px; margin-top: 4px; flex-wrap: wrap;
|
|
216
|
+
}
|
|
217
|
+
.rv-card__tags { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
|
|
218
|
+
.rv-tag {
|
|
219
|
+
display: inline-flex; align-items: center; gap: 5px;
|
|
220
|
+
background: #f3f4f6; border: 1px solid var(--rv-border);
|
|
221
|
+
border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 500;
|
|
222
|
+
white-space: nowrap; color: var(--rv-text);
|
|
223
|
+
}
|
|
224
|
+
.rv-tag svg { color: var(--rv-sub); flex-shrink: 0; }
|
|
225
|
+
.rv-helpful {
|
|
226
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
227
|
+
font-size: 13px; color: var(--rv-sub); background: none;
|
|
228
|
+
border: none; cursor: pointer; padding: 0; white-space: nowrap;
|
|
229
|
+
transition: color .15s;
|
|
230
|
+
}
|
|
231
|
+
.rv-helpful:hover { color: var(--rv-text); }
|
|
232
|
+
.rv-helpful--voted { color: #16a34a; cursor: default; }
|
|
233
|
+
.rv-helpful--voted svg { fill: #16a34a; stroke: #16a34a; }
|
|
234
|
+
|
|
235
|
+
/* ── Pagination ─────────────────────────────────────────────────────────── */
|
|
236
|
+
.rv-pagination {
|
|
237
|
+
display: flex; align-items: center; justify-content: center;
|
|
238
|
+
gap: 8px; margin-top: 24px;
|
|
239
|
+
}
|
|
240
|
+
.rv-pagination__info { font-size: 13px; color: var(--rv-sub); }
|
|
241
|
+
|
|
242
|
+
/* ── Modal ──────────────────────────────────────────────────────────────── */
|
|
243
|
+
.rv-overlay {
|
|
244
|
+
position: fixed; inset: 0; background: rgba(0,0,0,.5);
|
|
245
|
+
z-index: 9998; display: flex; align-items: center; justify-content: center;
|
|
246
|
+
padding: 16px; opacity: 0; pointer-events: none; transition: opacity .2s;
|
|
247
|
+
}
|
|
248
|
+
.rv-overlay--open { opacity: 1; pointer-events: auto; }
|
|
249
|
+
.rv-modal {
|
|
250
|
+
background: #fff; border-radius: 20px; max-width: 680px; width: 100%;
|
|
251
|
+
max-height: 90dvh; overflow-y: auto; position: relative;
|
|
252
|
+
box-shadow: var(--rv-shadow-lg);
|
|
253
|
+
animation: rv-modal .22s cubic-bezier(.22,1,.36,1) both;
|
|
254
|
+
}
|
|
255
|
+
.rv-modal__nav {
|
|
256
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
257
|
+
padding: 16px 20px; border-bottom: 1px solid var(--rv-border); gap: 12px;
|
|
258
|
+
position: sticky; top: 0; background: #fff; z-index: 10;
|
|
259
|
+
}
|
|
260
|
+
.rv-modal__nav-btn {
|
|
261
|
+
width: 36px; height: 36px; border-radius: 50%; border: none;
|
|
262
|
+
background: #f3f4f6; display: flex; align-items: center; justify-content: center;
|
|
263
|
+
cursor: pointer; color: var(--rv-sub); transition: background .15s; flex-shrink: 0;
|
|
264
|
+
}
|
|
265
|
+
.rv-modal__nav-btn:hover { background: #e5e7eb; }
|
|
266
|
+
.rv-modal__nav-title { font-size: 16px; font-weight: 700; flex: 1; text-align: center; }
|
|
267
|
+
.rv-product-strip {
|
|
268
|
+
display: flex; align-items: center; gap: 12px;
|
|
269
|
+
padding: 14px 20px; background: #f9fafb; border-bottom: 1px solid var(--rv-border);
|
|
270
|
+
}
|
|
271
|
+
.rv-product-strip__img {
|
|
272
|
+
width: 52px; height: 52px; border-radius: 8px;
|
|
273
|
+
object-fit: cover; flex-shrink: 0; border: 1px solid var(--rv-border);
|
|
274
|
+
}
|
|
275
|
+
.rv-product-strip__name { font-weight: 600; font-size: 14px; line-height: 1.3; }
|
|
276
|
+
.rv-product-strip__variant { font-size: 12px; color: var(--rv-sub); margin-top: 2px; }
|
|
277
|
+
.rv-modal__body { padding: 24px 24px 32px; }
|
|
278
|
+
|
|
279
|
+
/* ── Form ───────────────────────────────────────────────────────────────── */
|
|
280
|
+
.rv-form { display: flex; flex-direction: column; gap: 16px; }
|
|
281
|
+
.rv-field { display: flex; flex-direction: column; gap: 7px; }
|
|
282
|
+
.rv-label {
|
|
283
|
+
font-size: 14px; font-weight: 600; color: var(--rv-text);
|
|
284
|
+
display: flex; align-items: center; gap: 5px;
|
|
285
|
+
}
|
|
286
|
+
.rv-label__required { color: #dc2626; }
|
|
287
|
+
.rv-label__hint { font-weight: 400; color: var(--rv-sub); font-size: 12px; }
|
|
288
|
+
.rv-input, .rv-textarea {
|
|
289
|
+
width: 100%; padding: 10px 14px; font-size: 14px; color: var(--rv-text);
|
|
290
|
+
background: #f6f6f7; border: 1px solid #e3e3e3; border-radius: 8px;
|
|
291
|
+
outline: none; font-family: inherit; transition: border-color .15s;
|
|
292
|
+
}
|
|
293
|
+
.rv-input::placeholder, .rv-textarea::placeholder { color: #9ca3af; }
|
|
294
|
+
.rv-input:focus, .rv-textarea:focus { border-color: var(--rv-primary); background: #fff; }
|
|
295
|
+
.rv-textarea { resize: vertical; min-height: 110px; }
|
|
296
|
+
.rv-input--icon { padding-left: 40px; }
|
|
297
|
+
.rv-input-wrap { position: relative; }
|
|
298
|
+
.rv-input-wrap__icon {
|
|
299
|
+
position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
|
|
300
|
+
color: #9ca3af; pointer-events: none; flex-shrink: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Star rating input */
|
|
304
|
+
.rv-star-input { display: flex; gap: 4px; align-items: center; }
|
|
305
|
+
.rv-star-input__hint { font-size: 13px; color: #9ca3af; margin-left: 8px; }
|
|
306
|
+
.rv-star-btn {
|
|
307
|
+
background: none; border: none; cursor: pointer; padding: 2px;
|
|
308
|
+
transition: transform .1s;
|
|
309
|
+
}
|
|
310
|
+
.rv-star-btn:hover { transform: scale(1.1); }
|
|
311
|
+
.rv-star-btn svg { display: block; }
|
|
312
|
+
|
|
313
|
+
/* Scale */
|
|
314
|
+
.rv-scale { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
315
|
+
.rv-scale__btn {
|
|
316
|
+
padding: 8px 14px; border: 1.5px solid var(--rv-border); border-radius: 10px;
|
|
317
|
+
background: #fff; cursor: pointer; font-size: 13px; font-weight: 500;
|
|
318
|
+
transition: background .12s, border-color .12s, color .12s; font-family: inherit;
|
|
319
|
+
}
|
|
320
|
+
.rv-scale__btn--active { background: var(--rv-primary); color: #fff; border-color: var(--rv-primary); }
|
|
321
|
+
.rv-scale__labels {
|
|
322
|
+
display: flex; justify-content: space-between; font-size: 11px; color: var(--rv-sub);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Option pills */
|
|
326
|
+
.rv-options { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
327
|
+
.rv-option-pill {
|
|
328
|
+
display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
|
|
329
|
+
font-size: 14px; padding: 10px 18px; border: 1.5px solid var(--rv-border);
|
|
330
|
+
border-radius: 10px; background: #fff; transition: border-color .12s, background .12s;
|
|
331
|
+
user-select: none;
|
|
332
|
+
}
|
|
333
|
+
.rv-option-pill:hover { border-color: #9ca3af; }
|
|
334
|
+
.rv-option-pill--checked { border-color: var(--rv-primary); background: #f9fafb; font-weight: 600; }
|
|
335
|
+
.rv-option-pill--disabled { opacity: .45; cursor: not-allowed; }
|
|
336
|
+
.rv-option-pill input { display: none; }
|
|
337
|
+
|
|
338
|
+
/* Boolean toggle */
|
|
339
|
+
.rv-toggle-row { display: flex; align-items: center; gap: 10px; }
|
|
340
|
+
.rv-toggle {
|
|
341
|
+
width: 44px; height: 24px; border-radius: 999px; border: none;
|
|
342
|
+
background: #d1d5db; cursor: pointer; position: relative;
|
|
343
|
+
transition: background .2s; flex-shrink: 0;
|
|
344
|
+
}
|
|
345
|
+
.rv-toggle--on { background: var(--rv-primary); }
|
|
346
|
+
.rv-toggle__knob {
|
|
347
|
+
position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
|
|
348
|
+
border-radius: 50%; background: #fff; transition: left .2s;
|
|
349
|
+
}
|
|
350
|
+
.rv-toggle--on .rv-toggle__knob { left: 23px; }
|
|
351
|
+
.rv-toggle__label { cursor: pointer; font-size: 14px; }
|
|
352
|
+
|
|
353
|
+
/* Media upload */
|
|
354
|
+
.rv-photo-strip { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
355
|
+
.rv-photo-cell {
|
|
356
|
+
width: 72px; height: 72px; border-radius: 8px; border: 1.5px dashed var(--rv-border);
|
|
357
|
+
display: flex; align-items: center; justify-content: center; overflow: hidden;
|
|
358
|
+
background: #f9fafb; cursor: pointer; position: relative;
|
|
359
|
+
transition: border-color .15s;
|
|
360
|
+
}
|
|
361
|
+
.rv-photo-cell:hover { border-color: #9ca3af; }
|
|
362
|
+
.rv-photo-cell img, .rv-photo-cell video { width: 100%; height: 100%; object-fit: cover; }
|
|
363
|
+
.rv-photo-cell--filled { border-style: solid; border-color: var(--rv-border); cursor: default; }
|
|
364
|
+
.rv-photo-remove {
|
|
365
|
+
position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
|
|
366
|
+
border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: none;
|
|
367
|
+
cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center;
|
|
368
|
+
}
|
|
369
|
+
.rv-photo-add-icon { font-size: 22px; color: #9ca3af; }
|
|
370
|
+
|
|
371
|
+
/* Anon row */
|
|
372
|
+
.rv-anon {
|
|
373
|
+
display: flex; align-items: center; gap: 8px; cursor: pointer;
|
|
374
|
+
font-size: 14px; color: var(--rv-sub);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* Error / success */
|
|
378
|
+
.rv-error {
|
|
379
|
+
font-size: 13px; color: #dc2626; background: #fef2f2;
|
|
380
|
+
border: 1px solid #fecaca; border-radius: 10px; padding: 10px 14px;
|
|
381
|
+
}
|
|
382
|
+
.rv-success {
|
|
383
|
+
text-align: center; padding: 40px 16px;
|
|
384
|
+
}
|
|
385
|
+
.rv-success__icon { font-size: 48px; }
|
|
386
|
+
.rv-success__title { font-weight: 700; font-size: 20px; margin: 12px 0 6px; }
|
|
387
|
+
.rv-success__sub { color: var(--rv-sub); font-size: 14px; }
|
|
388
|
+
|
|
389
|
+
/* ── Carousel ───────────────────────────────────────────────────────────── */
|
|
390
|
+
.rv-carousel { position: relative; overflow: hidden; }
|
|
391
|
+
.rv-carousel__inner {
|
|
392
|
+
display: flex; gap: 16px; align-items: stretch;
|
|
393
|
+
padding: 4px 2px; overflow: hidden;
|
|
394
|
+
}
|
|
395
|
+
.rv-carousel__slide { flex: 0 0 100%; }
|
|
396
|
+
.rv-carousel__nav {
|
|
397
|
+
position: absolute; top: 50%; transform: translateY(-60%);
|
|
398
|
+
width: 36px; height: 36px; border-radius: 50%;
|
|
399
|
+
border: 1px solid var(--rv-border); background: var(--rv-bg);
|
|
400
|
+
cursor: pointer; display: flex; align-items: center; justify-content: center;
|
|
401
|
+
z-index: 10; box-shadow: 0 1px 6px rgba(0,0,0,.1); color: var(--rv-text);
|
|
402
|
+
transition: background .15s, border-color .15s;
|
|
403
|
+
}
|
|
404
|
+
.rv-carousel__nav:hover { background: var(--rv-primary); border-color: var(--rv-primary); color: #fff; }
|
|
405
|
+
.rv-carousel__nav:disabled { opacity: .3; cursor: default; }
|
|
406
|
+
.rv-carousel__nav--prev { left: -18px; }
|
|
407
|
+
.rv-carousel__nav--next { right: -18px; }
|
|
408
|
+
.rv-carousel__dots {
|
|
409
|
+
display: flex; justify-content: center; gap: 6px; margin-top: 14px;
|
|
410
|
+
}
|
|
411
|
+
.rv-carousel__dot {
|
|
412
|
+
width: 8px; height: 8px; border-radius: 99px; background: var(--rv-border);
|
|
413
|
+
border: none; cursor: pointer; padding: 0; transition: background .2s, width .2s;
|
|
414
|
+
}
|
|
415
|
+
.rv-carousel__dot--active { background: var(--rv-primary); width: 20px; }
|
|
416
|
+
|
|
417
|
+
/* ── Gallery ────────────────────────────────────────────────────────────── */
|
|
418
|
+
.rv-gallery { columns: 3; column-gap: 8px; }
|
|
419
|
+
.rv-gallery__item {
|
|
420
|
+
break-inside: avoid; margin-bottom: 8px; position: relative;
|
|
421
|
+
cursor: pointer; border-radius: var(--rv-radius); overflow: hidden; display: block;
|
|
422
|
+
border: none; padding: 0; background: none; width: 100%;
|
|
423
|
+
}
|
|
424
|
+
.rv-gallery__img { width: 100%; display: block; transition: transform .2s; }
|
|
425
|
+
.rv-gallery__item:hover .rv-gallery__img { transform: scale(1.03); }
|
|
426
|
+
.rv-gallery__stars,
|
|
427
|
+
.rv-gallery__overlay {
|
|
428
|
+
position: absolute; bottom: 6px; left: 6px;
|
|
429
|
+
background: rgba(0,0,0,.55); border-radius: 4px; padding: 2px 7px;
|
|
430
|
+
}
|
|
431
|
+
.rv-lightbox {
|
|
432
|
+
position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 99999;
|
|
433
|
+
display: flex; align-items: center; justify-content: center; padding: 16px;
|
|
434
|
+
animation: rv-fade-up .2s ease;
|
|
435
|
+
}
|
|
436
|
+
.rv-lightbox__card {
|
|
437
|
+
background: #fff; border-radius: 16px; max-width: 520px; width: 100%;
|
|
438
|
+
overflow: hidden; position: relative;
|
|
439
|
+
}
|
|
440
|
+
.rv-lightbox__img { width: 100%; display: block; max-height: 320px; object-fit: cover; }
|
|
441
|
+
.rv-lightbox__body { padding: 16px; }
|
|
442
|
+
.rv-lightbox__close {
|
|
443
|
+
position: absolute; top: 10px; right: 10px; width: 32px; height: 32px;
|
|
444
|
+
border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none;
|
|
445
|
+
cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* ── Ticker ─────────────────────────────────────────────────────────────── */
|
|
449
|
+
.rv-ticker-wrap { overflow: hidden; position: relative; }
|
|
450
|
+
.rv-ticker__track {
|
|
451
|
+
display: flex; gap: 32px; width: max-content;
|
|
452
|
+
}
|
|
453
|
+
.rv-ticker__item {
|
|
454
|
+
display: flex; gap: 10px; align-items: center; min-width: 220px; flex-shrink: 0;
|
|
455
|
+
}
|
|
456
|
+
.rv-ticker__avatar {
|
|
457
|
+
width: 34px; height: 34px; border-radius: 50%;
|
|
458
|
+
display: flex; align-items: center; justify-content: center;
|
|
459
|
+
font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
|
|
460
|
+
}
|
|
461
|
+
.rv-ticker__content { display: flex; flex-direction: column; gap: 3px; }
|
|
462
|
+
.rv-ticker__body {
|
|
463
|
+
font-size: 13px; overflow: hidden; white-space: nowrap;
|
|
464
|
+
max-width: 200px; text-overflow: ellipsis; margin: 0;
|
|
465
|
+
}
|
|
466
|
+
.rv-ticker__author { font-size: 11px; color: var(--rv-sub); }
|
|
467
|
+
|
|
468
|
+
/* ── Trust badge ────────────────────────────────────────────────────────── */
|
|
469
|
+
.rv-trust-badge { display: inline-flex; }
|
|
470
|
+
.rv-trust-badge--pill {
|
|
471
|
+
align-items: center; gap: 6px;
|
|
472
|
+
background: var(--rv-bg); border: 1px solid var(--rv-border);
|
|
473
|
+
border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600;
|
|
474
|
+
}
|
|
475
|
+
.rv-trust-badge--inline { align-items: center; gap: 6px; font-size: 14px; }
|
|
476
|
+
.rv-trust-badge--card {
|
|
477
|
+
flex-direction: column; align-items: center; gap: 6px;
|
|
478
|
+
padding: 18px 28px; background: var(--rv-bg); border-radius: 14px;
|
|
479
|
+
box-shadow: var(--rv-shadow); text-align: center;
|
|
480
|
+
}
|
|
481
|
+
.rv-trust-badge__score { font-size: 34px; font-weight: 800; line-height: 1; }
|
|
482
|
+
.rv-trust-badge__count { font-size: 13px; color: var(--rv-sub); }
|
|
483
|
+
|
|
484
|
+
/* ── Social proof popup ─────────────────────────────────────────────────── */
|
|
485
|
+
.rv-popup {
|
|
486
|
+
position: fixed; z-index: 99998;
|
|
487
|
+
background: var(--rv-bg); border-radius: 14px;
|
|
488
|
+
box-shadow: 0 4px 20px rgba(0,0,0,.13); padding: 12px 14px;
|
|
489
|
+
max-width: 290px; display: flex; gap: 10px; align-items: flex-start;
|
|
490
|
+
animation: rv-fade-up .3s ease;
|
|
491
|
+
}
|
|
492
|
+
.rv-popup--bottom-left { bottom: 20px; left: 20px; }
|
|
493
|
+
.rv-popup--bottom-right { bottom: 20px; right: 20px; }
|
|
494
|
+
.rv-popup__avatar {
|
|
495
|
+
width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
|
|
496
|
+
display: flex; align-items: center; justify-content: center;
|
|
497
|
+
font-weight: 700; font-size: 16px; color: #fff;
|
|
498
|
+
}
|
|
499
|
+
.rv-popup__avatar--img { object-fit: cover; }
|
|
500
|
+
.rv-popup__content { flex: 1; min-width: 0; }
|
|
501
|
+
.rv-popup__body {
|
|
502
|
+
font-size: 13px; line-height: 1.4; margin: 4px 0;
|
|
503
|
+
overflow: hidden; display: -webkit-box;
|
|
504
|
+
-webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
|
505
|
+
}
|
|
506
|
+
.rv-popup__author { font-size: 11px; color: var(--rv-sub); }
|
|
507
|
+
.rv-popup__meta { font-size: 11px; color: var(--rv-sub); }
|
|
508
|
+
.rv-popup__close,
|
|
509
|
+
.rv-popup__dismiss {
|
|
510
|
+
background: none; border: none; cursor: pointer;
|
|
511
|
+
color: #9ca3af; padding: 0; flex-shrink: 0; line-height: 1;
|
|
512
|
+
display: flex; align-items: center; justify-content: center;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/* ── Floating tab ───────────────────────────────────────────────────────── */
|
|
516
|
+
.rv-tab__btn {
|
|
517
|
+
position: fixed; z-index: 9997; top: 50%;
|
|
518
|
+
padding: 10px 14px; border: none; cursor: pointer;
|
|
519
|
+
writing-mode: vertical-rl; text-orientation: mixed;
|
|
520
|
+
font-size: 13px; font-weight: 600; color: #fff;
|
|
521
|
+
transition: opacity .15s;
|
|
522
|
+
}
|
|
523
|
+
.rv-tab__btn:hover { opacity: .9; }
|
|
524
|
+
.rv-tab__btn--right {
|
|
525
|
+
right: 0; transform: translateY(-50%) rotate(180deg);
|
|
526
|
+
border-radius: 8px 0 0 8px;
|
|
527
|
+
}
|
|
528
|
+
.rv-tab__btn--left {
|
|
529
|
+
left: 0; transform: translateY(-50%);
|
|
530
|
+
border-radius: 0 8px 8px 0;
|
|
531
|
+
}
|
|
532
|
+
.rv-tab__panel {
|
|
533
|
+
position: fixed; z-index: 99997; top: 50%; transform: translateY(-50%);
|
|
534
|
+
background: var(--rv-bg); box-shadow: var(--rv-shadow-lg);
|
|
535
|
+
width: 300px; max-height: 80vh; overflow-y: auto;
|
|
536
|
+
padding: 20px; border-radius: 12px;
|
|
537
|
+
visibility: hidden; pointer-events: none; opacity: 0; transition: opacity .2s;
|
|
538
|
+
}
|
|
539
|
+
.rv-tab__panel--open { visibility: visible; pointer-events: auto; opacity: 1; }
|
|
540
|
+
.rv-tab__panel--right { right: 0; border-radius: 12px 0 0 12px; }
|
|
541
|
+
.rv-tab__panel--left { left: 0; border-radius: 0 12px 12px 0; }
|
|
542
|
+
.rv-tab__panel-header {
|
|
543
|
+
display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
|
|
544
|
+
}
|
|
545
|
+
.rv-tab__panel-title { font-size: 15px; font-weight: 700; margin: 0; }
|
|
546
|
+
.rv-tab__close {
|
|
547
|
+
background: none; border: none; cursor: pointer; font-size: 20px; color: var(--rv-sub);
|
|
548
|
+
}
|
|
549
|
+
.rv-tab__stats { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
|
|
550
|
+
.rv-tab__stats-text { font-size: 13px; color: var(--rv-sub); }
|
|
551
|
+
.rv-tab__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
|
|
552
|
+
.rv-tab__item { border-bottom: 1px solid var(--rv-border); padding: 12px 0; }
|
|
553
|
+
.rv-tab__item:last-child { border-bottom: none; padding-bottom: 0; }
|
|
554
|
+
.rv-tab__reviews { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
|
|
555
|
+
.rv-tab__review-item { border-bottom: 1px solid var(--rv-border); padding-bottom: 12px; }
|
|
556
|
+
.rv-tab__review-item:last-child { border-bottom: none; padding-bottom: 0; }
|
|
557
|
+
|
|
558
|
+
/* ── Floating button ────────────────────────────────────────────────────── */
|
|
559
|
+
.rv-fab {
|
|
560
|
+
position: fixed; z-index: 9996; display: flex; align-items: center; gap: 8px;
|
|
561
|
+
padding: 14px 20px; border: none; border-radius: 999px;
|
|
562
|
+
font-size: 14px; font-weight: 600; cursor: pointer; color: #fff;
|
|
563
|
+
box-shadow: 0 4px 20px rgba(0,0,0,.2); transition: opacity .15s, transform .15s;
|
|
564
|
+
}
|
|
565
|
+
.rv-fab:hover { opacity: .9; transform: translateY(-1px); }
|
|
566
|
+
.rv-fab--bottom-right { bottom: 20px; right: 20px; }
|
|
567
|
+
.rv-fab--bottom-left { bottom: 20px; left: 20px; }
|
|
568
|
+
.rv-fab--top-right { top: 20px; right: 20px; }
|
|
569
|
+
.rv-fab--top-left { top: 20px; left: 20px; }
|
|
570
|
+
|
|
571
|
+
/* ── Q&A ────────────────────────────────────────────────────────────────── */
|
|
572
|
+
.rv-qna { display: flex; flex-direction: column; gap: 20px; }
|
|
573
|
+
.rv-qna__header {
|
|
574
|
+
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
575
|
+
}
|
|
576
|
+
.rv-qna__title { margin: 0; font-size: 18px; font-weight: 700; }
|
|
577
|
+
.rv-qna__list { display: flex; flex-direction: column; gap: 16px; list-style: none; padding: 0; margin: 0; }
|
|
578
|
+
.rv-qna__item {
|
|
579
|
+
background: var(--rv-bg); border: 1px solid var(--rv-border);
|
|
580
|
+
border-radius: var(--rv-radius-lg); padding: 16px; box-shadow: var(--rv-shadow-sm);
|
|
581
|
+
}
|
|
582
|
+
.rv-qna__question-row { display: flex; gap: 12px; align-items: flex-start; }
|
|
583
|
+
.rv-qna__question-body { flex: 1; min-width: 0; }
|
|
584
|
+
.rv-qna__question-text { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
|
|
585
|
+
.rv-qna__q-mark {
|
|
586
|
+
width: 24px; height: 24px; border-radius: 50%; background: var(--rv-primary); color: #fff;
|
|
587
|
+
display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
|
|
588
|
+
flex-shrink: 0; margin-top: 1px;
|
|
589
|
+
}
|
|
590
|
+
.rv-qna__a-mark {
|
|
591
|
+
width: 24px; height: 24px; border-radius: 50%; background: #e5e7eb; color: var(--rv-sub);
|
|
592
|
+
display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
|
|
593
|
+
flex-shrink: 0; margin-top: 1px;
|
|
594
|
+
}
|
|
595
|
+
.rv-qna__a-mark--store { background: #dbeafe; color: #1d4ed8; }
|
|
596
|
+
.rv-qna__meta { font-size: 12px; color: var(--rv-sub); }
|
|
597
|
+
.rv-qna__q { font-weight: 600; font-size: 14px; margin: 0 0 6px; }
|
|
598
|
+
.rv-qna__q-meta { font-size: 12px; color: var(--rv-sub); }
|
|
599
|
+
.rv-qna__answers { list-style: none; padding: 10px 0 0 36px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
|
|
600
|
+
.rv-qna__answer { display: flex; gap: 10px; align-items: flex-start; }
|
|
601
|
+
.rv-qna__answer-body { flex: 1; min-width: 0; }
|
|
602
|
+
.rv-qna__answer-text { font-size: 14px; margin: 0 0 4px; }
|
|
603
|
+
.rv-qna__store-label { font-weight: 700; font-size: 12px; color: #1d4ed8; }
|
|
604
|
+
.rv-qna__answer-meta { font-size: 12px; color: var(--rv-sub); }
|
|
605
|
+
.rv-qna__admin-badge {
|
|
606
|
+
display: inline-flex; align-items: center; gap: 4px;
|
|
607
|
+
background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
|
|
608
|
+
border-radius: 99px; padding: 2px 8px; font-size: 11px; font-weight: 600;
|
|
609
|
+
}
|
|
610
|
+
.rv-qna__form { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #f9fafb; border-radius: var(--rv-radius); border: 1px solid var(--rv-border); }
|
|
611
|
+
|
|
612
|
+
/* ── Count badge ────────────────────────────────────────────────────────── */
|
|
613
|
+
.rv-count-badge { display: inline-flex; align-items: center; gap: 6px; }
|
|
614
|
+
.rv-count-badge__score { font-size: 14px; font-weight: 700; }
|
|
615
|
+
.rv-count-badge__total { font-size: 13px; color: var(--rv-sub); }
|
|
616
|
+
.rv-count-badge__text { font-size: 13px; color: var(--rv-sub); }
|
|
617
|
+
|
|
618
|
+
/* ── Responsive ─────────────────────────────────────────────────────────── */
|
|
619
|
+
@media (max-width: 640px) {
|
|
620
|
+
.rv-summary { gap: 14px; padding: 18px; }
|
|
621
|
+
.rv-summary__divider { display: none; }
|
|
622
|
+
.rv-summary__gauge { width: 96px; height: 96px; }
|
|
623
|
+
.rv-summary__score { font-size: 26px; }
|
|
624
|
+
.rv-card { gap: 10px; padding: 14px; }
|
|
625
|
+
.rv-card__avatar { width: 38px; height: 38px; font-size: 14px; }
|
|
626
|
+
.rv-gallery { columns: 2; }
|
|
627
|
+
.rv-tab__panel { max-width: 80vw; }
|
|
628
|
+
.rv-modal__body { padding: 16px; }
|
|
629
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revova/hydrogen",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Official Revova review widgets for Shopify Hydrogen storefronts",
|
|
5
5
|
"author": "Revova",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"require": "./dist/index.cjs",
|
|
15
15
|
"types": "./dist/index.d.ts"
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./styles.css": "./dist/styles.css"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist"
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"access": "public"
|
|
23
24
|
},
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
26
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean && node -e \"require('fs').copyFileSync('src/styles.css','dist/styles.css')\"",
|
|
26
27
|
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
27
28
|
"typecheck": "tsc --noEmit",
|
|
28
29
|
"lint": "eslint src --ext .ts,.tsx"
|