@opengovsg/confetti 0.1.2 → 0.1.4

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.
@@ -36,6 +36,7 @@
36
36
  --confetti-disabled-button-opacity: 0.6;
37
37
  }
38
38
 
39
+ /* Popover Confetti CSS classes */
39
40
  .confetti-dialog {
40
41
  width: var(--confetti-max-width);
41
42
  max-height: 95dvh;
@@ -84,6 +85,72 @@
84
85
  }
85
86
  }
86
87
 
88
+ /* Modal Confetti CSS classes */
89
+ .confetti-modal-overlay {
90
+ position: fixed;
91
+ inset: 0;
92
+ z-index: var(--confetti-z-index);
93
+ background: rgba(0, 0, 0, 0.4);
94
+ display: flex;
95
+ justify-content: center;
96
+ overflow-y: auto;
97
+ overscroll-behavior: none;
98
+ padding: 10vh 0;
99
+ }
100
+
101
+ .confetti-modal {
102
+ margin: auto;
103
+
104
+ .confetti-modal-dialog {
105
+ width: var(--confetti-max-width);
106
+ max-width: 100%;
107
+ position: relative;
108
+ box-shadow: var(--confetti-box-shadow);
109
+ border: 1px solid var(--confetti-border-color);
110
+ border-radius: var(--confetti-border-radius);
111
+ background: var(--confetti-background-color);
112
+ padding: var(--confetti-box-padding);
113
+
114
+ &:focus-visible {
115
+ outline: none;
116
+ }
117
+
118
+ .confetti-modal-dialog-close {
119
+ position: absolute;
120
+ top: 8px;
121
+ right: 8px;
122
+ background: transparent;
123
+ border: none;
124
+ cursor: pointer;
125
+ padding: 8px;
126
+ border-radius: 8px;
127
+ transition: background 200ms;
128
+
129
+ & svg {
130
+ width: 16px;
131
+ height: 16px;
132
+ color: var(--confetti-text-subtle-color);
133
+ }
134
+
135
+ &:hover {
136
+ background: rgba(0, 0, 0, 0.05);
137
+ }
138
+
139
+ &:focus-visible {
140
+ outline: 2px solid var(--confetti-outline-color);
141
+ outline-offset: 2px;
142
+ }
143
+ }
144
+
145
+ /* Adjust title padding to accommodate close button */
146
+ .cf-header {
147
+ .cf-title {
148
+ padding-right: 20px;
149
+ }
150
+ }
151
+ }
152
+ }
153
+
87
154
  .confetti {
88
155
  font-family: var(--confetti-font-family);
89
156
  display: flex;
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as MultiSelectQuestionProperties, c as StatementQuestionProperties, i as PublicGetSurveyOutput, l as TextQuestionProperties, n as ConfettiState, o as RatingQuestionProperties, r as Question, s as SingleSelectQuestionProperties, t as Answer } from "./types-BnnL5f51.js";
2
2
  import * as react0 from "react";
3
3
  import { HTMLAttributes, PropsWithChildren } from "react";
4
- import * as react_jsx_runtime3 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/core/ConfettiController.d.ts
7
7
  interface ConfettiControllerProps {
@@ -19,7 +19,7 @@ declare const ConfettiController: ({
19
19
  shouldAutoSubmit,
20
20
  onFinished,
21
21
  children
22
- }: ConfettiControllerProps) => react_jsx_runtime3.JSX.Element;
22
+ }: ConfettiControllerProps) => react_jsx_runtime4.JSX.Element;
23
23
  //#endregion
24
24
  //#region src/core/ConfettiProvider.d.ts
25
25
  interface ConfettiContextValue {
@@ -54,7 +54,7 @@ declare const ConfettiProvider: ({
54
54
  metadata,
55
55
  isSurveyVisible: isSurveyVisibleInput,
56
56
  apiBaseUrl
57
- }: ConfettiProviderProps) => react_jsx_runtime3.JSX.Element | null;
57
+ }: ConfettiProviderProps) => react_jsx_runtime4.JSX.Element | null;
58
58
  declare const useConfetti: () => ConfettiContextValue;
59
59
  //#endregion
60
60
  //#region src/components/Confetti.d.ts
