@sikka/hawa 0.1.57 → 0.1.59
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/{src/elements → archive}/HawaSnackbar.tsx +1 -1
- package/{src/elements → archive}/HawaSwitch.tsx +1 -1
- package/dist/index.d.mts +24 -45
- package/dist/index.d.ts +24 -45
- package/dist/index.js +1954 -2030
- package/dist/index.mjs +1773 -1825
- package/dist/styles.css +106 -99
- package/package.json +2 -1
- package/src/blocks/AuthForms/AppLanding.tsx +5 -5
- package/src/blocks/Misc/EmptyState.tsx +1 -1
- package/src/blocks/Misc/NoPermission.tsx +1 -1
- package/src/blocks/Payment/SelectPayment.tsx +153 -54
- package/src/blocks/Pricing/ComparingPlans.tsx +1 -1
- package/src/blocks/Pricing/HorizontalPricing.tsx +5 -5
- package/src/blocks/Referral/ReferralAccount.tsx +2 -2
- package/src/blocks/Referral/ReferralSettlement.tsx +1 -1
- package/src/elements/Button.tsx +1 -0
- package/src/elements/DragDropImages.tsx +32 -4
- package/src/elements/DropdownMenu.tsx +35 -34
- package/src/elements/HawaCodeBlock.tsx +3 -3
- package/src/elements/HawaDropdownMenu.tsx +4 -4
- package/src/elements/HawaRadio.tsx +3 -3
- package/src/elements/HawaSettingsRow.tsx +3 -3
- package/src/elements/HawaStepper.tsx +1 -1
- package/src/elements/HawaTable.tsx +12 -11
- package/src/elements/InvoiceAccordion.tsx +4 -4
- package/src/elements/Select.tsx +3 -3
- package/src/elements/Switch.tsx +68 -0
- package/src/elements/UsageCard.tsx +1 -1
- package/src/elements/UserFeedback.tsx +6 -3
- package/src/elements/index.ts +1 -3
- package/src/layout/AppLayout.tsx +57 -22
- package/src/layout/HawaAppLayout.tsx +6 -6
- package/src/layout/HawaAppLayoutSimplified.tsx +6 -6
- package/src/layout/HawaSiteLayout.tsx +3 -3
- package/src/layout/Sidebar.tsx +0 -2
- package/src/styles.css +106 -99
- package/src/tailwind.css +3 -2
- package/src/elements/HawaLogoButton.tsx +0 -154
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import React, { FC } from "react"
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { FC, useState } from "react"
|
|
2
|
+
import { Button } from "../../elements"
|
|
3
|
+
import {
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardFooter,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
} from "../../elements/Card"
|
|
11
|
+
import { cn } from "../../util"
|
|
4
12
|
|
|
5
13
|
type SelectPaymentTypes = {
|
|
6
14
|
viaMada: boolean
|
|
@@ -17,72 +25,163 @@ type SelectPaymentTypes = {
|
|
|
17
25
|
applePayLabel: string
|
|
18
26
|
visaMasterLabel: string
|
|
19
27
|
googlePayLabel: string
|
|
20
|
-
|
|
21
|
-
handleWallet: any
|
|
22
|
-
handleSTCPay: any
|
|
23
|
-
handlePayPal: any
|
|
24
|
-
handleApplePay: any
|
|
25
|
-
handleCreditCard: any
|
|
26
|
-
handleGooglePay: any
|
|
28
|
+
handleContinue: (string) => void
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export const SelectPayment: FC<SelectPaymentTypes> = (props) => {
|
|
32
|
+
const [selectedMethod, setSelectedMethod] = useState("")
|
|
30
33
|
return (
|
|
31
34
|
<Card>
|
|
32
35
|
<CardHeader>
|
|
33
36
|
<CardTitle>Choose Payment Method</CardTitle>
|
|
37
|
+
<CardDescription>
|
|
38
|
+
And you'll be directed to the next step to complete the payment
|
|
39
|
+
</CardDescription>
|
|
34
40
|
</CardHeader>
|
|
35
|
-
<CardContent>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
<CardContent className="grid grid-cols-2 gap-4">
|
|
42
|
+
<Button
|
|
43
|
+
className={cn(
|
|
44
|
+
"flex w-full flex-col gap-2 pt-6",
|
|
45
|
+
selectedMethod === "mada" && "outline outline-4 outline-primary"
|
|
46
|
+
)}
|
|
47
|
+
variant="outline"
|
|
48
|
+
size="heightless"
|
|
49
|
+
disabled={!props.viaMada}
|
|
50
|
+
onClick={() => setSelectedMethod("mada")}
|
|
51
|
+
>
|
|
52
|
+
<img
|
|
53
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png"
|
|
54
|
+
className="h-6"
|
|
41
55
|
/>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
<span>{props.madaLabel}</span>
|
|
57
|
+
</Button>
|
|
58
|
+
|
|
59
|
+
<Button
|
|
60
|
+
className={cn(
|
|
61
|
+
"flex w-full flex-col gap-2",
|
|
62
|
+
selectedMethod === "apple-pay" &&
|
|
63
|
+
"outline outline-4 outline-primary"
|
|
64
|
+
)}
|
|
65
|
+
variant="outline"
|
|
66
|
+
size="heightless"
|
|
67
|
+
disabled={!props.viaApplePay}
|
|
68
|
+
onClick={() => setSelectedMethod("apple-pay")}
|
|
69
|
+
>
|
|
70
|
+
<img
|
|
71
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png"
|
|
72
|
+
className="h-11"
|
|
55
73
|
/>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
<span>{props.applePayLabel}</span>
|
|
75
|
+
</Button>
|
|
76
|
+
|
|
77
|
+
<Button
|
|
78
|
+
className={cn(
|
|
79
|
+
"flex w-full flex-col gap-2",
|
|
80
|
+
selectedMethod === "visa-master" &&
|
|
81
|
+
"outline outline-4 outline-primary"
|
|
82
|
+
)}
|
|
83
|
+
variant="outline"
|
|
84
|
+
size="heightless"
|
|
85
|
+
disabled={!props.viaCreditCard}
|
|
86
|
+
onClick={() => setSelectedMethod("visa-master")}
|
|
87
|
+
>
|
|
88
|
+
<img
|
|
89
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png"
|
|
90
|
+
className="h-6"
|
|
62
91
|
/>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
92
|
+
<span>{props.visaMasterLabel}</span>
|
|
93
|
+
</Button>
|
|
94
|
+
|
|
95
|
+
<Button
|
|
96
|
+
variant="outline"
|
|
97
|
+
size="heightless"
|
|
98
|
+
className={cn(
|
|
99
|
+
"flex w-full flex-col gap-2",
|
|
100
|
+
selectedMethod === "wallet" && "outline outline-4 outline-primary"
|
|
101
|
+
)}
|
|
102
|
+
disabled={!props.viaWallet}
|
|
103
|
+
onClick={() => setSelectedMethod("wallet")}
|
|
104
|
+
>
|
|
105
|
+
<svg
|
|
106
|
+
version="1.1"
|
|
107
|
+
fill="currentColor"
|
|
108
|
+
viewBox="0 0 223 223"
|
|
109
|
+
className="h-6 w-6"
|
|
110
|
+
>
|
|
111
|
+
<g>
|
|
112
|
+
<path
|
|
113
|
+
d="M223,94.5c0-6.075-4.925-11-11-11h-63c-6.075,0-11,4.925-11,11v33c0,6.075,4.925,11,11,11h63c6.075,0,11-4.925,11-11V94.5z
|
|
114
|
+
M169.515,123.967c-7.082,0-12.823-5.741-12.823-12.823c0-7.082,5.741-12.823,12.823-12.823c7.082,0,12.823,5.741,12.823,12.823
|
|
115
|
+
C182.338,118.225,176.597,123.967,169.515,123.967z"
|
|
116
|
+
/>
|
|
117
|
+
<path
|
|
118
|
+
d="M123.509,68.5H205v-33c0-8.271-6.395-15-14.667-15h-175C7.062,20.5,0,27.229,0,35.5v152c0,8.271,7.062,15,15.333,15h175
|
|
119
|
+
c8.271,0,14.667-6.729,14.667-15v-34h-81.342L123.509,68.5z"
|
|
120
|
+
/>
|
|
121
|
+
</g>
|
|
122
|
+
</svg>
|
|
123
|
+
<span>{props.walletLabel}</span>
|
|
124
|
+
</Button>
|
|
125
|
+
<Button
|
|
126
|
+
variant="outline"
|
|
127
|
+
size="heightless"
|
|
128
|
+
className={cn(
|
|
129
|
+
"flex w-full flex-col gap-2",
|
|
130
|
+
selectedMethod === "stc-pay" && "outline outline-4 outline-primary"
|
|
131
|
+
)}
|
|
132
|
+
disabled={!props.viaSTCPay}
|
|
133
|
+
onClick={() => setSelectedMethod("stc-pay")}
|
|
134
|
+
>
|
|
135
|
+
<img
|
|
136
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png"
|
|
137
|
+
className="h-6"
|
|
69
138
|
/>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
139
|
+
<span>{props.stcPayLabel}</span>
|
|
140
|
+
</Button>
|
|
141
|
+
|
|
142
|
+
<Button
|
|
143
|
+
variant="outline"
|
|
144
|
+
size="heightless"
|
|
145
|
+
className={cn(
|
|
146
|
+
"flex w-full flex-col gap-2",
|
|
147
|
+
selectedMethod === "google-pay" &&
|
|
148
|
+
"outline outline-4 outline-primary"
|
|
149
|
+
)}
|
|
150
|
+
disabled={!props.viaGooglePay}
|
|
151
|
+
onClick={() => setSelectedMethod("google-pay")}
|
|
152
|
+
>
|
|
153
|
+
<img
|
|
154
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png"
|
|
155
|
+
className="h-6"
|
|
76
156
|
/>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
157
|
+
<span>{props.googlePayLabel}</span>
|
|
158
|
+
</Button>
|
|
159
|
+
<Button
|
|
160
|
+
variant="outline"
|
|
161
|
+
size="heightless"
|
|
162
|
+
className={cn(
|
|
163
|
+
"col-span-2 flex w-full flex-col gap-2",
|
|
164
|
+
selectedMethod === "paypal" && "outline outline-4 outline-primary"
|
|
165
|
+
)}
|
|
166
|
+
disabled={!props.viaPayPal}
|
|
167
|
+
onClick={() => setSelectedMethod("paypal")}
|
|
168
|
+
>
|
|
169
|
+
<img
|
|
170
|
+
src="https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png"
|
|
171
|
+
className="h-6"
|
|
83
172
|
/>
|
|
84
|
-
|
|
173
|
+
<span>{props.paypalLabel}</span>
|
|
174
|
+
</Button>
|
|
85
175
|
</CardContent>
|
|
176
|
+
<CardFooter>
|
|
177
|
+
<Button
|
|
178
|
+
onClick={() => props.handleContinue(selectedMethod)}
|
|
179
|
+
className="w-full"
|
|
180
|
+
disabled={!selectedMethod}
|
|
181
|
+
>
|
|
182
|
+
Continue
|
|
183
|
+
</Button>
|
|
184
|
+
</CardFooter>
|
|
86
185
|
</Card>
|
|
87
186
|
)
|
|
88
187
|
}
|
|
@@ -105,13 +105,13 @@ const CheckIcons = () => (
|
|
|
105
105
|
<svg
|
|
106
106
|
fill="none"
|
|
107
107
|
viewBox="0 0 24 24"
|
|
108
|
-
|
|
108
|
+
strokeWidth="1.5"
|
|
109
109
|
stroke="currentColor"
|
|
110
110
|
className="default h-8 w-8 text-neutral-500"
|
|
111
111
|
>
|
|
112
112
|
<path
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
strokeLinecap="round"
|
|
114
|
+
strokeLinejoin="round"
|
|
115
115
|
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
116
116
|
/>
|
|
117
117
|
</svg>
|
|
@@ -121,8 +121,8 @@ const CheckIcons = () => (
|
|
|
121
121
|
className="active hidden h-8 w-8 text-blue-500"
|
|
122
122
|
>
|
|
123
123
|
<path
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
fillRule="evenodd"
|
|
125
|
+
clipRule="evenodd"
|
|
126
126
|
d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z"
|
|
127
127
|
/>
|
|
128
128
|
</svg>
|
|
@@ -28,7 +28,7 @@ export const ReferralAccount: FC<ReferralAccount> = ({
|
|
|
28
28
|
<svg
|
|
29
29
|
stroke="currentColor"
|
|
30
30
|
fill="currentColor"
|
|
31
|
-
|
|
31
|
+
strokeWidth="0"
|
|
32
32
|
viewBox="0 0 512 512"
|
|
33
33
|
height="1em"
|
|
34
34
|
width="1em"
|
|
@@ -51,7 +51,7 @@ export const ReferralAccount: FC<ReferralAccount> = ({
|
|
|
51
51
|
<svg
|
|
52
52
|
stroke="currentColor"
|
|
53
53
|
fill="currentColor"
|
|
54
|
-
|
|
54
|
+
strokeWidth="0"
|
|
55
55
|
viewBox="0 0 512 512"
|
|
56
56
|
height="1em"
|
|
57
57
|
width="1em"
|
package/src/elements/Button.tsx
CHANGED
|
@@ -20,6 +20,9 @@ type DragDropImagesTypes = {
|
|
|
20
20
|
onClearFiles: any
|
|
21
21
|
maxSize: number
|
|
22
22
|
errorMessages: string
|
|
23
|
+
disclaimer?: boolean
|
|
24
|
+
termsLink?: string
|
|
25
|
+
privacyLink?: string
|
|
23
26
|
/** The translation object, use this to replace the default text with any translated text you want.*/
|
|
24
27
|
texts: {
|
|
25
28
|
errorUploading: any
|
|
@@ -29,6 +32,10 @@ type DragDropImagesTypes = {
|
|
|
29
32
|
fileTooLarge: any
|
|
30
33
|
acceptedFileTypes: any
|
|
31
34
|
invalidFileType: any
|
|
35
|
+
terms?: string
|
|
36
|
+
privacyPolicy?: string
|
|
37
|
+
disclaimer?: string
|
|
38
|
+
and?: string
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
|
|
@@ -44,8 +51,11 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
44
51
|
showPreview,
|
|
45
52
|
onDeleteFile,
|
|
46
53
|
onClearFiles,
|
|
54
|
+
disclaimer,
|
|
47
55
|
maxSize,
|
|
48
56
|
label,
|
|
57
|
+
termsLink,
|
|
58
|
+
privacyLink,
|
|
49
59
|
}) => {
|
|
50
60
|
const [cmp, setCmp] = useState(0)
|
|
51
61
|
const [max, setMax] = useState<any>(0)
|
|
@@ -197,7 +207,7 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
197
207
|
)}
|
|
198
208
|
<div
|
|
199
209
|
className={clsx(
|
|
200
|
-
"flex flex-col justify-center rounded border border-dashed transition-all hover:bg-gray-100 dark:hover:bg-gray-800 ",
|
|
210
|
+
"flex flex-col justify-center rounded border border-dashed bg-gray-50 p-6 transition-all hover:bg-gray-100 dark:bg-gray-950 dark:hover:bg-gray-800 ",
|
|
201
211
|
isDragActive ? "bg-gray-200 dark:bg-gray-700" : "bg-background"
|
|
202
212
|
)}
|
|
203
213
|
>
|
|
@@ -207,10 +217,10 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
207
217
|
<svg
|
|
208
218
|
stroke="currentColor"
|
|
209
219
|
fill="none"
|
|
210
|
-
|
|
220
|
+
strokeWidth="2"
|
|
211
221
|
viewBox="0 0 24 24"
|
|
212
|
-
|
|
213
|
-
|
|
222
|
+
strokeLinecap="round"
|
|
223
|
+
strokeLinejoin="round"
|
|
214
224
|
height="1.5em"
|
|
215
225
|
width="1.5em"
|
|
216
226
|
>
|
|
@@ -246,6 +256,24 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
246
256
|
) : null}
|
|
247
257
|
<div className="px-4">{fileRejections[0]?.errors[0]?.code && errs}</div>
|
|
248
258
|
</div>
|
|
259
|
+
{disclaimer && (
|
|
260
|
+
<div className="mt-2 text-sm text-muted-foreground/50">
|
|
261
|
+
{texts.disclaimer ?? "By uploading a file you agree to our"}{" "}
|
|
262
|
+
<a
|
|
263
|
+
href={termsLink}
|
|
264
|
+
className="clickable-link text-muted-foreground/50"
|
|
265
|
+
>
|
|
266
|
+
{texts.terms ?? "Terms"}
|
|
267
|
+
</a>{" "}
|
|
268
|
+
{texts.and ?? "and"}{" "}
|
|
269
|
+
<a
|
|
270
|
+
href={privacyLink}
|
|
271
|
+
className="clickable-link text-muted-foreground/50"
|
|
272
|
+
>
|
|
273
|
+
{texts.privacyPolicy ?? "Privacy Policy"}
|
|
274
|
+
</a>
|
|
275
|
+
</div>
|
|
276
|
+
)}
|
|
249
277
|
</div>
|
|
250
278
|
)
|
|
251
279
|
}
|
|
@@ -25,20 +25,20 @@ const DropdownMenuSubTrigger = React.forwardRef<
|
|
|
25
25
|
)}
|
|
26
26
|
{...props}
|
|
27
27
|
>
|
|
28
|
-
<div className="flex flex-row items-center gap-
|
|
28
|
+
<div className="flex flex-row items-center gap-2">{children}</div>{" "}
|
|
29
29
|
{/* <ChevronRight className="ml-auto h-4 w-4" /> */}
|
|
30
30
|
<svg
|
|
31
31
|
aria-label="Chevron Right Icon"
|
|
32
32
|
stroke="currentColor"
|
|
33
33
|
fill="currentColor"
|
|
34
|
-
|
|
34
|
+
strokeWidth="0"
|
|
35
35
|
viewBox="0 0 16 16"
|
|
36
36
|
height="1em"
|
|
37
37
|
width="1em"
|
|
38
38
|
className={cn(props.dir === "rtl" ? "rotate-180" : "")}
|
|
39
39
|
>
|
|
40
40
|
<path
|
|
41
|
-
|
|
41
|
+
fillRule="evenodd"
|
|
42
42
|
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
|
|
43
43
|
></path>
|
|
44
44
|
</svg>
|
|
@@ -72,7 +72,7 @@ const DropdownMenuContent = React.forwardRef<
|
|
|
72
72
|
ref={ref}
|
|
73
73
|
sideOffset={sideOffset}
|
|
74
74
|
className={cn(
|
|
75
|
-
"z-50
|
|
75
|
+
"z-50 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
76
76
|
className
|
|
77
77
|
)}
|
|
78
78
|
{...props}
|
|
@@ -85,17 +85,22 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
85
85
|
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
86
86
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
87
87
|
inset?: boolean
|
|
88
|
+
end?: any
|
|
88
89
|
}
|
|
89
90
|
>(({ className, inset, ...props }, ref) => (
|
|
90
91
|
<DropdownMenuPrimitive.Item
|
|
91
92
|
ref={ref}
|
|
92
93
|
className={cn(
|
|
93
|
-
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-
|
|
94
|
+
"relative flex cursor-pointer select-none items-center justify-between rounded-sm px-2 py-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
94
95
|
inset && "pl-8",
|
|
95
96
|
className
|
|
96
97
|
)}
|
|
97
98
|
{...props}
|
|
98
|
-
|
|
99
|
+
>
|
|
100
|
+
<div className="flex flex-row items-center gap-2">{props.children}</div>
|
|
101
|
+
|
|
102
|
+
{props.end && props.end}
|
|
103
|
+
</DropdownMenuPrimitive.Item>
|
|
99
104
|
))
|
|
100
105
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
101
106
|
|
|
@@ -119,7 +124,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
|
|
|
119
124
|
aria-label="Check Mark"
|
|
120
125
|
stroke="currentColor"
|
|
121
126
|
fill="currentColor"
|
|
122
|
-
|
|
127
|
+
strokeWidth="0"
|
|
123
128
|
viewBox="0 0 512 512"
|
|
124
129
|
height="0.60em"
|
|
125
130
|
width="0.60em"
|
|
@@ -157,9 +162,9 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
157
162
|
viewBox="0 0 24 24"
|
|
158
163
|
fill="none"
|
|
159
164
|
stroke="currentColor"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
strokeWidth="2"
|
|
166
|
+
strokeLinecap="round"
|
|
167
|
+
strokeLinejoin="round"
|
|
163
168
|
className="h-2 w-2 fill-current"
|
|
164
169
|
>
|
|
165
170
|
<circle cx="12" cy="12" r="10"></circle>
|
|
@@ -239,6 +244,8 @@ type Item = {
|
|
|
239
244
|
icon?: any
|
|
240
245
|
label: string
|
|
241
246
|
value: string
|
|
247
|
+
end?: any
|
|
248
|
+
presist?: boolean
|
|
242
249
|
action?: () => void
|
|
243
250
|
highlighted?: boolean
|
|
244
251
|
subitems?: SubItem[] // Note the use of the optional modifier
|
|
@@ -255,8 +262,8 @@ export const DropdownMenu = ({
|
|
|
255
262
|
triggerClassname,
|
|
256
263
|
align,
|
|
257
264
|
alignOffset,
|
|
265
|
+
width = "default",
|
|
258
266
|
}: {
|
|
259
|
-
// ... other prop types
|
|
260
267
|
trigger?: any
|
|
261
268
|
items?: Item[]
|
|
262
269
|
direction?: "rtl" | "ltr"
|
|
@@ -267,8 +274,14 @@ export const DropdownMenu = ({
|
|
|
267
274
|
side?: ExtendedDropdownMenuContentProps["side"]
|
|
268
275
|
align?: ExtendedDropdownMenuContentProps["align"]
|
|
269
276
|
alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
|
|
270
|
-
|
|
277
|
+
width?: "default" | "sm" | "lg" | "parent"
|
|
271
278
|
}) => {
|
|
279
|
+
const widthStyles = {
|
|
280
|
+
default: "min-w-[8rem]",
|
|
281
|
+
sm: "w-fit",
|
|
282
|
+
lg: "w-[200px]",
|
|
283
|
+
parent: "ddm-w-parent",
|
|
284
|
+
}
|
|
272
285
|
return (
|
|
273
286
|
<DropdownMenuRoot dir={direction}>
|
|
274
287
|
<DropdownMenuTrigger className={triggerClassname}>
|
|
@@ -278,7 +291,7 @@ export const DropdownMenu = ({
|
|
|
278
291
|
<DropdownMenuContent
|
|
279
292
|
side={side}
|
|
280
293
|
sideOffset={sideOffset}
|
|
281
|
-
className={cn(className, "flex flex-col gap-
|
|
294
|
+
className={cn(className, widthStyles[width], "flex flex-col gap-2")}
|
|
282
295
|
align={align}
|
|
283
296
|
alignOffset={alignOffset}
|
|
284
297
|
>
|
|
@@ -293,7 +306,7 @@ export const DropdownMenu = ({
|
|
|
293
306
|
<DropdownMenuSubContent>
|
|
294
307
|
{item.subitems.map((subitem, subIndex) => (
|
|
295
308
|
<DropdownMenuItem
|
|
296
|
-
className="flex flex-row gap-
|
|
309
|
+
className="flex flex-row gap-2"
|
|
297
310
|
onSelect={() => subitem.action()}
|
|
298
311
|
key={subIndex}
|
|
299
312
|
>
|
|
@@ -306,9 +319,15 @@ export const DropdownMenu = ({
|
|
|
306
319
|
</DropdownMenuSub>
|
|
307
320
|
) : (
|
|
308
321
|
<DropdownMenuItem
|
|
309
|
-
className="flex flex-row gap-
|
|
322
|
+
className="flex flex-row gap-2"
|
|
310
323
|
key={index}
|
|
311
|
-
onSelect={() =>
|
|
324
|
+
onSelect={(e) => {
|
|
325
|
+
if (item.presist) {
|
|
326
|
+
e.preventDefault()
|
|
327
|
+
}
|
|
328
|
+
item.action()
|
|
329
|
+
}}
|
|
330
|
+
end={item.end}
|
|
312
331
|
>
|
|
313
332
|
{item.icon && item.icon}
|
|
314
333
|
{item.label}
|
|
@@ -320,21 +339,3 @@ export const DropdownMenu = ({
|
|
|
320
339
|
</DropdownMenuRoot>
|
|
321
340
|
)
|
|
322
341
|
}
|
|
323
|
-
|
|
324
|
-
// export {
|
|
325
|
-
// DropdownMenu,
|
|
326
|
-
// DropdownMenuTrigger,
|
|
327
|
-
// DropdownMenuContent,
|
|
328
|
-
// DropdownMenuItem,
|
|
329
|
-
// DropdownMenuCheckboxItem,
|
|
330
|
-
// DropdownMenuRadioItem,
|
|
331
|
-
// DropdownMenuLabel,
|
|
332
|
-
// DropdownMenuSeparator,
|
|
333
|
-
// DropdownMenuShortcut,
|
|
334
|
-
// DropdownMenuGroup,
|
|
335
|
-
// DropdownMenuPortal,
|
|
336
|
-
// DropdownMenuSub,
|
|
337
|
-
// DropdownMenuSubContent,
|
|
338
|
-
// DropdownMenuSubTrigger,
|
|
339
|
-
// DropdownMenuRadioGroup,
|
|
340
|
-
// }
|
|
@@ -108,10 +108,10 @@ export const HawaCodeBlock: FC<CodeBlockTypes> = ({
|
|
|
108
108
|
aria-label="Copy Icon"
|
|
109
109
|
stroke="currentColor"
|
|
110
110
|
fill="none"
|
|
111
|
-
|
|
111
|
+
strokeWidth="2"
|
|
112
112
|
viewBox="0 0 24 24"
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
strokeLinecap="round"
|
|
114
|
+
strokeLinejoin="round"
|
|
115
115
|
height="1em"
|
|
116
116
|
width="1em"
|
|
117
117
|
>
|
|
@@ -101,13 +101,13 @@ export const HawaDropdownMenu: FC<TMenuTypes> = ({ children, direction }) => {
|
|
|
101
101
|
aria-label="Chevron Right Icon"
|
|
102
102
|
stroke="currentColor"
|
|
103
103
|
fill="currentColor"
|
|
104
|
-
|
|
104
|
+
strokeWidth="0"
|
|
105
105
|
viewBox="0 0 16 16"
|
|
106
106
|
height="1em"
|
|
107
107
|
width="1em"
|
|
108
108
|
>
|
|
109
109
|
<path
|
|
110
|
-
|
|
110
|
+
fillRule="evenodd"
|
|
111
111
|
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
|
|
112
112
|
></path>
|
|
113
113
|
</svg>
|
|
@@ -157,7 +157,7 @@ export const HawaDropdownMenu: FC<TMenuTypes> = ({ children, direction }) => {
|
|
|
157
157
|
aria-label="Check Mark"
|
|
158
158
|
stroke="currentColor"
|
|
159
159
|
fill="currentColor"
|
|
160
|
-
|
|
160
|
+
strokeWidth="0"
|
|
161
161
|
viewBox="0 0 512 512"
|
|
162
162
|
height="0.60em"
|
|
163
163
|
width="0.60em"
|
|
@@ -185,7 +185,7 @@ export const HawaDropdownMenu: FC<TMenuTypes> = ({ children, direction }) => {
|
|
|
185
185
|
aria-label="Check Mark"
|
|
186
186
|
stroke="currentColor"
|
|
187
187
|
fill="currentColor"
|
|
188
|
-
|
|
188
|
+
strokeWidth="0"
|
|
189
189
|
viewBox="0 0 512 512"
|
|
190
190
|
height="0.60em"
|
|
191
191
|
width="0.60em"
|
|
@@ -155,9 +155,9 @@ export const HawaRadio: FC<RadioTypes> = ({
|
|
|
155
155
|
>
|
|
156
156
|
<path
|
|
157
157
|
stroke="currentColor"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
strokeLinecap="round"
|
|
159
|
+
strokeLinejoin="round"
|
|
160
|
+
strokeWidth="2"
|
|
161
161
|
d="M1 5h12m0 0L9 1m4 4L9 9"
|
|
162
162
|
/>
|
|
163
163
|
</svg> */}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { FC } from "react"
|
|
2
2
|
import { HawaTextField } from "./HawaTextField"
|
|
3
|
-
import { HawaSwitch } from "./HawaSwitch"
|
|
4
3
|
import { HawaColorPicker } from "./HawaColorPicker"
|
|
5
4
|
import { HawaRange } from "./HawaRange"
|
|
6
5
|
import { HawaRadio } from "./HawaRadio"
|
|
7
6
|
import { HawaSelect } from "./HawaSelect"
|
|
7
|
+
import { Switch } from "./Switch"
|
|
8
8
|
|
|
9
9
|
type SettingsRowTypes = {
|
|
10
10
|
settingsLabel: string
|
|
@@ -24,7 +24,7 @@ type SettingsRowTypes = {
|
|
|
24
24
|
max?: any
|
|
25
25
|
}
|
|
26
26
|
switchProps: {
|
|
27
|
-
size: "
|
|
27
|
+
size: "sm" | "default"
|
|
28
28
|
}
|
|
29
29
|
selectProps: {
|
|
30
30
|
label?: string
|
|
@@ -64,7 +64,7 @@ export const HawaSettingsRow: FC<SettingsRowTypes> = ({
|
|
|
64
64
|
)}{" "}
|
|
65
65
|
</div>
|
|
66
66
|
{settingsType === "text" && <HawaTextField margin="none" width="small" />}
|
|
67
|
-
{settingsType === "boolean" && <
|
|
67
|
+
{settingsType === "boolean" && <Switch {...switchProps} />}
|
|
68
68
|
{settingsType === "range" && <HawaRange {...rangeProps} />}
|
|
69
69
|
{settingsType === "color" && <HawaColorPicker {...colorProps} />}
|
|
70
70
|
{settingsType === "radio" && <HawaRadio {...radioProps} />}
|