cekat-ui 1.3.16 → 1.3.17

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
@@ -1,11 +1,18 @@
1
1
  import { ButtonProps as ButtonProps_2 } from 'react-aria-components';
2
2
  import { ButtonRenderProps } from 'react-aria-components';
3
+ import { CalendarCellProps as CalendarCellProps_2 } from 'react-aria-components';
4
+ import { CalendarDate } from '@internationalized/date';
5
+ import { CalendarGridProps as CalendarGridProps_2 } from 'react-aria-components';
6
+ import { CalendarProps as CalendarProps_2 } from 'react-aria-components';
3
7
  import { CellProps as CellProps_2 } from 'react-aria-components';
4
8
  import { ClassValue } from 'clsx';
5
9
  import { ColumnProps as ColumnProps_2 } from 'react-aria-components';
6
10
  import { ColumnResizerProps as ColumnResizerProps_2 } from 'react-aria-components';
7
11
  import { ComboBoxProps as ComboBoxProps_2 } from 'react-aria-components';
8
12
  import { CountryCode } from 'libphonenumber-js/min';
13
+ import { DateDuration } from '@internationalized/date';
14
+ import { DateFieldProps as DateFieldProps_2 } from 'react-aria-components';
15
+ import { DateValue } from 'react-aria-components';
9
16
  import { default as default_2 } from 'react';
10
17
  import { DialogProps } from 'react-aria-components';
11
18
  import { GroupProps } from 'react-aria-components';
@@ -23,6 +30,7 @@ import { MenuTrigger } from 'react-aria-components';
23
30
  import { ModalOverlayProps } from 'react-aria-components';
24
31
  import { PopoverProps as PopoverProps_2 } from 'react-aria-components';
25
32
  import { PressEvent } from 'react-aria-components';
33
+ import { RangeCalendarProps as RangeCalendarProps_2 } from 'react-aria-components';
26
34
  import * as React_2 from 'react';
27
35
  import { ReactNode } from 'react';
28
36
  import { ResizableTableContainerProps } from 'react-aria-components';
@@ -280,7 +288,7 @@ export declare interface BaseInputProps extends Omit<React_2.InputHTMLAttributes
280
288
  label?: string;
281
289
  required?: boolean;
282
290
  hint?: string;
283
- size?: InputSize;
291
+ size?: DateFieldSize;
284
292
  error?: boolean;
285
293
  disabled?: boolean;
286
294
  /** Tighter padding/height/radius and a smaller semibold label, independent of `size`'s font scale. Opt-in, mirrors `Input`'s `compact`. */
@@ -395,6 +403,204 @@ export declare type ButtonTone = 'primary' | 'destructive';
395
403
 
396
404
  export declare type ButtonVariant = 'solid' | 'outline' | 'outline-primary' | 'ghost' | 'ghost-primary' | 'plain' | 'plain-black';
397
405
 