@@ -64,7 +64,7 @@ declare const Confetti: ({
64
64
  onFinished,
65
65
  shouldAutoSubmit,
66
66
  ...props
67
- }: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) => react_jsx_runtime3.JSX.Element;
67
+ }: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) => react_jsx_runtime4.JSX.Element;
68
68
  //#endregion
69
69
  //#region src/components/ThankYouMessage.d.ts
70
70
  interface ThankYouMessageProps {
@@ -81,7 +81,31 @@ declare const ThankYouMessage: ({
81
81
  title,
82
82
  description,
83
83
  classNames
84
- }: ThankYouMessageProps) => react_jsx_runtime3.JSX.Element | null;
84
+ }: ThankYouMessageProps) => react_jsx_runtime4.JSX.Element | null;
85
+ //#endregion
86
+ //#region src/components/container/ModalContainer.d.ts
87
+ interface ModalContainerProps {
88
+ closeOnFinishMs?: number | null;
89
+ isDismissable?: boolean;
90
+ classNames?: {
91
+ overlay?: string;
92
+ modal?: string;
93
+ dialog?: string;
94
+ closeButton?: string;
95
+ icon?: string;
96
+ };
97
+ onDismiss?: () => void;
98
+ children: React.ReactNode | ((props: {
99
+ setIsFinished: () => void;
100
+ }) => React.ReactNode);
101
+ }
102
+ declare const ModalContainer: ({
103
+ children,
104
+ classNames,
105
+ onDismiss,
106
+ isDismissable,
107
+ closeOnFinishMs
108
+ }: ModalContainerProps) => react_jsx_runtime4.JSX.Element;
85
109
  //#endregion
86
110
  //#region src/components/container/PopoverContainer.d.ts
87
111
  interface PopoverContainerProps {
@@ -103,7 +127,7 @@ declare const PopoverContainer: ({
103
127
  containerProps,
104
128
  onDismiss,
105
129
  closeOnFinishMs
106
- }: PopoverContainerProps) => react_jsx_runtime3.JSX.Element;
130
+ }: PopoverContainerProps) => react_jsx_runtime4.JSX.Element;
107
131
  //#endregion
108
132
  //#region src/components/questions/types.d.ts
109
133
  type Question$1 = PublicGetSurveyOutput['questions'][number];
@@ -126,7 +150,7 @@ declare const SurveyQuestionFactory: ({
126
150
  question,
127
151
  onChange,
128
152
  error
129
- }: SurveyQuestionFactoryProps) => react_jsx_runtime3.JSX.Element;
153
+ }: SurveyQuestionFactoryProps) => react_jsx_runtime4.JSX.Element;
130
154
  //#endregion
131
155
  //#region src/components/questions/Rating.d.ts
132
156
  interface RatingProps extends BaseFieldProps {
@@ -161,7 +185,7 @@ declare const Rating: ({
161
185
  id,
162
186
  error,
163
187
  required
164
- }: RatingProps) => react_jsx_runtime3.JSX.Element;
188
+ }: RatingProps) => react_jsx_runtime4.JSX.Element;
165
189
  //#endregion
166
190
  //#region src/components/questions/FreeText.d.ts
167
191
  interface FreeTextProps extends BaseFieldProps {
@@ -185,7 +209,7 @@ declare const FreeText: ({
185
209
  classNames,
186
210
  required,
187
211
  error
188
- }: FreeTextProps) => react_jsx_runtime3.JSX.Element;
212
+ }: FreeTextProps) => react_jsx_runtime4.JSX.Element;
189
213
  //#endregion
190
214
  //#region src/components/questions/SingleChoice.d.ts
191
215
  interface SingleChoiceProps extends BaseFieldProps {
@@ -215,7 +239,7 @@ declare const SingleChoice: ({
215
239
  id,
216
240
  required,
217
241
  error
218
- }: SingleChoiceProps) => react_jsx_runtime3.JSX.Element;
242
+ }: SingleChoiceProps) => react_jsx_runtime4.JSX.Element;
219
243
  //#endregion
220
244
  //#region src/components/questions/MultiChoice.d.ts
