cekat-ui 1.3.13 → 1.3.15

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.mts CHANGED
@@ -5,6 +5,7 @@ import { ClassValue } from 'clsx';
5
5
  import { ColumnProps as ColumnProps_2 } from 'react-aria-components';
6
6
  import { ColumnResizerProps as ColumnResizerProps_2 } from 'react-aria-components';
7
7
  import { ComboBoxProps as ComboBoxProps_2 } from 'react-aria-components';
8
+ import { CountryCode } from 'libphonenumber-js/min';
8
9
  import { default as default_2 } from 'react';
9
10
  import { DialogProps } from 'react-aria-components';
10
11
  import { GroupProps } from 'react-aria-components';
@@ -113,6 +114,12 @@ export declare interface AvatarGroupItem {
113
114
  initials?: React_2.ReactNode;
114
115
  /** Tooltip content shown on hover. */
115
116
  label?: React_2.ReactNode;
117
+ /** Overrides the deterministic initials text color (e.g. "text-primary-600"). */
118
+ initialsTextColor?: string;
119
+ /** Overrides the initials background color (e.g. "bg-primary-100"). */
120
+ initialsBgColor?: string;
121
+ /** Overrides the contrast border color (e.g. "border-primary-600/20"). Defaults to "border-black/[0.08]". */
122
+ borderColor?: string;
116
123
  }
117
124
 
