rasp-feedback 1.0.3 → 1.0.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.
@@ -5,9 +5,16 @@ import { fontMap } from '../constants/fontexp';
5
5
  import { addFeedback } from '../functions/functionsexp';
6
6
  function StaticFormComponent({ form, mainTheme, fields }) {
7
7
  const [disabled, setDisabled] = useState(false);
8
+ const [isMobile, setIsMobile] = useState(false);
8
9
  useEffect(() => {
9
10
  if (typeof window === 'undefined')
10
11
  return;
12
+ // Check if mobile
13
+ const checkMobile = () => {
14
+ setIsMobile(window.innerWidth <= 768);
15
+ };
16
+ checkMobile();
17
+ window.addEventListener('resize', checkMobile);
11
18
  if (!document.getElementById('rasp-google-fonts')) {
12
19
  const link = document.createElement('link');
13
20
  link.id = 'rasp-google-fonts';
@@ -15,6 +22,7 @@ function StaticFormComponent({ form, mainTheme, fields }) {
15
22
  link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@600&family=Roboto:wght@600&family=Poppins:wght@800&family=Wix+Madefor+Text:wght@400&family=Montserrat:wght@600&family=Nunito:wght@600&family=Open+Sans:wght@600&family=Lato:wght@700&family=Work+Sans:wght@600&family=Source+Sans+3:wght@600&family=Rubik:wght@600&family=Playfair+Display:wght@700&family=Raleway:wght@700&family=DM+Serif+Display&family=Oswald:wght@600&family=Bebas+Neue&family=Merriweather:wght@700&family=Libre+Baskerville:wght@700&family=Cormorant+Garamond:wght@600&family=JetBrains+Mono:wght@600&family=Fira+Code:wght@600&display=swap';
16
23
  document.head.appendChild(link);
17
24
  }
25
+ return () => window.removeEventListener('resize', checkMobile);
18
26
  }, []);
19
27
  const [responses, setResponses] = useState(() => form.fieldsResponseObj.map((field) => ({
20
28
  ...field,
@@ -59,50 +67,83 @@ function StaticFormComponent({ form, mainTheme, fields }) {
59
67
  justifyContent: 'center',
60
68
  borderRadius: '0.75rem',
61
69
  backgroundColor: mainTheme.data.background,
62
- margin: '1.25rem',
63
- width: '470px',
70
+ margin: isMobile ? '0.5rem' : '1.25rem',
71
+ width: isMobile ? '90vw' : '470px',
72
+ maxWidth: '470px',
64
73
  height: 'auto',
65
74
  border: '1px solid black',
66
- padding: '1rem',
75
+ padding: isMobile ? '0.75rem' : '1rem',
67
76
  boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)'
68
- }, children: form && _jsxs(_Fragment, { children: [!submitted && _jsxs("form", { onSubmit: handleSubmit, id: formContainerId, style: { display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [_jsx("h2", { className: fontMap[form.design.title.fontId].className, style: { marginTop: '1rem', fontSize: form.design.title.size + "px", textAlign: 'center', color: mainTheme.data.text.title }, children: form.title }), _jsx("p", { className: fontMap[form.design.subtitle.fontId].className, style: { marginTop: '1rem', fontSize: form.design.subtitle.size + "px", textAlign: 'center', color: mainTheme.data.text.subtitle }, children: form.subtitle }), _jsx("br", {}), fields.map((field, index) => {
77
+ }, children: form && _jsxs(_Fragment, { children: [!submitted && _jsxs("form", { onSubmit: handleSubmit, id: formContainerId, style: { display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [_jsx("h2", { className: fontMap[form.design.title.fontId].className, style: {
78
+ marginTop: '1rem',
79
+ fontSize: isMobile ? Math.max(form.design.title.size * 0.8, 16) + "px" : form.design.title.size + "px",
80
+ textAlign: 'center',
81
+ color: mainTheme.data.text.title
82
+ }, children: form.title }), _jsx("p", { className: fontMap[form.design.subtitle.fontId].className, style: {
83
+ marginTop: '1rem',
84
+ fontSize: isMobile ? Math.max(form.design.subtitle.size * 0.85, 12) + "px" : form.design.subtitle.size + "px",
85
+ textAlign: 'center',
86
+ color: mainTheme.data.text.subtitle
87
+ }, children: form.subtitle }), _jsx("br", {}), fields.map((field, index) => {
69
88
  if (field._type === 'input') {
70
89
  return (_jsx("input", { required: true, value: responses[index]?.response || "", placeholder: field.placeholder, className: fontMap.wixmadefor.className, onChange: (e) => updateResponse(index, e.target.value), style: {
71
90
  width: "100%",
72
- padding: 10,
91
+ padding: isMobile ? 8 : 10,
73
92
  borderColor: mainTheme.data.text.title,
74
93
  borderWidth: 1,
75
94
  marginTop: '5px',
76
95
  borderRadius: 10,
77
- color: mainTheme.data.text.title
96
+ color: mainTheme.data.text.title,
97
+ fontSize: isMobile ? '14px' : '16px'
78
98
  } }, index));
79
99
  }
80
100
  if (field._type === "rating") {
81
101
  const currentRating = parseInt(responses[index]?.response || 0);
82
- return (_jsx("div", { style: { display: "flex", gap: "10px", marginTop: "10px" }, children: [1, 2, 3, 4, 5].map((num) => (_jsx("div", { style: { cursor: "pointer" }, onClick: () => updateResponse(index, String(num)), children: currentRating >= num ? iconMap.starActive : iconMap.starUnactive }, num))) }, index));
102
+ return (_jsx("div", { style: {
103
+ display: "flex",
104
+ gap: isMobile ? "8px" : "10px",
105
+ marginTop: "10px",
106
+ flexWrap: "wrap",
107
+ justifyContent: "center"
108
+ }, children: [1, 2, 3, 4, 5].map((num) => (_jsx("div", { style: {
109
+ cursor: "pointer",
110
+ transform: isMobile ? "scale(0.9)" : "scale(1)"
111
+ }, onClick: () => updateResponse(index, String(num)), children: currentRating >= num ? iconMap.starActive : iconMap.starUnactive }, num))) }, index));
83
112
  }
84
113
  if (field._type === 'textarea') {
85
114
  return (_jsx("textarea", { required: true, className: `${fontMap.wixmadefor.className} rasp-input`, value: responses[index]?.response || "", placeholder: field.placeholder, onChange: (e) => updateResponse(index, e.target.value), style: {
86
- height: '7.5rem',
115
+ height: isMobile ? '6rem' : '7.5rem',
87
116
  marginTop: '5px',
88
117
  borderWidth: 1,
89
118
  borderColor: mainTheme.data.text.title,
90
- padding: 10,
119
+ padding: isMobile ? 8 : 10,
91
120
  borderRadius: 10,
92
121
  width: "100%",
93
- color: mainTheme.data.text.title
122
+ color: mainTheme.data.text.title,
123
+ fontSize: isMobile ? '14px' : '16px'
94
124
  } }, index));
95
125
  }
96
126
  return null;
97
127
  }), _jsx("br", {}), _jsx("button", { type: "submit", className: fontMap.poppins.className, style: {
98
- padding: "15px",
128
+ padding: isMobile ? "12px" : "15px",
99
129
  borderRadius: "15px",
100
130
  backgroundColor: mainTheme.data.highlight,
101
131
  color: "white",
102
- width: "40%",
103
- fontSize: "13px",
132
+ width: isMobile ? "60%" : "40%",
133
+ fontSize: isMobile ? "12px" : "13px",
104
134
  cursor: "pointer",
105
135
  border: "none"
106
- }, children: "Send Feedback" })] }), submitted && _jsxs("div", { id: successContainerId, style: { display: "flex", flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [_jsx("br", {}), form.success_icon && iconMap[form.success_icon] ? iconMap[form.success_icon] : iconMap.circleCheckBig, _jsx("h2", { className: fontMap[form.success_heading_font].className, style: { marginTop: '1rem', fontSize: form.design.title.size + "px", color: mainTheme.data.text.title }, children: form.success_heading }), _jsx("p", { className: fontMap[form.success_message_font].className, style: { marginTop: '1rem', fontSize: '0.875rem', textAlign: 'center', color: mainTheme.data.text.subtitle }, children: form.success_message })] })] }) }) }));
136
+ }, children: "Send Feedback" })] }), submitted && _jsxs("div", { id: successContainerId, style: { display: "flex", flexDirection: 'column', alignItems: 'center', width: '100%', padding: isMobile ? '1rem 0' : '0' }, children: [_jsx("br", {}), form.success_icon && iconMap[form.success_icon] ? iconMap[form.success_icon] : iconMap.circleCheckBig, _jsx("h2", { className: fontMap[form.success_heading_font].className, style: {
137
+ marginTop: '1rem',
138
+ fontSize: isMobile ? Math.max(form.design.title.size * 0.8, 16) + "px" : form.design.title.size + "px",
139
+ color: mainTheme.data.text.title,
140
+ textAlign: 'center'
141
+ }, children: form.success_heading }), _jsx("p", { className: fontMap[form.success_message_font].className, style: {
142
+ marginTop: '1rem',
143
+ fontSize: isMobile ? '0.75rem' : '0.875rem',
144
+ textAlign: 'center',
145
+ color: mainTheme.data.text.subtitle,
146
+ padding: isMobile ? '0 0.5rem' : '0'
147
+ }, children: form.success_message })] })] }) }) }));
107
148
  }