406
+ /**
407
+ * Single-date calendar.
408
+ *
409
+ * Week start is locale-derived by default (`id-ID`/`en-US` Sunday-first, `en-GB` Monday-first
410
+ * per CLDR); pass `firstDayOfWeek="mon"` to force Figma's grid regardless of locale. See RFC
411
+ * Decision #7.
412
+ */
413
+ export declare function Calendar<T extends DateValue>({ size, hasActivity, className, children, ...props }: CalendarProps<T>): JSX_2.Element;
414
+
415
+ /**
416
+ * A single day cell.
417
+ *
418
+ * `Type=Today's date` (Figma `_Calendar cell` 2646:30128) maps to RAC's own `data-today`
419
+ * attribute — confirmed against the installed runtime, `dist/private/Calendar.mjs`, whose
420
+ * cell `dataAttrs` map ends with `'data-today': istoday || undefined`, and typed as `isToday`
421
+ * on `CalendarCellRenderProps`. No manual `isSameDay(date, today(...))` comparison is needed.
422
+ * (An earlier revision of the RFC claimed this prop was absent; that was a bad grep.)
423
+ *
424
+ * Figma's `Active dot` axis is driven by the parent's `hasActivity` predicate. Because RAC's
425
+ * `CalendarCell` takes a render function, the dot is rendered as a sibling of the date number
426
+ * rather than requiring a new slot — `formattedDate` still comes from RAC so locale-specific
427
+ * numerals are preserved.
428
+ */
429
+ export declare function CalendarCell({ date, size, className, ...props }: CalendarCellProps): JSX_2.Element;
430
+
431
+ export declare interface CalendarCellProps extends Omit<CalendarCellProps_2, 'className'> {
432
+ /** @default 'md' — inherited from the parent `Calendar` when omitted. */
433
+ size?: CalendarSize;
434
+ className?: ClassValue;
435
+ }
436
+
437
+ /**
438
+ * Weekday header row. RAC's `CalendarGridHeader` takes a render function receiving each day,
439
+ * and emits real `<th scope="col">` elements — Figma's flat `Dates` frame has no equivalent
440
+ * node (the weekday labels are drawn as ordinary cell instances), so this is a structure we
441
+ * add rather than reproduce.
442
+ */
443
+ export declare function CalendarGrid({ size, className, ...props }: CalendarGridProps): JSX_2.Element;
444
+
445
+ export declare interface CalendarGridProps extends Omit<CalendarGridProps_2, 'className' | 'style'> {
446
+ /** @default 'md' — inherited from the parent `Calendar` when omitted. */
447
+ size?: CalendarSize;
448
+ className?: ClassValue;
449
+ }
450
+
451
+ /**
452
+ * Month label plus previous/next buttons — Figma's `Month` frame (280×36), present in all eight
453
+ * panel variants.
454
+ *
455
+ * `slot="previous"`/`slot="next"` is how RAC wires these to the calendar's own paging state;
456
+ * they must not be given `onPress` handlers of their own.
457
+ *
458
+ * The labels are required props rather than defaulted strings. Figma renders these icon-only
459
+ * with no text, which is an accessibility defect we have to fix on our side, and a hardcoded
460
+ * English default would be wrong the moment the surrounding app runs in Indonesian — which,
461
+ * per RFC Decision #7, is the locale we tell consumers to set.
462
+ */
463
+ export declare function CalendarHeader({ previousLabel, nextLabel, withPickers, visibleYears, offset, className, }: CalendarHeaderProps): JSX_2.Element;
464
+
465
+ /**
466
+ * Header row: month label plus previous/next buttons. Figma `Month` frame (280×36) in
467
+ * every panel variant.
468
+ */
469
+ export declare interface CalendarHeaderProps {
470
+ /**
471
+ * Accessible name for the previous-month button. Figma renders it icon-only with no
472
+ * label, so this is required rather than defaulted — an unnamed icon button is an
473
+ * a11y defect, and a silent English default would be wrong under a non-English locale.
474
+ */
475
+ previousLabel: string;
476
+ /** Accessible name for the next-month button. Required for the same reason. */
477
+ nextLabel: string;
478
+ /**
479
+ * Replaces the static month/year heading with month and year dropdowns, so a user can jump
480
+ * straight to a distant month instead of paging through it. Off by default: the Figma spec
481
+ * draws a plain heading, and a picker is a different (larger) header.
482
+ */
483
+ withPickers?: boolean;
484
+ /** Forwarded to `CalendarYearSelect` when `withPickers`. @default 20 */
485
+ visibleYears?: number;
486
+ /**
487
+ * Same `offset` semantics as `CalendarGrid`'s — required when this header sits above a grid
488
+ * that is not the calendar's first visible month (the right-hand panel of a two-month range,
489
+ * offset={{months: 1}}). Without it, `withPickers` would show and drive the SAME focused
490
+ * month as the left header, because RAC's month/year pickers read `state.focusedDate`
491
+ * directly with no offset of their own — see `CalendarMonthSelect`'s docstring.
492
+ */
493
+ offset?: DateDuration;
494
+ className?: ClassValue;
495
+ }
496
+
497
+ /**
498
+ * Month dropdown for the calendar header.
499
+ *
500
+ * RAC's `CalendarMonthPicker` is headless: it hands back `items` (each with an `id`, a
501
+ * `CalendarDate`, and a locale-`formatted` label), the current `value`, an `onChange`, and an
502
+ * `aria-label` — and expects us to render the control. That is what makes it composable with
503
+ * this library's own `Select` instead of forcing a second, differently-styled dropdown into
504
+ * the design system.
505
+ *
506
+ * `size="sm"` is the default rather than `md`: the header row is 36px (Figma's `Month` frame),
507
+ * and an `md` trigger is 44px, which would push the header taller than the spec.
508
+ *
509
+ * `offset` is required for the right-hand panel of a two-month range — see
510
+ * `useOffsetCalendarState`'s docstring for why RAC cannot do this on its own.
511
+ *
512
+ * Only valid inside a `Calendar`/`RangeCalendar` — it reads calendar state from context. This
513
+ * is bypassed by calling `useCalendarMonthPicker` ourselves against the (possibly offset) state
514
+ * rather than rendering RAC's `CalendarMonthPicker`, because that component always reads the
515
+ * un-offset context state directly and offers no way to substitute it.
516
+ */
517
+ export declare function CalendarMonthSelect({ format, size, offset, className, }: CalendarMonthSelectProps): JSX_2.Element;
518
+
519
+ export declare interface CalendarMonthSelectProps {
520
+ /**
521
+ * Month name format, forwarded to RAC's `useCalendarMonthPicker`.
522
+ * @default 'long'
523
+ */
524
+ format?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
525
+ /** @default 'sm' — the header is 36px tall, so `md` (44px) would not fit. */
526
+ size?: SelectSize;
527
+ /** See `CalendarHeaderProps.offset`. */
528
+ offset?: DateDuration;
529
+ className?: ClassValue;
530
+ }
531
+
532
+ /**
533
+ * `firstDayOfWeek` IS available in RAC 1.20.0 and is inherited from `RACCalendarProps` — it is
534
+ * deliberately not re-declared below.
535
+ *
536
+ * An earlier revision of this file and of the RFC claimed the prop was absent, and concluded
537
+ * that Figma's Monday-first grid was unreachable. That was wrong: the grep looked in
538
+ * `dist/types/` and `@react-types/`, but the prop is declared in
539
+ * `react-stately/dist/types/src/calendar/types.d.ts` (`CalendarPropsBase`) and consumed in
540
+ * `react-aria-components/dist/private/Calendar.mjs`, which reads
541
+ * `calenderProps?.firstDayOfWeek ?? rangeCalenderProps?.firstDayOfWeek` off context and passes
542
+ * it to `useCalendarGrid`.
543
+ *
544
+ * Omit it and week start follows the locale (`id-ID` and `en-US` are Sunday-first per CLDR;
545
+ * `en-GB` and `de-DE` are Monday-first). Pass `firstDayOfWeek="mon"` for Figma's grid
546
+ * regardless of locale.
547
+ */
548
+ export declare interface CalendarProps<T extends DateValue> extends Omit<CalendarProps_2<T>, 'className' | 'style' | 'children'> {
549
+ /** @default 'md' */
550
+ size?: CalendarSize;
551
+ /**
552
+ * Months rendered at once. Figma's desktop dual-date panel (2646:30221) shows two;
553
+ * mobile (2646:30490) shows one. That difference is this prop, not a variant axis —
554
+ * see RFC Out-table, "`Breakpoint` variant axis".
555
+ * @default { months: 1 }
556
+ */
557
+ visibleDuration?: DateDuration;
558
+ /**
559
+ * Figma's `Active dot` axis — marks a day as having activity with a dot under the number.
560
+ * Called for every rendered cell, including days from adjacent months.
561
+ *
562
+ * A predicate rather than a date array: the library must not own an
563
+ * "is this date in that list" comparison, since `CalendarDate` equality is not `===` and the
564
+ * consumer already knows how its own data is keyed.
565
+ */
566
+ hasActivity?: (date: CalendarDate) => boolean;
567
+ className?: ClassValue;
568
+ style?: React_2.CSSProperties;
569
+ children?: React_2.ReactNode;
570
+ }
571
+
572
+ /**
573
+ * Grid density. `Input`'s scale is `'xs' | 'sm' | 'md'`, but a calendar has no meaningful
574
+ * `xs`: Figma draws every cell at a fixed 40×40 (`_Calendar cell` 2646:30128) and the grid
575
+ * at 280px (7 × 40) in all eight panel variants. `sm` is an inferred densification for
576
+ * table-cell contexts (`DateCell`), not a Figma-confirmed size — see `calendar.styles.ts`.
577
+ */
578
+ export declare type CalendarSize = 'sm' | 'md';
579
+
580
+ /**
581
+ * Year dropdown for the calendar header. Same headless shape and same offset handling as
582
+ * `CalendarMonthSelect` — see its docstring.
583
+ *
584
+ * `visibleYears` is a window centred on the currently visible year, not an absolute range — RAC
585
+ * recentres it as the user navigates. Constrain the actual selectable span with the calendar's
586
+ * own `minValue`/`maxValue` instead; those are what the grid enforces anyway, so driving it
587
+ * from here would let the two disagree.
588
+ */
589
+ export declare function CalendarYearSelect({ visibleYears, size, offset, className, }: CalendarYearSelectProps): JSX_2.Element;
590
+
591
+ export declare interface CalendarYearSelectProps {
592
+ /**
593
+ * How many years the dropdown offers, centred on the visible year.
594
+ * @default 20
595
+ */
596
+ visibleYears?: number;
597
+ /** @default 'sm' */
598
+ size?: SelectSize;
599
+ /** See `CalendarHeaderProps.offset`. */
600
+ offset?: DateDuration;
601
+ className?: ClassValue;
602
+ }
603
+
398
604
  export declare type CardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'diners' | 'unionpay';
