@factorialco/f0-react 1.242.1 → 1.243.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.
package/dist/f0.d.ts CHANGED
@@ -3,6 +3,7 @@ import { AlertTagCellValue as AlertTagCellValue_2 } from './types/alertTag.tsx';
3
3
  import { AmountCellValue } from '../../value-display/types/amount';
4
4
  import { AmountCellValue as AmountCellValue_2 } from './types/amount.tsx';
5
5
  import { AnchorHTMLAttributes } from 'react';
6
+ import { AriaAttributes } from 'react';
6
7
  import { AvatarListCellValue } from '../../value-display/types/avatarList';
7
8
  import { AvatarListCellValue as AvatarListCellValue_2 } from './types/avatarList.tsx';
8
9
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -832,6 +833,16 @@ export declare type CompanyAvatarVariant = Extract<AvatarVariant, {
832
833
 
833
834
  declare type CompanyTagProps = ComponentProps<typeof F0TagCompany>;
834
835
 
836
+ declare type CompareToDef = {
837
+ label: string;
838
+ value: {
839
+ delta: number;
840
+ units: GranularityDefinitionKey;
841
+ } | ((value: DateRangeComplete) => DateRangeComplete | DateRangeComplete[]);
842
+ };
843
+
844
+ declare type CompareToDefKey = string;
845
+
835
846
  declare type ComponentTypes = (typeof componentTypes)[number];
836
847
 
837
848
  declare const componentTypes: readonly ["layout", "info", "action", "form"];
@@ -1094,7 +1105,38 @@ declare type DateNavigatorFilterDefinition = NavigationFilterDefinitionBase<Date
1094
1105
  type: "date-navigator";
1095
1106
  } & DateNavigationOptions_2;
1096
1107
 
