@licklist/design 0.44.485-dev.64 → 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.
- package/dist/help/popover/HelpPopover.d.ts +4 -2
- package/dist/help/popover/HelpPopover.d.ts.map +1 -1
- package/dist/help/popover/HelpPopover.js +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.d.ts +3 -3
- package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
- package/dist/iframe/event/event-card/IframeEventCardSkeleton.d.ts +3 -3
- package/dist/iframe/event/event-card/IframeEventCardSkeleton.d.ts.map +1 -1
- package/dist/iframe/event/event-card/IframeEventCardSkeleton.js +1 -1
- package/dist/image-radio-input/ImageRadioInput.d.ts +15 -0
- package/dist/image-radio-input/ImageRadioInput.d.ts.map +1 -0
- package/dist/image-radio-input/ImageRadioInput.js +1 -0
- package/dist/image-radio-input/index.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/radio-card/RadioCard.d.ts +13 -0
- package/dist/radio-card/RadioCard.d.ts.map +1 -0
- package/dist/radio-card/RadioCard.js +1 -0
- package/dist/radio-card/index.d.ts +2 -0
- package/dist/radio-card/index.d.ts.map +1 -0
- package/dist/setting/dashboard/index.d.ts +0 -2
- package/dist/setting/dashboard/index.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/sorting-select/SortingSelect.d.ts +10 -0
- package/dist/sorting-select/SortingSelect.d.ts.map +1 -0
- package/dist/sorting-select/SortingSelect.js +1 -0
- package/dist/sorting-select/index.d.ts +2 -0
- package/dist/sorting-select/index.d.ts.map +1 -0
- package/{src/styles/widgets/ImageRadioInput.scss → dist/styles/image-radio-input/_index.scss} +12 -0
- package/dist/styles/packages.scss +2 -1
- package/{src/styles/widgets/WidgetTypeRadioButton.scss → dist/styles/radio-card/_index.scss} +8 -1
- package/package.json +2 -2
- package/src/help/popover/HelpPopover.tsx +13 -5
- package/src/iframe/event/event-card/IframeEventCard.stories.tsx +6 -14
- package/src/iframe/event/event-card/IframeEventCard.tsx +6 -10
- package/src/iframe/event/event-card/IframeEventCardSkeleton.tsx +20 -30
- package/src/iframe/event/event-card/IframeEventCards.stories.tsx +2 -3
- package/src/image-radio-input/ImageRadioInput.stories.tsx +67 -0
- package/src/image-radio-input/ImageRadioInput.tsx +53 -0
- package/src/index.ts +3 -0
- package/src/radio-card/RadioCard.stories.tsx +48 -0
- package/src/radio-card/RadioCard.tsx +49 -0
- package/src/radio-card/index.ts +1 -0
- package/src/setting/dashboard/index.ts +0 -2
- package/src/snippet/snippet-template/preview/Preview.tsx +0 -5
- package/src/sorting-select/SortingSelect.stories.tsx +15 -0
- package/src/sorting-select/SortingSelect.tsx +79 -0
- package/src/sorting-select/index.ts +1 -0
- package/{dist/styles/widgets/ImageRadioInput.scss → src/styles/image-radio-input/_index.scss} +12 -0
- package/src/styles/packages.scss +2 -1
- package/{dist/styles/widgets/WidgetTypeRadioButton.scss → src/styles/radio-card/_index.scss} +8 -1
- package/dist/assets/widgets/circlePlus.svg +0 -4
- package/dist/assets/widgets/inPage.svg +0 -10
- package/dist/assets/widgets/overlay.svg +0 -9
- package/dist/assets/widgets/sidebar.svg +0 -9
- package/dist/setting/dashboard/snippets/control/SnippetControl.d.ts +0 -9
- package/dist/setting/dashboard/snippets/control/SnippetControl.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/control/SnippetControl.js +0 -1
- package/dist/setting/dashboard/snippets/control/index.d.ts +0 -2
- package/dist/setting/dashboard/snippets/control/index.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/form/SnippetForm.d.ts +0 -33
- package/dist/setting/dashboard/snippets/form/SnippetForm.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/form/SnippetForm.js +0 -1
- package/dist/setting/dashboard/snippets/form/context.d.ts +0 -11
- package/dist/setting/dashboard/snippets/form/context.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/form/context.js +0 -1
- package/dist/setting/dashboard/snippets/form/index.d.ts +0 -2
- package/dist/setting/dashboard/snippets/form/index.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.d.ts +0 -19
- package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.d.ts.map +0 -1
- package/dist/setting/dashboard/snippets/modal/SnippetViewTypeModal.js +0 -1
- package/dist/setting/dashboard/snippets/modal/index.d.ts +0 -3
- package/dist/setting/dashboard/snippets/modal/index.d.ts.map +0 -1
- package/dist/styles/widgets/BookingStyleSelector.scss +0 -14
- package/dist/styles/widgets/CalendarStyleSelector.scss +0 -17
- package/dist/styles/widgets/CheckboxGroup.scss +0 -15
- package/dist/styles/widgets/ProductSetSelector.scss +0 -19
- package/dist/styles/widgets/SnippetCode.scss +0 -18
- package/dist/styles/widgets/WidgetBuilderForm.scss +0 -51
- package/dist/styles/widgets/WidgetTypeSelector.scss +0 -6
- package/dist/styles/widgets/_index.scss +0 -9
- package/dist/widgets/BookingStyleSelector/BookingStyleSelector.d.ts +0 -3
- package/dist/widgets/BookingStyleSelector/BookingStyleSelector.d.ts.map +0 -1
- package/dist/widgets/BookingStyleSelector/index.d.ts +0 -2
- package/dist/widgets/BookingStyleSelector/index.d.ts.map +0 -1
- package/dist/widgets/CalendarStyleSelector/CalendarStyleSelector.d.ts +0 -3
- package/dist/widgets/CalendarStyleSelector/CalendarStyleSelector.d.ts.map +0 -1
- package/dist/widgets/CalendarStyleSelector/index.d.ts +0 -2
- package/dist/widgets/CalendarStyleSelector/index.d.ts.map +0 -1
- package/dist/widgets/CheckboxGroup/CheckboxGroup.d.ts +0 -8
- package/dist/widgets/CheckboxGroup/CheckboxGroup.d.ts.map +0 -1
- package/dist/widgets/CheckboxGroup/index.d.ts +0 -2
- package/dist/widgets/CheckboxGroup/index.d.ts.map +0 -1
- package/dist/widgets/ImageRadioInput/ImageRadioInput.d.ts +0 -9
- package/dist/widgets/ImageRadioInput/ImageRadioInput.d.ts.map +0 -1
- package/dist/widgets/ImageRadioInput/index.d.ts.map +0 -1
- package/dist/widgets/ProductSetSelector/ProductSetSelector.d.ts +0 -3
- package/dist/widgets/ProductSetSelector/ProductSetSelector.d.ts.map +0 -1
- package/dist/widgets/ProductSetSelector/index.d.ts +0 -2
- package/dist/widgets/ProductSetSelector/index.d.ts.map +0 -1
- package/dist/widgets/SnippetCode/SnippetCode.d.ts +0 -6
- package/dist/widgets/SnippetCode/SnippetCode.d.ts.map +0 -1
- package/dist/widgets/SnippetCode/index.d.ts +0 -2
- package/dist/widgets/SnippetCode/index.d.ts.map +0 -1
- package/dist/widgets/WidgetBuilderForm/WidgetBuilderForm.d.ts +0 -12
- package/dist/widgets/WidgetBuilderForm/WidgetBuilderForm.d.ts.map +0 -1
- package/dist/widgets/WidgetTypeRadio/WidgetTypeRadio.d.ts +0 -7
- package/dist/widgets/WidgetTypeRadio/WidgetTypeRadio.d.ts.map +0 -1
- package/dist/widgets/WidgetTypeRadio/index.d.ts +0 -2
- package/dist/widgets/WidgetTypeRadio/index.d.ts.map +0 -1
- package/dist/widgets/WidgetTypeSelector/WidgetTypeSelector.d.ts +0 -3
- package/dist/widgets/WidgetTypeSelector/WidgetTypeSelector.d.ts.map +0 -1
- package/src/assets/widgets/circlePlus.svg +0 -4
- package/src/assets/widgets/inPage.svg +0 -10
- package/src/assets/widgets/overlay.svg +0 -9
- package/src/assets/widgets/sidebar.svg +0 -9
- package/src/setting/dashboard/snippets/control/SnippetControl.tsx +0 -235
- package/src/setting/dashboard/snippets/control/index.ts +0 -1
- package/src/setting/dashboard/snippets/form/SnippetForm.stories.tsx +0 -104
- package/src/setting/dashboard/snippets/form/SnippetForm.tsx +0 -94
- package/src/setting/dashboard/snippets/form/context.tsx +0 -18
- package/src/setting/dashboard/snippets/form/index.ts +0 -1
- package/src/setting/dashboard/snippets/modal/SnippetViewTypeModal.stories.tsx +0 -28
- package/src/setting/dashboard/snippets/modal/SnippetViewTypeModal.tsx +0 -104
- package/src/setting/dashboard/snippets/modal/index.ts +0 -2
- package/src/styles/widgets/BookingStyleSelector.scss +0 -14
- package/src/styles/widgets/CalendarStyleSelector.scss +0 -17
- package/src/styles/widgets/CheckboxGroup.scss +0 -15
- package/src/styles/widgets/ProductSetSelector.scss +0 -19
- package/src/styles/widgets/SnippetCode.scss +0 -18
- package/src/styles/widgets/WidgetBuilderForm.scss +0 -51
- package/src/styles/widgets/WidgetTypeSelector.scss +0 -6
- package/src/styles/widgets/_index.scss +0 -9
- package/src/widgets/BookingStyleSelector/BookingStyleSelector.stories.tsx +0 -12
- package/src/widgets/BookingStyleSelector/BookingStyleSelector.tsx +0 -34
- package/src/widgets/BookingStyleSelector/index.ts +0 -1
- package/src/widgets/CalendarStyleSelector/CalendarStyleSelector.stories.tsx +0 -12
- package/src/widgets/CalendarStyleSelector/CalendarStyleSelector.tsx +0 -29
- package/src/widgets/CalendarStyleSelector/index.ts +0 -1
- package/src/widgets/CheckboxGroup/CheckboxGroup.stories.tsx +0 -16
- package/src/widgets/CheckboxGroup/CheckboxGroup.tsx +0 -64
- package/src/widgets/CheckboxGroup/index.ts +0 -1
- package/src/widgets/ImageRadioInput/ImageRadioInput.stories.tsx +0 -18
- package/src/widgets/ImageRadioInput/ImageRadioInput.tsx +0 -29
- package/src/widgets/ProductSetSelector/ProductSetSelector.stories.tsx +0 -12
- package/src/widgets/ProductSetSelector/ProductSetSelector.tsx +0 -27
- package/src/widgets/ProductSetSelector/index.ts +0 -1
- package/src/widgets/SnippetCode/SnippetCode.stories.tsx +0 -17
- package/src/widgets/SnippetCode/SnippetCode.tsx +0 -27
- package/src/widgets/SnippetCode/index.ts +0 -1
- package/src/widgets/WidgetBuilderForm/WidgetBuilderForm.stories.tsx +0 -12
- package/src/widgets/WidgetBuilderForm/WidgetBuilderForm.tsx +0 -84
- package/src/widgets/WidgetTypeRadio/WidgetTypeRadio.stories.tsx +0 -17
- package/src/widgets/WidgetTypeRadio/WidgetTypeRadio.tsx +0 -43
- package/src/widgets/WidgetTypeRadio/index.ts +0 -1
- package/src/widgets/WidgetTypeSelector/WidgetTypeSelector.stories.tsx +0 -12
- package/src/widgets/WidgetTypeSelector/WidgetTypeSelector.tsx +0 -32
- package/tests/Snippets/Snippets.test.tsx +0 -77
- /package/dist/{widgets/ImageRadioInput → image-radio-input}/index.d.ts +0 -0
- /package/src/{widgets/ImageRadioInput → image-radio-input}/index.ts +0 -0
|
@@ -11,18 +11,15 @@ export default {
|
|
|
11
11
|
|
|
12
12
|
export function Default() {
|
|
13
13
|
const showImage = boolean("showImage", true);
|
|
14
|
-
const displayCost = boolean("displayCost", false);
|
|
15
|
-
const displayType = boolean("displayType", true);
|
|
16
|
-
const displayDescription = boolean("displayDescription", false);
|
|
17
14
|
const isListView = boolean("isListView", false);
|
|
18
15
|
|
|
19
16
|
return (
|
|
20
17
|
<div>
|
|
21
18
|
<IframeEventCard
|
|
22
19
|
imageSrc={
|
|
23
|
-
// eslint-disable-next-line max-len
|
|
24
20
|
showImage
|
|
25
|
-
?
|
|
21
|
+
? // eslint-disable-next-line max-len
|
|
22
|
+
"https://images.unsplash.com/photo-1638988319382-90e61be77c59?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80"
|
|
26
23
|
: undefined
|
|
27
24
|
}
|
|
28
25
|
title="Glitterbomb Bucks / Baga Chipz"
|
|
@@ -43,9 +40,8 @@ export function Default() {
|
|
|
43
40
|
RuPaul's Drag Race UK to VINYL Cambridge! So get excited because
|
|
44
41
|
the...`}
|
|
45
42
|
snippetSetting={{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
displayDescription,
|
|
43
|
+
includeAvailability: ["calendar", "product_sets", "time_slots"],
|
|
44
|
+
includeFromPrice: ["calendar", "product_sets", "time_slots"],
|
|
49
45
|
}}
|
|
50
46
|
goToDetails={() => null}
|
|
51
47
|
isListView={isListView}
|
|
@@ -59,9 +55,6 @@ export function Default() {
|
|
|
59
55
|
|
|
60
56
|
export function EventCardSkeleton() {
|
|
61
57
|
const showImage = boolean("showImage", true);
|
|
62
|
-
const displayCost = boolean("displayCost", false);
|
|
63
|
-
const displayType = boolean("displayType", true);
|
|
64
|
-
const displayDescription = boolean("displayDescription", false);
|
|
65
58
|
const isListView = boolean("isListView", false);
|
|
66
59
|
|
|
67
60
|
return (
|
|
@@ -69,9 +62,8 @@ export function EventCardSkeleton() {
|
|
|
69
62
|
<IframeEventCardSkeleton
|
|
70
63
|
showImage={showImage}
|
|
71
64
|
snippetSetting={{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
displayDescription,
|
|
65
|
+
includeAvailability: ["calendar", "product_sets", "time_slots"],
|
|
66
|
+
includeFromPrice: ["calendar", "product_sets", "time_slots"],
|
|
75
67
|
}}
|
|
76
68
|
isListView={isListView}
|
|
77
69
|
/>
|
|
@@ -3,7 +3,7 @@ import { Card } from "react-bootstrap";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import {
|
|
6
|
+
import { Snippet } from "@licklist/core/dist/DataMapper/Provider/SnippetDataMapper";
|
|
7
7
|
import { TipTapEditor } from "../../../tiptap-editor/TipTapEditor";
|
|
8
8
|
import { formatContent } from "../../../events/event-card/utils";
|
|
9
9
|
import { ReactComponent as ClockSvg } from "../../../assets/iframe/clock.svg";
|
|
@@ -18,7 +18,8 @@ interface IframeEventCardProps {
|
|
|
18
18
|
cost?: number;
|
|
19
19
|
date: string;
|
|
20
20
|
imageSrc?: string;
|
|
21
|
-
|
|
21
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
22
|
+
snippetSetting?: Snippet["widgetSetting"];
|
|
22
23
|
colour?: string;
|
|
23
24
|
goToDetails?: () => void;
|
|
24
25
|
description?: string | null;
|
|
@@ -35,11 +36,6 @@ export function IframeEventCard({
|
|
|
35
36
|
cost,
|
|
36
37
|
date,
|
|
37
38
|
imageSrc,
|
|
38
|
-
snippetSetting = {
|
|
39
|
-
displayType: true,
|
|
40
|
-
displayCost: true,
|
|
41
|
-
displayDescription: true,
|
|
42
|
-
},
|
|
43
39
|
colour,
|
|
44
40
|
goToDetails,
|
|
45
41
|
description,
|
|
@@ -102,7 +98,7 @@ export function IframeEventCard({
|
|
|
102
98
|
</div>
|
|
103
99
|
</Card.Text>
|
|
104
100
|
|
|
105
|
-
{type &&
|
|
101
|
+
{type && (
|
|
106
102
|
<Card.Text as="div" className="list-view-hided">
|
|
107
103
|
<div className="d-flex align-items-center mb-3">
|
|
108
104
|
<div className="icon-wrapper">
|
|
@@ -113,7 +109,7 @@ export function IframeEventCard({
|
|
|
113
109
|
</Card.Text>
|
|
114
110
|
)}
|
|
115
111
|
|
|
116
|
-
{typeof cost === "number" &&
|
|
112
|
+
{typeof cost === "number" && (
|
|
117
113
|
<Card.Text as="div">
|
|
118
114
|
<div className="d-flex align-items-center mb-3">
|
|
119
115
|
<div className="icon-wrapper">
|
|
@@ -127,7 +123,7 @@ export function IframeEventCard({
|
|
|
127
123
|
</Card.Text>
|
|
128
124
|
)}
|
|
129
125
|
|
|
130
|
-
{description &&
|
|
126
|
+
{description && (
|
|
131
127
|
<Card.Text as="div" className="list-view-hided">
|
|
132
128
|
<TipTapEditor
|
|
133
129
|
viewMode
|
|
@@ -2,11 +2,12 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { Card } from "react-bootstrap";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import Skeleton from "react-loading-skeleton";
|
|
5
|
-
import {
|
|
5
|
+
import { Snippet } from "@licklist/core/dist/DataMapper/Provider/SnippetDataMapper";
|
|
6
6
|
|
|
7
7
|
interface IframeEventCardSkeletonProps {
|
|
8
8
|
showImage?: boolean;
|
|
9
|
-
|
|
9
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
10
|
+
snippetSetting?: Snippet["widgetSetting"];
|
|
10
11
|
colour?: string;
|
|
11
12
|
isListView?: boolean;
|
|
12
13
|
className?: string;
|
|
@@ -15,11 +16,6 @@ interface IframeEventCardSkeletonProps {
|
|
|
15
16
|
export const IframeEventCardSkeleton = memo(
|
|
16
17
|
({
|
|
17
18
|
showImage,
|
|
18
|
-
snippetSetting = {
|
|
19
|
-
displayType: true,
|
|
20
|
-
displayCost: true,
|
|
21
|
-
displayDescription: true,
|
|
22
|
-
},
|
|
23
19
|
colour,
|
|
24
20
|
isListView = false,
|
|
25
21
|
className,
|
|
@@ -61,31 +57,25 @@ export const IframeEventCardSkeleton = memo(
|
|
|
61
57
|
</div>
|
|
62
58
|
</Card.Text>
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</Card.Text>
|
|
72
|
-
)}
|
|
60
|
+
<Card.Text as="div" className="list-view-hided">
|
|
61
|
+
<div className="d-flex align-items-center mb-3">
|
|
62
|
+
<p className="iframe-event-card__bold m-0">
|
|
63
|
+
<Skeleton className="skeleton-w6" />
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
</Card.Text>
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</Card.Text>
|
|
82
|
-
)}
|
|
68
|
+
<Card.Text as="div">
|
|
69
|
+
<div className="d-flex align-items-center mb-3">
|
|
70
|
+
<p className="iframe-event-card__bold m-0">
|
|
71
|
+
<Skeleton className="skeleton-w6" />
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
</Card.Text>
|
|
83
75
|
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
</Card.Text>
|
|
88
|
-
)}
|
|
76
|
+
<Card.Text as="div" className="list-view-hided">
|
|
77
|
+
<Skeleton className="w-100 h-100" />
|
|
78
|
+
</Card.Text>
|
|
89
79
|
</div>
|
|
90
80
|
</Card.Body>
|
|
91
81
|
</Card>
|
|
@@ -581,9 +581,8 @@ export function Default() {
|
|
|
581
581
|
date={String(event.startAt)}
|
|
582
582
|
colour={event.colour}
|
|
583
583
|
snippetSetting={{
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
displayDescription,
|
|
584
|
+
includeAvailability: [],
|
|
585
|
+
includeFromPrice: [],
|
|
587
586
|
}}
|
|
588
587
|
imageSrc={event.imgSrc}
|
|
589
588
|
goToDetails={() => {}}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import { ImageRadioInput, ImageRadioInputProps } from "./ImageRadioInput";
|
|
5
|
+
import { ReactComponent as MonthIcon } from "../assets/widgets/monthCalendar.svg";
|
|
6
|
+
import Icon from "../static/Icon";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "ImageRadioInput",
|
|
10
|
+
component: ImageRadioInput,
|
|
11
|
+
} as Meta;
|
|
12
|
+
|
|
13
|
+
type FormModel = {
|
|
14
|
+
test: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default: Story<ImageRadioInputProps<FormModel>> = (args) => {
|
|
18
|
+
const form = useForm();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FormProvider {...form}>
|
|
22
|
+
<ImageRadioInput {...args} />
|
|
23
|
+
</FormProvider>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Default.args = {
|
|
28
|
+
img: <MonthIcon />,
|
|
29
|
+
label: "Month",
|
|
30
|
+
name: "test",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const WithFontAwesomeIcon: Story<ImageRadioInputProps<FormModel>> = (
|
|
34
|
+
args
|
|
35
|
+
) => {
|
|
36
|
+
const form = useForm();
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<FormProvider {...form}>
|
|
40
|
+
<ImageRadioInput {...args} />
|
|
41
|
+
</FormProvider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
WithFontAwesomeIcon.args = {
|
|
46
|
+
img: <Icon type="bars" />,
|
|
47
|
+
label: "List",
|
|
48
|
+
name: "test",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Disabled: Story<ImageRadioInputProps<FormModel>> = (args) => {
|
|
52
|
+
const form = useForm();
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<FormProvider {...form}>
|
|
56
|
+
<ImageRadioInput {...args} />
|
|
57
|
+
</FormProvider>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
Disabled.args = {
|
|
62
|
+
img: <MonthIcon />,
|
|
63
|
+
label: "Month",
|
|
64
|
+
name: "test",
|
|
65
|
+
disabled: true,
|
|
66
|
+
disabledMessage: "Coming soon",
|
|
67
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import { Form } from "react-bootstrap";
|
|
4
|
+
import { FormCheckInputProps } from "react-bootstrap/esm/FormCheckInput";
|
|
5
|
+
import { Path, RegisterOptions, useFormContext } from "react-hook-form";
|
|
6
|
+
|
|
7
|
+
export type ImageRadioInputProps<FormModel> = {
|
|
8
|
+
img: ReactNode;
|
|
9
|
+
label: string;
|
|
10
|
+
value: string | number;
|
|
11
|
+
name: Path<FormModel>;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
disabledMessage?: string;
|
|
14
|
+
rules?: RegisterOptions<FormModel>;
|
|
15
|
+
inputProps?: FormCheckInputProps;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const ImageRadioInput = <FormModel,>({
|
|
19
|
+
img,
|
|
20
|
+
label,
|
|
21
|
+
value,
|
|
22
|
+
name,
|
|
23
|
+
disabled,
|
|
24
|
+
disabledMessage,
|
|
25
|
+
rules,
|
|
26
|
+
inputProps,
|
|
27
|
+
}: ImageRadioInputProps<FormModel>) => {
|
|
28
|
+
const { register } = useFormContext<FormModel>();
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Form.Check className="image-radio-input">
|
|
32
|
+
<Form.Check.Label
|
|
33
|
+
className={clsx("image-radio-input-wrapper", disabled && "disabled")}
|
|
34
|
+
>
|
|
35
|
+
<div className="image-radio-input-image-wrapper">{img}</div>
|
|
36
|
+
|
|
37
|
+
<div className="image-radio-input-label">
|
|
38
|
+
<Form.Check.Input
|
|
39
|
+
type="radio"
|
|
40
|
+
value={value}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
{...register(name, rules)}
|
|
43
|
+
{...inputProps}
|
|
44
|
+
/>
|
|
45
|
+
<span>{label}</span>
|
|
46
|
+
</div>
|
|
47
|
+
</Form.Check.Label>
|
|
48
|
+
<Form.Control.Feedback type="valid" className="d-block text-center">
|
|
49
|
+
{disabledMessage}
|
|
50
|
+
</Form.Control.Feedback>
|
|
51
|
+
</Form.Check>
|
|
52
|
+
);
|
|
53
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import { RadioCard, RadioCardProps } from "./RadioCard";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Widgets / Widget Type Radio Card",
|
|
8
|
+
component: RadioCard,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
type FormModel = {
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Default: Story<RadioCardProps<FormModel>> = (args) => {
|
|
16
|
+
const form = useForm<FormModel>();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<FormProvider {...form}>
|
|
20
|
+
<RadioCard {...args} />
|
|
21
|
+
</FormProvider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Default.args = {
|
|
26
|
+
label: "Venue Map",
|
|
27
|
+
description: "Date > Floor",
|
|
28
|
+
name: "name",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Invalid: Story<RadioCardProps<FormModel>> = (args) => {
|
|
32
|
+
const form = useForm<FormModel>();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FormProvider {...form}>
|
|
36
|
+
<RadioCard {...args} />
|
|
37
|
+
</FormProvider>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Invalid.args = {
|
|
42
|
+
label: "Venue Map",
|
|
43
|
+
description: "Date > Floor",
|
|
44
|
+
name: "name",
|
|
45
|
+
inputProps: {
|
|
46
|
+
isInvalid: true,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import { Form } from "react-bootstrap";
|
|
4
|
+
import { FormCheckInputProps } from "react-bootstrap/esm/FormCheckInput";
|
|
5
|
+
import { Path, RegisterOptions, useFormContext } from "react-hook-form";
|
|
6
|
+
|
|
7
|
+
export type RadioCardProps<FormModel> = {
|
|
8
|
+
label: string;
|
|
9
|
+
description: ReactNode;
|
|
10
|
+
name: Path<FormModel>;
|
|
11
|
+
value: string;
|
|
12
|
+
rules: RegisterOptions<FormModel>;
|
|
13
|
+
inputProps?: FormCheckInputProps;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const RadioCard = <FormModel,>({
|
|
17
|
+
label,
|
|
18
|
+
description,
|
|
19
|
+
name,
|
|
20
|
+
value,
|
|
21
|
+
rules,
|
|
22
|
+
inputProps,
|
|
23
|
+
}: RadioCardProps<FormModel>) => {
|
|
24
|
+
const {
|
|
25
|
+
register,
|
|
26
|
+
formState: { errors },
|
|
27
|
+
} = useFormContext<FormModel>();
|
|
28
|
+
|
|
29
|
+
const isInvalid = !!errors[name as string] || inputProps?.isInvalid;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Form.Check className={clsx("radio-card", isInvalid && "invalid")}>
|
|
33
|
+
<Form.Check.Label>
|
|
34
|
+
<div className="radio-card-controls">
|
|
35
|
+
<Form.Check.Input
|
|
36
|
+
type="radio"
|
|
37
|
+
isInvalid={isInvalid}
|
|
38
|
+
value={value}
|
|
39
|
+
{...register(name, rules)}
|
|
40
|
+
{...inputProps}
|
|
41
|
+
/>
|
|
42
|
+
<span>{label}</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<p className="radio-card-description">{description}</p>
|
|
46
|
+
</Form.Check.Label>
|
|
47
|
+
</Form.Check>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioCard } from "./RadioCard";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from "./DashboardSettingForm";
|
|
2
|
-
export * from "./snippets/form";
|
|
3
2
|
export * from "./snippets/card";
|
|
4
3
|
export * from "./snippet-templates/card";
|
|
5
4
|
export * from "./payments/payments-form/PaymentsForm";
|
|
6
5
|
export * from "./payments/payments-modal/PaymentsModal";
|
|
7
|
-
export * from "./snippets/modal";
|
|
@@ -368,11 +368,6 @@ export function Preview({
|
|
|
368
368
|
type="Party Doors 22:00 - 03:00"
|
|
369
369
|
cost={6}
|
|
370
370
|
date="Sat 2nd May"
|
|
371
|
-
snippetSetting={{
|
|
372
|
-
displayCost: true,
|
|
373
|
-
displayType: true,
|
|
374
|
-
displayDescription: true,
|
|
375
|
-
}}
|
|
376
371
|
goToDetails={() => null}
|
|
377
372
|
shortDate="07/03/2023"
|
|
378
373
|
/>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { SortingSelect, SortingSelectProps } from "./SortingSelect";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "SortingSelect",
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
export const Default: Story<SortingSelectProps> = (props) => {
|
|
10
|
+
return <SortingSelect {...props} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
Default.args = {
|
|
14
|
+
onSortingChange: () => null,
|
|
15
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import useQuery from "@licklist/plugins/dist/hooks/Query/useQuery";
|
|
3
|
+
import { Form, FormGroupProps } from "react-bootstrap";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import {
|
|
6
|
+
SORT_DIRECTION_ASC,
|
|
7
|
+
SORT_DIRECTION_NEWEST,
|
|
8
|
+
SORT_DIRECTION_DESC,
|
|
9
|
+
SORT_KEY_NAME,
|
|
10
|
+
SORT_KEY_CREATED_AT,
|
|
11
|
+
} from "@licklist/core/dist/Config";
|
|
12
|
+
|
|
13
|
+
export type SortingSelectProps = {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
formGroupProps?: FormGroupProps & Record<string, any>;
|
|
16
|
+
defaultSortKey?: string;
|
|
17
|
+
defaultSortDirection?: string;
|
|
18
|
+
onSortingChange?: (url: URLSearchParams) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const SortingSelect = ({
|
|
22
|
+
formGroupProps,
|
|
23
|
+
defaultSortKey = SORT_KEY_NAME,
|
|
24
|
+
defaultSortDirection = SORT_DIRECTION_ASC,
|
|
25
|
+
onSortingChange,
|
|
26
|
+
}: SortingSelectProps) => {
|
|
27
|
+
const { t } = useTranslation("Design");
|
|
28
|
+
const [controlValue, setControlValue] = useState(SORT_DIRECTION_ASC);
|
|
29
|
+
const searchParams = useQuery();
|
|
30
|
+
|
|
31
|
+
const { sortKey = defaultSortKey, sortDirection = defaultSortDirection } =
|
|
32
|
+
Object.fromEntries(searchParams);
|
|
33
|
+
|
|
34
|
+
const onSortingValueChange = ({ target: { value } }) => {
|
|
35
|
+
setControlValue(value);
|
|
36
|
+
|
|
37
|
+
const nextSortDirection =
|
|
38
|
+
value === SORT_DIRECTION_NEWEST ? SORT_DIRECTION_DESC : value;
|
|
39
|
+
|
|
40
|
+
const nextSortKey =
|
|
41
|
+
value === SORT_DIRECTION_NEWEST ? SORT_KEY_CREATED_AT : sortKey;
|
|
42
|
+
|
|
43
|
+
const nextSearchParams = new URLSearchParams(searchParams);
|
|
44
|
+
|
|
45
|
+
nextSearchParams.set("sortDirection", nextSortDirection);
|
|
46
|
+
nextSearchParams.set("sortKey", nextSortKey);
|
|
47
|
+
|
|
48
|
+
onSortingChange(nextSearchParams);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (sortKey === SORT_KEY_CREATED_AT) {
|
|
53
|
+
setControlValue(SORT_DIRECTION_NEWEST);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setControlValue(sortDirection);
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, [sortKey, sortDirection]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Form.Group className="d-flex align-items-center p-0" {...formGroupProps}>
|
|
63
|
+
<Form.Label className="text-nowrap mr-4 mb-0">
|
|
64
|
+
{t("App:sortBy")}:
|
|
65
|
+
</Form.Label>
|
|
66
|
+
<Form.Control
|
|
67
|
+
as="select"
|
|
68
|
+
data-testid="sorting-select"
|
|
69
|
+
onChange={onSortingValueChange}
|
|
70
|
+
custom
|
|
71
|
+
value={controlValue}
|
|
72
|
+
>
|
|
73
|
+
<option value={SORT_DIRECTION_ASC}>A-Z</option>
|
|
74
|
+
<option value={SORT_DIRECTION_DESC}>Z-A</option>
|
|
75
|
+
<option value={SORT_DIRECTION_NEWEST}>{t("newestOnTop")}</option>
|
|
76
|
+
</Form.Control>
|
|
77
|
+
</Form.Group>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SortingSelect";
|
package/{dist/styles/widgets/ImageRadioInput.scss → src/styles/image-radio-input/_index.scss}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.image-radio-input {
|
|
2
|
+
width: min-content;
|
|
2
3
|
padding: 0;
|
|
3
4
|
|
|
4
5
|
&-wrapper {
|
|
@@ -9,9 +10,16 @@
|
|
|
9
10
|
cursor: pointer;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
&-image-wrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
max-width: 7.5rem;
|
|
16
|
+
max-height: 4.25rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
&-label {
|
|
13
20
|
display: flex;
|
|
14
21
|
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
15
23
|
gap: 0.5rem;
|
|
16
24
|
|
|
17
25
|
input {
|
|
@@ -19,4 +27,8 @@
|
|
|
19
27
|
margin: 0;
|
|
20
28
|
}
|
|
21
29
|
}
|
|
30
|
+
|
|
31
|
+
.disabled {
|
|
32
|
+
opacity: 0.5;
|
|
33
|
+
}
|
|
22
34
|
}
|
package/src/styles/packages.scss
CHANGED
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
@import "./iframe-page";
|
|
30
30
|
@import "./affiliate";
|
|
31
31
|
@import "./zones";
|
|
32
|
-
@import "./widgets/";
|
|
33
32
|
@import "./resources-blocking";
|
|
34
33
|
@import "./ryft-payment-form";
|
|
35
34
|
@import "./skeleton";
|
|
@@ -37,3 +36,5 @@
|
|
|
37
36
|
@import "./error";
|
|
38
37
|
@import "./customers/";
|
|
39
38
|
@import "./striped-static-table/";
|
|
39
|
+
@import "./image-radio-input/";
|
|
40
|
+
@import "./radio-card/";
|
|
@@ -1,10 +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
|
-
<rect x="8.5" y="9.25" width="103" height="3" rx="1.5" fill="white" stroke="#FF0099"/>
|
|
4
|
-
<rect x="8.5" y="15.5" width="82" height="45.7283" rx="3.5" fill="#F8F8F8" stroke="#FF0099"/>
|
|
5
|
-
<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"/>
|
|
6
|
-
<circle cx="3.5" cy="3" r="1" fill="#FF1111"/>
|
|
7
|
-
<circle cx="6.5" cy="3" r="1" fill="#FFE311"/>
|
|
8
|
-
<circle cx="9.5" cy="3" r="1" fill="#11FF52"/>
|
|
9
|
-
<rect x="93.5" y="15.7715" width="18" height="45.7283" rx="3.5" fill="#D8D8D8" stroke="#FF0099"/>
|
|
10
|
-
</svg>
|
|
@@ -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
|
-
<rect x="28.5" y="17.5" width="63" height="35" rx="3.5" 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="M76 18H88C89.6569 18 91 19.3431 91 21V49C91 50.6569 89.6569 52 88 52H76V18Z" fill="#D8D8D8"/>
|
|
9
|
-
</svg>
|
|
@@ -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,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ShortSnippetTemplate } from "../form/SnippetForm";
|
|
3
|
-
export interface SnippetControlProps {
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
templates: Array<ShortSnippetTemplate>;
|
|
6
|
-
providerHasMap?: boolean | null;
|
|
7
|
-
}
|
|
8
|
-
export declare function SnippetControl({ isLoading, templates, providerHasMap, }: SnippetControlProps): JSX.Element;
|
|
9
|
-
//# sourceMappingURL=SnippetControl.d.ts.map
|