108
149
  export default StaticFormComponent;
@@ -1,20 +1,13 @@
1
+ type __VLS_Props = {
2
+ post: any;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ "update:showVoteUI": (value: boolean) => any;
6
+ "update:currentPost": (value: any) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
8
+ "onUpdate:showVoteUI"?: ((value: boolean) => any) | undefined;
9
+ "onUpdate:currentPost"?: ((value: any) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
1
11
  declare const _default: typeof __VLS_export;
2
12
  export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
- post: {
5
- type: ObjectConstructor;
6
- required: true;
7
- };
8
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- "update:currentPost": (...args: any[]) => void;
10
- "update:showVoteUI": (...args: any[]) => void;
11
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
- post: {
13
- type: ObjectConstructor;
14
- required: true;
15
- };
16
- }>> & Readonly<{
17
- "onUpdate:currentPost"?: ((...args: any[]) => any) | undefined;
18
- "onUpdate:showVoteUI"?: ((...args: any[]) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
13
  //# sourceMappingURL=PostItem.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostItem.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/PostItem.vue"],"names":[],"mappings":"wBA8LqB,OAAO,YAAY;;AATxC;;;;;;;;;;;;;;;;kFAQG"}
1
+ {"version":3,"file":"PostItem.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/PostItem.vue"],"names":[],"mappings":"AAuHA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AA+IF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RaspForm.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/RaspForm.vue"],"names":[],"mappings":"AAyMA,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,KAAK,CAAC;AAU1E,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyRD,QAAA,MAAM,YAAY;iBA3RF,aAAa;6EA8R3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"RaspForm.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/RaspForm.vue"],"names":[],"mappings":"AA4OA,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,KAAK,CAAC;AAU1E,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0TD,QAAA,MAAM,YAAY;iBA5TF,aAAa;6EA+T3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RaspProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/RaspProvider.vue"],"names":[],"mappings":"AAijBA,OAAO,cAAc,CAAC;AAKtB,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0yBD,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;sBAtzBK;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;6EAszBD,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"RaspProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/RaspProvider.vue"],"names":[],"mappings":"AAgqBA,OAAO,cAAc,CAAC;AAKtB,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA44BD,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;sBAx5BK;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;6EAw5BD,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/Skeleton.vue"],"names":[],"mappings":"wBAkEqB,OAAO,YAAY;;AANxC;;;;;;kGAKG"}
1
+ {"version":3,"file":"Skeleton.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/Skeleton.vue"],"names":[],"mappings":"wBAmEqB,OAAO,YAAY;;AANxC;;;;;;kGAKG"}
@@ -1,9 +1,9 @@
1
- interface Props {
1
+ type __VLS_Props = {
2
2
  form: any;
3
3
  mainTheme: any;
4
4
  fields: any[];
5
- }
6
- declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
7
  declare const _default: typeof __VLS_export;
8
8
  export default _default;
9
9
  //# sourceMappingURL=StaticFormComponent.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StaticFormComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/StaticFormComponent.vue"],"names":[],"mappings":"AAsQA,UAAU,KAAK;IACb,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;CACf;AAmPD,QAAA,MAAM,YAAY,sRAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"StaticFormComponent.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/components/StaticFormComponent.vue"],"names":[],"mappings":"AA4QA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;CACf,CAAC;AAyTF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- #rasp-launcher:hover{transform:scale(1.1)}#rasp-form-div{transform:translateY(20px);opacity:0;animation:rasp-slide-up .3s ease-in both;will-change:transform,opacity;transform-origin:bottom center}.rasp-exit{animation:rasp-slide-down .25s ease-out both;will-change:transform,opacity;transform-origin:bottom center}@keyframes rasp-slide-up{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes rasp-slide-down{0%{transform:translateY(0);opacity:1}to{transform:translateY(20px);opacity:0}}@keyframes skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}
1
+ #rasp-launcher:hover{transform:scale(1.1)}#rasp-form-div{transform:translateY(20px);opacity:0;animation:rasp-slide-up .3s ease-in both;will-change:transform,opacity;transform-origin:bottom center}.rasp-exit{animation:rasp-slide-down .25s ease-out both;will-change:transform,opacity;transform-origin:bottom center}@keyframes rasp-slide-up{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes rasp-slide-down{0%{transform:translateY(0);opacity:1}to{transform:translateY(20px);opacity:0}}@keyframes skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}