221
245
  interface MultiChoiceProps extends BaseFieldProps {
@@ -248,7 +272,7 @@ declare const MultiChoice: ({
248
272
  id,
249
273
  required,
250
274
  error
251
- }: MultiChoiceProps) => react_jsx_runtime3.JSX.Element;
275
+ }: MultiChoiceProps) => react_jsx_runtime4.JSX.Element;
252
276
  //#endregion
253
277
  //#region src/components/questions/Statement.d.ts
254
278
  interface StatementProps extends BaseFieldProps {
@@ -266,7 +290,7 @@ declare const Statement: ({
266
290
  title,
267
291
  description,
268
292
  classNames
269
- }: StatementProps) => react_jsx_runtime3.JSX.Element;
293
+ }: StatementProps) => react_jsx_runtime4.JSX.Element;
270
294
  //#endregion
271
295
  //#region src/components/presentation/Flow.d.ts
272
296
  type ChildField = (_: {
@@ -285,7 +309,7 @@ declare const Flow: ({
285
309
  children,
286
310
  question,
287
311
  isLastQuestion
288
- }: FlowProps) => react_jsx_runtime3.JSX.Element;
312
+ }: FlowProps) => react_jsx_runtime4.JSX.Element;
289
313
  //#endregion
290
314
  //#region src/components/presentation/Embed.d.ts
291
315
  declare const Embed: ({
@@ -295,10 +319,23 @@ declare const Embed: ({
295
319
  }: PropsWithChildren<{
296
320
  isCompleted: boolean;
297
321
  onSubmit: () => void;
298
- }>) => react_jsx_runtime3.JSX.Element;
322
+ }>) => react_jsx_runtime4.JSX.Element;
299
323
  //#endregion
300
324
  //#region src/templates/EmbeddedConfetti.d.ts
301
- declare const EmbeddedConfetti: (props: ConfettiProps) => react_jsx_runtime3.JSX.Element;
325
+ declare const EmbeddedConfetti: (props: ConfettiProps) => react_jsx_runtime4.JSX.Element;
326
+ //#endregion
327
+ //#region src/templates/ModalConfetti.d.ts
328
+ interface ModalConfettiProps extends ConfettiProps {
329
+ closeOnFinishMs?: number | null;
330
+ onDismiss?: () => void;
331
+ isDismissable?: boolean;
332
+ }
333
+ declare const ModalConfetti: ({
334
+ onDismiss,
335
+ closeOnFinishMs,
336
+ isDismissable,
337
+ ...props
338
+ }: ModalConfettiProps) => react_jsx_runtime4.JSX.Element;
302
339
  //#endregion
303
340
  //#region src/templates/PopoverConfetti.d.ts
304
341
  interface PopoverConfettiProps extends ConfettiProps {
@@ -318,10 +355,10 @@ declare const PopoverConfetti: ({
318
355
  onDismiss,
319
356
  closeOnFinishMs,
320
357
  ...props
321
- }: PopoverConfettiProps) => react_jsx_runtime3.JSX.Element;
358
+ }: PopoverConfettiProps) => react_jsx_runtime4.JSX.Element;
322
359
  //#endregion
323
360
  //#region src/templates/StepperConfetti.d.ts
324
- declare const StepperConfetti: (props: ConfettiProps) => react_jsx_runtime3.JSX.Element;
361
+ declare const StepperConfetti: (props: ConfettiProps) => react_jsx_runtime4.JSX.Element;
325
362
  //#endregion
326
363
  //#region src/hooks/useVisibleAfterDelay.d.ts
327
364
  interface UseVisibleAfterDelayOptions {
@@ -363,5 +400,4 @@ declare const useVisibleAfterScroll: ({
363
400
  isVisible: boolean;
364
401
  };
365
402
  //#endregion
366
- export { type Answer, Confetti, ConfettiContext, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, Embed, EmbeddedConfetti, Flow, FreeText, type FreeTextProps, MultiChoice, type MultiChoiceProps, PopoverConfetti, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, StepperConfetti, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useConfetti, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };
367
- //# sourceMappingURL=index.d.ts.map
403
+ export { type Answer, Confetti, ConfettiContext, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, Embed, EmbeddedConfetti, Flow, FreeText, type FreeTextProps, ModalConfetti, ModalContainer, type ModalContainerProps, MultiChoice, type MultiChoiceProps, PopoverConfetti, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, StepperConfetti, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useConfetti, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };