@factorialco/f0-react 6.101.1 → 6.102.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.
@@ -45,6 +45,7 @@ import { EmployeeItemProps } from './types';
45
45
  import { F0CommandPaletteProviderProps as F0CommandPaletteProviderProps_2 } from './types';
46
46
  import { F0EmojiPickerProps as F0EmojiPickerProps_2 } from './types';
47
47
  import { F0ENPSButtonProps as F0ENPSButtonProps_2 } from './types';
48
+ import { F0LocationInputProps as F0LocationInputProps_2 } from './types';
48
49
  import { F0PhoneInputProps as F0PhoneInputProps_2 } from './types';
49
50
  import { F0SegmentedControlProps as F0SegmentedControlProps_2 } from './types';
50
51
  import { F0SelectProps as F0SelectProps_2 } from './types';
@@ -5840,6 +5841,31 @@ declare const defaultTranslations: {
5840
5841
  readonly searchCountry: "Search country or dial code";
5841
5842
  readonly noResults: "No country found";
5842
5843
  };
5844
+ readonly locationInput: {
5845
+ readonly country: "Country";
5846
+ readonly addressLine1: "Address line 1";
5847
+ readonly addressLine2: "Address line 2";
5848
+ readonly city: "City";
5849
+ readonly state: "Region";
5850
+ readonly postalCode: "Postal code";
5851
+ readonly placeholder: "Enter an address";
5852
+ readonly selectCountry: "Select a country";
5853
+ readonly searchCountry: "Search country";
5854
+ readonly noCountryResults: "No country found";
5855
+ readonly noResults: "No addresses found";
5856
+ readonly searchHint: "Type an address to search";
5857
+ readonly noResultsHelp: "Can't find an address?";
5858
+ readonly enterManually: "Enter it manually";
5859
+ readonly addressLine1Placeholder: "Enter a street and number";
5860
+ readonly addressLine2Placeholder: "Enter a floor or unit";
5861
+ readonly postalCodePlaceholder: "e.g., 08001";
5862
+ readonly searching: "Searching addresses";
5863
+ readonly searchError: "Couldn't load addresses. Try again.";
5864
+ readonly resultsCount: {
5865
+ readonly one: "{{count}} address found";
5866
+ readonly other: "{{count}} addresses found";
5867
+ };
5868
+ };
5843
5869
  readonly imageUpload: {
5844
5870
  readonly uploading: "Uploading...";
5845
5871
  readonly uploadError: "Upload failed";
@@ -8927,6 +8953,118 @@ declare type F0LinkProps = Omit<ActionLinkProps, "variant" | "href"> & {
8927
8953
  href?: string;
8928
8954
  };
8929
8955
 
8956
+ /** @experimental This is an experimental component, use it at your own risk. */
8957
+ export declare const F0LocationInput: ForwardRefExoticComponent<F0LocationInputProps_2 & RefAttributes<HTMLInputElement>>;
8958
+
8959
+ export declare type F0LocationInputChangeMeta = {
8960
+ /**
8961
+ * `"picked"` when a suggestion was chosen *and* resolved into a full value.
8962
+ * `"typed"` in every other case, which includes a suggestion that could not
8963
+ * be resolved, so do not read `"typed"` as "the user did not use the list".
8964
+ * `isResolved` is what says whether the value can be trusted.
8965
+ */
8966
+ source: "picked" | "typed";
8967
+ /** Whether the value still carries trustworthy coordinates and place id */
8968
+ isResolved: boolean;
8969
+ };
8970
+
8971
+ export declare interface F0LocationInputProps {
8972
+ label: string;
8973
+ /** Controlled value */
8974
+ value?: F0LocationInputValue;
8975
+ /** Initial value when uncontrolled */
8976
+ defaultValue?: F0LocationInputValue;
8977
+ onChange?: (value: F0LocationInputValue | undefined, meta: F0LocationInputChangeMeta) => void;
8978
+ /**
8979
+ * Renders the whole address as separate fields the user can fill in by
8980
+ * hand: country, address line 1 and 2, city, region and postal code.
8981
+ * Changing the country clears the other parts, since they described a
8982
+ * place in the previous one. Without it the component is the address
8983
+ * field alone.
8984
+ * @default false
8985
+ */
8986
+ manualEntry?: boolean;
8987
+ /** Overrides for the per-part labels, which default to translated copy */
8988
+ partLabels?: Partial<Record<LocationPart, string>>;
8989
+ /** Restricts the country selector. A single entry also scopes the search */
8990
+ allowedCountries?: CountryCode[];
8991
+ /**
8992
+ * Country the search is scoped to. The value's own country is never used
8993
+ * for this: the search only exists without manual entry, where nothing on
8994
+ * screen would show or undo that scope, so the first picked address would
8995
+ * silently lock every later search to its country.
8996
+ */
8997
+ defaultCountry?: CountryCode;
8998
+ /**
8999
+ * Suggestion provider. Without it there is no autocomplete and the parts
9000
+ * stand alone as plain fields. Called with the current country so the
9001
+ * consumer can restrict the provider (e.g. Places `componentRestrictions`).
9002
+ */
9003
+ searchPlaces?: (query: string, context: F0LocationSearchContext) => Promise<F0LocationSuggestion[]>;
9004
+ /**
9005
+ * Resolves a picked suggestion into a full value. Every field of
9006
+ * `F0LocationInputValue` is optional, so two thresholds are worth knowing:
9007
+ * the value needs `formatted` or `addressLine1` to be shown at all, and
9008
+ * `placeId` plus both coordinates to report `isResolved: true`. Returning a
9009
+ * provider's formatted address without its granular parts is supported.
9010
+ */
9011
+ resolvePlace?: (id: string) => Promise<F0LocationInputValue | undefined>;
9012
+ placeholder?: string;
9013
+ hideLabel?: boolean;
9014
+ labelIcon?: IconType;
9015
+ hint?: string;
9016
+ error?: string | boolean;
9017
+ status?: InputFieldStatus;
9018
+ required?: boolean;
9019
+ disabled?: boolean;
9020
+ readonly?: boolean;
9021
+ loading?: boolean;
9022
+ clearable?: boolean;
9023
+ size?: LocationInputSize;
9024
+ name?: string;
9025
+ autoFocus?: boolean;
9026
+ onBlur?: () => void;
9027
+ onFocus?: () => void;
9028
+ }
9029
+
9030
+ /**
9031
+ * Canonical address shape. Deliberately camelCase with a lowercase ISO-2
9032
+ * country so every consumer stores the same thing.
9033
+ */
9034
+ export declare type F0LocationInputValue = {
9035
+ /** Display string. Comes from `resolvePlace` when picked, assembled locally once edited */
9036
+ formatted?: string;
9037
+ addressLine1?: string;
9038
+ addressLine2?: string;
9039
+ city?: string;
9040
+ /** Region, state or province, as free text */
9041
+ state?: string;
9042
+ postalCode?: string;
9043
+ country?: CountryCode;
9044
+ /**
9045
+ * Provider id of the picked place. Cleared as soon as a part that describes
9046
+ * where the pin is gets edited; `addressLine2` does not, since a floor
9047
+ * number stays inside the same building.
9048
+ */
9049
+ placeId?: string;
9050
+ latitude?: number;
9051
+ longitude?: number;
9052
+ /** Carried through from `resolvePlace`, never derived here */
9053
+ timezone?: string;
9054
+ };
9055
+
9056
+ export declare type F0LocationSearchContext = {
9057
+ /** Country to scope the search to, when one is selected or implied */
9058
+ country?: CountryCode;
9059
+ };
9060
+
9061
+ export declare type F0LocationSuggestion = {
9062
+ id: string;
9063
+ label: string;
9064
+ /** Appended to the label, so each suggestion reads as one line */
9065
+ description?: string;
9066
+ };
9067
+
8930
9068
  export declare const F0Map: ForwardRefExoticComponent<F0MapProps & RefAttributes<F0MapHandle>>;
8931
9069
 
8932
9070
  /**
@@ -9749,6 +9887,14 @@ declare type F0SelectFieldProps<T extends string, R = unknown> = F0SelectPopupPr
9749
9887
  * @default false
9750
9888
  */
9751
9889
  showPreview?: boolean;
9890
+ /**
9891
+ * Hides the trigger's dropdown arrow. For fields where the select is an
9892
+ * implementation detail rather than the affordance: the value is a typed
9893
+ * search result, not one of a few known options, and the arrow promises a
9894
+ * list the user is not meant to browse.
9895
+ * @default false
9896
+ */
9897
+ hideArrow?: boolean;
9752
9898
  } & Pick<InputFieldProps<T>, "required" | "loading" | "hideLabel" | "labelIcon" | "size" | "label" | "icon" | "placeholder" | "disabled" | "name" | "error" | "status" | "hint">;
