@srimandir/pitru-paksh-common 2.13.0 → 2.20.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.
@@ -6,7 +6,7 @@
6
6
  * re-computing/re-translating it. Pass `title`/`subtitle`/`subtitleItems`
7
7
  * explicitly to override any of it for a one-off usage.
8
8
  */
9
- export type BookingSummaryBannerLocale = 'en' | 'hi';
9
+ export type BookingSummaryBannerLocale = "en" | "hi" | "te" | "kn";
10
10
  export interface BookingSummaryBannerDefaultCopy {
11
11
  title: string;
12
12
  ancestorsLabel: string;
@@ -25,6 +25,12 @@ export interface CheckoutBarProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  /** Extra props forwarded to the underlying `Button` (variant, size, disabled, loading, ...). */
26
26
  proceedButtonProps?: Omit<ButtonProps, 'children' | 'onClick'>;
27
27
  buttonWrapperClassName?: string;
28
+ /**
29
+ * Shrinks the amount/subtitle block to its content width and grows the
30
+ * Proceed button to fill the rest of the row instead of the default
31
+ * (amount block flexes, button sized to its label). Defaults to `false`.
32
+ */
33
+ growProceedButton?: boolean;
28
34
  }
29
35
  /**
30
36
  * Sticky-friendly checkout bar shown at the bottom of a package-selection or
@@ -1,9 +1,9 @@
1
1
  import { default as React } from 'react';
2
- import { SelectorCardProps, SelectorCardNoteProps, SelectorCardPriceBadgeProps } from '../SelectorCard';
2
+ import { SelectorCardProps, SelectorCardPriceBadgeProps } from '../SelectorCard';
3
3
  import { TrustBadgesBarProps } from '../TrustBadgesBar';
4
4
  import { CheckoutBarProps } from '../CheckoutBar';
5
5
  import { PackageSelectLocale } from './PackageSelect.translations';
6
- export interface PackageSelectOption extends Omit<SelectorCardProps, 'id' | 'selected' | 'onSelect' | 'badge' | 'children'> {
6
+ export interface PackageSelectOption extends Omit<SelectorCardProps, 'id' | 'selected' | 'onSelect' | 'badge' | 'children' | 'note'> {
7
7
  /** Unique id for this option, passed back via `onChange`. */
8
8
  id: string | number;
9
9
  /** Price label, e.g. "+₹400" or "₹0". Ignored when `badge` is set directly. */
@@ -18,11 +18,15 @@ export interface PackageSelectOption extends Omit<SelectorCardProps, 'id' | 'sel
18
18
  badge?: React.ReactNode;
19
19
  /** Extra props forwarded to the price badge (`SelectorCardPriceBadge`, or the plain muted `<span>` when `free`). */
20
20
  priceBadgeProps?: Omit<SelectorCardPriceBadgeProps, 'value'>;
21
- /** Highlighted strip rendered under this option only while it's selected, e.g. "Rituals will be performed on behalf of 2 family members". Ignored when `children` is set directly. */
21
+ /**
22
+ * Explainer note shown only while this option is selected, e.g. "Rituals
23
+ * will be performed on behalf of 2 family members" — rendered via
24
+ * `SelectorCard`'s own `note` prop, as its own surface behind the card
25
+ * (same treatment `DeathTithi`'s "don't know the tithi" option uses),
26
+ * not nested inside it. Ignored when `children` is set directly.
27
+ */
22
28
  note?: React.ReactNode;
23
- /** Extra props forwarded to the `SelectorCardNote` wrapping `note`. */
24
- noteProps?: Omit<SelectorCardNoteProps, 'children'>;
25
- /** Full override for the card's children slot — takes precedence over `note`/`noteProps`. */
29
+ /** Full override for the card's children slot — takes precedence over `note`. */
26
30
  children?: React.ReactNode;
27
31
  }
