@birdycom/omniaui-react 0.12.3 → 0.12.4
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.d.ts +5 -2
- package/dist/index.js +8 -0
- package/package.json +1 -1
- package/src/components/PriceCard.tsx +10 -5
package/dist/index.d.ts
CHANGED
|
@@ -1489,8 +1489,10 @@ interface PriceCardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
1489
1489
|
monthly: PriceCardPrice;
|
|
1490
1490
|
/** Without a yearly price the toggle is not rendered. */
|
|
1491
1491
|
yearly?: PriceCardPrice;
|
|
1492
|
+
/** Optional third option, e.g. a one-time price. Needs `yearly`. */
|
|
1493
|
+
lifetime?: PriceCardPrice;
|
|
1492
1494
|
/** Period that is selected first (uncontrolled radio). */
|
|
1493
|
-
defaultPeriod?: "monthly" | "yearly";
|
|
1495
|
+
defaultPeriod?: "monthly" | "yearly" | "lifetime";
|
|
1494
1496
|
features?: PriceCardFeature[];
|
|
1495
1497
|
/** Call to action, e.g. <a className="oc-btn oc-price-card__cta">. */
|
|
1496
1498
|
cta?: ReactNode;
|
|
@@ -1498,8 +1500,9 @@ interface PriceCardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
1498
1500
|
/** Labels of the toggle. */
|
|
1499
1501
|
monthlyLabel?: ReactNode;
|
|
1500
1502
|
yearlyLabel?: ReactNode;
|
|
1503
|
+
lifetimeLabel?: ReactNode;
|
|
1501
1504
|
}
|
|
1502
|
-
/** `<article class="oc-price-card">`: plan card with a CSS-only monthly / yearly switch. */
|
|
1505
|
+
/** `<article class="oc-price-card">`: plan card with a CSS-only monthly / yearly (/ lifetime) switch. */
|
|
1503
1506
|
declare const PriceCard: react.ForwardRefExoticComponent<PriceCardProps & react.RefAttributes<HTMLElement>>;
|
|
1504
1507
|
|
|
1505
1508
|
type ProductMarkSize = "sm" | "default" | "lg" | "xl";
|
package/dist/index.js
CHANGED
|
@@ -2976,12 +2976,14 @@ var PriceCard = forwardRef74(function PriceCard2({
|
|
|
2976
2976
|
discount,
|
|
2977
2977
|
monthly,
|
|
2978
2978
|
yearly,
|
|
2979
|
+
lifetime,
|
|
2979
2980
|
defaultPeriod = "monthly",
|
|
2980
2981
|
features = [],
|
|
2981
2982
|
cta,
|
|
2982
2983
|
featured = false,
|
|
2983
2984
|
monthlyLabel = "Monthly",
|
|
2984
2985
|
yearlyLabel = "Yearly",
|
|
2986
|
+
lifetimeLabel = "Lifetime",
|
|
2985
2987
|
className,
|
|
2986
2988
|
...rest
|
|
2987
2989
|
}, ref) {
|
|
@@ -3002,10 +3004,16 @@ var PriceCard = forwardRef74(function PriceCard2({
|
|
|
3002
3004
|
/* @__PURE__ */ jsx76("input", { type: "radio", name: group, value: "yearly", defaultChecked: defaultPeriod === "yearly" }),
|
|
3003
3005
|
" ",
|
|
3004
3006
|
yearlyLabel
|
|
3007
|
+
] }),
|
|
3008
|
+
lifetime && /* @__PURE__ */ jsxs60("label", { className: "oc-segmented-item", children: [
|
|
3009
|
+
/* @__PURE__ */ jsx76("input", { type: "radio", name: group, value: "lifetime", defaultChecked: defaultPeriod === "lifetime" }),
|
|
3010
|
+
" ",
|
|
3011
|
+
lifetimeLabel
|
|
3005
3012
|
] })
|
|
3006
3013
|
] }),
|
|
3007
3014
|
/* @__PURE__ */ jsx76(Price, { kind: "monthly", price: monthly }),
|
|
3008
3015
|
yearly && /* @__PURE__ */ jsx76(Price, { kind: "yearly", price: yearly }),
|
|
3016
|
+
yearly && lifetime && /* @__PURE__ */ jsx76(Price, { kind: "lifetime", price: lifetime }),
|
|
3009
3017
|
features.length > 0 && /* @__PURE__ */ jsx76("ul", { className: "oc-price-card__features", children: features.map((f, i) => /* @__PURE__ */ jsx76("li", { className: cx("oc-price-card__feature", f.excluded && "oc-price-card__feature--excluded"), children: f.label }, i)) }),
|
|
3010
3018
|
cta
|
|
3011
3019
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@birdycom/omniaui-react",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
4
4
|
"description": "OmniaUI for React: typed function components and page blocks that render the exact @birdycom/omniaui and @birdycom/omniaui-blocks markup.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,10 @@ export interface PriceCardProps extends Omit<HTMLAttributes<HTMLElement>, "title
|
|
|
25
25
|
monthly: PriceCardPrice;
|
|
26
26
|
/** Without a yearly price the toggle is not rendered. */
|
|
27
27
|
yearly?: PriceCardPrice;
|
|
28
|
+
/** Optional third option, e.g. a one-time price. Needs `yearly`. */
|
|
29
|
+
lifetime?: PriceCardPrice;
|
|
28
30
|
/** Period that is selected first (uncontrolled radio). */
|
|
29
|
-
defaultPeriod?: "monthly" | "yearly";
|
|
31
|
+
defaultPeriod?: "monthly" | "yearly" | "lifetime";
|
|
30
32
|
features?: PriceCardFeature[];
|
|
31
33
|
/** Call to action, e.g. <a className="oc-btn oc-price-card__cta">. */
|
|
32
34
|
cta?: ReactNode;
|
|
@@ -34,9 +36,10 @@ export interface PriceCardProps extends Omit<HTMLAttributes<HTMLElement>, "title
|
|
|
34
36
|
/** Labels of the toggle. */
|
|
35
37
|
monthlyLabel?: ReactNode;
|
|
36
38
|
yearlyLabel?: ReactNode;
|
|
39
|
+
lifetimeLabel?: ReactNode;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
function Price({ kind, price }: { kind: "monthly" | "yearly"; price: PriceCardPrice }) {
|
|
42
|
+
function Price({ kind, price }: { kind: "monthly" | "yearly" | "lifetime"; price: PriceCardPrice }) {
|
|
40
43
|
return (
|
|
41
44
|
<p className={`oc-price-card__price oc-price-card__price--${kind}`}>
|
|
42
45
|
<span className="oc-price-card__amount">{price.amount}</span>
|
|
@@ -47,10 +50,10 @@ function Price({ kind, price }: { kind: "monthly" | "yearly"; price: PriceCardPr
|
|
|
47
50
|
);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
/** `<article class="oc-price-card">`: plan card with a CSS-only monthly / yearly switch. */
|
|
53
|
+
/** `<article class="oc-price-card">`: plan card with a CSS-only monthly / yearly (/ lifetime) switch. */
|
|
51
54
|
export const PriceCard = forwardRef<HTMLElement, PriceCardProps>(function PriceCard(
|
|
52
|
-
{ name, description, discount, monthly, yearly, defaultPeriod = "monthly", features = [], cta, featured = false,
|
|
53
|
-
monthlyLabel = "Monthly", yearlyLabel = "Yearly", className, ...rest },
|
|
55
|
+
{ name, description, discount, monthly, yearly, lifetime, defaultPeriod = "monthly", features = [], cta, featured = false,
|
|
56
|
+
monthlyLabel = "Monthly", yearlyLabel = "Yearly", lifetimeLabel = "Lifetime", className, ...rest },
|
|
54
57
|
ref,
|
|
55
58
|
) {
|
|
56
59
|
// Every card needs its own radio group name.
|
|
@@ -66,10 +69,12 @@ export const PriceCard = forwardRef<HTMLElement, PriceCardProps>(function PriceC
|
|
|
66
69
|
<div className="oc-segmented oc-price-card__toggle" role="radiogroup" aria-label="Billing period">
|
|
67
70
|
<label className="oc-segmented-item"><input type="radio" name={group} value="monthly" defaultChecked={defaultPeriod === "monthly"} /> {monthlyLabel}</label>
|
|
68
71
|
<label className="oc-segmented-item"><input type="radio" name={group} value="yearly" defaultChecked={defaultPeriod === "yearly"} /> {yearlyLabel}</label>
|
|
72
|
+
{lifetime && <label className="oc-segmented-item"><input type="radio" name={group} value="lifetime" defaultChecked={defaultPeriod === "lifetime"} /> {lifetimeLabel}</label>}
|
|
69
73
|
</div>
|
|
70
74
|
)}
|
|
71
75
|
<Price kind="monthly" price={monthly} />
|
|
72
76
|
{yearly && <Price kind="yearly" price={yearly} />}
|
|
77
|
+
{yearly && lifetime && <Price kind="lifetime" price={lifetime} />}
|
|
73
78
|
{features.length > 0 && (
|
|
74
79
|
<ul className="oc-price-card__features">
|
|
75
80
|
{features.map((f, i) => (
|