399
605
 
400
606
  /**
@@ -626,6 +832,43 @@ export declare interface CurrencyOption {
626
832
  locale?: string;
627
833
  }
628
834
 
835
+ /**
836
+ * Segmented date entry — day, month and year are separate `spinbutton`s, not one free-text
837
+ * input. Typing `0`,`5` in the day segment advances to month automatically; arrow keys
838
+ * increment; the whole field is one tab stop.
839
+ *
840
+ * There is deliberately no `displayFormat` prop (RFC Decision #4). Segment order and the
841
+ * separator come from the locale RAC reads via `useLocale()` — `id-ID` yields `DD/MM/YYYY`,
842
+ * which is 13 of the 25 formats used across cekat-dashboard. The consumer sets this once with
843
+ * `<I18nProvider locale="id-ID">`; the same provider is what fixes the calendar's week start
844
+ * (RFC Decision #7), so one piece of setup covers both.
845
+ *
846
+ * Known limitation, carried from the RFC: `MMM DD, YYYY` (3 call sites in cekat-dashboard)
847
+ * cannot be produced by a segmented editable field at all — a segment renders a number, not
848
+ * "Aug". Those sites display read-only dates, so they should render formatted text via
849
+ * `DateFormatter` rather than mount a `DateField`.
850
+ *
851
+ * `Group` wraps the segments so the leading `icon` and `trailing` slot are siblings of the
852
+ * input rather than inside it — the same shape `ComboBoxTrigger` uses.
853
+ */
854
+ export declare function DateField<T extends DateValue>({ size, icon, trailing, className, style, ...props }: DateFieldProps<T>): JSX_2.Element;
855
+
856
+ export declare interface DateFieldProps<T extends DateValue> extends Omit<DateFieldProps_2<T>, 'className' | 'style' | 'children'> {
857
+ /** Shares `Input`'s scale so the two line up when composed side by side. @default 'md' */
858
+ size?: DateFieldSize;
859
+ /** Leading ornament — icon or status dot. Mirrors `ComboBoxTrigger`'s `icon`. */
860
+ icon?: React_2.ReactNode;
861
+ /**
862
+ * Rendered at the end of the field, inside the border. Phase 2's `DatePicker` puts its
863
+ * calendar toggle button here; on its own a `DateField` has no trailing affordance.
864
+ */
865
+ trailing?: React_2.ReactNode;
866
+ className?: ClassValue;
867
+ style?: React_2.CSSProperties;
868
+ }
869
+
870
+ export declare type DateFieldSize = 'xs' | 'sm' | 'md';
871
+
629
872
  export declare const Dot: {
630
873
  ({ size, outline, className }: DotProps): JSX_2.Element;
631
874
  displayName: string;
@@ -754,7 +997,7 @@ declare const Input_2: default_2.ForwardRefExoticComponent<InputProps & default_
754
997
  export declare function InputCardNumber({ size, label, required, hint, error, disabled, placeholder, value, leftSlot, onChange, className, wrapperClassName, }: InputCardNumberProps): JSX_2.Element;
755
998
 
756
999
  export declare interface InputCardNumberProps {
757
- size?: InputSize;
1000
+ size?: DateFieldSize;
758
1001
  label?: string;
759
1002
  required?: boolean;
760
1003
  hint?: string;
@@ -888,7 +1131,7 @@ export declare type InputDropdownType = 'default' | 'search' | 'tags';
888
1131
  export declare function InputPhone({ size, label, required, hint, error, disabled, placeholder, value, defaultCountry, countries, onChange, className, wrapperClassName, }: InputPhoneProps): JSX_2.Element;
889
1132
 
890
1133
  export declare interface InputPhoneProps {
891
- size?: InputSize;
1134
+ size?: DateFieldSize;
892
1135
  label?: string;
893
1136
  required?: boolean;
894
1137
  hint?: string;
@@ -938,7 +1181,7 @@ declare function InputPrefix({ children }: {
938
1181
  export declare function InputPrice({ size, label, required, hint, error, disabled, placeholder, value, currency, currencies, onCurrencyChange, onChange, className, wrapperClassName, }: InputPriceProps): JSX_2.Element;
939
1182
 
940
1183
  export declare interface InputPriceProps {
941
- size?: InputSize;
1184
+ size?: DateFieldSize;
942
1185
  label?: string;
943
1186
  required?: boolean;
944
1187
  hint?: string;
@@ -967,7 +1210,7 @@ declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputE
967
1210
  required?: boolean;
968
1211
  hint?: string;
969
1212
  rightIcon?: React_2.ReactNode;
970
- size?: InputSize;
1213
+ size?: DateFieldSize;
971
1214
  error?: boolean;
972
1215
  /** Tighter padding/height/radius and a smaller semibold label, independent of `size`'s font scale. Opt-in, does not affect default styling. */
973
1216
  compact?: boolean;
@@ -988,8 +1231,6 @@ declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputE
988
1231
  wrapperClassName?: ClassValue;
989
1232
  }
990
1233
 
991
- declare type InputSize = 'xs' | 'sm' | 'md';
992
-
993
1234
  declare function InputSuffix({ children }: {
994
1235
  children: ReactNode;
995
1236
  }): JSX_2.Element;
@@ -1378,6 +1619,40 @@ declare type RadioSize = 'sm' | 'md'
1378
1619
  /** @deprecated `lg` is no longer a distinct size — it now renders identically to `md` and will be removed in a future major version. Migrate to `md`. */
1379
1620
  | 'lg';
1380
1621
 
1622
+ /**
1623
+ * Contiguous date-range calendar.
1624
+ *
1625
+ * `visibleDuration={{ months: 2 }}` reproduces Figma's desktop dual-date panel (2646:30221);
1626
+ * the default single month matches mobile (2646:30490). That is a prop, not a variant axis —
1627
+ * the `Breakpoint` axis in Figma was shown to be an authoring artifact (identical sizes and
1628
+ * byte-identical token maps between the Desktop and Mobile single-date variants), see the RFC
1629
+ * Out-table.
1630
+ *
1631
+ * Rendering two months requires two `CalendarGrid`s, the second offset — RAC does not fan a
1632
+ * single grid out across the visible duration:
1633
+ *
1634
+ * <RangeCalendar visibleDuration={{ months: 2 }}>
1635
+ * <CalendarHeader previousLabel="…" nextLabel="…" />
1636
+ * <div className="flex gap-6">
1637
+ * <CalendarGrid />
1638
+ * <CalendarGrid offset={{ months: 1 }} />
1639
+ * </div>
1640
+ * </RangeCalendar>
1641
+ */
1642
+ export declare function RangeCalendar<T extends DateValue>({ size, hasActivity, className, children, ...props }: RangeCalendarProps<T>): JSX_2.Element;
1643
+
1644
+ export declare interface RangeCalendarProps<T extends DateValue> extends Omit<RangeCalendarProps_2<T>, 'className' | 'style' | 'children'> {
1645
+ /** @default 'md' */
1646
+ size?: CalendarSize;
1647
+ /** @default { months: 1 } */
1648
+ visibleDuration?: DateDuration;
1649
+ /** See `CalendarProps.hasActivity`. */
1650
+ hasActivity?: (date: CalendarDate) => boolean;
1651
+ className?: ClassValue;
1652
+ style?: React_2.CSSProperties;
1653
+ children?: React_2.ReactNode;
1654
+ }
1655
+
1381
1656
  export declare const Row: <T extends object>(props: RowProps<T> & {
1382
1657
  ref?: React_2.Ref<HTMLTableRowElement>;
1383
1658
  }) => React_2.ReactElement;