1097
- declare interface DatePreset {
1108
+ declare type DatePickerCompareTo = Record<GranularityDefinitionKey, CompareToDef[]>;
1109
+
1110
+ declare interface DatePickerPopupProps {
1111
+ onSelect?: (value: DatePickerValue_2 | undefined) => void;
1112
+ value?: DatePickerValue_2;
1113
+ defaultValue?: DatePickerValue_2;
1114
+ presets?: DatePreset[];
1115
+ granularities?: GranularityDefinitionKey[];
1116
+ minDate?: Date;
1117
+ maxDate?: Date;
1118
+ disabled?: boolean;
1119
+ hideGoToCurrent?: boolean;
1120
+ children: React.ReactNode;
1121
+ open?: boolean;
1122
+ onOpenChange?: (open: boolean) => void;
1123
+ compareTo?: DatePickerCompareTo;
1124
+ defaultCompareTo?: CompareToDefKey;
1125
+ hideCalendarInput?: boolean;
1126
+ asChild?: boolean;
1127
+ onCompareToChange?: (compareTo: DateRangeComplete | DateRangeComplete[] | undefined) => void;
1128
+ }
1129
+
1130
+ export declare const datepickerSizes: readonly ["sm", "md"];
1131
+
1132
+ export declare type DatePickerValue = DatePickerValue_2;
1133
+
1134
+ declare type DatePickerValue_2 = {
1135
+ value: DateRangeComplete | undefined;
1136
+ granularity: GranularityDefinitionKey;
1137
+ };
1138
+
1139
+ export declare interface DatePreset {
1098
1140
  label: string;
1099
1141
  granularity: GranularityDefinitionKey;
1100
1142
  value: DateRange | (() => DateRange);
@@ -1667,6 +1709,18 @@ export declare const F0ChipList: {
1667
1709
  displayName: string;
1668
1710
  };
1669
1711
 
1712
+ /**
1713
+ * @experimental This is an experimental component use it at your own risk
1714
+ */
1715
+ export declare const F0DatePicker: typeof F0DatePicker_2;
1716
+
1717
+ declare function F0DatePicker_2({ onChange, value, presets, granularities, minDate, maxDate, open, ...inputProps }: F0DatePickerProps): JSX_2.Element;
1718
+
1719
+ export declare type F0DatePickerProps = Pick<DatePickerPopupProps, "granularities" | "minDate" | "maxDate" | "presets" | "open" | "onOpenChange"> & {
1720
+ onChange?: (value: DatePickerValue | undefined, stringValue: string | undefined) => void;
1721
+ value?: DatePickerValue;
1722
+ } & Pick<InputFieldProps<string>, InputFieldInheritedProps>;
1723
+
1670
1724
  export declare function F0EventCatcherProvider({ children, onEvent, enabled, catchEvents, }: EventCatcherProviderProps): JSX.Element;
1671
1725
 
1672
1726
  export declare const F0Icon: ForwardRefExoticComponent<Omit<Omit<F0IconProps_2, "ref"> & RefAttributes<SVGSVGElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>;
@@ -2021,6 +2075,86 @@ export declare type InfiniteScrollPaginatedResponse<TRecord> = BasePaginatedResp
2021
2075
  hasMore: boolean;
2022
2076
  };
2023
2077
 
2078
+ declare const INPUTFIELD_SIZES: readonly ["sm", "md"];
2079
+
2080
+ declare type InputFieldInheritedProps = (typeof inputFieldInheritedProps)[number];
2081
+
2082
+ declare const inputFieldInheritedProps: readonly ["label", "placeholder", "hideLabel", "size", "error", "disabled", "readonly", "required", "clearable", "labelIcon", "status", "hint"];
2083
+
2084
+ declare type InputFieldProps<T> = {
2085
+ autoFocus?: boolean;
2086
+ label: string;
2087
+ placeholder?: string;
2088
+ labelIcon?: IconType;
2089
+ hideLabel?: boolean;
2090
+ hidePlaceholder?: boolean;
2091
+ name?: string;
2092
+ onClickPlaceholder?: () => void;
2093
+ onClickChildren?: () => void;
2094
+ onClickContent?: () => void;
2095
+ value?: T | undefined;
2096
+ onChange?: (value: T) => void;
2097
+ size?: InputFieldSize;
2098
+ error?: string | boolean;
2099
+ status?: InputFieldStatus;
2100
+ hint?: string;
2101
+ disabled?: boolean;
2102
+ className?: string;
2103
+ required?: boolean;
2104
+ readonly?: boolean;
2105
+ clearable?: boolean;
2106
+ role?: string;
2107
+ inputRef?: React.Ref<unknown>;
2108
+ "aria-controls"?: AriaAttributes["aria-controls"];
2109
+ "aria-expanded"?: AriaAttributes["aria-expanded"];
2110
+ onClear?: () => void;
2111
+ onFocus?: () => void;
2112
+ onBlur?: () => void;
2113
+ onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
2114
+ canGrow?: boolean;
2115
+ children: React.ReactNode & {
2116
+ onFocus?: () => void;
2117
+ onBlur?: () => void;
2118
+ onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
2119
+ onChange?: (value: T | React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
2120
+ value?: T;
2121
+ };
2122
+ icon?: IconType;
2123
+ isEmpty?: (value: T | undefined) => boolean;
2124
+ emptyValue?: T;
2125
+ maxLength?: number;
2126
+ hideMaxLength?: boolean;
2127
+ append?: React.ReactNode;
2128
+ appendTag?: string;
2129
+ lengthProvider?: (value: T | undefined) => number;
2130
+ loading?: boolean;
2131
+ avatar?: AvatarVariant;
2132
+ loadingIndicator?: {
2133
+ /**
2134
+ * If true, the loading spinner will be displayed over the content without affecting the layout
2135
+ */
2136
+ asOverlay?: boolean;
2137
+ /**
2138
+ * The offset of the loading spinner from the content
2139
+ */
2140
+ offset?: number;
2141
+ };
2142
+ };
2143
+
2144
+ declare type InputFieldSize = (typeof INPUTFIELD_SIZES)[number];
2145
+
2146
+ declare type InputFieldStatus = {
2147
+ type: Exclude<InputFieldStatusType, "error">;
2148
+ message: string;
2149
+ } | {
2150
+ type: "error";
2151
+ message?: string;
2152
+ };
2153
+
2154
+ declare const inputFieldStatus: readonly ["default", "warning", "info", "error"];
2155
+
2156
+ declare type InputFieldStatusType = (typeof inputFieldStatus)[number];
2157
+
2024
2158
  declare const internalAvatarColors: readonly ["viridian", "malibu", "yellow", "purple", "lilac", "barbie", "smoke", "army", "flubber", "indigo", "camel"];
2025
2159
 
2026
2160
  declare type InternalAvatarProps = React_2.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & {
@@ -2419,6 +2553,8 @@ declare type PersonTagProps = ComponentProps<typeof F0TagPerson>;
2419
2553
 
2420
2554
  export declare const PieChart: ForwardRefExoticComponent<Omit<PieChartProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLElement | SVGElement>>;
2421
2555
 
2556
+ export declare const predefinedPresets: Record<string, DatePreset>;
2557
+
2422
2558
  /**
2423
2559
  * Defines preset filter configurations that can be applied to a collection.
2424
2560
  * @template Filters - The available filter configurations