myoperator-ui 0.0.159 → 0.0.160-beta.1
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/index.js +219 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -456,7 +456,7 @@ const buttonVariants = cva(
|
|
|
456
456
|
destructive:
|
|
457
457
|
"bg-semantic-error-primary text-semantic-text-inverted hover:bg-semantic-error-hover",
|
|
458
458
|
outline:
|
|
459
|
-
"border border-semantic-border-
|
|
459
|
+
"border border-semantic-border-layout bg-semantic-bg-primary text-semantic-text-secondary hover:bg-semantic-primary-surface",
|
|
460
460
|
secondary:
|
|
461
461
|
"bg-semantic-primary-surface text-semantic-text-secondary hover:bg-semantic-bg-hover",
|
|
462
462
|
ghost:
|
|
@@ -7664,6 +7664,7 @@ export const AutoPaySetup = React.forwardRef<HTMLDivElement, AutoPaySetupProps>(
|
|
|
7664
7664
|
noteLabel = "Note:",
|
|
7665
7665
|
showCta = true,
|
|
7666
7666
|
ctaText = "Enable Auto-Pay",
|
|
7667
|
+
ctaVariant = "default",
|
|
7667
7668
|
onCtaClick,
|
|
7668
7669
|
loading = false,
|
|
7669
7670
|
disabled = false,
|
|
@@ -7724,7 +7725,7 @@ export const AutoPaySetup = React.forwardRef<HTMLDivElement, AutoPaySetupProps>(
|
|
|
7724
7725
|
{/* CTA Button */}
|
|
7725
7726
|
{showCta && (
|
|
7726
7727
|
<Button
|
|
7727
|
-
variant=
|
|
7728
|
+
variant={ctaVariant}
|
|
7728
7729
|
className="w-full"
|
|
7729
7730
|
onClick={onCtaClick}
|
|
7730
7731
|
loading={loading}
|
|
@@ -7776,6 +7777,8 @@ export interface AutoPaySetupProps {
|
|
|
7776
7777
|
showCta?: boolean;
|
|
7777
7778
|
/** Text for the CTA button (defaults to "Enable Auto-Pay") */
|
|
7778
7779
|
ctaText?: string;
|
|
7780
|
+
/** CTA button variant \u2014 use "outline" for the subscribed "Edit subscription" state */
|
|
7781
|
+
ctaVariant?: "default" | "outline";
|
|
7779
7782
|
/** Callback when CTA button is clicked */
|
|
7780
7783
|
onCtaClick?: () => void;
|
|
7781
7784
|
/** Whether the CTA button shows loading state */
|
|
@@ -8197,6 +8200,220 @@ export type {
|
|
|
8197
8200
|
PaymentSummaryProps,
|
|
8198
8201
|
PaymentSummaryItem,
|
|
8199
8202
|
} from "./payment-summary";
|
|
8203
|
+
`, prefix)
|
|
8204
|
+
}
|
|
8205
|
+
]
|
|
8206
|
+
},
|
|
8207
|
+
"payment-option-card": {
|
|
8208
|
+
name: "payment-option-card",
|
|
8209
|
+
description: "A selectable payment method list with icons, titles, and descriptions",
|
|
8210
|
+
category: "custom",
|
|
8211
|
+
dependencies: [
|
|
8212
|
+
"clsx",
|
|
8213
|
+
"tailwind-merge",
|
|
8214
|
+
"lucide-react"
|
|
8215
|
+
],
|
|
8216
|
+
internalDependencies: [
|
|
8217
|
+
"button"
|
|
8218
|
+
],
|
|
8219
|
+
isMultiFile: true,
|
|
8220
|
+
directory: "payment-option-card",
|
|
8221
|
+
mainFile: "payment-option-card.tsx",
|
|
8222
|
+
files: [
|
|
8223
|
+
{
|
|
8224
|
+
name: "payment-option-card.tsx",
|
|
8225
|
+
content: prefixTailwindClasses(`import * as React from "react";
|
|
8226
|
+
import { cn } from "../../../lib/utils";
|
|
8227
|
+
import { Button } from "../button";
|
|
8228
|
+
import { X } from "lucide-react";
|
|
8229
|
+
import type { PaymentOptionCardProps } from "./types";
|
|
8230
|
+
|
|
8231
|
+
/**
|
|
8232
|
+
* PaymentOptionCard displays a selectable list of payment methods with icons,
|
|
8233
|
+
* titles, and descriptions. One option can be highlighted as selected.
|
|
8234
|
+
*
|
|
8235
|
+
* @example
|
|
8236
|
+
* \`\`\`tsx
|
|
8237
|
+
* <PaymentOptionCard
|
|
8238
|
+
* options={[
|
|
8239
|
+
* { id: "net-banking", icon: <Globe className="size-5" />, title: "Net banking", description: "Pay securely through your bank" },
|
|
8240
|
+
* { id: "upi", icon: <Smartphone className="size-5" />, title: "UPI", description: "Pay using UPI ID or QR" },
|
|
8241
|
+
* ]}
|
|
8242
|
+
* onOptionSelect={(id) => console.log(id)}
|
|
8243
|
+
* onCtaClick={() => console.log("proceed")}
|
|
8244
|
+
* />
|
|
8245
|
+
* \`\`\`
|
|
8246
|
+
*/
|
|
8247
|
+
export const PaymentOptionCard = React.forwardRef<
|
|
8248
|
+
HTMLDivElement,
|
|
8249
|
+
PaymentOptionCardProps
|
|
8250
|
+
>(
|
|
8251
|
+
(
|
|
8252
|
+
{
|
|
8253
|
+
title = "Select payment method",
|
|
8254
|
+
subtitle = "Preferred method with secure transactions",
|
|
8255
|
+
options,
|
|
8256
|
+
selectedOptionId,
|
|
8257
|
+
defaultSelectedOptionId,
|
|
8258
|
+
onOptionSelect,
|
|
8259
|
+
ctaText = "Proceed to pay",
|
|
8260
|
+
onCtaClick,
|
|
8261
|
+
onClose,
|
|
8262
|
+
loading = false,
|
|
8263
|
+
disabled = false,
|
|
8264
|
+
className,
|
|
8265
|
+
},
|
|
8266
|
+
ref
|
|
8267
|
+
) => {
|
|
8268
|
+
const [internalSelected, setInternalSelected] = React.useState<
|
|
8269
|
+
string | undefined
|
|
8270
|
+
>(defaultSelectedOptionId);
|
|
8271
|
+
|
|
8272
|
+
const isControlled = selectedOptionId !== undefined;
|
|
8273
|
+
const activeId = isControlled ? selectedOptionId : internalSelected;
|
|
8274
|
+
|
|
8275
|
+
const handleSelect = (optionId: string) => {
|
|
8276
|
+
if (!isControlled) {
|
|
8277
|
+
setInternalSelected(optionId);
|
|
8278
|
+
}
|
|
8279
|
+
onOptionSelect?.(optionId);
|
|
8280
|
+
};
|
|
8281
|
+
|
|
8282
|
+
return (
|
|
8283
|
+
<div
|
|
8284
|
+
ref={ref}
|
|
8285
|
+
className={cn(
|
|
8286
|
+
"relative w-full rounded-lg bg-background border-b border-[#e4e4e4] p-9",
|
|
8287
|
+
className
|
|
8288
|
+
)}
|
|
8289
|
+
>
|
|
8290
|
+
{/* Close button */}
|
|
8291
|
+
{onClose && (
|
|
8292
|
+
<button
|
|
8293
|
+
type="button"
|
|
8294
|
+
onClick={onClose}
|
|
8295
|
+
className="absolute right-6 top-6 text-semantic-text-muted hover:text-semantic-text-primary transition-colors"
|
|
8296
|
+
aria-label="Close"
|
|
8297
|
+
>
|
|
8298
|
+
<X className="size-3.5" />
|
|
8299
|
+
</button>
|
|
8300
|
+
)}
|
|
8301
|
+
|
|
8302
|
+
<div className="flex flex-col gap-6">
|
|
8303
|
+
{/* Header */}
|
|
8304
|
+
<div className="flex flex-col gap-2">
|
|
8305
|
+
<h3 className="text-lg font-semibold text-semantic-text-primary m-0">
|
|
8306
|
+
{title}
|
|
8307
|
+
</h3>
|
|
8308
|
+
<p className="text-sm text-semantic-text-muted tracking-[0.035px] m-0">
|
|
8309
|
+
{subtitle}
|
|
8310
|
+
</p>
|
|
8311
|
+
</div>
|
|
8312
|
+
|
|
8313
|
+
{/* Options list */}
|
|
8314
|
+
<div className="flex flex-col gap-2.5">
|
|
8315
|
+
{options.map((option) => {
|
|
8316
|
+
const isSelected = activeId === option.id;
|
|
8317
|
+
return (
|
|
8318
|
+
<button
|
|
8319
|
+
key={option.id}
|
|
8320
|
+
type="button"
|
|
8321
|
+
onClick={() => handleSelect(option.id)}
|
|
8322
|
+
className={cn(
|
|
8323
|
+
"flex items-center gap-2.5 w-full rounded-lg border p-3 text-left transition-colors cursor-pointer bg-transparent",
|
|
8324
|
+
isSelected
|
|
8325
|
+
? "border-[var(--semantic-brand)]"
|
|
8326
|
+
: "border-semantic-border-layout hover:border-[var(--semantic-brand-selected-hover)]"
|
|
8327
|
+
)}
|
|
8328
|
+
>
|
|
8329
|
+
<div className="flex items-center justify-center size-[34px] rounded-lg bg-[var(--color-info-25)] shrink-0">
|
|
8330
|
+
{option.icon}
|
|
8331
|
+
</div>
|
|
8332
|
+
<div className="flex flex-col gap-0.5 min-w-0">
|
|
8333
|
+
<span className="text-sm text-semantic-text-primary tracking-[0.035px]">
|
|
8334
|
+
{option.title}
|
|
8335
|
+
</span>
|
|
8336
|
+
<span className="text-xs text-semantic-text-muted tracking-[0.048px]">
|
|
8337
|
+
{option.description}
|
|
8338
|
+
</span>
|
|
8339
|
+
</div>
|
|
8340
|
+
</button>
|
|
8341
|
+
);
|
|
8342
|
+
})}
|
|
8343
|
+
</div>
|
|
8344
|
+
|
|
8345
|
+
{/* CTA button */}
|
|
8346
|
+
<Button
|
|
8347
|
+
variant="default"
|
|
8348
|
+
className="w-full"
|
|
8349
|
+
onClick={onCtaClick}
|
|
8350
|
+
loading={loading}
|
|
8351
|
+
disabled={disabled}
|
|
8352
|
+
>
|
|
8353
|
+
{ctaText}
|
|
8354
|
+
</Button>
|
|
8355
|
+
</div>
|
|
8356
|
+
</div>
|
|
8357
|
+
);
|
|
8358
|
+
}
|
|
8359
|
+
);
|
|
8360
|
+
|
|
8361
|
+
PaymentOptionCard.displayName = "PaymentOptionCard";
|
|
8362
|
+
`, prefix)
|
|
8363
|
+
},
|
|
8364
|
+
{
|
|
8365
|
+
name: "types.ts",
|
|
8366
|
+
content: prefixTailwindClasses(`import * as React from "react";
|
|
8367
|
+
|
|
8368
|
+
/**
|
|
8369
|
+
* A single payment option entry.
|
|
8370
|
+
*/
|
|
8371
|
+
export interface PaymentOption {
|
|
8372
|
+
/** Unique identifier for this option */
|
|
8373
|
+
id: string;
|
|
8374
|
+
/** Icon rendered inside a rounded container (e.g. an SVG or Lucide icon) */
|
|
8375
|
+
icon: React.ReactNode;
|
|
8376
|
+
/** Primary label (e.g. "Net banking") */
|
|
8377
|
+
title: string;
|
|
8378
|
+
/** Secondary description (e.g. "Pay securely through your bank") */
|
|
8379
|
+
description: string;
|
|
8380
|
+
}
|
|
8381
|
+
|
|
8382
|
+
/**
|
|
8383
|
+
* Props for the PaymentOptionCard component.
|
|
8384
|
+
*/
|
|
8385
|
+
export interface PaymentOptionCardProps {
|
|
8386
|
+
/** Header title */
|
|
8387
|
+
title?: string;
|
|
8388
|
+
/** Header subtitle */
|
|
8389
|
+
subtitle?: string;
|
|
8390
|
+
/** List of selectable payment options */
|
|
8391
|
+
options: PaymentOption[];
|
|
8392
|
+
/** Currently selected option id */
|
|
8393
|
+
selectedOptionId?: string;
|
|
8394
|
+
/** Default selected option id (uncontrolled mode) */
|
|
8395
|
+
defaultSelectedOptionId?: string;
|
|
8396
|
+
/** Callback fired when an option is selected */
|
|
8397
|
+
onOptionSelect?: (optionId: string) => void;
|
|
8398
|
+
/** CTA button text */
|
|
8399
|
+
ctaText?: string;
|
|
8400
|
+
/** Callback fired when CTA button is clicked */
|
|
8401
|
+
onCtaClick?: () => void;
|
|
8402
|
+
/** Callback fired when close button is clicked */
|
|
8403
|
+
onClose?: () => void;
|
|
8404
|
+
/** Whether the CTA button shows loading state */
|
|
8405
|
+
loading?: boolean;
|
|
8406
|
+
/** Whether the CTA button is disabled */
|
|
8407
|
+
disabled?: boolean;
|
|
8408
|
+
/** Additional className for the root element */
|
|
8409
|
+
className?: string;
|
|
8410
|
+
}
|
|
8411
|
+
`, prefix)
|
|
8412
|
+
},
|
|
8413
|
+
{
|
|
8414
|
+
name: "index.ts",
|
|
8415
|
+
content: prefixTailwindClasses(`export { PaymentOptionCard } from "./payment-option-card";
|
|
8416
|
+
export type { PaymentOptionCardProps, PaymentOption } from "./types";
|
|
8200
8417
|
`, prefix)
|
|
8201
8418
|
}
|
|
8202
8419
|
]
|