gotcha-feedback 1.1.0 → 1.1.2
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 +1 -1
- package/dist/index.d.mts +138 -3
- package/dist/index.d.ts +138 -3
- package/dist/index.js +150 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ function FeatureCard() {
|
|
|
49
49
|
- **Customizable** - Themes, sizes, positions
|
|
50
50
|
- **Accessible** - Full keyboard navigation and screen reader support
|
|
51
51
|
- **Animated** - Smooth enter/exit animations with CSS transitions
|
|
52
|
-
- **Lightweight** - ~
|
|
52
|
+
- **Lightweight** - ~11KB gzipped
|
|
53
53
|
|
|
54
54
|
## Props
|
|
55
55
|
|
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,23 @@ interface GotchaStyles {
|
|
|
16
16
|
modal?: React.CSSProperties;
|
|
17
17
|
input?: React.CSSProperties;
|
|
18
18
|
submitButton?: React.CSSProperties;
|
|
19
|
+
title?: React.CSSProperties;
|
|
20
|
+
closeButton?: React.CSSProperties;
|
|
21
|
+
starRating?: React.CSSProperties;
|
|
22
|
+
star?: React.CSSProperties;
|
|
23
|
+
voteButton?: React.CSSProperties;
|
|
24
|
+
voteButtonSelected?: React.CSSProperties;
|
|
25
|
+
pollOption?: React.CSSProperties;
|
|
26
|
+
pollOptionSelected?: React.CSSProperties;
|
|
27
|
+
npsButton?: React.CSSProperties;
|
|
28
|
+
npsButtonSelected?: React.CSSProperties;
|
|
29
|
+
npsLabels?: React.CSSProperties;
|
|
30
|
+
successMessage?: React.CSSProperties;
|
|
31
|
+
successIcon?: React.CSSProperties;
|
|
32
|
+
errorMessage?: React.CSSProperties;
|
|
33
|
+
bugFlag?: React.CSSProperties;
|
|
34
|
+
backdrop?: React.CSSProperties;
|
|
35
|
+
spinner?: React.CSSProperties;
|
|
19
36
|
}
|
|
20
37
|
interface SubmitResponsePayload {
|
|
21
38
|
elementId: string;
|
|
@@ -72,6 +89,120 @@ interface ScoreData {
|
|
|
72
89
|
npsScore: number | null;
|
|
73
90
|
}
|
|
74
91
|
|
|
92
|
+
interface GotchaThemeColors {
|
|
93
|
+
primary: string;
|
|
94
|
+
primaryHover: string;
|
|
95
|
+
primaryText: string;
|
|
96
|
+
background: string;
|
|
97
|
+
backgroundGradient: string;
|
|
98
|
+
surface: string;
|
|
99
|
+
surfaceHover: string;
|
|
100
|
+
text: string;
|
|
101
|
+
textSecondary: string;
|
|
102
|
+
textDisabled: string;
|
|
103
|
+
border: string;
|
|
104
|
+
borderFocus: string;
|
|
105
|
+
success: string;
|
|
106
|
+
successSurface: string;
|
|
107
|
+
error: string;
|
|
108
|
+
errorSurface: string;
|
|
109
|
+
errorBorder: string;
|
|
110
|
+
warning: string;
|
|
111
|
+
warningActive: string;
|
|
112
|
+
warningSurface: string;
|
|
113
|
+
warningBorder: string;
|
|
114
|
+
starFilled: string;
|
|
115
|
+
starEmpty: string;
|
|
116
|
+
voteUp: string;
|
|
117
|
+
voteUpSurface: string;
|
|
118
|
+
voteUpBorder: string;
|
|
119
|
+
voteDown: string;
|
|
120
|
+
voteDownSurface: string;
|
|
121
|
+
voteDownBorder: string;
|
|
122
|
+
npsColors: string[];
|
|
123
|
+
buttonBackground: string;
|
|
124
|
+
buttonBackgroundHover: string;
|
|
125
|
+
buttonBackgroundDisabled: string;
|
|
126
|
+
buttonColor: string;
|
|
127
|
+
buttonColorDisabled: string;
|
|
128
|
+
buttonBorder: string;
|
|
129
|
+
buttonShadow: string;
|
|
130
|
+
backdropColor: string;
|
|
131
|
+
closeButton: string;
|
|
132
|
+
closeButtonHover: string;
|
|
133
|
+
closeButtonBg: string;
|
|
134
|
+
glassBackground: string;
|
|
135
|
+
glassBorder: string;
|
|
136
|
+
glassColor: string;
|
|
137
|
+
glassShadow: string;
|
|
138
|
+
glassHoverShadow: string;
|
|
139
|
+
inputBackground: string;
|
|
140
|
+
inputBackgroundFocus: string;
|
|
141
|
+
inputBorder: string;
|
|
142
|
+
inputBorderFocus: string;
|
|
143
|
+
inputFocusRing: string;
|
|
144
|
+
pollBorder: string;
|
|
145
|
+
pollSelectedBorder: string;
|
|
146
|
+
pollBackground: string;
|
|
147
|
+
pollSelectedBackground: string;
|
|
148
|
+
pollColor: string;
|
|
149
|
+
pollSelectedColor: string;
|
|
150
|
+
pollCheckBorder: string;
|
|
151
|
+
pollCheckSelectedBorder: string;
|
|
152
|
+
pollCheckSelectedBg: string;
|
|
153
|
+
}
|
|
154
|
+
interface GotchaThemeTypography {
|
|
155
|
+
fontFamily: string;
|
|
156
|
+
fontSize: {
|
|
157
|
+
xs: number;
|
|
158
|
+
sm: number;
|
|
159
|
+
md: number;
|
|
160
|
+
lg: number;
|
|
161
|
+
};
|
|
162
|
+
fontWeight: {
|
|
163
|
+
normal: number;
|
|
164
|
+
medium: number;
|
|
165
|
+
semibold: number;
|
|
166
|
+
bold: number;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
interface GotchaThemeBorders {
|
|
170
|
+
radius: {
|
|
171
|
+
sm: number;
|
|
172
|
+
md: number;
|
|
173
|
+
lg: number;
|
|
174
|
+
full: string;
|
|
175
|
+
};
|
|
176
|
+
width: number;
|
|
177
|
+
}
|
|
178
|
+
interface GotchaThemeShadows {
|
|
179
|
+
sm: string;
|
|
180
|
+
md: string;
|
|
181
|
+
lg: string;
|
|
182
|
+
modal: string;
|
|
183
|
+
button: string;
|
|
184
|
+
}
|
|
185
|
+
interface GotchaThemeAnimation {
|
|
186
|
+
duration: {
|
|
187
|
+
fast: string;
|
|
188
|
+
normal: string;
|
|
189
|
+
slow: string;
|
|
190
|
+
};
|
|
191
|
+
easing: {
|
|
192
|
+
default: string;
|
|
193
|
+
spring: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
interface GotchaThemeConfig {
|
|
197
|
+
colors?: Partial<GotchaThemeColors>;
|
|
198
|
+
typography?: Partial<GotchaThemeTypography>;
|
|
199
|
+
borders?: Partial<GotchaThemeBorders>;
|
|
200
|
+
shadows?: Partial<GotchaThemeShadows>;
|
|
201
|
+
animation?: Partial<GotchaThemeAnimation>;
|
|
202
|
+
}
|
|
203
|
+
/** Create a custom theme by merging partial overrides onto a preset */
|
|
204
|
+
declare function createTheme(base: 'light' | 'dark', overrides: GotchaThemeConfig): GotchaThemeConfig;
|
|
205
|
+
|
|
75
206
|
interface GotchaProviderProps {
|
|
76
207
|
/** Your Gotcha API key */
|
|
77
208
|
apiKey: string;
|
|
@@ -85,8 +216,10 @@ interface GotchaProviderProps {
|
|
|
85
216
|
disabled?: boolean;
|
|
86
217
|
/** Default user metadata applied to all submissions */
|
|
87
218
|
defaultUser?: GotchaUser;
|
|
219
|
+
/** Theme configuration overrides applied to all instances */
|
|
220
|
+
themeConfig?: GotchaThemeConfig;
|
|
88
221
|
}
|
|
89
|
-
declare function GotchaProvider({ apiKey, children, baseUrl, debug, disabled, defaultUser, }: GotchaProviderProps): react_jsx_runtime.JSX.Element;
|
|
222
|
+
declare function GotchaProvider({ apiKey, children, baseUrl, debug, disabled, defaultUser, themeConfig, }: GotchaProviderProps): react_jsx_runtime.JSX.Element;
|
|
90
223
|
|
|
91
224
|
interface GotchaProps {
|
|
92
225
|
/** Unique identifier for this element */
|
|
@@ -146,6 +279,8 @@ interface GotchaProps {
|
|
|
146
279
|
bugFlagLabel?: string;
|
|
147
280
|
/** When true and user has already responded, show submitted state and allow review/edit instead of new submission */
|
|
148
281
|
onePerUser?: boolean;
|
|
282
|
+
/** Enable entrance animations on the button and modal (default: true) */
|
|
283
|
+
animated?: boolean;
|
|
149
284
|
/** Called after successful submission */
|
|
150
285
|
onSubmit?: (response: GotchaResponse) => void;
|
|
151
286
|
/** Called when modal opens */
|
|
@@ -155,7 +290,7 @@ interface GotchaProps {
|
|
|
155
290
|
/** Called on error */
|
|
156
291
|
onError?: (error: GotchaError) => void;
|
|
157
292
|
}
|
|
158
|
-
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
293
|
+
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
159
294
|
|
|
160
295
|
type ScoreVariant = 'stars' | 'number' | 'compact' | 'votes';
|
|
161
296
|
interface GotchaScoreProps {
|
|
@@ -202,4 +337,4 @@ declare function useGotcha(): {
|
|
|
202
337
|
submitFeedback: (payload: Omit<SubmitResponsePayload, "context">) => Promise<GotchaResponse>;
|
|
203
338
|
};
|
|
204
339
|
|
|
205
|
-
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, useGotcha };
|
|
340
|
+
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,23 @@ interface GotchaStyles {
|
|
|
16
16
|
modal?: React.CSSProperties;
|
|
17
17
|
input?: React.CSSProperties;
|
|
18
18
|
submitButton?: React.CSSProperties;
|
|
19
|
+
title?: React.CSSProperties;
|
|
20
|
+
closeButton?: React.CSSProperties;
|
|
21
|
+
starRating?: React.CSSProperties;
|
|
22
|
+
star?: React.CSSProperties;
|
|
23
|
+
voteButton?: React.CSSProperties;
|
|
24
|
+
voteButtonSelected?: React.CSSProperties;
|
|
25
|
+
pollOption?: React.CSSProperties;
|
|
26
|
+
pollOptionSelected?: React.CSSProperties;
|
|
27
|
+
npsButton?: React.CSSProperties;
|
|
28
|
+
npsButtonSelected?: React.CSSProperties;
|
|
29
|
+
npsLabels?: React.CSSProperties;
|
|
30
|
+
successMessage?: React.CSSProperties;
|
|
31
|
+
successIcon?: React.CSSProperties;
|
|
32
|
+
errorMessage?: React.CSSProperties;
|
|
33
|
+
bugFlag?: React.CSSProperties;
|
|
34
|
+
backdrop?: React.CSSProperties;
|
|
35
|
+
spinner?: React.CSSProperties;
|
|
19
36
|
}
|
|
20
37
|
interface SubmitResponsePayload {
|
|
21
38
|
elementId: string;
|
|
@@ -72,6 +89,120 @@ interface ScoreData {
|
|
|
72
89
|
npsScore: number | null;
|
|
73
90
|
}
|
|
74
91
|
|
|
92
|
+
interface GotchaThemeColors {
|
|
93
|
+
primary: string;
|
|
94
|
+
primaryHover: string;
|
|
95
|
+
primaryText: string;
|
|
96
|
+
background: string;
|
|
97
|
+
backgroundGradient: string;
|
|
98
|
+
surface: string;
|
|
99
|
+
surfaceHover: string;
|
|
100
|
+
text: string;
|
|
101
|
+
textSecondary: string;
|
|
102
|
+
textDisabled: string;
|
|
103
|
+
border: string;
|
|
104
|
+
borderFocus: string;
|
|
105
|
+
success: string;
|
|
106
|
+
successSurface: string;
|
|
107
|
+
error: string;
|
|
108
|
+
errorSurface: string;
|
|
109
|
+
errorBorder: string;
|
|
110
|
+
warning: string;
|
|
111
|
+
warningActive: string;
|
|
112
|
+
warningSurface: string;
|
|
113
|
+
warningBorder: string;
|
|
114
|
+
starFilled: string;
|
|
115
|
+
starEmpty: string;
|
|
116
|
+
voteUp: string;
|
|
117
|
+
voteUpSurface: string;
|
|
118
|
+
voteUpBorder: string;
|
|
119
|
+
voteDown: string;
|
|
120
|
+
voteDownSurface: string;
|
|
121
|
+
voteDownBorder: string;
|
|
122
|
+
npsColors: string[];
|
|
123
|
+
buttonBackground: string;
|
|
124
|
+
buttonBackgroundHover: string;
|
|
125
|
+
buttonBackgroundDisabled: string;
|
|
126
|
+
buttonColor: string;
|
|
127
|
+
buttonColorDisabled: string;
|
|
128
|
+
buttonBorder: string;
|
|
129
|
+
buttonShadow: string;
|
|
130
|
+
backdropColor: string;
|
|
131
|
+
closeButton: string;
|
|
132
|
+
closeButtonHover: string;
|
|
133
|
+
closeButtonBg: string;
|
|
134
|
+
glassBackground: string;
|
|
135
|
+
glassBorder: string;
|
|
136
|
+
glassColor: string;
|
|
137
|
+
glassShadow: string;
|
|
138
|
+
glassHoverShadow: string;
|
|
139
|
+
inputBackground: string;
|
|
140
|
+
inputBackgroundFocus: string;
|
|
141
|
+
inputBorder: string;
|
|
142
|
+
inputBorderFocus: string;
|
|
143
|
+
inputFocusRing: string;
|
|
144
|
+
pollBorder: string;
|
|
145
|
+
pollSelectedBorder: string;
|
|
146
|
+
pollBackground: string;
|
|
147
|
+
pollSelectedBackground: string;
|
|
148
|
+
pollColor: string;
|
|
149
|
+
pollSelectedColor: string;
|
|
150
|
+
pollCheckBorder: string;
|
|
151
|
+
pollCheckSelectedBorder: string;
|
|
152
|
+
pollCheckSelectedBg: string;
|
|
153
|
+
}
|
|
154
|
+
interface GotchaThemeTypography {
|
|
155
|
+
fontFamily: string;
|
|
156
|
+
fontSize: {
|
|
157
|
+
xs: number;
|
|
158
|
+
sm: number;
|
|
159
|
+
md: number;
|
|
160
|
+
lg: number;
|
|
161
|
+
};
|
|
162
|
+
fontWeight: {
|
|
163
|
+
normal: number;
|
|
164
|
+
medium: number;
|
|
165
|
+
semibold: number;
|
|
166
|
+
bold: number;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
interface GotchaThemeBorders {
|
|
170
|
+
radius: {
|
|
171
|
+
sm: number;
|
|
172
|
+
md: number;
|
|
173
|
+
lg: number;
|
|
174
|
+
full: string;
|
|
175
|
+
};
|
|
176
|
+
width: number;
|
|
177
|
+
}
|
|
178
|
+
interface GotchaThemeShadows {
|
|
179
|
+
sm: string;
|
|
180
|
+
md: string;
|
|
181
|
+
lg: string;
|
|
182
|
+
modal: string;
|
|
183
|
+
button: string;
|
|
184
|
+
}
|
|
185
|
+
interface GotchaThemeAnimation {
|
|
186
|
+
duration: {
|
|
187
|
+
fast: string;
|
|
188
|
+
normal: string;
|
|
189
|
+
slow: string;
|
|
190
|
+
};
|
|
191
|
+
easing: {
|
|
192
|
+
default: string;
|
|
193
|
+
spring: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
interface GotchaThemeConfig {
|
|
197
|
+
colors?: Partial<GotchaThemeColors>;
|
|
198
|
+
typography?: Partial<GotchaThemeTypography>;
|
|
199
|
+
borders?: Partial<GotchaThemeBorders>;
|
|
200
|
+
shadows?: Partial<GotchaThemeShadows>;
|
|
201
|
+
animation?: Partial<GotchaThemeAnimation>;
|
|
202
|
+
}
|
|
203
|
+
/** Create a custom theme by merging partial overrides onto a preset */
|
|
204
|
+
declare function createTheme(base: 'light' | 'dark', overrides: GotchaThemeConfig): GotchaThemeConfig;
|
|
205
|
+
|
|
75
206
|
interface GotchaProviderProps {
|
|
76
207
|
/** Your Gotcha API key */
|
|
77
208
|
apiKey: string;
|
|
@@ -85,8 +216,10 @@ interface GotchaProviderProps {
|
|
|
85
216
|
disabled?: boolean;
|
|
86
217
|
/** Default user metadata applied to all submissions */
|
|
87
218
|
defaultUser?: GotchaUser;
|
|
219
|
+
/** Theme configuration overrides applied to all instances */
|
|
220
|
+
themeConfig?: GotchaThemeConfig;
|
|
88
221
|
}
|
|
89
|
-
declare function GotchaProvider({ apiKey, children, baseUrl, debug, disabled, defaultUser, }: GotchaProviderProps): react_jsx_runtime.JSX.Element;
|
|
222
|
+
declare function GotchaProvider({ apiKey, children, baseUrl, debug, disabled, defaultUser, themeConfig, }: GotchaProviderProps): react_jsx_runtime.JSX.Element;
|
|
90
223
|
|
|
91
224
|
interface GotchaProps {
|
|
92
225
|
/** Unique identifier for this element */
|
|
@@ -146,6 +279,8 @@ interface GotchaProps {
|
|
|
146
279
|
bugFlagLabel?: string;
|
|
147
280
|
/** When true and user has already responded, show submitted state and allow review/edit instead of new submission */
|
|
148
281
|
onePerUser?: boolean;
|
|
282
|
+
/** Enable entrance animations on the button and modal (default: true) */
|
|
283
|
+
animated?: boolean;
|
|
149
284
|
/** Called after successful submission */
|
|
150
285
|
onSubmit?: (response: GotchaResponse) => void;
|
|
151
286
|
/** Called when modal opens */
|
|
@@ -155,7 +290,7 @@ interface GotchaProps {
|
|
|
155
290
|
/** Called on error */
|
|
156
291
|
onError?: (error: GotchaError) => void;
|
|
157
292
|
}
|
|
158
|
-
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
293
|
+
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
159
294
|
|
|
160
295
|
type ScoreVariant = 'stars' | 'number' | 'compact' | 'votes';
|
|
161
296
|
interface GotchaScoreProps {
|
|
@@ -202,4 +337,4 @@ declare function useGotcha(): {
|
|
|
202
337
|
submitFeedback: (payload: Omit<SubmitResponsePayload, "context">) => Promise<GotchaResponse>;
|
|
203
338
|
};
|
|
204
339
|
|
|
205
|
-
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, useGotcha };
|
|
340
|
+
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha };
|