9753
9899
 
9754
9900
  declare type F0SelectInlineProps<T extends string, R = unknown> = F0SelectPopupProps<T, R> & F0SelectSingleSelectionProps<T, R> & Pick<InputFieldProps<T>, "label" | "placeholder" | "disabled"> & {
@@ -9764,6 +9910,8 @@ declare type F0SelectInlineProps<T extends string, R = unknown> = F0SelectPopupP
9764
9910
  children?: never;
9765
9911
  className?: never;
9766
9912
  asList?: never;
9913
+ hideArrow?: never;
9914
+ searchEmptyAction?: never;
9767
9915
  showPreview?: never;
9768
9916
  required?: never;
9769
9917
  loading?: never;
@@ -9838,6 +9986,12 @@ declare type F0SelectPopupProps<T extends string, R = unknown> = {
9838
9986
  */
9839
9987
  onFiltersChange?: (filters: FiltersState<FiltersDefinition>) => void;
9840
9988
  searchEmptyMessage?: string;
9989
+ /**
9990
+ * Rendered under the empty state, for the way out when the list has nothing
9991
+ * to offer. `onCreate` draws its own action, so this is for the cases where
9992
+ * the answer is not "create what you typed".
9993
+ */
9994
+ searchEmptyAction?: React.ReactNode;
9841
9995
  actions?: Action[];
9842
9996
  /** Callback to create a new item from the current search text. When provided, a "+ Create" button is shown in the empty state of the dropdown. */
9843
9997
  onCreate?: (value: string) => Promise<void> | void;
@@ -12075,6 +12229,15 @@ declare interface LocalizedOption<T> {
12075
12229
  value: T;
12076
12230
  }
12077
12231
 
12232
+ export declare type LocationInputSize = (typeof locationInputSizes)[number];
12233
+
12234
+ export declare const locationInputSizes: readonly ["sm", "md"];
12235
+
12236
+ export declare type LocationPart = (typeof locationParts)[number];
12237
+
12238
+ /** Every part the manual entry block renders, in the order it renders them */
12239
+ export declare const locationParts: readonly ["country", "addressLine1", "addressLine2", "city", "state", "postalCode"];
12240
+
12078
12241
  declare const markerColors: readonly ["neutral", "grey", "radical", "malibu", "viridian", "flubber", "grass", "camel", "indigo", "lilac", "orange", "purple", "yellow", "red", "army", "smoke", "barbie"];
12079
12242
 
12080
12243
  export declare const MAX_EXPANDED_ACTIONS = 2;