118
125
  export declare interface AvatarGroupProps {
@@ -243,6 +250,53 @@ export declare type BadgeSize = 'sm' | 'md' | 'lg';
243
250
 
244
251
  export declare type BadgeVariant = 'solid' | 'outline';
245
252
 
253
+ /**
254
+ * The shared foundation every Input-family component is built on — see
255
+ * `RFC-input-family.md` (Decision #0) for the full rationale. Anatomy is exactly three parts:
256
+ * `leftSlot`, the native `<input>`, `rightSlot`. No other structural surface — a component that
257
+ * needs a divider, a dropdown trigger, or a button renders that INSIDE its own slot content;
258
+ * `BaseInput` never grows new props to accommodate it (that's the exact prop-list-per-Type-variant
259
+ * growth this primitive exists to stop).
260
+ *
261
+ * Internally built on `react-aria-components`' `Group` + `Input` (not `TextField`): `Group` is a
262
+ * bare bordered-container primitive with hover/focus-within/focus-visible/disabled/invalid state
263
+ * for free, and no forced field-level semantics (label association, description slot, validation
264
+ * state machine) the way `TextField` has — `TextField` would force a wrapper `<div>` we'd then
265
+ * have to fight or double up on. Same choice `ComboBoxTrigger` already made for an analogous
266
+ * "bordered shell holding an input plus other stuff" role (see `ComboBox.tsx`).
267
+ *
268
+ * The PUBLIC API stays 100% native-DOM-shaped on purpose (`onChange: ChangeEventHandler`,
269
+ * `error: boolean`, `disabled: boolean`, `required: boolean`) even though the internals are RAC —
270
+ * RAC's own shape for the same concepts (`onChange: (value: string) => void`, `isInvalid`,
271
+ * `isDisabled`, `isRequired`) is intentionally not exposed. This keeps `BaseInput` a drop-in
272
+ * sibling of the existing native `Input` rather than introducing a second, incompatible prop
273
+ * shape into the same family.
274
+ *
275
+ * Forwards its ref to the inner `<input>`, matching `Input`'s existing ref contract.
276
+ */
277
+ export declare const BaseInput: React_2.ForwardRefExoticComponent<BaseInputProps & React_2.RefAttributes<HTMLInputElement>>;
278
+
279
+ export declare interface BaseInputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'size' | 'className' | 'style'> {
280
+ label?: string;
281
+ required?: boolean;
282
+ hint?: string;
283
+ size?: InputSize;
284
+ error?: boolean;
285
+ disabled?: boolean;
286
+ /** Tighter padding/height/radius and a smaller semibold label, independent of `size`'s font scale. Opt-in, mirrors `Input`'s `compact`. */
287
+ compact?: boolean;
288
+ /**
289
+ * Anything mounted at the start of the field — icon, fixed text, dropdown trigger, whatever
290
+ * the derived component needs. Pure `ReactNode`: `BaseInput` has no opinion on the slot's
291
+ * internal layout, border, or divider — that's the slot content's own responsibility.
292
+ */
293
+ leftSlot?: React_2.ReactNode;
294
+ /** Same contract as `leftSlot`, mounted at the end of the field. */
295
+ rightSlot?: React_2.ReactNode;
296
+ className?: ClassValue;
297
+ wrapperClassName?: ClassValue;
298
+ }
299
+
246
300
  /**
247
301
  * Wraps RAC's `<Breadcrumb>` (an `<li>`). RAC computes `isCurrent` from the item's position
248
302
  * in the collection — the last item gets it — so the trailing separator is suppressed
@@ -341,23 +395,7 @@ export declare type ButtonTone = 'primary' | 'destructive';
341
395
 
342
396
  export declare type ButtonVariant = 'solid' | 'outline' | 'outline-primary' | 'ghost' | 'ghost-primary' | 'plain' | 'plain-black';
343
397
 
344
- export declare function CardNumberInput({ size, label, required, hint, error, disabled, placeholder, value, onChange, rightIcon, prefix, className, wrapperClassName, }: CardNumberInputProps): JSX_2.Element;
345
-
346
- declare interface CardNumberInputProps {
347
- size?: 'sm' | 'md';
348
- label?: string;
349
- required?: boolean;
350
- hint?: string;
351
- error?: boolean;
352
- disabled?: boolean;
353
- placeholder?: string;
354
- value?: string;
355
- onChange?: default_2.ChangeEventHandler<HTMLInputElement>;
356
- rightIcon?: default_2.ReactNode;
357
- prefix?: default_2.ReactNode;
358
- className?: InputProps['className'];
359
- wrapperClassName?: InputProps['wrapperClassName'];
360
- }
398
+ export declare type CardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'diners' | 'unionpay';
361
399
 
362
400
  /**
363
401
  * `min-h-[42px]`, never `h-[42px]` — a fixed height plus no truncation would
@@ -530,6 +568,24 @@ export declare interface ComboBoxTriggerProps extends Omit<GroupProps, 'classNam
530
568
  className?: ClassValue;
531
569
  }
532
570
 
571
+ export declare interface CountryOption {
572
+ code: CountryCode;
573
+ dial_code: string;
574
+ name: string;
575
+ flag?: string;
576
+ }
577
+
578
+ export declare interface CurrencyOption {
579
+ /** ISO 4217-shaped code the consumer defines, e.g. 'IDR', 'USD' — not validated against a real ISO list, since this is a consumer-owned/backend-owned shape (see `RFC-input-family.md` Decision #3). */
580
+ code: string;
581
+ /** Displayed in the amount field's leftSlot, e.g. 'Rp', '$'. */
582
+ symbol: string;
583
+ /** Displayed in the currency picker dropdown row, e.g. 'Indonesian Rupiah'. */
584
+ label: string;
585
+ /** BCP 47 locale tag driving thousands/decimal separator formatting, e.g. 'id-ID', 'en-US'. Falls back to the browser's default locale when omitted. */
586
+ locale?: string;
587
+ }
588
+
533
589
  export declare const Dot: {
534
590
  ({ size, outline, className }: DotProps): JSX_2.Element;
535
591
  displayName: string;
@@ -591,6 +647,20 @@ export declare type FeaturedIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
591
647
  */
592
648
  export declare type FeaturedIconType = 'light' | 'dark' | 'modern' | 'glass';
593
649
 
650
+ /**
651
+ * The country/dial-code list `InputPhone` ships with by default (see `RFC-input-family.md`
652
+ * Decision #2 — this is cekat-ui-owned static data, not fetched, not backend-driven, unlike
653
+ * `InputPrice`'s currency list). Built from `libphonenumber-js`'s own `getCountries()` +
654
+ * `getCountryCallingCode()` (already a dependency, single source of truth for calling codes —
655
+ * no separately hand-maintained dial-code JSON to drift out of sync) plus the runtime's own
656
+ * `Intl.DisplayNames` for localized country names and a pure Unicode transform for flag emoji.
657
+ * Zero bundled data table beyond what the phone-parsing library itself already carries.
658
+ *
659
+ * Computed once and cached — `Intl.DisplayNames` construction and 245 `.of()` calls are cheap
660
+ * individually but unnecessary to repeat across every `InputPhone` instance.
661
+ */
662
+ export declare function getDefaultCountryOptions(): CountryOption[];
663
+
594
664
  export declare const Icon: {
595
665
  ({ icon: IconComponent, size, strokeWidth, label, className, ...rest }: IconProps): JSX_2.Element;
596
666
  displayName: string;
@@ -626,6 +696,52 @@ export declare const Input: InputCompound;
626
696
  */
627
697
  declare const Input_2: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
628
698
 
699
+ /**
700
+ * Rebuild of the old `CardNumberInput` export slot — the previous implementation was a dead
701
+ * placeholder (hardcoded a static mastercard PNG import regardless of the number typed in, no
702
+ * Luhn check, no brand detection, no digit grouping, 0 real consumers). This version is built on
703
+ * `BaseInput` per `RFC-input-family.md`, matching the Figma `Input field` master's
704
+ * `Type=Payment input` variant (verified via metadata — node `80:8127` etc: a single "Payment
705
+ * method icon" leading slot + text, no trailing element at all).
706
+ *
707
+ * `leftSlot` renders NOTHING by default — RFC Decision #4: shipping trademarked
708
+ * Visa/Mastercard/etc. logos inside a design-system package is legal/brand-guideline exposure
709
+ * this component is not positioned to clear. Brand detection (IIN/BIN prefix regex table) and
710
+ * Luhn validation are genuinely component-owned logic and still run on every keystroke — the
711
+ * detected brand is surfaced via `onChange`'s second argument so a consumer with their own
712
+ * cleared icon set can render it in `leftSlot` themselves.
713
+ */
714
+ export declare function InputCardNumber({ size, label, required, hint, error, disabled, placeholder, value, leftSlot, onChange, className, wrapperClassName, }: InputCardNumberProps): JSX_2.Element;
715
+
716
+ export declare interface InputCardNumberProps {
717
+ size?: InputSize;
718
+ label?: string;
719
+ required?: boolean;
720
+ hint?: string;
721
+ error?: boolean;
722
+ disabled?: boolean;
723
+ placeholder?: string;
724
+ /** Controlled, formatted display value (spaces already inserted per the detected brand's grouping). */
725
+ value?: string;
726
+ /**
727
+ * Consumer-supplied brand mark, mounted in `leftSlot`. Renders nothing by default — see
728
+ * `RFC-input-family.md` Decision #4: shipping trademarked payment-network logos inside a
729
+ * design-system package is legal/brand-guideline exposure this component is not positioned
730
+ * to clear. The detected brand is still surfaced via `onChange`'s second argument, so a
731
+ * consumer with their own cleared icon set (or a generic/licensed asset) can render it here.
732
+ */
733
+ leftSlot?: React_2.ReactNode;
734
+ /**
735
+ * `value` is the formatted display string (spaces inserted). `brand` is the network detected
736
+ * from the IIN/BIN prefix, or `null` if no known prefix matches yet. `isValid` is Luhn check
737
+ * pass AND the digit count matching the detected brand's expected length — always `false`
738
+ * while `brand` is `null` (an undetected prefix can't be validated against a target length).
739
+ */
740
+ onChange?: (value: string, brand: CardBrand | null, isValid: boolean) => void;
741
+ className?: ClassValue;
742
+ wrapperClassName?: ClassValue;
743
+ }
744
+
629
745
  declare type InputCompound = typeof Input_2 & {
630
746
  Prefix: typeof InputPrefix;
631
747
  Suffix: typeof InputSuffix;
@@ -709,10 +825,103 @@ declare interface InputDropdownSlot {
709
825
 
710
826
  export declare type InputDropdownType = 'default' | 'search' | 'tags';
711
827
 
828
+ /**
829
+ * Rebuild of the old `PhoneInput` export slot — the previous implementation was a dead
830
+ * placeholder (hardcoded `"US"` prefix text, no library-backed formatting/validation, 0 real
831
+ * consumers). This version is a genuine port of cekat-dashboard's working freestyle
832
+ * implementation (`RegisterSteps/Step1.tsx` + `phoneUtils.ts`) into the library, built on
833
+ * `BaseInput` per `RFC-input-family.md`.
834
+ *
835
+ * The country picker's trigger shows only the ISO country code ("ID", "US") — the dial code
836
+ * itself (+62, +1) lives inside the input's own text, combined with the national number
837
+ * (e.g. "+62 812 345 6789"), rather than being shown twice. `value`/`onChange` therefore carry
838
+ * the FULL string including the dial code — not just the national number like the picker-shows-
839
+ * dial-code version this replaced.
840
+ *
841
+ * Country list defaults to `getDefaultCountryOptions()` (cekat-ui-owned, generated from
842
+ * `libphonenumber-js` + `Intl.DisplayNames`, see `countryOptions.ts`) — the `countries` prop is
843
+ * an override escape hatch, not the expected path (Decision #2).
844
+ *
845
+ * Formatting/validation is `libphonenumber-js`'s `AsYouType`/`parsePhoneNumberFromString`,
846
+ * matching `phoneUtils.ts`'s exact behavior rather than reinventing phone parsing.
847
+ */
848
+ export declare function InputPhone({ size, label, required, hint, error, disabled, placeholder, value, defaultCountry, countries, onChange, className, wrapperClassName, }: InputPhoneProps): JSX_2.Element;
849
+
850
+ export declare interface InputPhoneProps {
851
+ size?: InputSize;
852
+ label?: string;
853
+ required?: boolean;
854
+ hint?: string;
855
+ error?: boolean;
856
+ disabled?: boolean;
857
+ placeholder?: string;
858
+ /** National-format display value (controlled) — what the user sees/types, not E.164. */
859
+ value?: string;
860
+ /** ISO 3166-1 alpha-2 default country, drives both the picker's initial selection and AsYouType formatting. Default `'ID'`. */
861
+ defaultCountry?: CountryCode;
862
+ /**
863
+ * Overrides the default bundled country/dial-code list (see `RFC-input-family.md` Decision
864
+ * #2 — `getDefaultCountryOptions()` from `countryOptions.ts` is cekat-ui's own owned data,
865
+ * this prop exists purely as an escape hatch, not because swapping it in is the expected
866
+ * path).
867
+ */
868
+ countries?: CountryOption[];
869
+ /**
870
+ * `value` is the national-format display string as typed (AsYouType-formatted).
871
+ * `isValid` is `libphonenumber-js`'s own validation for the currently-selected country.
872
+ * `e164` is only present when `isValid` is true — full `+<countrycode><number>` form,
873
+ * ready to submit to a backend without the consumer re-deriving it.
874
+ */
875
+ onChange?: (value: string, isValid: boolean, e164?: string) => void;
876
+ className?: ClassValue;
877
+ wrapperClassName?: ClassValue;
878
+ }
879
+
712
880
  declare function InputPrefix({ children }: {
713
881
  children: ReactNode;
714
882
  }): JSX_2.Element;
715
883
 
884
+ /**
885
+ * Rebuild of the old `SaleAmountInput` export slot — the previous implementation was a dead
886
+ * placeholder (hardcoded `$` prefix regardless of `currency`, `currency` prop existed but
887
+ * `onCurrencyChange` had no actual dropdown/menu behind it, no locale-aware number formatting,
888
+ * 0 real consumers). This version is built on `BaseInput` per `RFC-input-family.md`: currency
889
+ * symbol in `leftSlot`, currency picker in `rightSlot`, matching the Figma `Input field` master's
890
+ * `Type=Trailing dropdown` variant (verified via Figma metadata — node `80:9230` etc, "Leading
891
+ * text" + "Dropdown" sub-frames).
892
+ *
893
+ * `currencies` is a REQUIRED prop with no bundled default — per RFC Decision #3, the currency
894
+ * list is backend-owned, not cekat-ui's. Formatting is locale-aware per the selected currency's
895
+ * `locale` field (thousands/decimal separators via `Intl.NumberFormat`, see `amountFormat.ts`),
896
+ * not hardcoded to any single currency's conventions.
897
+ */
898
+ export declare function InputPrice({ size, label, required, hint, error, disabled, placeholder, value, currency, currencies, onCurrencyChange, onChange, className, wrapperClassName, }: InputPriceProps): JSX_2.Element;
899
+
900
+ export declare interface InputPriceProps {
901
+ size?: InputSize;
902
+ label?: string;
903
+ required?: boolean;
904
+ hint?: string;
905
+ error?: boolean;
906
+ disabled?: boolean;
907
+ placeholder?: string;
908
+ /** Raw numeric value (controlled) — not a pre-formatted display string. `undefined`/empty renders a blank field. */
909
+ value?: number;
910
+ /** Currently-selected currency's `code`. Must match one entry in `currencies`. */
911
+ currency: string;
912
+ /**
913
+ * REQUIRED — no bundled default (see `RFC-input-family.md` Decision #3, updated). The
914
+ * currency list is backend-owned; cekat-ui never assumes or hardcodes it. Consumers map
915
+ * whatever shape backend returns into `CurrencyOption[]` before passing it in.
916
+ */
917
+ currencies: CurrencyOption[];
918
+ onCurrencyChange?: (code: string) => void;
919
+ /** Fires with the parsed numeric value on every keystroke that changes it (locale-aware — thousands/decimal separators are stripped per the selected currency's `locale`). */
920
+ onChange?: (value: number) => void;
921
+ className?: ClassValue;
922
+ wrapperClassName?: ClassValue;
923
+ }
924
+
716
925
  declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'className'> {
717
926
  label?: string;
718
927
  required?: boolean;
@@ -1041,23 +1250,6 @@ export declare interface NotificationToastProps {
1041
1250
  */
1042
1251
  export declare type NotificationToastType = 'primary-icon' | 'gray-icon' | 'progress' | 'avatar' | 'image' | 'success' | 'warning' | 'error' | 'no-icon';
1043
1252
 
1044
- export declare function PhoneInput({ size, label, required, hint, error, disabled, placeholder, rightIcon, value, onChange, className, wrapperClassName, }: PhoneInputProps): JSX_2.Element;
1045
-
1046
- declare interface PhoneInputProps {
1047
- size?: 'sm' | 'md';
1048
- label?: string;
1049
- required?: boolean;
1050
- hint?: string;
1051
- error?: boolean;
1052
- disabled?: boolean;
1053
- placeholder?: string;
1054
- rightIcon?: default_2.ReactNode;
1055
- value?: string;
1056
- onChange?: default_2.ChangeEventHandler<HTMLInputElement>;
1057
- className?: InputProps['className'];
1058
- wrapperClassName?: InputProps['wrapperClassName'];
1059
- }
1060
-
1061
1253
  /**
1062
1254
  * Overlay foundation for the dropdown family (Menu, Select, ComboBox) and Tooltip. Wraps RAC's
1063
1255
  * `Popover`, which already provides: portal to `document.body`,
@@ -1114,25 +1306,6 @@ export declare const Row: <T extends object>(props: RowProps<T> & {
1114
1306
  export declare interface RowProps<T extends object> extends RowProps_2<T> {
1115
1307
  }
1116
1308
 
1117
- export declare function SaleAmountInput({ size, label, required, hint, error, disabled, value, placeholder, currency, onCurrencyChange, rightIcon, onChange, className, wrapperClassName, }: SaleAmountInputProps): JSX_2.Element;
1118
-
1119
- declare interface SaleAmountInputProps {
1120
- size?: 'sm' | 'md';
1121
- label?: string;
1122
- required?: boolean;
1123
- hint?: string;
1124
- error?: boolean;
1125
- disabled?: boolean;
1126
- value?: string;
1127
- placeholder?: string;
1128
- currency?: string;
1129
- onCurrencyChange?: () => void;
1130
- rightIcon?: default_2.ReactNode;
1131
- onChange?: default_2.ChangeEventHandler<HTMLInputElement>;
1132
- className?: InputProps['className'];
1133
- wrapperClassName?: InputProps['wrapperClassName'];
1134
- }
1135
-
1136
1309
  export declare const Select: <T extends object>(props: SelectProps<T> & {
1137
1310
  ref?: React_2.Ref<HTMLDivElement>;
1138
1311
  }) => React_2.ReactElement;
@@ -1481,6 +1654,20 @@ export declare type TagShape = 'rounded' | 'pill';
1481
1654
 
1482
1655
  export declare type TagSize = 'sm' | 'md' | 'lg';
1483
1656
 
1657
+ /**
1658
+ * Internally built on `react-aria-components`' `Group` + `TextArea` — same directional choice
1659
+ * `BaseInput` made (see `RFC-input-family.md` Decision #0) and for the same reason:
1660
+ * `TextField`'s own multi-line composition would force a wrapper `<div>` and value-based
1661
+ * `onChange` this component doesn't want. RAC's `TextArea` (confirmed via installed
1662
+ * `react-aria-components@1.20.0` types, not assumed from docs) is already native-DOM-shaped by
1663
+ * default (`extends TextareaHTMLAttributes<HTMLTextAreaElement>`, plain `onChange:
1664
+ * ChangeEventHandler`) — unlike `TextField`'s `Input`, it needs no adapter layer at all, so this
1665
+ * migration is a pure internals swap: `Textarea`'s public API is unchanged.
1666
+ *
1667
+ * `Group` gives hover/focus-within/focus-visible/`data-[invalid]`/`data-[disabled]` state for
1668
+ * free instead of hand-rolling it via plain `focus-within:` CSS (the pre-RAC version's approach)
1669
+ * — same accessibility/state-machine benefit `BaseInput` already gets from it.
1670
+ */
1484
1671
  export declare const Textarea: React_2.ForwardRefExoticComponent<TextareaProps & React_2.RefAttributes<HTMLTextAreaElement>>;
1485
1672
 
1486
1673
  export declare interface TextareaProps extends Omit<React_2.TextareaHTMLAttributes<HTMLTextAreaElement>, 'className'> {
@@ -1490,6 +1677,7 @@ export declare interface TextareaProps extends Omit<React_2.TextareaHTMLAttribut
1490
1677
  helpIcon?: React_2.ReactNode;
1491
1678
  error?: boolean;
1492
1679
  disabled?: boolean;
1680
+ /** Whether the resize handle is shown at all — the browser's own CSS `resize` behavior already clamps a drag to never go below the rendered min-height (132px default / rows-driven), so "resize down to no smaller than default height" needs no extra logic beyond that CSS floor. */
1493
1681
  resizable?: boolean;
1494
1682
  /** Tighter padding/min-height and a smaller semibold label, for compact form layouts (e.g. a multi-field grid). Opt-in, does not affect default styling. */
1495
1683
  compact?: boolean;