@licklist/design 0.44.485-dev.63 → 0.44.485-dev.65

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.
Files changed (172) hide show
  1. package/dist/events/event-venue-map/components/MapPoint/MapPoint.js +1 -1
  2. package/dist/help/popover/HelpPopover.d.ts +4 -2
  3. package/dist/help/popover/HelpPopover.d.ts.map +1 -1
  4. package/dist/help/popover/HelpPopover.js +1 -1
  5. package/dist/iframe/event/event-card/IframeEventCard.d.ts +3 -3
  6. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  7. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  8. package/dist/iframe/event/event-card/IframeEventCardSkeleton.d.ts +3 -3
  9. package/dist/iframe/event/event-card/IframeEventCardSkeleton.d.ts.map +1 -1
  10. package/dist/iframe/event/event-card/IframeEventCardSkeleton.js +1 -1
  11. package/dist/image-radio-input/ImageRadioInput.d.ts +15 -0
  12. package/dist/image-radio-input/ImageRadioInput.d.ts.map +1 -0
  13. package/dist/image-radio-input/ImageRadioInput.js +1 -0
  14. package/dist/image-radio-input/index.d.ts.map +1 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  19. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +1 -1
  20. package/dist/provider/constants.d.ts +1 -1
  21. package/dist/provider/constants.js +1 -1
  22. package/dist/provider/provider-details-input/ProviderDetailsInput.js +1 -1
  23. package/dist/radio-card/RadioCard.d.ts +13 -0
  24. package/dist/radio-card/RadioCard.d.ts.map +1 -0
  25. package/dist/radio-card/RadioCard.js +1 -0
  26. package/dist/radio-card/index.d.ts +2 -0
  27. package/dist/radio-card/index.d.ts.map +1 -0
  28. package/dist/setting/dashboard/index.d.ts +0 -2
  29. package/dist/setting/dashboard/index.d.ts.map +1 -1
  30. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  31. package/dist/snippet/snippet-template/preview/Preview.js +1 -1
  32. package/dist/sorting-select/SortingSelect.d.ts +10 -0
  33. package/dist/sorting-select/SortingSelect.d.ts.map +1 -0
  34. package/dist/sorting-select/SortingSelect.js +1 -0
  35. package/dist/sorting-select/index.d.ts +2 -0
  36. package/dist/sorting-select/index.d.ts.map +1 -0
  37. package/{src/styles/widgets/ImageRadioInput.scss → dist/styles/image-radio-input/_index.scss} +12 -0
  38. package/dist/styles/packages.scss +2 -1
  39. package/{src/styles/widgets/WidgetTypeRadioButton.scss → dist/styles/radio-card/_index.scss} +8 -1
  40. package/package.json +2 -2
  41. package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
  42. package/src/help/popover/HelpPopover.tsx +13 -5
  43. package/src/iframe/event/event-card/IframeEventCard.stories.tsx +6 -14
  44. package/src/iframe/event/event-card/IframeEventCard.tsx +6 -10
  45. package/src/iframe/event/event-card/IframeEventCardSkeleton.tsx +20 -30
  46. package/src/iframe/event/event-card/IframeEventCards.stories.tsx +2 -3
  47. package/src/image-radio-input/ImageRadioInput.stories.tsx +67 -0
  48. package/src/image-radio-input/ImageRadioInput.tsx +53 -0
  49. package/src/index.ts +3 -0
  50. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +0 -5
  51. package/src/provider/constants.ts +1 -1
  52. package/src/provider/provider-details-input/ProviderDetailsInput.tsx +1 -1
  53. package/src/radio-card/RadioCard.stories.tsx +48 -0
  54. package/src/radio-card/RadioCard.tsx +49 -0
  55. package/src/radio-card/index.ts +1 -0
  56. package/src/setting/dashboard/index.ts +0 -2
  57. package/src/snippet/snippet-template/preview/Preview.tsx +0 -5
  58. package/src/sorting-select/SortingSelect.stories.tsx +15 -0
  59. package/src/sorting-select/SortingSelect.tsx +79 -0
  60. package/src/sorting-select/index.ts +1 -0
  61. package/{dist/styles/widgets/ImageRadioInput.scss → src/styles/image-radio-input/_index.scss} +12 -0
  62. package/src/styles/packages.scss +2 -1
  63. package/{dist/styles/widgets/WidgetTypeRadioButton.scss → src/styles/radio-card/_index.scss} +8 -1
  64. package/dist/assets/widgets/circlePlus.svg +0 -4
  65. package/dist/assets/widgets/inPage.svg +0 -10
  66. package/dist/assets/widgets/overlay.svg +0 -9
  67. package/dist/assets/widgets/sidebar.svg +0 -9
  68. package/dist/setting/dashboard/snippets/control/SnippetControl.d.ts +0 -9
  69. package/dist/setting/dashboard/snippets/control/SnippetControl.d.ts.map +0 -1
  70. package/dist/setting/dashboard/snippets/control/SnippetControl.js +0 -1
  71. package/dist/setting/dashboard/snippets/control/index.d.ts +0 -2
  72. package/dist/setting/dashboard/snippets/control/index.d.ts.map +0 -1
  73. package/dist/setting/dashboard/snippets/form/SnippetForm.d.ts +0 -33
  74. package/dist/setting/dashboard/snippets/form/SnippetForm.d.ts.map +0 -1
  75. package/dist/setting/dashboard/snippets/form/SnippetForm.js +0 -1
  76. package/dist/setting/dashboard/snippets/form/context.d.ts +0 -11
  77. package/dist/setting/dashboard/snippets/form/context.d.ts.map +0 -1
  78. package/dist/setting/dashboard/snippets/form/context.js +0 -1
  79. package/dist/setting/dashboard/snippets/form/index.d.ts +0 -2
  80. package/dist/setting/dashboard/snippets/form/index.d.ts.map +0 -1
  81. package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.d.ts +0 -19
  82. package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.d.ts.map +0 -1
  83. package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.js +0 -1
  84. package/dist/setting/dashboard/snippets/modal/index.d.ts +0 -3
  85. package/dist/setting/dashboard/snippets/modal/index.d.ts.map +0 -1
  86. package/dist/styles/widgets/BookingStyleSelector.scss +0 -14
  87. package/dist/styles/widgets/CalendarStyleSelector.scss +0 -17
  88. package/dist/styles/widgets/CheckboxGroup.scss +0 -15
  89. package/dist/styles/widgets/ProductSetSelector.scss +0 -19
  90. package/dist/styles/widgets/SnippetCode.scss +0 -18
  91. package/dist/styles/widgets/WidgetBuilderForm.scss +0 -51
  92. package/dist/styles/widgets/WidgetTypeSelector.scss +0 -6
  93. package/dist/styles/widgets/_index.scss +0 -9
  94. package/dist/widgets/BookingStyleSelector/BookingStyleSelector.d.ts +0 -3
  95. package/dist/widgets/BookingStyleSelector/BookingStyleSelector.d.ts.map +0 -1
  96. package/dist/widgets/BookingStyleSelector/index.d.ts +0 -2
  97. package/dist/widgets/BookingStyleSelector/index.d.ts.map +0 -1
  98. package/dist/widgets/CalendarStyleSelector/CalendarStyleSelector.d.ts +0 -3
  99. package/dist/widgets/CalendarStyleSelector/CalendarStyleSelector.d.ts.map +0 -1
  100. package/dist/widgets/CalendarStyleSelector/index.d.ts +0 -2
  101. package/dist/widgets/CalendarStyleSelector/index.d.ts.map +0 -1
  102. package/dist/widgets/CheckboxGroup/CheckboxGroup.d.ts +0 -8
  103. package/dist/widgets/CheckboxGroup/CheckboxGroup.d.ts.map +0 -1
  104. package/dist/widgets/CheckboxGroup/index.d.ts +0 -2
  105. package/dist/widgets/CheckboxGroup/index.d.ts.map +0 -1
  106. package/dist/widgets/ImageRadioInput/ImageRadioInput.d.ts +0 -9
  107. package/dist/widgets/ImageRadioInput/ImageRadioInput.d.ts.map +0 -1
  108. package/dist/widgets/ImageRadioInput/index.d.ts.map +0 -1
  109. package/dist/widgets/ProductSetSelector/ProductSetSelector.d.ts +0 -3
  110. package/dist/widgets/ProductSetSelector/ProductSetSelector.d.ts.map +0 -1
  111. package/dist/widgets/ProductSetSelector/index.d.ts +0 -2
  112. package/dist/widgets/ProductSetSelector/index.d.ts.map +0 -1
  113. package/dist/widgets/SnippetCode/SnippetCode.d.ts +0 -6
  114. package/dist/widgets/SnippetCode/SnippetCode.d.ts.map +0 -1
  115. package/dist/widgets/SnippetCode/index.d.ts +0 -2
  116. package/dist/widgets/SnippetCode/index.d.ts.map +0 -1
  117. package/dist/widgets/WidgetBuilderForm/WidgetBuilderForm.d.ts +0 -12
  118. package/dist/widgets/WidgetBuilderForm/WidgetBuilderForm.d.ts.map +0 -1
  119. package/dist/widgets/WidgetTypeRadio/WidgetTypeRadio.d.ts +0 -7
  120. package/dist/widgets/WidgetTypeRadio/WidgetTypeRadio.d.ts.map +0 -1
  121. package/dist/widgets/WidgetTypeRadio/index.d.ts +0 -2
  122. package/dist/widgets/WidgetTypeRadio/index.d.ts.map +0 -1
  123. package/dist/widgets/WidgetTypeSelector/WidgetTypeSelector.d.ts +0 -3
  124. package/dist/widgets/WidgetTypeSelector/WidgetTypeSelector.d.ts.map +0 -1
  125. package/src/assets/widgets/circlePlus.svg +0 -4
  126. package/src/assets/widgets/inPage.svg +0 -10
  127. package/src/assets/widgets/overlay.svg +0 -9
  128. package/src/assets/widgets/sidebar.svg +0 -9
  129. package/src/setting/dashboard/snippets/control/SnippetControl.tsx +0 -235
  130. package/src/setting/dashboard/snippets/control/index.ts +0 -1
  131. package/src/setting/dashboard/snippets/form/SnippetForm.stories.tsx +0 -104
  132. package/src/setting/dashboard/snippets/form/SnippetForm.tsx +0 -94
  133. package/src/setting/dashboard/snippets/form/context.tsx +0 -18
  134. package/src/setting/dashboard/snippets/form/index.ts +0 -1
  135. package/src/setting/dashboard/snippets/modal/SnippetViewTypeModal.stories.tsx +0 -28
  136. package/src/setting/dashboard/snippets/modal/SnippetViewTypeModal.tsx +0 -104
  137. package/src/setting/dashboard/snippets/modal/index.ts +0 -2
  138. package/src/styles/widgets/BookingStyleSelector.scss +0 -14
  139. package/src/styles/widgets/CalendarStyleSelector.scss +0 -17
  140. package/src/styles/widgets/CheckboxGroup.scss +0 -15
  141. package/src/styles/widgets/ProductSetSelector.scss +0 -19
  142. package/src/styles/widgets/SnippetCode.scss +0 -18
  143. package/src/styles/widgets/WidgetBuilderForm.scss +0 -51
  144. package/src/styles/widgets/WidgetTypeSelector.scss +0 -6
  145. package/src/styles/widgets/_index.scss +0 -9
  146. package/src/widgets/BookingStyleSelector/BookingStyleSelector.stories.tsx +0 -12
  147. package/src/widgets/BookingStyleSelector/BookingStyleSelector.tsx +0 -34
  148. package/src/widgets/BookingStyleSelector/index.ts +0 -1
  149. package/src/widgets/CalendarStyleSelector/CalendarStyleSelector.stories.tsx +0 -12
  150. package/src/widgets/CalendarStyleSelector/CalendarStyleSelector.tsx +0 -29
  151. package/src/widgets/CalendarStyleSelector/index.ts +0 -1
  152. package/src/widgets/CheckboxGroup/CheckboxGroup.stories.tsx +0 -16
  153. package/src/widgets/CheckboxGroup/CheckboxGroup.tsx +0 -64
  154. package/src/widgets/CheckboxGroup/index.ts +0 -1
  155. package/src/widgets/ImageRadioInput/ImageRadioInput.stories.tsx +0 -18
  156. package/src/widgets/ImageRadioInput/ImageRadioInput.tsx +0 -29
  157. package/src/widgets/ProductSetSelector/ProductSetSelector.stories.tsx +0 -12
  158. package/src/widgets/ProductSetSelector/ProductSetSelector.tsx +0 -27
  159. package/src/widgets/ProductSetSelector/index.ts +0 -1
  160. package/src/widgets/SnippetCode/SnippetCode.stories.tsx +0 -17
  161. package/src/widgets/SnippetCode/SnippetCode.tsx +0 -27
  162. package/src/widgets/SnippetCode/index.ts +0 -1
  163. package/src/widgets/WidgetBuilderForm/WidgetBuilderForm.stories.tsx +0 -12
  164. package/src/widgets/WidgetBuilderForm/WidgetBuilderForm.tsx +0 -84
  165. package/src/widgets/WidgetTypeRadio/WidgetTypeRadio.stories.tsx +0 -17
  166. package/src/widgets/WidgetTypeRadio/WidgetTypeRadio.tsx +0 -43
  167. package/src/widgets/WidgetTypeRadio/index.ts +0 -1
  168. package/src/widgets/WidgetTypeSelector/WidgetTypeSelector.stories.tsx +0 -12
  169. package/src/widgets/WidgetTypeSelector/WidgetTypeSelector.tsx +0 -32
  170. package/tests/Snippets/Snippets.test.tsx +0 -77
  171. /package/dist/{widgets/ImageRadioInput → image-radio-input}/index.d.ts +0 -0
  172. /package/src/{widgets/ImageRadioInput → image-radio-input}/index.ts +0 -0