28
32
  export interface PackageSelectProps {
@@ -4,13 +4,15 @@ export interface PhoneNumberSheetProps {
4
4
  onClose: () => void;
5
5
  heading: string;
6
6
  subtext?: string;
7
+ /** Shown inside the number field before anything's typed, e.g. "your mobile number". */
8
+ placeholder?: string;
7
9
  confirmLabel: string;
8
10
  onConfirm: (phoneNumber: string, country: Country) => void;
9
11
  /** Pre-fills the field, e.g. with a value already saved elsewhere. */
10
12
  initialValue?: string;
11
13
  /** Defaults to `DEFAULT_COUNTRIES`. */
12
14
  countries?: Country[];
13
- /** ISO alpha-2 of the pre-selected country. Defaults to India. */
15
+ /** ISO alpha-2 of the fixed country this field collects a number for. Defaults to India. */
14
16
  initialCountryIso?: string;
15
17
  }
16
- export declare function PhoneNumberSheet({ isOpen, onClose, heading, subtext, confirmLabel, onConfirm, initialValue, countries, initialCountryIso, }: PhoneNumberSheetProps): import("react").JSX.Element;
18
+ export declare function PhoneNumberSheet({ isOpen, onClose, heading, subtext, placeholder, confirmLabel, onConfirm, initialValue, countries, initialCountryIso, }: PhoneNumberSheetProps): import("react").JSX.Element;
@@ -42,10 +42,10 @@ export interface SelectorCardProps extends Omit<React.ButtonHTMLAttributes<HTMLB
42
42
  */
43
43
  children?: React.ReactNode;
44
44
  /**
45
- * An explainer note rendered as its own surface *behind* the card, instead of
46
- * nested inside it like `children` — pulled up behind the card via negative
47
- * margin so the card's higher stacking order covers the seam between them.
48
- * Typically shown only while `selected` is true; that's left to the caller.
45
+ * An explainer note rendered flush below the card, both wrapped in a shared
46
+ * lavender wash surface (instead of nested inside the card's own border like
47
+ * `children`). Typically shown only while `selected` is true; that's left to
48
+ * the caller.
49
49
  */
50
50
  note?: React.ReactNode;
51
51
  /** Extra classes for the `note` surface, e.g. to change its text color. */
@@ -1,12 +1,27 @@
1
1
  import { default as React } from 'react';
2
+ import { OutcomeLocale } from '../../outcome-i18n';
2
3
  export interface ServiceOfferCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
3
4
  /** Illustration/photo shown top-right, e.g. the ritual/service photo. */
4
5
  image: string;
5
6
  imageAlt?: string;
6
7
  /** Service name, e.g. "Offer tarpan donation for the peace of your ancestors". */
7
8
  title: React.ReactNode;
8
- /** Helper copy under the title, typically ending in a "...and see"/"Read more" affordance you compose yourself. */
9
+ /**
10
+ * Helper copy under the title. When it's a plain string longer than
11
+ * `descriptionMaxLength`, it's truncated with an inline "Read more" toggle.
12
+ * If `sheetPrice` is set, that toggle opens the details `ServiceOfferSheet`
13
+ * (like tapping the card); otherwise it expands the text inline in place,
14
+ * toggling to "Read less". A non-string node (or a short string) renders as-is.
15
+ */
9
16
  description?: React.ReactNode;
17
+ /** Character count above which a string `description` is truncated. Defaults to 40. */
18
+ descriptionMaxLength?: number;
19
+ /** Locale used to translate the default `readMoreLabel`/`readLessLabel` below. Defaults to 'en'. */
20
+ locale?: OutcomeLocale;
21
+ /** Label for the "Read more" toggle. Defaults to the translated "Read More" copy for `locale`. */
22
+ readMoreLabel?: React.ReactNode;
23
+ /** Label for the inline collapse toggle — only used when `sheetPrice` isn't set. Defaults to the translated "Read Less" copy for `locale`. */
24
+ readLessLabel?: React.ReactNode;
10
25
  /** Current price, e.g. "₹199". */
11
26
  price: React.ReactNode;
12
27
  /** Original price shown struck-through before `price`, e.g. "₹250". */
@@ -21,8 +36,28 @@ export interface ServiceOfferCardProps extends Omit<React.HTMLAttributes<HTMLDiv
21
36
  /**
22
37
  * Control anchored over the bottom edge of the image — typically a
23
38
  * `QuantityStepper`, but accepts any node so a plain CTA button works too.
39
+ * Also reused as-is inside the details sheet's footer when `sheetPrice` is set.
24
40
  */
25
41
  action?: React.ReactNode;
42
+ /**
43
+ * Numeric price for the tap-to-open `ServiceOfferSheet`'s "Save X%" math —
44
+ * the card's own `price`/`originalPrice` above are preformatted `ReactNode`
45
+ * (e.g. "₹199") and can't be used for that calculation. Setting this makes
46
+ * the whole card tappable: it opens a `ServiceOfferSheet` with the same
47
+ * image/tag/title/full-description/action, plus this price data. Omit to
48
+ * keep the card static (no tap-to-open behavior).
49
+ */
50
+ sheetPrice?: number;
51
+ /** Original/base price before discount, for the sheet's struck-through price + "Save X%" badge. */
52
+ sheetBasePrice?: number;
53
+ /** Prefixed to `sheetPrice`/`sheetBasePrice` in the sheet. Defaults to '₹'. */
54
+ sheetCurrencySymbol?: string;
55
+ /** Forwarded to the sheet's `showSavedBadge`. */
56
+ sheetShowSavedBadge?: boolean;
57
+ /** Forwarded to the sheet's `savedLabel`. */
58
+ sheetSavedLabel?: React.ReactNode;
59
+ /** Accessible name for the sheet dialog. */
60
+ sheetAriaLabel?: string;
26
61
  }
