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