@@ -1,9 +0,0 @@
1
- <svg width="120" height="68" viewBox="0 0 120 68" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.5" y="0.5" width="119" height="67" rx="3.5" fill="white" stroke="#DCDCDC"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M116 66.5H92.5C90.2909 66.5 88.5 64.7091 88.5 62.5L88.5 10.5C88.5 8.29086 90.2909 6.5 92.5 6.5L119 6.5V63.5C119 63.5 119 64.5 118 65.5C117 66.5 116 66.5 116 66.5Z" fill="#F8F8F8" stroke="#FF0099"/>
4
- <path d="M0 2.5C0 1.11929 1.11929 0 2.5 0H117.5C118.881 0 120 1.11929 120 2.5V6H0V2.5Z" fill="#D8D8D8"/>
5
- <circle cx="3.5" cy="3" r="1" fill="#FF1111"/>
6
- <circle cx="6.5" cy="3" r="1" fill="#FFE311"/>
7
- <circle cx="9.5" cy="3" r="1" fill="#11FF52"/>
8
- <path d="M118.5 51V63C118.5 64.6569 117.157 66 115.5 66H92C90.3431 66 89 64.6569 89 63V51L118.5 51Z" fill="#D8D8D8"/>
9
- </svg>
@@ -1,235 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { Col, Row, Form } from "react-bootstrap";
3
- import { useFormContext, Controller } from "react-hook-form";
4
- import { useTranslation } from "react-i18next";
5
- import { useId } from "@react-aria/utils";
6
- import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
7
- import { SNIPPET_TYPES } from "@licklist/core/dist/DataMapper/Provider/SnippetDataMapper";
8
- import { Switch } from "../../../../static";
9
- import { ShortSnippetTemplate, SnippetFormValues } from "../form/SnippetForm";
10
-
11
- export interface SnippetControlProps {
12
- isLoading: boolean;
13
- templates: Array<ShortSnippetTemplate>;
14
- providerHasMap?: boolean | null;
15
- }
16
-
17
- export function SnippetControl({
18
- isLoading,
19
- templates,
20
- providerHasMap,
21
- }: SnippetControlProps) {
22
- const { t } = useTranslation(["Design", "Validation", "User"]);
23
- const [isValid, setIsValid] = useState(true);
24
- const nameId = useId();
25
- const displayDescriptionId = useId();
26
- const displayCostId = useId();
27
- const displayTypeId = useId();
28
-
29
- const {
30
- register,
31
- watch,
32
- control,
33
- formState: { errors },
34
- setValue,
35
- } = useFormContext<SnippetFormValues>();
36
- const type = watch("type");
37
- const isEvent = type === "event_list";
38
-
39
- const { displayCost, displayDescription, displayType } =
40
- watch("widgetSetting");
41
- const templateId = watch("designId") || "";
42
-
43
- useEffect(() => {
44
- if (isEvent) {
45
- setIsValid(displayDescription || displayCost || displayType);
46
- }
47
- }, [isEvent, displayDescription, displayCost, displayType]);
48
-
49
- useEffect(() => {
50
- if (!templateId) return;
51
-
52
- const selectedTemplate = templates.find(
53
- (template) =>
54
- template.type === type && String(templateId) === String(template.id)
55
- );
56
-
57
- if (selectedTemplate) return;
58
-
59
- setValue("designId", "");
60
- // eslint-disable-next-line react-hooks/exhaustive-deps
61
- }, [templateId, type, templates]);
62
-
63
- return (
64
- <>
65
- <Row>
66
- <Form.Group
67
- as={Col}
68
- controlId={nameId}
69
- xs
70
- sm={12}
71
- md={8}
72
- lg={10}
73
- xl={12}
74
- >
75
- <Form.Label>{t("name")}</Form.Label>
76
- <Form.Control
77
- {...register("name", {
78
- maxLength: 255,
79
- required: t("Validation:fieldRequired", {
80
- attribute: t("name"),
81
- }) as string,
82
- })}
83
- placeholder={t("Design:widgetName")}
84
- isInvalid={Boolean(errors.name)}
85
- />
86
- <Form.Control.Feedback type="invalid">
87
- {errors.name?.message}
88
- </Form.Control.Feedback>
89
- </Form.Group>
90
- </Row>
91
- {providerHasMap && (
92
- <Row>
93
- <Controller
94
- control={control}
95
- name="type"
96
- render={({ field: { name, value, onChange } }) => (
97
- <Form.Group as={Col}>
98
- <Form.Label>{t("type")}</Form.Label>
99
- <Switch
100
- name={name}
101
- options={SNIPPET_TYPES.map((type) => ({
102
- id: type,
103
- value: t(type),
104
- }))}
105
- value={value}
106
- onChange={onChange}
107
- disabled={isLoading}
108
- />
109
- </Form.Group>
110
- )}
111
- />
112
- </Row>
113
- )}
114
-
115
- <Row>
116
- {isEvent && (
117
- <Form.Group
118
- as={Col}
119
- className="mt-4"
120
- xs
121
- sm={12}
122
- md={8}
123
- lg={10}
124
- xl={12}
125
- >
126
- <Form.Label className="mb-3">{t("Options")}</Form.Label>
127
- <Form.Check
128
- {...register("widgetSetting.displayDescription")}
129
- id={displayDescriptionId}
130
- isInvalid={!isValid}
131
- name="snippetSetting.displayDescription"
132
- label={t("Design:shouldShowDesc")}
133
- custom
134
- className="mb-3"
135
- disabled={isLoading}
136
- />
137
- <Form.Check
138
- {...register("widgetSetting.displayCost")}
139
- id={displayCostId}
140
- isInvalid={!isValid}
141
- name="snippetSetting.displayCost"
142
- label={t("Design:shouldShowCost")}
143
- custom
144
- className="mb-3"
145
- disabled={isLoading}
146
- />
147
- <Form.Check
148
- {...register("widgetSetting.displayType")}
149
- id={displayTypeId}
150
- isInvalid={!isValid}
151
- name="snippetSetting.displayType"
152
- label={t("Design:shouldShowType")}
153
- custom
154
- disabled={isLoading}
155
- />
156
- {!isValid && (
157
- <div className="d-block invalid-feedback">
158
- {t("Validation:fieldAtLeastSelected", {
159
- number: t("Design:one"),
160
- filedType: t("Design:checkbox"),
161
- })}
162
- </div>
163
- )}
164
- </Form.Group>
165
- )}
166
- </Row>
167
- {isEvent && (
168
- <Row>
169
- <Form.Group as={Col} xs sm={12} md={8} lg={10} xl={12}>
170
- <Form.Label>{t("eventsView")}</Form.Label>
171
- <Form.Control
172
- as="select"
173
- {...register("viewType", {
174
- required: t("Validation:fieldRequired", {
175
- attribute: t("viewType"),
176
- }) as string,
177
- })}
178
- placeholder={t("Design:eventsView")}
179
- disabled={isLoading}
180
- >
181
- <option value="grid">{t("Design:grid")}</option>
182
- <option value="list">{t("Design:list")}</option>
183
- </Form.Control>
184
- </Form.Group>
185
- </Row>
186
- )}
187
- <Row>
188
- <Form.Group as={Col} xs sm={12} md={8} lg={10} xl={12}>
189
- <Controller
190
- control={control}
191
- name="designId"
192
- rules={{ required: true }}
193
- render={({
194
- field: { value, onChange },
195
- fieldState: { invalid, error },
196
- }) => {
197
- const fieldSetValue = value ? String(value) : "";
198
- return (
199
- <>
200
- <Form.Label className="mt-5">{t("widgetDesign")}</Form.Label>
201
- <Form.Control
202
- as="select"
203
- disabled={isLoading}
204
- onChange={onChange}
205
- isInvalid={invalid}
206
- value={fieldSetValue}
207
- >
208
- <option value="">{t("Design:pleaseChooseOne")}</option>
209
- {templates?.map((template) => {
210
- if (template.type !== type) {
211
- return null;
212
- }
213
-
214
- return (
215
- <option value={template.id} key={template.id}>
216
- {template.name}
217
- </option>
218
- );
219
- })}
220
- </Form.Control>
221
- <Form.Control.Feedback type="invalid">
222
- {HookFormService.hasError(error, "required") &&
223
- t("Validation:fieldRequired", {
224
- attribute: t("Design:widgetDesign"),
225
- })}
226
- </Form.Control.Feedback>
227
- </>
228
- );
229
- }}
230
- />
231
- </Form.Group>
232
- </Row>
233
- </>
234
- );
235
- }
@@ -1 +0,0 @@
1
- export * from "./SnippetControl";
@@ -1,104 +0,0 @@
1
- import React from "react";
2
- import { Meta, Story } from "@storybook/react";
3
- import { boolean } from "@storybook/addon-knobs";
4
- import { SnippetForm, SnippetFormProps } from "./SnippetForm";
5
-
6
- export default {
7
- title: "Snippets / Snippet Form",
8
- } as Meta;
9
-
10
- export const Default: Story<SnippetFormProps> = (args) => {
11
- const providerHasMap = boolean("providerHasMap", true);
12
-
13
- return <SnippetForm {...args} providerHasMap={providerHasMap} />;
14
- };
15
-
16
- export const Empty: Story<SnippetFormProps> = (args) => {
17
- const providerHasMap = boolean("providerHasMap", true);
18
-
19
- return <SnippetForm {...args} providerHasMap={providerHasMap} />;
20
- };
21
-
22
- export const ServerErrors: Story<SnippetFormProps> = (args) => {
23
- const providerHasMap = boolean("providerHasMap", true);
24
-
25
- return <SnippetForm {...args} providerHasMap={providerHasMap} />;
26
- };
27
-
28
- Default.args = {
29
- onSubmit: (data) => console.log(data),
30
- isLoading: false,
31
- hasPermission: true,
32
- defaultValues: {
33
- name: "",
34
- type: "event",
35
- templateId: "62419ded59888e0e590a9182",
36
- snippetSetting: {
37
- displayDescription: false,
38
- displayCost: true,
39
- displayType: true,
40
- },
41
- },
42
- templates: [
43
- {
44
- id: "62419ded59888e0e590a9182",
45
- name: "Template21 (DFtest)",
46
- colors: [],
47
- },
48
- {
49
- id: "6241a12f5334b6556b0ffea2",
50
- name: "Template12",
51
- colors: [],
52
- },
53
- ],
54
- };
55
-
56
- Empty.args = {
57
- onSubmit: (data) => console.log(data),
58
- isLoading: true,
59
- defaultValues: {
60
- name: "",
61
- type: "event",
62
- templateId: "",
63
- snippetSetting: {
64
- displayDescription: true,
65
- displayCost: true,
66
- displayType: true,
67
- },
68
- },
69
- templates: [
70
- {
71
- id: "62419ded59888e0e590a9182",
72
- name: "Template21 (DFtest)",
73
- colors: [],
74
- },
75
- {
76
- id: "6241a12f5334b6556b0ffea2",
77
- name: "Template12",
78
- colors: [],
79
- },
80
- ],
81
- };
82
-
83
- ServerErrors.args = {
84
- onSubmit: (data) => console.log(data),
85
- isLoading: true,
86
- serverErrors: { name: ["Name is required field"] },
87
- defaultValues: {
88
- name: "",
89
- type: "event",
90
- templateId: "",
91
- snippetSetting: {
92
- displayDescription: true,
93
- displayCost: true,
94
- displayType: true,
95
- },
96
- },
97
- templates: [
98
- {
99
- id: "6241a12f5334b6556b0ffea2",
100
- name: "Template12",
101
- colors: [],
102
- },
103
- ],
104
- };
@@ -1,94 +0,0 @@
1
- import React, { useEffect } from "react";
2
- import { FormValues } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
3
- import { Button, Form } from "react-bootstrap";
4
- import { FormProvider, useForm } from "react-hook-form";
5
- import { useTranslation } from "react-i18next";
6
- import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
7
- import { ServerError } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
8
- import FormErrorService from "@licklist/plugins/dist/services/Form/FormErrorService";
9
- import {
10
- SnippetViewType,
11
- SnippetType,
12
- } from "@licklist/core/dist/DataMapper/Provider/SnippetDataMapper";
13
- import { SnippetTemplateType } from "@licklist/core/dist/DataMapper/Provider/SnippetTemplateDataMapper";
14
- import { SnippetControl } from "../control";
15
- import { SnippetContextProvider, SnippetLoadingContext } from "./context";
16
-
17
- export interface SnippetFormValues extends FormValues {
18
- name: string;
19
- type: SnippetType;
20
- designId: string;
21
- widgetSetting?: {
22
- displayDescription: boolean;
23
- displayCost: boolean;
24
- displayType: boolean;
25
- };
26
- viewType: SnippetViewType;
27
- }
28
-
29
- export interface ShortSnippetTemplate {
30
- id: string;
31
- name: string;
32
- colors: Array<string>;
33
- type: SnippetTemplateType;
34
- }
35
-
36
- export interface SnippetFormProps extends HasPermissionProp {
37
- isLoading: boolean;
38
- onSubmit: (values: SnippetFormValues) => void;
39
- templates: Array<ShortSnippetTemplate>;
40
- defaultValues?: SnippetFormValues;
41
- serverErrors?: ServerError;
42
- providerHasMap?: boolean | null;
43
- }
44
-
45
- export function SnippetForm({
46
- isLoading,
47
- defaultValues,
48
- onSubmit,
49
- templates,
50
- hasPermission = true,
51
- serverErrors,
52
- providerHasMap = false,
53
- }: SnippetFormProps) {
54
- const { t } = useTranslation("Design");
55
-
56
- const form = useForm<SnippetFormValues>({ defaultValues });
57
-
58
- const { setError } = form;
59
-
60
- useEffect(() => {
61
- FormErrorService.handleServerErrors(serverErrors, setError);
62
- }, [serverErrors, setError]);
63
-
64
- return (
65
- <SnippetContextProvider>
66
- <FormProvider {...form}>
67
- <Form onSubmit={form.handleSubmit(onSubmit)}>
68
- <SnippetLoadingContext.Consumer>
69
- {({ isLoading: contextIsLoading }) => {
70
- return (
71
- <>
72
- <SnippetControl
73
- templates={templates}
74
- isLoading={isLoading}
75
- providerHasMap={providerHasMap}
76
- />
77
- {hasPermission && (
78
- <Button
79
- className="mt-5 d-no dne d-md-block"
80
- type="submit"
81
- disabled={contextIsLoading}
82
- >
83
- {t("save")}
84
- </Button>
85
- )}
86
- </>
87
- );
88
- }}
89
- </SnippetLoadingContext.Consumer>
90
- </Form>
91
- </FormProvider>
92
- </SnippetContextProvider>
93
- );
94
- }
@@ -1,18 +0,0 @@
1
- import React, { createContext, useState } from "react";
2
-
3
- interface LoadingContext {
4
- isLoading: boolean;
5
- setLoading: (loading: boolean) => void;
6
- }
7
-
8
- export const SnippetLoadingContext = createContext<LoadingContext | null>(null);
9
-
10
- export function SnippetContextProvider({ children }) {
11
- const [loading, setLoading] = useState(false);
12
-
13
- return (
14
- <SnippetLoadingContext.Provider value={{ isLoading: loading, setLoading }}>
15
- {children}
16
- </SnippetLoadingContext.Provider>
17
- );
18
- }
@@ -1 +0,0 @@
1
- export * from "./SnippetForm";
@@ -1,28 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Button } from "react-bootstrap";
3
- import { Meta, Story } from "@storybook/react";
4
-
5
- import {
6
- SnippetViewTypeModal,
7
- SnippetViewTypeModalProps,
8
- } from "./SnippetViewTypeModal";
9
-
10
- export default {
11
- title: "Snippets / SnippetViewTypeModal",
12
- } as Meta;
13
-
14
- export const Default: Story<SnippetViewTypeModalProps> = () => {
15
- const [isVisible, setIsVisible] = useState(false);
16
- return (
17
- <div>
18
- <Button onClick={() => setIsVisible(true)}>Open modal</Button>
19
- <SnippetViewTypeModal
20
- isVisible={isVisible}
21
- onSubmit={(value) => console.log(value)}
22
- onHide={() => setIsVisible(false)}
23
- />
24
- </div>
25
- );
26
- };
27
-
28
- Default.args = {};
@@ -1,104 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Button, Modal } from "react-bootstrap";
3
- import { useTranslation } from "react-i18next";
4
- import clsx from "clsx";
5
-
6
- import ModalHeader from "react-bootstrap/ModalHeader";
7
- import ModalTitle from "react-bootstrap/ModalTitle";
8
- import Col from "react-bootstrap/Col";
9
- import {
10
- SNIPPET_VIEW_TYPE_GRID,
11
- SNIPPET_VIEW_TYPE_LIST,
12
- SnippetViewType,
13
- } from "@licklist/core/dist/DataMapper/Provider/SnippetDataMapper";
14
- import Icon from "../../../../static/Icon";
15
-
16
- export const SNIPPET_VIEW_TYPES: {
17
- [SNIPPET_VIEW_TYPE_GRID]: { label: string; icon: string };
18
- [SNIPPET_VIEW_TYPE_LIST]: { label: string; icon: string };
19
- } = {
20
- [SNIPPET_VIEW_TYPE_GRID]: {
21
- label: SNIPPET_VIEW_TYPE_GRID,
22
- icon: "th",
23
- },
24
- [SNIPPET_VIEW_TYPE_LIST]: {
25
- label: SNIPPET_VIEW_TYPE_LIST,
26
- icon: "bars",
27
- },
28
- };
29
-
30
- export interface SnippetViewTypeModalProps {
31
- isVisible: boolean;
32
- onHide: () => void;
33
- onSubmit: (value: SnippetViewType) => void;
34
- }
35
-
36
- export const SnippetViewTypeModal = ({
37
- isVisible,
38
- onHide,
39
- onSubmit,
40
- }: SnippetViewTypeModalProps) => {
41
- const { t } = useTranslation(["Design"]);
42
- const allViewTypes = Object.keys(SNIPPET_VIEW_TYPES);
43
- const [viewType, setViewType] = useState<SnippetViewType>("grid");
44
-
45
- const onModalSubmit = () => {
46
- onSubmit(viewType);
47
- onHide();
48
- };
49
-
50
- return (
51
- <Modal
52
- size="lg"
53
- centered
54
- show={isVisible}
55
- onHide={onHide}
56
- className="p-3 border-0"
57
- animation={false}
58
- contentClassName="rounded"
59
- >
60
- <ModalHeader className="align-items-center border-0">
61
- <ModalTitle as="h5">{t("Design:selectWidgetViewType")}</ModalTitle>
62
-
63
- <Button variant="danger" className="btn-sm rounded" onClick={onHide}>
64
- <Icon type="times" height="1.2rem" />
65
- </Button>
66
- </ModalHeader>
67
-
68
- <Modal.Body>
69
- <div className="d-flex flex-row flex-wrap p-4 justify-content-between">
70
- {allViewTypes.map((currentViewType) => {
71
- const { label, icon } = SNIPPET_VIEW_TYPES[currentViewType];
72
- return (
73
- <Col key={label}>
74
- <Button
75
- variant="outline-light"
76
- className={clsx(
77
- "d-flex justify-content-center align-items-center flex-column w-100 py-6 rounded",
78
- viewType === currentViewType && "selected-snippet-type"
79
- )}
80
- role="button"
81
- tabIndex={0}
82
- onClick={() =>
83
- setViewType(currentViewType as SnippetViewType)
84
- }
85
- >
86
- <Icon type={icon} color="#0e8ce2" height="4rem" />
87
- <h6 className="text-dark mt-3">{t(label)}</h6>
88
- </Button>
89
- </Col>
90
- );
91
- })}
92
- </div>
93
- </Modal.Body>
94
- <Modal.Footer className="border-0">
95
- <Button variant="secondary" onClick={onHide}>
96
- {t("cancel")}
97
- </Button>
98
- <Button variant="primary" onClick={onModalSubmit}>
99
- {t("confirm")}
100
- </Button>
101
- </Modal.Footer>
102
- </Modal>
103
- );
104
- };
@@ -1,2 +0,0 @@
1
- export { SnippetViewTypeModal } from "./SnippetViewTypeModal";
2
- export type { SnippetViewTypeModalProps } from "./SnippetViewTypeModal";
@@ -1,14 +0,0 @@
1
- .widget-booking-style-selector {
2
- margin-bottom: 2rem;
3
-
4
- h4 {
5
- margin-bottom: 1.5rem;
6
- }
7
-
8
- .wrapper {
9
- display: flex;
10
- justify-content: space-between;
11
- flex-wrap: wrap;
12
- gap: 1rem;
13
- }
14
- }
@@ -1,17 +0,0 @@
1
- .widget-calendar-style-selector {
2
- margin-bottom: 2rem;
3
-
4
- p {
5
- font-size: 0.8125rem;
6
- }
7
-
8
- .controls {
9
- display: flex;
10
- gap: 2rem;
11
- margin-top: 0.75rem;
12
-
13
- .form-check {
14
- padding-left: 0;
15
- }
16
- }
17
- }
@@ -1,15 +0,0 @@
1
- .widgets-checkbox-group {
2
- h3 {
3
- margin-bottom: 0.75rem;
4
- }
5
-
6
- .custom-checkbox {
7
- margin-top: 0;
8
- }
9
-
10
- .divider {
11
- height: 2px;
12
- margin-bottom: 1.5rem;
13
- background-color: #e7e7e7;
14
- }
15
- }
@@ -1,19 +0,0 @@
1
- .widget-builder-product-set-selector {
2
- button {
3
- display: flex;
4
- align-items: center;
5
- gap: 0.5rem;
6
- height: 1.5rem;
7
- padding: 0;
8
- background-color: transparent;
9
- border: none;
10
- color: #000;
11
-
12
- &:hover,
13
- &:focus,
14
- &:active {
15
- background-color: transparent !important;
16
- color: #0e8ce2 !important;
17
- }
18
- }
19
- }
@@ -1,18 +0,0 @@
1
- .widget-designer-snippet-code {
2
- .code-container {
3
- padding: 1rem;
4
- background: #fff;
5
- border: 2px solid #dcdcdc;
6
- border-radius: 0.5rem;
7
- word-break: break-all;
8
- }
9
-
10
- button {
11
- display: flex;
12
- align-items: center;
13
- gap: 1rem;
14
- border: 2px solid #0e8ce2;
15
- background: #fff;
16
- color: #0e8ce2;
17
- }
18
- }