@zonos/amino 5.1.37 → 5.1.39
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/components/button/MenuButton.js +1 -1
- package/components/button/RippleGroup.d.ts +2 -2
- package/components/button/useRipple.d.ts +2 -2
- package/components/connection-map/ConnectionMap.d.ts +4 -4
- package/components/filter/filter-date/FilterDate.d.ts +2 -2
- package/components/filter/filter-multi-select/FilterMultiSelect.d.ts +4 -4
- package/components/filter/filter-select/FilterSelect.d.ts +3 -3
- package/components/select/CountryMultiSelect.d.ts +7 -7
- package/components/select/CountryPhoneSelect.d.ts +7 -7
- package/components/select/CountrySelect.d.ts +5 -5
- package/components/select/MultiSelect.d.ts +5 -5
- package/components/select/Select.d.ts +3 -3
- package/components/select/_StyledReactSelect.d.ts +4 -4
- package/components/split-panel/SplitPanel.d.ts +2 -2
- package/icons/flag-icon/FlagIcon.d.ts +6 -6
- package/package.json +1 -1
- package/types/{ICountry.d.ts → Country.d.ts} +11 -11
- package/types/{IGeoJsonWorld.d.ts → GeoJsonWorld.d.ts} +5 -5
- package/types/{IOption.d.ts → SelectOption.d.ts} +2 -2
- package/utils/_graphiqlFetcher.d.ts +2 -2
- package/utils/getCountryCodeByName.d.ts +2 -2
- package/utils/prepCountryOptions.d.ts +2 -2
- package/utils/prepRegionCountryOptions.d.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime");require("react");var i=require("styled-components"),t=require("../../animations/DropdownAnimation.js"),o=require("../../styles/constants/theme.js"),r=require("../../utils/hooks/useDropdown.js");function a(e){return e&&e.__esModule?e:{default:e}}require("@floating-ui/react");var s,d,l=a(i),u
|
|
1
|
+
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime");require("react");var i=require("styled-components"),t=require("../../animations/DropdownAnimation.js"),o=require("../../styles/constants/theme.js"),r=require("../../utils/hooks/useDropdown.js");function a(e){return e&&e.__esModule?e:{default:e}}require("@floating-ui/react");var s,d,l,u=a(i),c=u.default.div(s||(s=e.__makeTemplateObject(["\n position: relative;\n display: inline-flex;\n"],["\n position: relative;\n display: inline-flex;\n"]))),m=u.default.div(d||(d=e.__makeTemplateObject(["\n z-index: 10;\n"],["\n z-index: 10;\n"]))),f=u.default.div(l||(l=e.__makeTemplateObject(["\n background: ",";\n border: ",";\n padding: ",";\n border-radius: ",";\n box-shadow: ",";\n animation: "," 250ms ease-in-out;\n animation-fill-mode: both;\n padding: "," 0;\n margin-top: ",";\n right: 0;\n min-width: 100%;\n width: max-content;\n"],["\n background: ",";\n border: ",";\n padding: ",";\n border-radius: ",";\n box-shadow: ",";\n animation: "," 250ms ease-in-out;\n animation-fill-mode: both;\n padding: "," 0;\n margin-top: ",";\n right: 0;\n min-width: 100%;\n width: max-content;\n"])),o.theme.surfaceColor,o.theme.border,o.theme.space24,o.theme.radius6,o.theme.v3ShadowLarge,t.DropdownAnimation,o.theme.radius6,o.theme.space8);exports.MenuButton=function(i){var t=i.action,o=i.children,a=i.className,s=i.closeOnMouseLeave,d=void 0===s||s,l=i.closeOnSelect,u=void 0===l||l,h=r.useDropdown({offsetCrossAxis:0,offsetMainAxis:0}),p=h.floatingStyles,b=h.refs,v=h.setVisible,x=h.visibility,g=h.visible,w=h.wrapperRef,_=function(){u&&v(!1)};return n.jsxs(c,{ref:w,className:a,onMouseLeave:function(){d&&v(!1)},children:[n.jsx("div",{ref:b.setReference,onClick:function(e){e.stopPropagation(),v(!0)},onKeyDown:function(e){"Enter"===e.key&&v(!0)},role:"button",tabIndex:0,children:t}),n.jsx(m,{ref:b.setFloating,style:e.__assign(e.__assign({},p),{visibility:x}),children:g&&n.jsx(f,{onClick:_,onKeyDown:function(e){"Enter"===e.key&&_()},role:"button",tabIndex:-1,children:o})})]})};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Color } from "../../types";
|
|
3
|
-
export interface
|
|
3
|
+
export interface RippleActions {
|
|
4
4
|
start: (event: React.SyntheticEvent) => void;
|
|
5
5
|
}
|
|
6
6
|
export type RippleGroupProps = {
|
|
@@ -17,4 +17,4 @@ export type RippleGroupProps = {
|
|
|
17
17
|
*/
|
|
18
18
|
opacity?: number;
|
|
19
19
|
};
|
|
20
|
-
export declare const RippleGroup: React.ForwardRefExoticComponent<RippleGroupProps & React.RefAttributes<
|
|
20
|
+
export declare const RippleGroup: React.ForwardRefExoticComponent<RippleGroupProps & React.RefAttributes<RippleActions>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RippleActions } from "./RippleGroup";
|
|
3
3
|
interface IRippleEventHandlers {
|
|
4
4
|
onMouseDown: React.MouseEventHandler;
|
|
5
5
|
}
|
|
6
6
|
type Props = {
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
rippleEnabled: boolean;
|
|
9
|
-
rippleRef: React.RefObject<
|
|
9
|
+
rippleRef: React.RefObject<RippleActions>;
|
|
10
10
|
};
|
|
11
11
|
type Return = {
|
|
12
12
|
/** Combines event handlers */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BaseProps } from "../../types/BaseProps";
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
2
|
+
import { type CountryOption } from "../../types/Country";
|
|
3
|
+
import { type GeoJsonWorld } from "../../types/GeoJsonWorld";
|
|
4
4
|
type Props = BaseProps & {
|
|
5
|
-
countries:
|
|
5
|
+
countries: CountryOption[];
|
|
6
6
|
from: string;
|
|
7
7
|
height?: number;
|
|
8
8
|
to: string;
|
|
9
|
-
worldData:
|
|
9
|
+
worldData: GeoJsonWorld | null;
|
|
10
10
|
};
|
|
11
11
|
export declare const ConnectionMap: ({ className, countries, from, height, to, worldData, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Dispatch } from 'react';
|
|
2
2
|
import { type FilterDateAction, type FilterDateState } from "./filterDateReducer";
|
|
3
3
|
import { type BaseFilterProps } from "../useFilterWrapper";
|
|
4
|
-
type
|
|
4
|
+
type BadgeFilterDateProps = BaseFilterProps & {
|
|
5
5
|
dispatch: Dispatch<FilterDateAction>;
|
|
6
6
|
filter: FilterDateState;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Assumes exclusive date range. Specific formats/ranges should be handled upstream.
|
|
10
10
|
*/
|
|
11
|
-
export declare const FilterDate: ({ dispatch, dropdownTitle, filter, label, }:
|
|
11
|
+
export declare const FilterDate: ({ dispatch, dropdownTitle, filter, label, }: BadgeFilterDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type BaseFilterProps } from "../useFilterWrapper";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SelectOption } from "../../../types/SelectOption";
|
|
3
3
|
type FilterMultiSelectProps<T extends string = string> = BaseFilterProps & {
|
|
4
|
-
options:
|
|
5
|
-
value:
|
|
6
|
-
onChange: (value:
|
|
4
|
+
options: SelectOption<T>[];
|
|
5
|
+
value: SelectOption<T>[];
|
|
6
|
+
onChange: (value: SelectOption<T>[]) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const FilterMultiSelect: <T extends string = string>({ dropdownTitle, label, onChange, options, value, }: FilterMultiSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type BaseFilterProps } from "../useFilterWrapper";
|
|
2
|
-
import type {
|
|
3
|
-
type FilterSelectProps<T extends string = string, O extends
|
|
2
|
+
import type { SelectOption } from "../../../types/SelectOption";
|
|
3
|
+
type FilterSelectProps<T extends string = string, O extends SelectOption<string> = SelectOption<T>> = BaseFilterProps & {
|
|
4
4
|
options: O[];
|
|
5
5
|
value: O | null;
|
|
6
6
|
onChange: (value: O | null) => void;
|
|
7
7
|
};
|
|
8
|
-
export declare const FilterSelect: <T extends string = string, O extends
|
|
8
|
+
export declare const FilterSelect: <T extends string = string, O extends SelectOption<T> = SelectOption<T>>({ onChange, options, value, ...props }: FilterSelectProps<T, O>) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type GroupBase, type MenuListProps, type Props, type SelectComponentsConfig, type StylesConfig } from 'react-select';
|
|
3
3
|
import { type HelpTextProps } from "../help-text/HelpText";
|
|
4
|
-
import { type
|
|
5
|
-
import type {
|
|
6
|
-
export declare const MenuList: <Option extends
|
|
7
|
-
export interface CountryMultiSelectProps<Option extends
|
|
4
|
+
import { type CountryOption, type UnavailableCountry } from "../../types/Country";
|
|
5
|
+
import type { SelectOption } from "../../types/SelectOption";
|
|
6
|
+
export declare const MenuList: <Option extends SelectOption, IsMulti extends boolean, Group extends GroupBase<Option>>({ children, ...props }: MenuListProps<Option, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export interface CountryMultiSelectProps<Option extends SelectOption<string> = SelectOption<string>, IsMulti extends true = true, Group extends GroupBase<Option> = GroupBase<Option>> extends Omit<Props<Option, IsMulti, Group>, 'isMulti' | 'onChange' | 'options' | 'value'>, HelpTextProps {
|
|
8
8
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
9
|
-
countryOptions:
|
|
9
|
+
countryOptions: CountryOption<Option['value']>[];
|
|
10
10
|
icon?: ReactNode;
|
|
11
11
|
label?: string;
|
|
12
12
|
styles?: StylesConfig<Option, IsMulti, Group>;
|
|
13
|
-
unavailableCountries:
|
|
13
|
+
unavailableCountries: UnavailableCountry[];
|
|
14
14
|
value: Option['value'][];
|
|
15
15
|
onChange: (countryCodes: Option['value'][]) => void;
|
|
16
16
|
}
|
|
17
|
-
export declare const CountryMultiSelect: <T extends string>({ countryOptions, label, onChange, unavailableCountries, value, ...props }: CountryMultiSelectProps<
|
|
17
|
+
export declare const CountryMultiSelect: <T extends string>({ countryOptions, label, onChange, unavailableCountries, value, ...props }: CountryMultiSelectProps<SelectOption<T>, true, GroupBase<SelectOption<T>>>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type GroupBase, type Props, type SelectComponentsConfig, type StylesConfig } from 'react-select';
|
|
3
3
|
import type { HelpTextProps } from "../help-text/HelpText";
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
export interface CountryPhoneSelectProps<Option extends
|
|
4
|
+
import type { CountryOption } from "../../types/Country";
|
|
5
|
+
import type { SelectOption } from "../../types/SelectOption";
|
|
6
|
+
export interface CountryPhoneSelectProps<Option extends SelectOption = SelectOption, IsMulti extends false = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Omit<Props<Option, IsMulti, Group>, 'isMulti' | 'onChange' | 'value'>, HelpTextProps {
|
|
7
7
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
8
|
-
countryOptions:
|
|
8
|
+
countryOptions: CountryOption[];
|
|
9
9
|
hasGroups?: boolean;
|
|
10
10
|
icon?: ReactNode;
|
|
11
11
|
label?: string;
|
|
12
12
|
phone: string;
|
|
13
|
-
phoneCountry:
|
|
13
|
+
phoneCountry: CountryOption | null;
|
|
14
14
|
styles?: StylesConfig<Option, IsMulti, Group>;
|
|
15
15
|
setPhone: (changed: string) => void;
|
|
16
|
-
setPhoneCountry: (changed:
|
|
16
|
+
setPhoneCountry: (changed: CountryOption | null) => void;
|
|
17
17
|
}
|
|
18
|
-
export declare const CountryPhoneSelect: ({ countryOptions, icon, label, phone, phoneCountry, setPhone, setPhoneCountry, ...props }: CountryPhoneSelectProps<
|
|
18
|
+
export declare const CountryPhoneSelect: ({ countryOptions, icon, label, phone, phoneCountry, setPhone, setPhoneCountry, ...props }: CountryPhoneSelectProps<CountryOption>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type SelectProps } from "./Select";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CountryOption } from "../../types/Country";
|
|
3
3
|
type CountrySelectType<T extends string> = {
|
|
4
4
|
autoFocus?: SelectProps['autoFocus'];
|
|
5
|
-
countryOptions:
|
|
5
|
+
countryOptions: CountryOption<T>[];
|
|
6
6
|
label?: string;
|
|
7
|
-
onChange: SelectProps<
|
|
7
|
+
onChange: SelectProps<CountryOption<T>>['onChange'];
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
value: T | null;
|
|
10
|
-
filter?: (country:
|
|
10
|
+
filter?: (country: CountryOption<T>) => boolean;
|
|
11
11
|
};
|
|
12
|
-
export type CountrySelectProps<T extends string = string> = CountrySelectType<T> & Omit<SelectProps<
|
|
12
|
+
export type CountrySelectProps<T extends string = string> = CountrySelectType<T> & Omit<SelectProps<CountryOption<T>>, keyof CountrySelectType<T> | 'options'>;
|
|
13
13
|
export declare const CountrySelect: <T extends string>({ autoFocus, countryOptions, filter, label, onChange, placeholder, value, ...props }: CountrySelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { GroupBase, Props, PropsValue, SelectComponentsConfig, StylesConfig } from 'react-select';
|
|
3
3
|
import { type HelpTextProps } from "../help-text/HelpText";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SelectOption } from "../../types/SelectOption";
|
|
5
5
|
type RequiredProps = 'onChange' | 'options' | 'value';
|
|
6
|
-
export interface MultiSelectProps<Option extends
|
|
6
|
+
export interface MultiSelectProps<Option extends SelectOption = SelectOption, IsMulti extends true = true, Group extends GroupBase<Option> = GroupBase<Option>> extends Omit<Props<Option, IsMulti, Group>, 'isMulti' | RequiredProps>, Required<Pick<Props<Option, IsMulti, Group>, RequiredProps>>, HelpTextProps {
|
|
7
7
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
8
8
|
hasGroups?: boolean;
|
|
9
9
|
icon?: ReactNode;
|
|
@@ -15,12 +15,12 @@ export interface MultiSelectProps<Option extends IOption = IOption, IsMulti exte
|
|
|
15
15
|
*/
|
|
16
16
|
value: PropsValue<Option>;
|
|
17
17
|
}
|
|
18
|
-
export type
|
|
18
|
+
export type GroupOption<Option extends SelectOption> = {
|
|
19
19
|
data: Option;
|
|
20
20
|
index: 0;
|
|
21
21
|
isDisabled: false;
|
|
22
22
|
isSelected: false;
|
|
23
23
|
type: 'option';
|
|
24
|
-
} &
|
|
25
|
-
export declare const MultiSelect: <Option extends
|
|
24
|
+
} & SelectOption;
|
|
25
|
+
export declare const MultiSelect: <Option extends SelectOption, Group extends GroupBase<Option>>({ closeMenuOnSelect, hideSelectedOptions, ...props }: MultiSelectProps<Option, true, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ActionMeta, GroupBase, Props, SelectComponentsConfig, StylesConfig } from 'react-select';
|
|
3
3
|
import { type HelpTextProps } from "../help-text/HelpText";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SelectOption } from "../../types/SelectOption";
|
|
5
5
|
import type { Size } from "../../types/Size";
|
|
6
6
|
type RequiredProps = 'options' | 'value';
|
|
7
|
-
export interface SelectProps<Option extends
|
|
7
|
+
export interface SelectProps<Option extends SelectOption = SelectOption, IsMulti extends false = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Omit<Props<Option, IsMulti, Group>, 'isMulti' | RequiredProps>, Required<Pick<Props<Option, IsMulti, Group>, RequiredProps>>, HelpTextProps {
|
|
8
8
|
/** Close the select dropdown menu when scrolling outside of menu to prevent graphical jank */
|
|
9
9
|
closeOnOutsideScroll?: boolean;
|
|
10
10
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
@@ -28,5 +28,5 @@ export interface SelectProps<Option extends IOption = IOption, IsMulti extends f
|
|
|
28
28
|
*/
|
|
29
29
|
onChange: (changed: Option | null, actionMeta: ActionMeta<Option>) => void;
|
|
30
30
|
}
|
|
31
|
-
export declare const Select: <Option extends
|
|
31
|
+
export declare const Select: <Option extends SelectOption, Group extends GroupBase<Option> = GroupBase<Option>>({ isClearable, label, value, ...props }: SelectProps<Option, false, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { GroupBase, OptionProps, Props, SelectComponentsConfig, StylesConfig } from 'react-select';
|
|
3
3
|
import { type HelpTextProps } from "../help-text/HelpText";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SelectOption } from "../../types/SelectOption";
|
|
5
5
|
import type { Size } from "../../types/Size";
|
|
6
6
|
type AdditionalProps<Value> = {
|
|
7
7
|
hasGroups?: boolean;
|
|
@@ -10,12 +10,12 @@ type AdditionalProps<Value> = {
|
|
|
10
10
|
size?: Size;
|
|
11
11
|
customOption?: (value: Value) => ReactNode;
|
|
12
12
|
};
|
|
13
|
-
export declare const CheckboxOptionComponent: <Option extends
|
|
14
|
-
export interface StyledReactSelectProps<Option extends
|
|
13
|
+
export declare const CheckboxOptionComponent: <Option extends SelectOption, IsMulti extends boolean, Group extends GroupBase<Option>>(props: OptionProps<Option, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export interface StyledReactSelectProps<Option extends SelectOption, IsMulti extends boolean, Group extends GroupBase<Option>> extends Props<Option, IsMulti, Group>, HelpTextProps, AdditionalProps<Option['value']> {
|
|
15
15
|
closeOnOutsideScroll?: boolean;
|
|
16
16
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
17
17
|
size?: Size;
|
|
18
18
|
styles?: StylesConfig<Option, IsMulti, Group>;
|
|
19
19
|
}
|
|
20
|
-
export declare const StyledReactSelect: <Option extends
|
|
20
|
+
export declare const StyledReactSelect: <Option extends SelectOption, IsMulti extends boolean, Group extends GroupBase<Option>>({ closeOnOutsideScroll, components, customOption, error, hasGroups, helpText, icon, label, menuPosition, placeholder, size, styles, ...props }: StyledReactSelectProps<Option, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
-
type
|
|
2
|
+
type SplitPanelProps = {
|
|
3
3
|
children: any;
|
|
4
4
|
className?: string;
|
|
5
5
|
collapseAll?: boolean;
|
|
@@ -26,5 +26,5 @@ type IProps = {
|
|
|
26
26
|
* Split panel component
|
|
27
27
|
* @ref https://greggman.github.io/react-split-it/
|
|
28
28
|
*/
|
|
29
|
-
export declare const SplitPanel: ({ children, className, collapseAll, direction, gutterSize, onSetSizes, sizes, ...props }:
|
|
29
|
+
export declare const SplitPanel: ({ children, className, collapseAll, direction, gutterSize, onSetSizes, sizes, ...props }: SplitPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as flags from "../flags/FlagIndex";
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
3
|
+
export type Flag = keyof typeof flags;
|
|
4
|
+
export type FlagScale = 'small' | 'medium' | 'large';
|
|
5
5
|
export type FlagIconProps = {
|
|
6
|
-
iconScale:
|
|
6
|
+
iconScale: FlagScale;
|
|
7
7
|
} & {
|
|
8
|
-
code:
|
|
8
|
+
code: Flag;
|
|
9
9
|
};
|
|
10
10
|
export declare const FlagIcon: import("react").ForwardRefExoticComponent<{
|
|
11
|
-
iconScale:
|
|
11
|
+
iconScale: FlagScale;
|
|
12
12
|
} & {
|
|
13
|
-
code:
|
|
13
|
+
code: Flag;
|
|
14
14
|
} & import("react").RefAttributes<SVGSVGElement>>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SelectOption } from "./SelectOption";
|
|
2
2
|
export declare const regions: readonly ["Africa", "Americas", "Asia", "Central America", "Europe", "North America", "Oceania", "South America"];
|
|
3
|
-
type
|
|
3
|
+
type Region = (typeof regions)[number];
|
|
4
4
|
/** @desc /api/address/getCountries */
|
|
5
|
-
export interface
|
|
5
|
+
export interface Country<CountryCode extends string = string> {
|
|
6
6
|
active: boolean;
|
|
7
7
|
code: CountryCode;
|
|
8
8
|
code3: string | null;
|
|
@@ -11,23 +11,23 @@ export interface ICountry<CountryCode extends string = string> {
|
|
|
11
11
|
fraudRisk: number;
|
|
12
12
|
languageCode: string | null;
|
|
13
13
|
numericCode: string | null;
|
|
14
|
-
region:
|
|
14
|
+
region: Region;
|
|
15
15
|
upsCode: string | null;
|
|
16
16
|
zipRegex: string | null;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface CountryOption<CountryCode extends string = string> extends Country<CountryCode>, SelectOption<CountryCode> {
|
|
19
19
|
phoneCode: string[];
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
22
|
-
label:
|
|
23
|
-
options:
|
|
21
|
+
export interface RegionCountryOption {
|
|
22
|
+
label: Region;
|
|
23
|
+
options: CountryOption[];
|
|
24
24
|
}
|
|
25
|
-
export interface
|
|
25
|
+
export interface UnavailableCountry {
|
|
26
26
|
code: string;
|
|
27
27
|
message: string;
|
|
28
28
|
}
|
|
29
29
|
/** @desc /api/address/getCountries */
|
|
30
|
-
export interface
|
|
31
|
-
[key: string]:
|
|
30
|
+
export interface GetCountriesResponse<CountryCode extends string = string> {
|
|
31
|
+
[key: string]: Country<CountryCode>;
|
|
32
32
|
}
|
|
33
33
|
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { BBox } from 'geojson';
|
|
2
2
|
import type { Arc, MultiPolygon, Polygon, Transform } from 'topojson-specification';
|
|
3
|
-
type
|
|
3
|
+
type Properties = {
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
|
-
type
|
|
7
|
-
properties:
|
|
6
|
+
type Geometry = (Polygon | MultiPolygon) & {
|
|
7
|
+
properties: Properties;
|
|
8
8
|
};
|
|
9
|
-
export type
|
|
9
|
+
export type GeoJsonWorld = {
|
|
10
10
|
arcs: Arc[];
|
|
11
11
|
bbox: BBox;
|
|
12
12
|
objects: {
|
|
13
13
|
countries: {
|
|
14
|
-
geometries:
|
|
14
|
+
geometries: Geometry[];
|
|
15
15
|
type: 'GeometryCollection';
|
|
16
16
|
};
|
|
17
17
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type SelectOption<V extends string | number = string | number> = {
|
|
3
3
|
icon?: ReactNode;
|
|
4
4
|
isDisabled?: boolean;
|
|
5
5
|
label: string;
|
|
6
6
|
labelDescription?: string;
|
|
7
7
|
value: V;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
@@ -19,7 +19,7 @@ export type GraphiqlFetcher = (graphQLParams: FetcherParams, opts?: FetcherOpts)
|
|
|
19
19
|
export type HandleFetchFetcher = <ResponseBody extends unknown, RequestBody = unknown>(url: string, _opts?: RequestOptions<ResponseBody, RequestBody> & {
|
|
20
20
|
logRequestIfError?: boolean;
|
|
21
21
|
}) => Promise<HandleFetchReturn<ResponseBody>>;
|
|
22
|
-
type
|
|
22
|
+
type Fetcher = (props: {
|
|
23
23
|
customFetcher: HandleFetchFetcher | null;
|
|
24
24
|
url: string | null;
|
|
25
25
|
}) => GraphiqlFetcher;
|
|
@@ -27,5 +27,5 @@ type IFetcher = (props: {
|
|
|
27
27
|
* Graphiql fetcher to send a GraphQl request
|
|
28
28
|
* @param url url to fetch
|
|
29
29
|
*/
|
|
30
|
-
export declare const graphiqlFetcher:
|
|
30
|
+
export declare const graphiqlFetcher: Fetcher;
|
|
31
31
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const getCountryCodeByName: (countryName: string, countries:
|
|
1
|
+
import type { CountryOption } from "../types/Country";
|
|
2
|
+
export declare const getCountryCodeByName: (countryName: string, countries: CountryOption[]) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GetCountriesResponse } from "../types/Country";
|
|
2
2
|
export declare const prepCountryOptions: <CountryCode extends string = string>({ json, }: {
|
|
3
|
-
json:
|
|
3
|
+
json: GetCountriesResponse<CountryCode>;
|
|
4
4
|
}) => {
|
|
5
5
|
label: string;
|
|
6
6
|
phoneCode: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const prepRegionCountryOptions: <T extends string = string>(countries:
|
|
1
|
+
import { type CountryOption } from "../types/Country";
|
|
2
|
+
export declare const prepRegionCountryOptions: <T extends string = string>(countries: CountryOption<T>[]) => {
|
|
3
3
|
label: "Africa" | "Americas" | "Asia" | "Central America" | "Europe" | "North America" | "Oceania" | "South America";
|
|
4
|
-
options:
|
|
4
|
+
options: CountryOption<T>[];
|
|
5
5
|
}[];
|