@opengovsg/confetti 0.0.0-snapshot-20260130164049
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/LICENSE +13 -0
- package/README.md +94 -0
- package/build/confetti.css +486 -0
- package/build/index.d.ts +341 -0
- package/build/index.js +1367 -0
- package/build/internals.d.ts +14 -0
- package/build/internals.js +3 -0
- package/build/routing-DjtQKwsR.js +59 -0
- package/build/types-wal5J7b-.d.ts +184 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Except for any logos, trade marks, service marks, names, insignias, emblems, the Singapore state crest and Singapore national coat of arms, and/or any other graphic, image or sound which is used to identify any Singapore public sector agency or is associated with any Singapore public sector agency, or which belongs to a third party such as Shutterstock, Inc., and/or any asset or code identified by the Government Technology Agency (“GovTech”) as not licensed to you (such identification may come in the form of a filename labelled with “restricted” or similar phrasing, or via code comments), the contents of this repository are provided under the MIT License SUBJECT FURTHER TO THE FOLLOWING:
|
|
2
|
+
|
|
3
|
+
(1) The MIT License and the terms herein (collectively, the “Terms”) shall be governed by the laws of Singapore. Any dispute arising out of or in connection with the Terms, including any question regarding its existence, validity or termination, shall be referred to and finally resolved by arbitration administered by the Singapore International Arbitration Centre (“SIAC”) in accordance with the Arbitration Rules of the Singapore International Arbitration Centre (“SIAC Rules”) for the time being in force, which rules are deemed to be incorporated by reference in this clause. The seat of arbitration shall be Singapore. The Tribunal shall consist of one (1) arbitrator. The language of the arbitration shall be English.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright 2025 Government Technology Agency.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @opengovsg/confetti
|
|
2
|
+
|
|
3
|
+
Embeddable React survey widget for collecting user feedback.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@opengovsg/confetti)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# npm
|
|
11
|
+
npm install @opengovsg/confetti
|
|
12
|
+
|
|
13
|
+
# yarn
|
|
14
|
+
yarn add @opengovsg/confetti
|
|
15
|
+
|
|
16
|
+
# pnpm
|
|
17
|
+
pnpm add @opengovsg/confetti
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Peer Dependencies
|
|
21
|
+
|
|
22
|
+
This package requires React 18.2.0+ or React 19:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install react@^18.2.0
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
1. Import the CSS file in your application entry point:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import '@opengovsg/confetti/confetti.css'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. Add the widget to your page:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { PopoverConfetti } from '@opengovsg/confetti'
|
|
40
|
+
|
|
41
|
+
function App() {
|
|
42
|
+
return (
|
|
43
|
+
<div style={{ position: 'fixed', bottom: '1rem', right: '1rem' }}>
|
|
44
|
+
<PopoverConfetti
|
|
45
|
+
surveyId="your-survey-id"
|
|
46
|
+
publishableKey="your-publishable-key"
|
|
47
|
+
metadata={{}}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Note:** You'll need the survey ID and publishable key from your Confetti dashboard. Make sure to whitelist your domain in your team settings.
|
|
55
|
+
|
|
56
|
+
3. Add Confetti to your CSP headers:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
connect-src https://confetti.hack2026.gov.sg;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Template Components
|
|
63
|
+
|
|
64
|
+
Choose the component that best fits your use case:
|
|
65
|
+
|
|
66
|
+
| Component | Use Case | Behavior |
|
|
67
|
+
| ------------------ | --------------------------------- | --------------------------------------------------------- |
|
|
68
|
+
| `EmbeddedConfetti` | Inline surveys, feedback sections | Shows questions in an inline manner with a submit button |
|
|
69
|
+
| `PopoverConfetti` | Floating feedback widgets | Dismissible popover, step-by-step questions, auto-submits |
|
|
70
|
+
| `StepperConfetti` | Guided surveys | One question at a time, auto-submits after last question |
|
|
71
|
+
|
|
72
|
+
## Visibility Hooks
|
|
73
|
+
|
|
74
|
+
Control when your survey appears with these hooks:
|
|
75
|
+
|
|
76
|
+
### useVisibleAfterDelay
|
|
77
|
+
|
|
78
|
+
Show the survey after a delay:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { useVisibleAfterDelay } from '@opengovsg/confetti'
|
|
82
|
+
|
|
83
|
+
const { isVisible } = useVisibleAfterDelay({ delay: 5000 }) // 5 seconds
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### useVisibleAfterScroll
|
|
87
|
+
|
|
88
|
+
Show the survey after scrolling a certain distance:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { useVisibleAfterScroll } from '@opengovsg/confetti'
|
|
92
|
+
|
|
93
|
+
const { isVisible } = useVisibleAfterScroll({ threshold: 500 }) // 500px
|
|
94
|
+
```
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--confetti-font-scale: 16px;
|
|
3
|
+
/* Define CSS Variables with defaults */
|
|
4
|
+
--confetti-box-padding: 20px 24px;
|
|
5
|
+
--confetti-max-width: 300px;
|
|
6
|
+
--confetti-z-index: 2147483647;
|
|
7
|
+
--confetti-border-color: #e4e4e7;
|
|
8
|
+
--confetti-border-bottom: 1.5px solid var(--confetti-border-color);
|
|
9
|
+
--confetti-border-radius: 12px;
|
|
10
|
+
--confetti-background-color: #ffffff;
|
|
11
|
+
--confetti-hover-background-color: #f5f5f5;
|
|
12
|
+
--confetti-box-shadow:
|
|
13
|
+
0 4px 6px -4px rgba(16, 24, 40, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
|
14
|
+
--confetti-focus-shadow: 0 0 0 2px rgba(9, 9, 11, 0.3);
|
|
15
|
+
--confetti-submit-button-color: #18181b;
|
|
16
|
+
--confetti-submit-button-text-color: #fafafa;
|
|
17
|
+
--confetti-rating-bg-color: white;
|
|
18
|
+
--confetti-rating-text-color: #09090b;
|
|
19
|
+
--confetti-rating-active-bg-color: #09090b;
|
|
20
|
+
--confetti-rating-active-text-color: white;
|
|
21
|
+
|
|
22
|
+
--confetti-indicator-active-bg-color: var(--confetti-rating-text-color);
|
|
23
|
+
--confetti-indicator-active-dot-color: white;
|
|
24
|
+
|
|
25
|
+
--confetti-text-primary-color: #09090b;
|
|
26
|
+
--confetti-text-subtle-color: #71717a;
|
|
27
|
+
|
|
28
|
+
/* Widget/Embedded Tab CSS Variables */
|
|
29
|
+
--confetti-widget-color: #e0a045; /* Default color */
|
|
30
|
+
--confetti-widget-text-color: white; /* Default text color (usually white for contrast) */
|
|
31
|
+
--confetti-scrollbar-thumb-color: var(--confetti-border-color);
|
|
32
|
+
--confetti-scrollbar-track-color: var(--confetti-background-color);
|
|
33
|
+
--confetti-outline-color: rgba(9, 9, 11, 0.8);
|
|
34
|
+
--confetti-input-background: white;
|
|
35
|
+
--confetti-input-text-color: #020617;
|
|
36
|
+
--confetti-disabled-button-opacity: 0.6;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.confetti-dialog {
|
|
40
|
+
width: var(--confetti-max-width);
|
|
41
|
+
max-width: 100%;
|
|
42
|
+
background: transparent;
|
|
43
|
+
position: relative;
|
|
44
|
+
|
|
45
|
+
.confetti-dialog-close {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 8px;
|
|
48
|
+
right: 8px;
|
|
49
|
+
background: transparent;
|
|
50
|
+
border: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
padding: 8px;
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
transition: background 200ms;
|
|
55
|
+
|
|
56
|
+
& svg {
|
|
57
|
+
width: 16px;
|
|
58
|
+
height: 16px;
|
|
59
|
+
color: var(--confetti-text-subtle-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background: rgba(0, 0, 0, 0.05);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
68
|
+
outline-offset: 2px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Adjust title padding to accommodate close button */
|
|
73
|
+
.cf-header {
|
|
74
|
+
.cf-title {
|
|
75
|
+
padding-right: 20px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.confetti {
|
|
81
|
+
font-family: var(--confetti-font-family);
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
padding: 24px;
|
|
84
|
+
border-radius: var(--confetti-border-radius);
|
|
85
|
+
border: 1px solid var(--confetti-border-color);
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
gap: 16px;
|
|
89
|
+
color: var(--confetti-text-primary-color);
|
|
90
|
+
font-size: var(--confetti-font-scale);
|
|
91
|
+
width: 100%;
|
|
92
|
+
background: var(--confetti-background-color);
|
|
93
|
+
|
|
94
|
+
box-shadow: var(--confetti-box-shadow);
|
|
95
|
+
|
|
96
|
+
.cf-submit-button {
|
|
97
|
+
align-self: end;
|
|
98
|
+
color: var(--confetti-submit-button-text-color);
|
|
99
|
+
background: var(--confetti-submit-button-color);
|
|
100
|
+
padding: 8px 16px;
|
|
101
|
+
border-radius: 8px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
transition: transform 200ms;
|
|
104
|
+
font-size: 0.875em;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
line-height: 20px;
|
|
107
|
+
|
|
108
|
+
transition: background 200ms ease-out;
|
|
109
|
+
|
|
110
|
+
&:focus-visible {
|
|
111
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
112
|
+
outline-offset: 2px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&[data-disabled] {
|
|
116
|
+
opacity: var(--confetti-disabled-button-opacity);
|
|
117
|
+
cursor: not-allowed;
|
|
118
|
+
transform: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:hover {
|
|
122
|
+
background: color-mix(
|
|
123
|
+
in srgb,
|
|
124
|
+
white 10%,
|
|
125
|
+
var(--confetti-submit-button-color)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:active {
|
|
130
|
+
background: color-mix(
|
|
131
|
+
in srgb,
|
|
132
|
+
white 5%,
|
|
133
|
+
var(--confetti-submit-button-color)
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.sr-only {
|
|
139
|
+
clip: rect(0, 0, 0, 0);
|
|
140
|
+
border: 0;
|
|
141
|
+
height: 1px;
|
|
142
|
+
margin: -1px;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
padding: 0;
|
|
145
|
+
position: absolute;
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
width: 1px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.cf-response-choices {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
gap: 12px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.cf-choice {
|
|
157
|
+
font-size: 1em;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
padding: 8px 10px;
|
|
160
|
+
border-radius: 6px;
|
|
161
|
+
border: 1px solid var(--confetti-border-color);
|
|
162
|
+
|
|
163
|
+
transition: background 200ms ease-out;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
background: var(--confetti-hover-background-color);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.cf-choice-label {
|
|
170
|
+
gap: 8px;
|
|
171
|
+
display: inline-flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.cf-choice-description {
|
|
176
|
+
font-size: 0.875em;
|
|
177
|
+
margin-left: 26px;
|
|
178
|
+
color: var(--confetti-text-subtle-color);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.cf-radio,
|
|
183
|
+
.cf-checkbox {
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
/* This is needed so the hidden input is positioned correctly */
|
|
188
|
+
position: relative;
|
|
189
|
+
align-items: start;
|
|
190
|
+
color: var(--confetti-text-primary-color);
|
|
191
|
+
forced-color-adjust: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.cf-checkbox {
|
|
195
|
+
--checkmark-color: var(--confetti-indicator-active-dot-color);
|
|
196
|
+
|
|
197
|
+
.cf-checkbox-indicator {
|
|
198
|
+
background: white;
|
|
199
|
+
border: 1px solid var(--confetti-border-color);
|
|
200
|
+
width: 18px;
|
|
201
|
+
height: 18px;
|
|
202
|
+
box-sizing: border-box;
|
|
203
|
+
border-radius: 4px;
|
|
204
|
+
transition: color 200ms ease-out;
|
|
205
|
+
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
svg {
|
|
213
|
+
width: calc(100% - 8px);
|
|
214
|
+
height: calc(100% - 8px);
|
|
215
|
+
fill: none;
|
|
216
|
+
stroke: var(--checkmark-color);
|
|
217
|
+
stroke-width: 3px;
|
|
218
|
+
stroke-dasharray: 22px;
|
|
219
|
+
stroke-dashoffset: 66;
|
|
220
|
+
stroke-linecap: round;
|
|
221
|
+
stroke-linejoin: round;
|
|
222
|
+
transition: all 200ms;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&[data-focus-visible='true'] {
|
|
226
|
+
.cf-checkbox-indicator {
|
|
227
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
228
|
+
outline-offset: 2px;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
&[data-selected],
|
|
232
|
+
&[data-indeterminate] {
|
|
233
|
+
.cf-checkbox-indicator {
|
|
234
|
+
background: var(--confetti-indicator-active-bg-color);
|
|
235
|
+
border: none;
|
|
236
|
+
}
|
|
237
|
+
svg {
|
|
238
|
+
stroke-dashoffset: 44;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
&[data-indeterminate] {
|
|
243
|
+
svg {
|
|
244
|
+
stroke: none;
|
|
245
|
+
fill: var(--checkmark-color);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.cf-radio {
|
|
251
|
+
-webkit-tap-highlight-color: transparent;
|
|
252
|
+
--dot-color: var(--confetti-indicator-active-dot-color);
|
|
253
|
+
|
|
254
|
+
.cf-radio-indicator {
|
|
255
|
+
position: relative;
|
|
256
|
+
width: 18px;
|
|
257
|
+
height: 18px;
|
|
258
|
+
box-sizing: border-box;
|
|
259
|
+
border-radius: 50%;
|
|
260
|
+
transition: color 200ms ease-out;
|
|
261
|
+
border: 1px solid var(--confetti-border-color);
|
|
262
|
+
background: white;
|
|
263
|
+
|
|
264
|
+
&::after {
|
|
265
|
+
content: '';
|
|
266
|
+
position: absolute;
|
|
267
|
+
inset: 1px;
|
|
268
|
+
border-radius: inherit;
|
|
269
|
+
background: transparent;
|
|
270
|
+
transition: scale 200ms;
|
|
271
|
+
scale: 0;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&[data-selected] {
|
|
276
|
+
.cf-radio-indicator {
|
|
277
|
+
background: var(--confetti-indicator-active-bg-color);
|
|
278
|
+
border-color: var(--confetti-indicator-active-bg-color);
|
|
279
|
+
|
|
280
|
+
&::after {
|
|
281
|
+
background: var(--dot-color);
|
|
282
|
+
scale: 0.4;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&[data-disabled] {
|
|
288
|
+
color: var(--text-color-disabled);
|
|
289
|
+
--dot-color: var(--text-color-disabled);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
&[data-focus-visible='true'] {
|
|
293
|
+
.cf-radio-indicator {
|
|
294
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
295
|
+
outline-offset: 2px;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.cf-input,
|
|
301
|
+
.cf-textarea {
|
|
302
|
+
background: var(--confetti-input-background);
|
|
303
|
+
border: 1px solid var(--confetti-border-color);
|
|
304
|
+
border-radius: 8px;
|
|
305
|
+
color: var(--confetti-input-text-color);
|
|
306
|
+
padding: 10px;
|
|
307
|
+
transition:
|
|
308
|
+
border-color 0.2s ease-out,
|
|
309
|
+
box-shadow 0.2s ease-out,
|
|
310
|
+
transform 0.15s ease-out;
|
|
311
|
+
|
|
312
|
+
&:focus {
|
|
313
|
+
border-color: var(--confetti-outline-color);
|
|
314
|
+
box-shadow: var(--confetti-focus-shadow);
|
|
315
|
+
outline: none;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.cf-question {
|
|
320
|
+
display: flex;
|
|
321
|
+
flex-direction: column;
|
|
322
|
+
gap: 16px;
|
|
323
|
+
|
|
324
|
+
.cf-error {
|
|
325
|
+
display: none;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.cf-header {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
gap: 2px;
|
|
332
|
+
|
|
333
|
+
.cf-title {
|
|
334
|
+
line-height: 24px;
|
|
335
|
+
font-weight: 500;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.cf-label-optional {
|
|
339
|
+
font-weight: 400;
|
|
340
|
+
color: var(--confetti-text-subtle-color);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.cf-description {
|
|
344
|
+
font-size: 0.875em;
|
|
345
|
+
line-height: 20px;
|
|
346
|
+
font-weight: 400;
|
|
347
|
+
color: var(--confetti-text-subtle-color);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.cf-others-choice {
|
|
352
|
+
display: flex;
|
|
353
|
+
flex-direction: column;
|
|
354
|
+
gap: 8px;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.cf-rating-section {
|
|
359
|
+
display: flex;
|
|
360
|
+
flex-direction: column;
|
|
361
|
+
gap: 4px;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.cf-rating-tiff {
|
|
365
|
+
overflow: hidden;
|
|
366
|
+
border-radius: 100%;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.cf-rating-tiff,
|
|
370
|
+
.cf-rating-emoji {
|
|
371
|
+
opacity: 0.5;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.cf-rating-display-tiff,
|
|
375
|
+
.cf-rating-display-star,
|
|
376
|
+
.cf-rating-display-emoji {
|
|
377
|
+
display: grid;
|
|
378
|
+
grid-template-columns: repeat(auto-fit, 40px);
|
|
379
|
+
justify-content: space-between;
|
|
380
|
+
gap: 8px;
|
|
381
|
+
|
|
382
|
+
.cf-rating-tiff,
|
|
383
|
+
.cf-rating-emoji,
|
|
384
|
+
.cf-rating-star {
|
|
385
|
+
font-size: 1em;
|
|
386
|
+
background-color: transparent;
|
|
387
|
+
border: none;
|
|
388
|
+
padding: 0;
|
|
389
|
+
transition: transform 0.15s ease-out;
|
|
390
|
+
color: var(--confetti-rating-active-bg-color);
|
|
391
|
+
|
|
392
|
+
&[data-focus-visible='true'] {
|
|
393
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
394
|
+
outline-offset: 2px;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
&:hover {
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
transform: scale(1.15);
|
|
400
|
+
opacity: 1 !important;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
&[data-filled='true'] {
|
|
404
|
+
opacity: 1;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
&[data-selected='true'] {
|
|
408
|
+
opacity: 1;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
& svg {
|
|
412
|
+
/* Smooth color transitions */
|
|
413
|
+
transition: fill 0.15s ease-out;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.cf-rating-text {
|
|
419
|
+
display: flex;
|
|
420
|
+
justify-content: space-between;
|
|
421
|
+
font-size: 0.75em;
|
|
422
|
+
color: var(--confetti-text-subtle-color);
|
|
423
|
+
font-weight: 500;
|
|
424
|
+
line-height: 1;
|
|
425
|
+
|
|
426
|
+
.cf-rating-text-lower {
|
|
427
|
+
flex: 1;
|
|
428
|
+
text-align: start;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.cf-rating-text-upper {
|
|
432
|
+
flex: 1;
|
|
433
|
+
text-align: end;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* Special classes to make previous radio filled with color when one is selected */
|
|
438
|
+
.cf-rating-display-star {
|
|
439
|
+
.cf-rating-star[data-selected='true'] ~ .cf-rating-star {
|
|
440
|
+
opacity: 0.5;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.cf-rating-display-number {
|
|
445
|
+
display: grid;
|
|
446
|
+
grid-auto-columns: 1fr;
|
|
447
|
+
grid-auto-flow: column;
|
|
448
|
+
border: 1px solid var(--confetti-border-color);
|
|
449
|
+
border-radius: 8px;
|
|
450
|
+
overflow: hidden;
|
|
451
|
+
|
|
452
|
+
.cf-rating-number {
|
|
453
|
+
border-right: 1px solid var(--confetti-border-color);
|
|
454
|
+
text-align: center;
|
|
455
|
+
cursor: pointer;
|
|
456
|
+
color: var(--confetti-rating-text-color);
|
|
457
|
+
border-left: none;
|
|
458
|
+
border-top: none;
|
|
459
|
+
border-bottom: none;
|
|
460
|
+
font-weight: 700;
|
|
461
|
+
padding: 8px 0;
|
|
462
|
+
margin-top: -1px;
|
|
463
|
+
margin-bottom: -1px;
|
|
464
|
+
|
|
465
|
+
&:first-of-type {
|
|
466
|
+
border-top-left-radius: 8px;
|
|
467
|
+
border-bottom-left-radius: 8px;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
&:last-of-type {
|
|
471
|
+
border-top-right-radius: 8px;
|
|
472
|
+
border-bottom-right-radius: 8px;
|
|
473
|
+
border-right: 0;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&[data-focus-visible='true'] {
|
|
477
|
+
box-shadow: inset 0 0 0 1px var(--confetti-outline-color);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
&[data-selected='true'] {
|
|
481
|
+
background: var(--confetti-rating-active-bg-color);
|
|
482
|
+
color: var(--confetti-rating-active-text-color);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|