myoperator-ui 0.0.194 → 0.0.195
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 +222 -61
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9009,7 +9009,7 @@ export { DateInput };
|
|
|
9009
9009
|
{
|
|
9010
9010
|
name: "payment-summary.tsx",
|
|
9011
9011
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
9012
|
-
import { Info } from "lucide-react";
|
|
9012
|
+
import { Info, Wallet } from "lucide-react";
|
|
9013
9013
|
import { cn } from "../../../lib/utils";
|
|
9014
9014
|
import {
|
|
9015
9015
|
Tooltip,
|
|
@@ -9035,15 +9035,53 @@ export interface PaymentSummaryItem {
|
|
|
9035
9035
|
bold?: boolean;
|
|
9036
9036
|
/** Font size for the value \u2014 "lg" renders at 18px semibold */
|
|
9037
9037
|
valueSize?: "default" | "lg";
|
|
9038
|
+
/** Small 12px link-colored hint text shown below the label (e.g. remaining prepaid amount) */
|
|
9039
|
+
hint?: string;
|
|
9040
|
+
}
|
|
9041
|
+
|
|
9042
|
+
/** Right-side wallet info displayed in the card header */
|
|
9043
|
+
export interface PaymentSummaryHeaderInfo {
|
|
9044
|
+
/** Label text e.g. "Prepaid Wallet Amount:" */
|
|
9045
|
+
label: string;
|
|
9046
|
+
/** Value text e.g. "\u20B96,771.48" */
|
|
9047
|
+
value: string;
|
|
9048
|
+
/** Color variant for the value \u2014 defaults to "success" */
|
|
9049
|
+
valueColor?: "default" | "success" | "error";
|
|
9050
|
+
}
|
|
9051
|
+
|
|
9052
|
+
/** A single row inside the breakdown card */
|
|
9053
|
+
export interface BreakdownCardItem {
|
|
9054
|
+
label: string;
|
|
9055
|
+
value: string;
|
|
9056
|
+
/** Color variant for the label */
|
|
9057
|
+
labelColor?: "default" | "success" | "muted";
|
|
9058
|
+
/** Color variant for the value */
|
|
9059
|
+
valueColor?: "default" | "success" | "muted";
|
|
9060
|
+
}
|
|
9061
|
+
|
|
9062
|
+
/** The light-blue bordered breakdown card shown below the subtotal */
|
|
9063
|
+
export interface PaymentSummaryBreakdownCard {
|
|
9064
|
+
/** Top items separated by an inner border (e.g. Gross Charges, Prepaid Deduction) */
|
|
9065
|
+
topItems: BreakdownCardItem[];
|
|
9066
|
+
/** Bottom items (e.g. Amount Due Without GST, Applicable GST) */
|
|
9067
|
+
bottomItems?: BreakdownCardItem[];
|
|
9038
9068
|
}
|
|
9039
9069
|
|
|
9040
9070
|
export interface PaymentSummaryProps {
|
|
9041
9071
|
/** Line items displayed in the top section */
|
|
9042
|
-
items
|
|
9043
|
-
/** Summary items displayed below the
|
|
9072
|
+
items?: PaymentSummaryItem[];
|
|
9073
|
+
/** Summary items displayed below the main sections (e.g. totals) */
|
|
9044
9074
|
summaryItems?: PaymentSummaryItem[];
|
|
9045
9075
|
/** Custom className for the outer container */
|
|
9046
9076
|
className?: string;
|
|
9077
|
+
/** Card header title e.g. "Detailed Bill Breakdown" */
|
|
9078
|
+
title?: string;
|
|
9079
|
+
/** Right-side header wallet info badge */
|
|
9080
|
+
headerInfo?: PaymentSummaryHeaderInfo;
|
|
9081
|
+
/** Bold subtotal row shown after line items */
|
|
9082
|
+
subtotal?: { label: string; value: string };
|
|
9083
|
+
/** Light-blue bordered breakdown card shown below the subtotal */
|
|
9084
|
+
breakdownCard?: PaymentSummaryBreakdownCard;
|
|
9047
9085
|
}
|
|
9048
9086
|
|
|
9049
9087
|
const valueColorMap: Record<string, string> = {
|
|
@@ -9052,19 +9090,43 @@ const valueColorMap: Record<string, string> = {
|
|
|
9052
9090
|
error: "text-semantic-error-primary",
|
|
9053
9091
|
};
|
|
9054
9092
|
|
|
9093
|
+
const breakdownColorMap: Record<string, string> = {
|
|
9094
|
+
default: "text-semantic-text-primary",
|
|
9095
|
+
success: "text-semantic-success-primary",
|
|
9096
|
+
muted: "text-semantic-text-muted",
|
|
9097
|
+
};
|
|
9098
|
+
|
|
9055
9099
|
const SummaryRow = ({ item }: { item: PaymentSummaryItem }) => (
|
|
9056
|
-
<div className="flex
|
|
9057
|
-
<div className="flex
|
|
9058
|
-
|
|
9059
|
-
className=
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9100
|
+
<div className={cn("flex justify-between w-full", item.hint ? "items-start" : "items-center")}>
|
|
9101
|
+
<div className={cn("flex gap-1.5", item.hint ? "items-start" : "items-center")}>
|
|
9102
|
+
{item.hint ? (
|
|
9103
|
+
<div className="flex flex-col gap-0.5">
|
|
9104
|
+
<span
|
|
9105
|
+
className={cn(
|
|
9106
|
+
"text-sm tracking-[0.035px]",
|
|
9107
|
+
item.bold
|
|
9108
|
+
? "font-semibold text-semantic-text-primary"
|
|
9109
|
+
: "text-semantic-text-muted"
|
|
9110
|
+
)}
|
|
9111
|
+
>
|
|
9112
|
+
{item.label}
|
|
9113
|
+
</span>
|
|
9114
|
+
<span className="text-xs text-semantic-text-link tracking-[0.06px]">
|
|
9115
|
+
{item.hint}
|
|
9116
|
+
</span>
|
|
9117
|
+
</div>
|
|
9118
|
+
) : (
|
|
9119
|
+
<span
|
|
9120
|
+
className={cn(
|
|
9121
|
+
"text-sm tracking-[0.035px]",
|
|
9122
|
+
item.bold
|
|
9123
|
+
? "font-semibold text-semantic-text-primary"
|
|
9124
|
+
: "text-semantic-text-muted"
|
|
9125
|
+
)}
|
|
9126
|
+
>
|
|
9127
|
+
{item.label}
|
|
9128
|
+
</span>
|
|
9129
|
+
)}
|
|
9068
9130
|
{item.tooltip && (
|
|
9069
9131
|
<Tooltip>
|
|
9070
9132
|
<TooltipTrigger asChild>
|
|
@@ -9095,68 +9157,167 @@ const SummaryRow = ({ item }: { item: PaymentSummaryItem }) => (
|
|
|
9095
9157
|
</div>
|
|
9096
9158
|
);
|
|
9097
9159
|
|
|
9160
|
+
const BreakdownCardRow = ({ item }: { item: BreakdownCardItem }) => (
|
|
9161
|
+
<div className="flex items-center justify-between w-full">
|
|
9162
|
+
<span
|
|
9163
|
+
className={cn(
|
|
9164
|
+
"text-sm tracking-[0.035px]",
|
|
9165
|
+
breakdownColorMap[item.labelColor ?? "default"]
|
|
9166
|
+
)}
|
|
9167
|
+
>
|
|
9168
|
+
{item.label}
|
|
9169
|
+
</span>
|
|
9170
|
+
<span
|
|
9171
|
+
className={cn(
|
|
9172
|
+
"text-sm tracking-[0.035px]",
|
|
9173
|
+
breakdownColorMap[item.valueColor ?? "default"]
|
|
9174
|
+
)}
|
|
9175
|
+
>
|
|
9176
|
+
{item.value}
|
|
9177
|
+
</span>
|
|
9178
|
+
</div>
|
|
9179
|
+
);
|
|
9180
|
+
|
|
9098
9181
|
/**
|
|
9099
|
-
* PaymentSummary displays a card with line-item rows
|
|
9100
|
-
*
|
|
9101
|
-
*
|
|
9182
|
+
* PaymentSummary displays a card with line-item rows, an optional breakdown card,
|
|
9183
|
+
* and a summary/totals section. Supports a rich header with wallet balance info,
|
|
9184
|
+
* a subtotal row, and a nested breakdown card for GST/prepaid deduction details.
|
|
9102
9185
|
*
|
|
9103
9186
|
* @example
|
|
9104
9187
|
* \`\`\`tsx
|
|
9105
9188
|
* <PaymentSummary
|
|
9189
|
+
* title="Detailed Bill Breakdown"
|
|
9190
|
+
* headerInfo={{ label: "Prepaid Wallet Amount:", value: "\u20B92,178.75" }}
|
|
9106
9191
|
* items={[
|
|
9192
|
+
* { label: "Business Account Number (BAN)", value: "6LMVPG" },
|
|
9107
9193
|
* { label: "Pending Rental", value: "\u20B90.00" },
|
|
9108
|
-
* { label: "Current Usage", value: "\
|
|
9109
|
-
* { label: "Prepaid Wallet", value: "\u20B978,682.92", valueColor: "success" },
|
|
9194
|
+
* { label: "Current Usage", value: "\u20B92,500.00" },
|
|
9110
9195
|
* ]}
|
|
9196
|
+
* subtotal={{ label: "Total Charges", value: "\u20B92,500.00" }}
|
|
9197
|
+
* breakdownCard={{
|
|
9198
|
+
* topItems: [
|
|
9199
|
+
* { label: "Gross Charges", value: "\u20B92,500.00" },
|
|
9200
|
+
* { label: "(-) Prepaid Deduction", value: "\u20B92,178.75", labelColor: "success", valueColor: "success" },
|
|
9201
|
+
* ],
|
|
9202
|
+
* bottomItems: [
|
|
9203
|
+
* { label: "Amount Due Without GST", value: "\u20B9321.25" },
|
|
9204
|
+
* { label: "(+) Applicable GST 18%", value: "\u20B957.83", labelColor: "muted", valueColor: "muted" },
|
|
9205
|
+
* ],
|
|
9206
|
+
* }}
|
|
9111
9207
|
* summaryItems={[
|
|
9112
|
-
* { label: "Total amount due", value: "
|
|
9113
|
-
* { label: "Credit limit", value: "\u20B910,000.00", tooltip: "Your current credit limit" },
|
|
9208
|
+
* { label: "Total amount due", value: "\u20B9379.08", bold: true, valueSize: "lg", valueColor: "error" },
|
|
9114
9209
|
* ]}
|
|
9115
9210
|
* />
|
|
9116
9211
|
* \`\`\`
|
|
9117
9212
|
*/
|
|
9118
|
-
export const PaymentSummary = React.forwardRef<
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
<TooltipProvider delayDuration={100}>
|
|
9124
|
-
<div
|
|
9125
|
-
ref={ref}
|
|
9126
|
-
className={cn(
|
|
9127
|
-
"rounded-lg border border-semantic-border-layout bg-semantic-bg-primary p-5",
|
|
9128
|
-
className
|
|
9129
|
-
)}
|
|
9130
|
-
>
|
|
9131
|
-
<div className="flex flex-col gap-5">
|
|
9132
|
-
{/* Line items */}
|
|
9133
|
-
{items.length > 0 && (
|
|
9134
|
-
<div
|
|
9135
|
-
className={cn(
|
|
9136
|
-
"flex flex-col gap-5",
|
|
9137
|
-
summaryItems && summaryItems.length > 0 &&
|
|
9138
|
-
"border-b border-semantic-border-layout pb-5"
|
|
9139
|
-
)}
|
|
9140
|
-
>
|
|
9141
|
-
{items.map((item, index) => (
|
|
9142
|
-
<SummaryRow key={index} item={item} />
|
|
9143
|
-
))}
|
|
9144
|
-
</div>
|
|
9145
|
-
)}
|
|
9213
|
+
export const PaymentSummary = React.forwardRef<HTMLDivElement, PaymentSummaryProps>(
|
|
9214
|
+
({ items = [], summaryItems, className, title, headerInfo, subtotal, breakdownCard }, ref) => {
|
|
9215
|
+
const hasItemsBorder =
|
|
9216
|
+
items.length > 0 &&
|
|
9217
|
+
(!!subtotal || !!breakdownCard || (summaryItems && summaryItems.length > 0));
|
|
9146
9218
|
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9219
|
+
return (
|
|
9220
|
+
<TooltipProvider delayDuration={100}>
|
|
9221
|
+
<div
|
|
9222
|
+
ref={ref}
|
|
9223
|
+
className={cn(
|
|
9224
|
+
"rounded-lg border border-semantic-border-layout bg-semantic-bg-primary p-5",
|
|
9225
|
+
className
|
|
9154
9226
|
)}
|
|
9227
|
+
>
|
|
9228
|
+
<div className="flex flex-col gap-4">
|
|
9229
|
+
{/* Header: title + wallet info badge */}
|
|
9230
|
+
{(title || headerInfo) && (
|
|
9231
|
+
<div className="flex items-center justify-between border-b border-semantic-border-layout pb-4">
|
|
9232
|
+
{title && (
|
|
9233
|
+
<span className="text-base font-semibold text-semantic-text-primary">
|
|
9234
|
+
{title}
|
|
9235
|
+
</span>
|
|
9236
|
+
)}
|
|
9237
|
+
{headerInfo && (
|
|
9238
|
+
<div className="flex items-center gap-1.5">
|
|
9239
|
+
<Wallet className="h-[18px] w-[18px] text-semantic-text-secondary" />
|
|
9240
|
+
<span className="text-base text-semantic-text-secondary">
|
|
9241
|
+
{headerInfo.label}
|
|
9242
|
+
</span>
|
|
9243
|
+
<span
|
|
9244
|
+
className={cn(
|
|
9245
|
+
"text-base font-semibold",
|
|
9246
|
+
valueColorMap[headerInfo.valueColor ?? "success"]
|
|
9247
|
+
)}
|
|
9248
|
+
>
|
|
9249
|
+
{headerInfo.value}
|
|
9250
|
+
</span>
|
|
9251
|
+
</div>
|
|
9252
|
+
)}
|
|
9253
|
+
</div>
|
|
9254
|
+
)}
|
|
9255
|
+
|
|
9256
|
+
{/* Line items */}
|
|
9257
|
+
{items.length > 0 && (
|
|
9258
|
+
<div
|
|
9259
|
+
className={cn(
|
|
9260
|
+
"flex flex-col gap-5",
|
|
9261
|
+
hasItemsBorder && "border-b border-semantic-border-layout pb-4"
|
|
9262
|
+
)}
|
|
9263
|
+
>
|
|
9264
|
+
{items.map((item, index) => (
|
|
9265
|
+
<SummaryRow key={index} item={item} />
|
|
9266
|
+
))}
|
|
9267
|
+
</div>
|
|
9268
|
+
)}
|
|
9269
|
+
|
|
9270
|
+
{/* Subtotal row */}
|
|
9271
|
+
{subtotal && (
|
|
9272
|
+
<div className="flex items-center justify-between w-full">
|
|
9273
|
+
<span className="text-sm font-semibold text-semantic-text-primary tracking-[0.035px]">
|
|
9274
|
+
{subtotal.label}
|
|
9275
|
+
</span>
|
|
9276
|
+
<span className="text-sm font-semibold text-semantic-text-primary tracking-[0.035px]">
|
|
9277
|
+
{subtotal.value}
|
|
9278
|
+
</span>
|
|
9279
|
+
</div>
|
|
9280
|
+
)}
|
|
9281
|
+
|
|
9282
|
+
{/* Breakdown card */}
|
|
9283
|
+
{breakdownCard && (
|
|
9284
|
+
<div className="rounded-lg border border-semantic-border-layout bg-semantic-info-surface px-4 py-4 flex flex-col gap-2.5">
|
|
9285
|
+
<div
|
|
9286
|
+
className={cn(
|
|
9287
|
+
"flex flex-col gap-2.5",
|
|
9288
|
+
breakdownCard.bottomItems &&
|
|
9289
|
+
breakdownCard.bottomItems.length > 0 &&
|
|
9290
|
+
"border-b border-semantic-border-layout pb-2.5"
|
|
9291
|
+
)}
|
|
9292
|
+
>
|
|
9293
|
+
{breakdownCard.topItems.map((item, index) => (
|
|
9294
|
+
<BreakdownCardRow key={index} item={item} />
|
|
9295
|
+
))}
|
|
9296
|
+
</div>
|
|
9297
|
+
{breakdownCard.bottomItems && breakdownCard.bottomItems.length > 0 && (
|
|
9298
|
+
<div className="flex flex-col gap-2.5">
|
|
9299
|
+
{breakdownCard.bottomItems.map((item, index) => (
|
|
9300
|
+
<BreakdownCardRow key={index} item={item} />
|
|
9301
|
+
))}
|
|
9302
|
+
</div>
|
|
9303
|
+
)}
|
|
9304
|
+
</div>
|
|
9305
|
+
)}
|
|
9306
|
+
|
|
9307
|
+
{/* Summary items (footer totals) */}
|
|
9308
|
+
{summaryItems && summaryItems.length > 0 && (
|
|
9309
|
+
<div className="flex flex-col gap-4">
|
|
9310
|
+
{summaryItems.map((item, index) => (
|
|
9311
|
+
<SummaryRow key={index} item={item} />
|
|
9312
|
+
))}
|
|
9313
|
+
</div>
|
|
9314
|
+
)}
|
|
9315
|
+
</div>
|
|
9155
9316
|
</div>
|
|
9156
|
-
</
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9317
|
+
</TooltipProvider>
|
|
9318
|
+
);
|
|
9319
|
+
}
|
|
9320
|
+
);
|
|
9160
9321
|
|
|
9161
9322
|
PaymentSummary.displayName = "PaymentSummary";
|
|
9162
9323
|
`, prefix)
|