27
62
  /**
28
63
  * Add-on card used on "review your booking" screens: an image with a
@@ -0,0 +1,43 @@
1
+ import { default as React } from 'react';
2
+ export interface ServiceOfferSheetProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ ariaLabel?: string;
6
+ /** Full-width illustration/photo at the top of the sheet. */
7
+ image: string;
8
+ imageAlt?: string;
9
+ /**
10
+ * Flush banner rendered under the image, e.g. "Contribute to cow service".
11
+ * Accepts any React node — pass an icon + label for a custom banner. Use
12
+ * `tagClassName` to change its color/theme.
13
+ */
14
+ tag?: React.ReactNode;
15
+ tagClassName?: string;
16
+ /** Service name, e.g. "Offer green fodder, dry fodder and 5 rotis to 11 cows for blessings". */
17
+ title: React.ReactNode;
18
+ /** Full copy under the title — this is the expanded detail view, so it's shown in full (no truncation). */
19
+ description?: React.ReactNode;
20
+ /** Final price, e.g. 199. Used both to display and to compute the amount saved. */
21
+ price: number;
22
+ /** Original/base price before discount, e.g. 250. Omit (or equal to `price`) to hide the strike-through and saved badge. */
23
+ basePrice?: number;
24
+ /** Prefixed to `price`/`basePrice` when formatting, e.g. "₹". */
25
+ currencySymbol?: string;
26
+ /**
27
+ * Whether to show the "Save X%" badge next to the price. Defaults to
28
+ * showing it whenever `basePrice` is greater than `price` — pass `false`
29
+ * to always hide it regardless of the computed discount.
30
+ */
31
+ showSavedBadge?: boolean;
32
+ /** Overrides the computed "Save X%" copy, e.g. for a translated label. */
33
+ savedLabel?: React.ReactNode;
34
+ /** Primary CTA anchored to the footer, e.g. an "Add" button or a `QuantityStepper` once added. */
35
+ action?: React.ReactNode;
36
+ }
37
+ /**
38
+ * Bottom-sheet detail view for a `ServiceOfferCard` item: full-width image,
39
+ * tag banner, title + full description (scrollable), and a footer pinned
40
+ * below the scroll area with the price (original price struck through, plus
41
+ * a computed "Save X%" badge) and the primary CTA.
42
+ */
43
+ export declare const ServiceOfferSheet: React.FC<ServiceOfferSheetProps>;
@@ -0,0 +1,2 @@
1
+ export { ServiceOfferSheet } from './ServiceOfferSheet';
2
+ export type { ServiceOfferSheetProps } from './ServiceOfferSheet';
@@ -3,8 +3,8 @@ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInput
3
3
  label?: string;
4
4
  value: string;
5
5
  onChange: (value: string) => void;
6
- /** Fixed, non-editable text shown before the value, e.g. "Late". */
7
- prefix?: string;
6
+ /** Fixed, non-editable content shown before the value, e.g. "Late" or an icon + country code. */
7
+ prefix?: React.ReactNode;
8
8
  /** Shows a live `value.length` counter below the field; appends `/maxLength` when that's set too. */
9
9
  showCharCount?: boolean;
10
10
  /** Overrides the char-count helper text, e.g. for an error message. */
package/dist/index.d.ts CHANGED
@@ -51,6 +51,8 @@ export { CartReviewItem, CartReviewMandapItem, CartReviewChangeButton, CartRevie
51
51
  export type { CartReviewItemProps, CartReviewMandapItemProps, CartReviewChangeButtonProps, CartReviewAddedBadgeProps, } from './components/CartReviewItem';
52
52
  export { ServiceOfferCard } from './components/ServiceOfferCard';
53
53
  export type { ServiceOfferCardProps } from './components/ServiceOfferCard';
54
+ export { ServiceOfferSheet } from './components/ServiceOfferSheet';
55
+ export type { ServiceOfferSheetProps } from './components/ServiceOfferSheet';
54
56
  export { PackageSelect } from './components/PackageSelect';
55
57
  export type { PackageSelectProps, PackageSelectOption, } from './components/PackageSelect';
56
58
  export { PACKAGE_SELECT_DEFAULT_COPY, getPackageSelectDefaultCopy, } from './components/PackageSelect';