@shipengine/elements 0.11.1 → 0.13.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/components/accordion/accordion.d.ts +12 -0
- package/components/accordion/accordion.styles.d.ts +7 -0
- package/components/accordion/index.d.ts +1 -0
- package/components/button-group/button-group.d.ts +7 -0
- package/components/button-group/index.d.ts +1 -0
- package/components/cube/cube.d.ts +5 -0
- package/components/cube/index.d.ts +1 -0
- package/components/disclosure/disclosure.d.ts +9 -0
- package/components/disclosure/disclosure.styles.d.ts +1 -0
- package/components/disclosure/index.d.ts +1 -0
- package/components/error-boundary/error-boundary.d.ts +31 -0
- package/components/error-boundary/index.d.ts +1 -0
- package/components/field/checkbox-input/checkbox-input.d.ts +6 -0
- package/components/field/checkbox-input/index.d.ts +1 -0
- package/components/field/create-field-controller.d.ts +23 -0
- package/components/field/date-picker/date-picker.d.ts +7 -0
- package/components/field/date-picker/date-picker.styles.d.ts +3 -0
- package/components/field/date-picker/index.d.ts +1 -0
- package/components/field/field.styles.d.ts +7 -0
- package/components/field/fields.d.ts +11 -0
- package/components/field/index.d.ts +1 -0
- package/components/field/input-group/index.d.ts +1 -0
- package/components/field/input-group/input-group.d.ts +13 -0
- package/components/field/input-group/input-group.styles.d.ts +2 -0
- package/components/field/money-input/hooks/index.d.ts +1 -0
- package/components/field/money-input/hooks/use-utils.d.ts +6 -0
- package/components/field/money-input/index.d.ts +1 -0
- package/components/field/money-input/money-input-styles.d.ts +2 -0
- package/components/field/money-input/money-input.d.ts +30 -0
- package/components/field/number-input/index.d.ts +1 -0
- package/components/field/number-input/number-input.d.ts +10 -0
- package/components/field/rate-card/cost-breakdown/cost-breakdown.d.ts +11 -0
- package/components/field/rate-card/cost-breakdown/cost-breakdown.styles.d.ts +6 -0
- package/components/field/rate-card/cost-breakdown/index.d.ts +1 -0
- package/components/field/rate-card/index.d.ts +1 -0
- package/components/field/rate-card/rate-card.d.ts +12 -0
- package/components/field/rate-card/rate-card.styles.d.ts +21 -0
- package/components/field/rate-select/index.d.ts +1 -0
- package/components/field/rate-select/rate-select.d.ts +11 -0
- package/components/field/rate-select/rate-select.styles.d.ts +3 -0
- package/components/field/select/index.d.ts +1 -0
- package/components/field/select/select.d.ts +20 -0
- package/components/field/submit-button/index.d.ts +1 -0
- package/components/field/submit-button/submit-button.d.ts +13 -0
- package/components/field/switch/index.d.ts +1 -0
- package/components/field/switch/switch.d.ts +9 -0
- package/components/field/text-area/index.d.ts +1 -0
- package/components/field/text-area/text-area.d.ts +3 -0
- package/components/field/text-input/index.d.ts +1 -0
- package/components/field/text-input/text-input.d.ts +3 -0
- package/components/field-label/field-label.d.ts +9 -0
- package/components/field-label/index.d.ts +1 -0
- package/components/index.d.ts +11 -4
- package/components/items-breakdown/index.d.ts +1 -0
- package/components/items-breakdown/items-breakdown.d.ts +14 -0
- package/components/items-breakdown/items-breakdown.styles.d.ts +3 -0
- package/components/loader/index.d.ts +1 -0
- package/components/loader/loader.d.ts +2 -0
- package/components/organisms/auto-funding-form/auto-funding-form.d.ts +15 -0
- package/components/organisms/auto-funding-form/auto-funding-schema.d.ts +53 -0
- package/components/organisms/auto-funding-form/index.d.ts +1 -0
- package/components/organisms/index.d.ts +2 -0
- package/components/organisms/manual-funding-form/index.d.ts +1 -0
- package/components/organisms/manual-funding-form/manual-funding-form.d.ts +14 -0
- package/components/organisms/manual-funding-form/manual-funding-schema.d.ts +27 -0
- package/components/portal/index.d.ts +1 -0
- package/components/portal/portal.d.ts +13 -0
- package/components/preset-descriptor/index.d.ts +1 -0
- package/components/preset-descriptor/preset-descriptor.d.ts +2 -0
- package/components/preset-descriptor/preset-descriptor.styles.d.ts +6 -0
- package/components/settings-card/index.d.ts +1 -0
- package/components/settings-card/settings-card.d.ts +11 -0
- package/components/settings-card/settings-card.styles.d.ts +6 -0
- package/components/spacer/index.d.ts +1 -0
- package/components/spacer/spacer.d.ts +6 -0
- package/components/templates/add-carriers/add-carriers.d.ts +5 -0
- package/components/templates/add-carriers/index.d.ts +1 -0
- package/components/templates/address-display/address-display.d.ts +9 -0
- package/components/templates/address-display/index.d.ts +1 -0
- package/components/templates/address-form/address-form.d.ts +18 -0
- package/components/templates/address-form/address-schema.d.ts +250 -0
- package/components/templates/address-form/index.d.ts +2 -0
- package/components/templates/address-parser/address-parser-schema.d.ts +10 -0
- package/components/templates/address-parser/address-parser.d.ts +13 -0
- package/components/templates/address-parser/index.d.ts +2 -0
- package/components/templates/address-preference-display/address-preference-display.d.ts +16 -0
- package/components/templates/address-preference-display/index.d.ts +1 -0
- package/components/templates/agreement-form/agreement-form-schema.d.ts +10 -0
- package/components/templates/agreement-form/agreement-form.d.ts +8 -0
- package/components/templates/agreement-form/agreement-form.styles.d.ts +1 -0
- package/components/templates/agreement-form/index.d.ts +1 -0
- package/components/templates/billing-form/billing-form-stories.d.ts +6 -0
- package/components/templates/billing-form/billing-form.d.ts +9 -0
- package/components/templates/billing-form/billing-schema.d.ts +76 -0
- package/components/templates/billing-form/index.d.ts +2 -0
- package/components/templates/customs-item-form/customs-item-form-schema.d.ts +80 -0
- package/components/templates/customs-item-form/customs-item-form.d.ts +14 -0
- package/components/templates/customs-item-form/index.d.ts +2 -0
- package/components/templates/customs-items-display/customs-items-display.d.ts +7 -0
- package/components/templates/customs-items-display/customs-items-display.styles.d.ts +6 -0
- package/components/templates/customs-items-display/index.d.ts +1 -0
- package/components/templates/funding-methods/funding-methods.d.ts +10 -0
- package/components/templates/funding-methods/index.d.ts +1 -0
- package/components/templates/index.d.ts +16 -0
- package/components/templates/label/index.d.ts +1 -0
- package/components/templates/label/label.d.ts +12 -0
- package/components/templates/manage-warehouses/index.d.ts +1 -0
- package/components/templates/manage-warehouses/manage-warehouses.d.ts +5 -0
- package/components/templates/rate-form/index.d.ts +1 -0
- package/components/templates/rate-form/rate-form.d.ts +21 -0
- package/components/templates/rate-form/rate-schema.d.ts +30 -0
- package/components/templates/register-wallet/index.d.ts +1 -0
- package/components/templates/register-wallet/register-wallet.d.ts +3 -0
- package/components/templates/register-wallet/register-wallet.styles.d.ts +6 -0
- package/components/templates/sales-order/sales-order.d.ts +8 -0
- package/components/templates/shipment/shipment.d.ts +17 -0
- package/components/templates/shipment-form/index.d.ts +1 -0
- package/components/templates/shipment-form/shipment-form.d.ts +51 -0
- package/components/templates/shipment-form/shipment-schema.d.ts +943 -0
- package/components/templates/void-label/void-label.d.ts +9 -0
- package/components/templates/warehouse-display/index.d.ts +1 -0
- package/components/templates/warehouse-display/warehouse-display.d.ts +6 -0
- package/constants/index.d.ts +1 -0
- package/constants/shipengine/address.d.ts +39 -0
- package/constants/shipengine/index.d.ts +1 -0
- package/elements/add-carriers.d.ts +1 -0
- package/elements/components/add-carriers/add-carriers.d.ts +8 -0
- package/elements/components/add-carriers/index.d.ts +1 -0
- package/{components → elements/components}/configure-shipment/configure-shipment.d.ts +5 -4
- package/{components → elements/components}/configure-shipment/hooks/use-address.d.ts +4 -2
- package/{components → elements/components}/configure-shipment/hooks/use-presets.d.ts +1 -1
- package/{components → elements/components}/configure-shipment/hooks/use-shipment-form.d.ts +6 -5
- package/elements/components/index.d.ts +8 -0
- package/elements/components/manage-funding/index.d.ts +1 -0
- package/elements/components/manage-funding/manage-funding.d.ts +2 -0
- package/elements/components/manage-warehouses/index.d.ts +1 -0
- package/elements/components/manage-warehouses/manage-warehouses.d.ts +2 -0
- package/elements/components/register-wallet/index.d.ts +1 -0
- package/elements/components/register-wallet/register-wallet.d.ts +9 -0
- package/elements/components/sales-order/index.d.ts +1 -0
- package/{components → elements/components}/sales-order/sales-order.d.ts +3 -2
- package/elements/components/shipment/index.d.ts +1 -0
- package/{components → elements/components}/shipment/shipment.d.ts +1 -1
- package/elements/components/void-label/index.d.ts +1 -0
- package/elements/index.d.ts +7 -0
- package/elements/manage-funding.d.ts +1 -0
- package/elements/manage-warehouses.d.ts +1 -0
- package/elements/register-wallet.d.ts +1 -0
- package/extensions/index.d.ts +1 -0
- package/extensions/zod.d.ts +18 -0
- package/factories/index.d.ts +2 -0
- package/factories/shipengine/address.d.ts +28 -0
- package/factories/shipengine/carrier.d.ts +10 -0
- package/factories/shipengine/index.d.ts +12 -0
- package/factories/shipengine/label.d.ts +10 -0
- package/factories/shipengine/money.d.ts +9 -0
- package/factories/shipengine/order-source.d.ts +11 -0
- package/factories/shipengine/package.d.ts +9 -0
- package/factories/shipengine/resource.d.ts +10 -0
- package/factories/shipengine/sales-order.d.ts +16 -0
- package/factories/shipengine/service.d.ts +9 -0
- package/factories/shipengine/shipment.d.ts +38 -0
- package/factories/shipengine/warehouse.d.ts +6 -0
- package/factories/shipengine/weight.d.ts +15 -0
- package/factories/utils.d.ts +3 -0
- package/hooks/index.d.ts +7 -0
- package/hooks/options/index.d.ts +12 -0
- package/hooks/options/use-confirmation-options.d.ts +5 -0
- package/hooks/options/use-country-code-options.d.ts +4 -0
- package/hooks/options/use-customs-contents-options.d.ts +5 -0
- package/hooks/options/use-customs-non-delivery-options.d.ts +5 -0
- package/hooks/options/use-expiration-month-options.d.ts +4 -0
- package/hooks/options/use-insurance-provider-options.d.ts +10 -0
- package/hooks/options/use-package-options.d.ts +3 -0
- package/hooks/options/use-rate-options.d.ts +21 -0
- package/hooks/options/use-service-code-options.d.ts +3 -0
- package/hooks/options/use-shipping-presets-options.d.ts +19 -0
- package/hooks/options/use-state-code-options.d.ts +4 -0
- package/hooks/options/use-warehouse-options.d.ts +5 -0
- package/hooks/use-carrier-metadata.d.ts +6 -0
- package/hooks/use-elements.d.ts +36 -0
- package/hooks/use-nested-form.d.ts +22 -0
- package/hooks/use-page-layout.d.ts +11 -0
- package/hooks/use-root-portal.d.ts +19 -0
- package/hooks/use-run-once-on-true.d.ts +7 -0
- package/index.cjs +24035 -14817
- package/index.d.ts +12 -3
- package/index.js +24343 -15279
- package/locales/en/index.d.ts +386 -0
- package/locales/index.d.ts +1 -0
- package/package.json +24 -5
- package/providers/giger-provider.d.ts +8 -0
- package/providers/index.d.ts +1 -0
- package/register.d.ts +19 -0
- package/schemas/index.d.ts +1 -0
- package/schemas/shipengine/address.d.ts +17 -0
- package/schemas/shipengine/index.d.ts +3 -0
- package/schemas/shipengine/money.d.ts +15 -0
- package/schemas/shipengine/phone.d.ts +10 -0
- package/testing/index.d.ts +2 -0
- package/testing/render.d.ts +1 -0
- package/testing/swr.d.ts +15 -0
- package/types/carrier-metadata.d.ts +7 -0
- package/types/index.d.ts +2 -0
- package/types/shipping-preset/index.d.ts +1 -0
- package/types/shipping-preset/shipping-preset.d.ts +17 -0
- package/utilities/create-dictionary.d.ts +4 -0
- package/utilities/date.d.ts +24 -0
- package/utilities/error.d.ts +4 -0
- package/utilities/form-logger.d.ts +16 -0
- package/utilities/index.d.ts +11 -0
- package/utilities/money.d.ts +4 -0
- package/utilities/predicates/index.d.ts +1 -0
- package/utilities/predicates/isString.d.ts +1 -0
- package/utilities/rates.d.ts +9 -0
- package/utilities/shipengine/address.d.ts +21 -0
- package/utilities/shipengine/carrier.d.ts +1 -0
- package/utilities/shipengine/dimensions.d.ts +10 -0
- package/utilities/shipengine/index.d.ts +7 -0
- package/utilities/shipengine/package.d.ts +4 -0
- package/utilities/shipengine/sales-order.d.ts +13 -0
- package/utilities/shipengine/shipment.d.ts +13 -0
- package/utilities/shipengine/weight.d.ts +13 -0
- package/utilities/string.d.ts +1 -0
- package/utilities/styles.d.ts +18 -0
- package/utilities/validation.d.ts +10 -0
- /package/components/{sales-order → templates/sales-order}/index.d.ts +0 -0
- /package/components/{shipment → templates/shipment}/index.d.ts +0 -0
- /package/components/{void-label → templates/void-label}/index.d.ts +0 -0
- /package/{components → elements/components}/configure-shipment/hooks/index.d.ts +0 -0
- /package/{components → elements/components}/configure-shipment/hooks/use-customs.d.ts +0 -0
- /package/{components → elements/components}/configure-shipment/hooks/use-rates-form.d.ts +0 -0
- /package/{components → elements/components}/configure-shipment/hooks/use-request-rates.d.ts +0 -0
- /package/{components → elements/components}/configure-shipment/index.d.ts +0 -0
- /package/{components → elements/components}/sales-order/hooks/index.d.ts +0 -0
- /package/{components → elements/components}/sales-order/hooks/use-configure-shipment.d.ts +0 -0
- /package/{components → elements/components}/sales-order/hooks/use-import-sales-order.d.ts +0 -0
- /package/{components → elements/components}/sales-order/hooks/use-pending-shipment.d.ts +0 -0
- /package/{components → elements/components}/void-label/void-label.d.ts +0 -0
- /package/{purchase-label.d.ts → elements/purchase-label.d.ts} +0 -0
- /package/{view-shipment.d.ts → elements/view-shipment.d.ts} +0 -0
- /package/{void-label.d.ts → elements/void-label.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WithChildrenCommonProps } from "@packlink/giger";
|
|
3
|
+
type AccordionProps = WithChildrenCommonProps<{
|
|
4
|
+
/** Flag to indicate if the Accordion must appear expanded */
|
|
5
|
+
initialExpanded?: boolean;
|
|
6
|
+
/** Title to show */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Element to render at the right part of the summary */
|
|
9
|
+
rightContent?: JSX.Element;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const Accordion: ({ initialExpanded, title, children, rightContent, ...rest }: AccordionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SerializedStyles } from "@emotion/react";
|
|
2
|
+
import { Theme } from "@packlink/brands";
|
|
3
|
+
export declare const getAccordionSummaryStyles: (theme: Theme) => SerializedStyles;
|
|
4
|
+
export declare const getAccordionSummaryWrapperStyles: (theme: Theme) => SerializedStyles;
|
|
5
|
+
export declare const getIconStyles: (theme: Theme) => SerializedStyles;
|
|
6
|
+
export declare const getSectionStyles: (theme: Theme) => SerializedStyles;
|
|
7
|
+
export declare const getRightContentWrapperStyles: () => SerializedStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./accordion";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type ButtonGroupProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
justify?: "start" | "center" | "end";
|
|
5
|
+
toolbar?: boolean;
|
|
6
|
+
} & React.ComponentPropsWithoutRef<"div">;
|
|
7
|
+
export declare const ButtonGroup: ({ children, justify, toolbar, ...props }: ButtonGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button-group";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cube";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type DisclosureProps = {
|
|
3
|
+
children?: React.ReactNode | ((toggle: () => void) => JSX.Element);
|
|
4
|
+
label: JSX.Element;
|
|
5
|
+
onToggle: (isOpen: boolean) => void;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
showToggle?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const Disclosure: ({ children, label, onToggle, open, showToggle, }: DisclosureProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: Record<"container" | "content" | "icon" | "toggle", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./disclosure";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type FallbackRender = (props: {
|
|
3
|
+
error: Error;
|
|
4
|
+
}) => React.ReactElement;
|
|
5
|
+
export type ErrorBoundaryProps = {
|
|
6
|
+
children?: React.ReactNode | (() => React.ReactNode);
|
|
7
|
+
fallback?: React.ReactElement | FallbackRender;
|
|
8
|
+
onError?: (err: Error, context: {
|
|
9
|
+
element?: string;
|
|
10
|
+
componentStack: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
element?: string;
|
|
13
|
+
};
|
|
14
|
+
type ErrorBoundaryState = {
|
|
15
|
+
error: Error | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Captures errors thrown within an Element, logs them and displays a fallback component
|
|
19
|
+
*
|
|
20
|
+
* @category Components
|
|
21
|
+
*
|
|
22
|
+
* @see {@link registerElement}
|
|
23
|
+
*/
|
|
24
|
+
declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
25
|
+
constructor(props: ErrorBoundaryProps);
|
|
26
|
+
componentDidCatch(error: Error & {
|
|
27
|
+
cause?: Error;
|
|
28
|
+
}, { componentStack }: React.ErrorInfo): void;
|
|
29
|
+
render(): React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./error-boundary";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ICheckboxProps as NativeCheckboxProps } from "@packlink/giger";
|
|
3
|
+
import { ControlledField } from "../create-field-controller";
|
|
4
|
+
export declare const CheckboxInput: ControlledField<NativeCheckboxProps & {
|
|
5
|
+
checkboxLabel: ReactNode;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox-input";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ControllerRenderProps, FieldPath, FieldValues, UseControllerProps } from "react-hook-form";
|
|
3
|
+
import { FieldLabelProps } from "../field-label";
|
|
4
|
+
type ControlledFormInputProps<NP> = Omit<NP, keyof UseControllerProps | keyof ControllerRenderProps | "children">;
|
|
5
|
+
export type FieldControllerProps<NP, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
6
|
+
children: (props: ControllerRenderProps<TFieldValues, TName> & ControlledFormInputProps<NP>) => JSX.Element;
|
|
7
|
+
control: NonNullable<UseControllerProps<TFieldValues, TName>["control"]>;
|
|
8
|
+
defaultValue?: Partial<UseControllerProps<TFieldValues, TName>["defaultValue"]>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
errors?: string[];
|
|
11
|
+
label: string;
|
|
12
|
+
labelWeight?: FieldLabelProps["weight"];
|
|
13
|
+
displayLabel?: boolean;
|
|
14
|
+
displayErrors?: boolean;
|
|
15
|
+
inputOnly?: boolean;
|
|
16
|
+
} & Omit<FieldLabelProps, "children" | "weight"> & Omit<UseControllerProps<TFieldValues, TName>, "defaultValue"> & ControlledFormInputProps<NP>;
|
|
17
|
+
type FieldControllerOptions = {
|
|
18
|
+
inputOnly?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const createFieldController: <P>(options?: FieldControllerOptions) => <TFieldValues extends FieldValues = FieldValues, TName extends import("react-hook-form").Path<TFieldValues> = import("react-hook-form").Path<TFieldValues>>({ children, control, defaultValue, displayErrors, displayLabel, errors: errorsProp, inputOnly, label, labelWeight, name, rules, shouldUnregister, subLabel, ...formInputProps }: FieldControllerProps<P, TFieldValues, TName>) => JSX.Element;
|
|
21
|
+
export type ControlledFieldProps = Parameters<ControlledField>[0];
|
|
22
|
+
export type ControlledField<NP = object, CP = object, OK extends string = ""> = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(fieldProps: Omit<FieldControllerProps<NP, TFieldValues, TName>, "children" | OK> & CP) => JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactDatePickerProps } from "react-datepicker";
|
|
2
|
+
import { ControlledField } from "../create-field-controller";
|
|
3
|
+
export type DatePickerProps = {
|
|
4
|
+
onChange?: (date: string | null) => void;
|
|
5
|
+
translator?: (text: string) => string;
|
|
6
|
+
} & Omit<ReactDatePickerProps, "onChange">;
|
|
7
|
+
export declare const DatePicker: ControlledField<DatePickerProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./date-picker";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./checkbox-input";
|
|
2
|
+
export * from "./date-picker";
|
|
3
|
+
export * from "./input-group";
|
|
4
|
+
export * from "./money-input";
|
|
5
|
+
export * from "./number-input";
|
|
6
|
+
export * from "./rate-select";
|
|
7
|
+
export * from "./select";
|
|
8
|
+
export * from "./submit-button";
|
|
9
|
+
export * from "./switch";
|
|
10
|
+
export * from "./text-area";
|
|
11
|
+
export * from "./text-input";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Field from "./fields";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./input-group";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { UseFormTrigger } from "react-hook-form";
|
|
3
|
+
import { FieldLabelProps } from "../../field-label";
|
|
4
|
+
import { ControlledField, ControlledFieldProps } from "../create-field-controller";
|
|
5
|
+
export type InputGroupItem = React.ReactElement<ControlledFieldProps>;
|
|
6
|
+
type InputGroupProps = {
|
|
7
|
+
children: InputGroupItem[];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
trigger: UseFormTrigger<any>;
|
|
10
|
+
divider?: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const InputGroup: ControlledField<FieldLabelProps, InputGroupProps, "errors" | "shouldDisplayErrors" | "withBottomMargin">;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./use-utils";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./money-input";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as SE from "@shipengine/types";
|
|
2
|
+
import { InputProps } from "@packlink/giger";
|
|
3
|
+
import { ControlledField } from "../create-field-controller";
|
|
4
|
+
export declare const transform: {
|
|
5
|
+
in: ({ amount, currency }?: Partial<{
|
|
6
|
+
amount: number | null;
|
|
7
|
+
currency: SE.Currency;
|
|
8
|
+
}>, hasFocus?: boolean) => {
|
|
9
|
+
amount: string | number;
|
|
10
|
+
currency: SE.Currency;
|
|
11
|
+
};
|
|
12
|
+
out: ({ amount, currency }: SE.Money) => {
|
|
13
|
+
amount: number | null;
|
|
14
|
+
currency: SE.Currency;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type MoneyInputOptions = {
|
|
18
|
+
signed?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type MoneyInputProps = {
|
|
21
|
+
value?: Partial<{
|
|
22
|
+
amount: number | string;
|
|
23
|
+
currency: SE.Currency;
|
|
24
|
+
}>;
|
|
25
|
+
/** Flag to render currency symbol at the left */
|
|
26
|
+
showCurrencySymbol?: boolean;
|
|
27
|
+
onChange?: (value: SE.Money) => void;
|
|
28
|
+
} & Omit<InputProps, "onChange" | "value">;
|
|
29
|
+
export declare const MoneyInput: ControlledField<MoneyInputProps, MoneyInputOptions>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./number-input";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputProps as NativeInputProps } from "@packlink/giger";
|
|
3
|
+
import { ControlledField } from "../create-field-controller";
|
|
4
|
+
type NumberInputOptions = {
|
|
5
|
+
isInteger?: boolean;
|
|
6
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
7
|
+
signed?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const NumberInput: ControlledField<NativeInputProps, NumberInputOptions>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as SE from "@shipengine/types";
|
|
3
|
+
export interface CostBreakdownProps {
|
|
4
|
+
showExtendedData: boolean;
|
|
5
|
+
shippingAmount?: SE.Money;
|
|
6
|
+
insuranceAmount?: SE.Money;
|
|
7
|
+
confirmationAmount?: SE.Money;
|
|
8
|
+
taxAmount?: SE.Money;
|
|
9
|
+
otherAmount?: SE.Money;
|
|
10
|
+
}
|
|
11
|
+
export declare const CostBreakdown: ({ showExtendedData, shippingAmount, insuranceAmount, confirmationAmount, taxAmount, otherAmount, }: CostBreakdownProps) => JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SerializedStyles } from "@emotion/react";
|
|
2
|
+
import { Theme } from "@packlink/brands";
|
|
3
|
+
export declare const getAsideStyles: (theme: Theme) => SerializedStyles;
|
|
4
|
+
export declare const getPriceStyles: (theme: Theme) => SerializedStyles;
|
|
5
|
+
export declare const getTableStyles: (theme: Theme) => SerializedStyles;
|
|
6
|
+
export declare const getTableCellLabelStyles: (theme: Theme) => SerializedStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cost-breakdown";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rate-card";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WithCommonProps } from "@packlink/giger";
|
|
2
|
+
import { RateOption } from "../../../hooks";
|
|
3
|
+
export type RateCardProps = Partial<RateOption> & WithCommonProps<{
|
|
4
|
+
displayNickname?: boolean;
|
|
5
|
+
isAcknowledged?: boolean;
|
|
6
|
+
onClick?: (rateId: string) => void;
|
|
7
|
+
onClickAcknowledgement?: (isAcknowledged: boolean) => void;
|
|
8
|
+
recommended?: boolean;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
voided?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, displayNickname, onClick, onClickAcknowledgement, otherAmount, rateId, recommended, requiresAcknowledgement, selected, serviceCode, serviceType, shippingAmount, taxAmount, voided, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SerializedStyles } from "@emotion/react";
|
|
2
|
+
import { Theme } from "@packlink/brands";
|
|
3
|
+
export declare const getRateCardFirstLineSize: (theme: Theme) => string;
|
|
4
|
+
export declare const getArticleStyles: (theme: Theme) => SerializedStyles;
|
|
5
|
+
export declare const getArticleNonSelectedStyles: (theme: Theme) => SerializedStyles;
|
|
6
|
+
export declare const getArticleSelectedStyles: (theme: Theme) => SerializedStyles;
|
|
7
|
+
export declare const getArticleVoidedStyles: () => SerializedStyles;
|
|
8
|
+
export declare const getArticleRecommendedStyles: (theme: Theme) => SerializedStyles;
|
|
9
|
+
export declare const getSectionStyles: (theme: Theme) => SerializedStyles;
|
|
10
|
+
export declare const getRateImageStyles: (theme: Theme) => SerializedStyles;
|
|
11
|
+
export declare const getRateInfoStyles: (theme: Theme) => SerializedStyles;
|
|
12
|
+
export declare const getRateRecommendedStyles: (theme: Theme) => SerializedStyles;
|
|
13
|
+
export declare const getServiceTypeStyles: (theme: Theme) => SerializedStyles;
|
|
14
|
+
export declare const getCarrierNameStyles: (theme: Theme) => SerializedStyles;
|
|
15
|
+
export declare const getDividerStyles: (theme: Theme) => SerializedStyles;
|
|
16
|
+
export declare const getFooterStyles: (theme: Theme) => SerializedStyles;
|
|
17
|
+
export declare const getFooterListStyles: () => SerializedStyles;
|
|
18
|
+
export declare const getFooterListWithMultipleMessagesStyles: (theme: Theme) => SerializedStyles;
|
|
19
|
+
export declare const getFooterListItemStyles: (theme: Theme) => SerializedStyles;
|
|
20
|
+
export declare const getAcknowledgmentStyles: (theme: Theme) => SerializedStyles;
|
|
21
|
+
export declare const getCheckboxWrapperStyles: () => SerializedStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rate-select";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RateOption } from "../../../hooks";
|
|
2
|
+
import { ControlledField } from "../create-field-controller";
|
|
3
|
+
type RateSelectProps = {
|
|
4
|
+
options: RateOption[];
|
|
5
|
+
nicknameFeature?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type RateSelectOptions = {
|
|
8
|
+
onClick?: (rateId: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const RateSelect: ControlledField<RateSelectProps, RateSelectOptions>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./select";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { ControlledField } from "../create-field-controller";
|
|
3
|
+
type NativeSelectProps = ComponentPropsWithoutRef<"select">;
|
|
4
|
+
export type SelectOption = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | object;
|
|
7
|
+
};
|
|
8
|
+
export type SelectCategory = {
|
|
9
|
+
label: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
};
|
|
13
|
+
export type SelectOptionOrCategory = SelectOption | SelectCategory;
|
|
14
|
+
type SelectProps = {
|
|
15
|
+
onCategoryChange?: (value?: string) => void;
|
|
16
|
+
onChange?: (value?: string | object) => void;
|
|
17
|
+
options?: SelectOptionOrCategory[];
|
|
18
|
+
};
|
|
19
|
+
export declare const Select: ControlledField<NativeSelectProps, SelectProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./submit-button";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Control } from "react-hook-form";
|
|
3
|
+
import { IButtonProps } from "@packlink/giger";
|
|
4
|
+
export type SubmitButtonProps = {
|
|
5
|
+
alwaysRequireValidity?: boolean;
|
|
6
|
+
control: Control<any, any>;
|
|
7
|
+
requireDirty?: boolean;
|
|
8
|
+
} & Omit<IButtonProps, "type">;
|
|
9
|
+
export declare const SubmitButton: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
10
|
+
alwaysRequireValidity?: boolean | undefined;
|
|
11
|
+
control: Control<any, any>;
|
|
12
|
+
requireDirty?: boolean | undefined;
|
|
13
|
+
} & Omit<IButtonProps, "type"> & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./switch";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ISwitchProps } from "@packlink/giger";
|
|
3
|
+
export type SwitchProps = {
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
shouldUnmount?: boolean;
|
|
7
|
+
label: string;
|
|
8
|
+
} & Omit<ISwitchProps, "children">;
|
|
9
|
+
export declare const Switch: ({ defaultChecked, children, shouldUnmount, label, onChange, ...props }: SwitchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./text-area";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./text-input";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type FieldLabelProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
label?: string;
|
|
5
|
+
subLabel?: string;
|
|
6
|
+
weight?: "bold" | "normal";
|
|
7
|
+
withInput?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const FieldLabel: ({ children, label, subLabel, weight, withInput, }: FieldLabelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./field-label";
|
package/components/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export * as Templates from "./templates";
|
|
2
|
+
export * from "./accordion";
|
|
3
|
+
export * from "./button-group";
|
|
4
|
+
export * from "./cube";
|
|
5
|
+
export * from "./error-boundary";
|
|
6
|
+
export * from "./field";
|
|
7
|
+
export * from "./field-label";
|
|
8
|
+
export * from "./items-breakdown";
|
|
9
|
+
export * from "./loader";
|
|
10
|
+
export * from "./portal";
|
|
11
|
+
export * from "./spacer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./items-breakdown";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as SE from "@shipengine/types";
|
|
2
|
+
export type Item = {
|
|
3
|
+
name: string;
|
|
4
|
+
detail: string;
|
|
5
|
+
quantity: number;
|
|
6
|
+
value: SE.Money;
|
|
7
|
+
totalValue?: SE.Money;
|
|
8
|
+
subDetail?: string;
|
|
9
|
+
subDetailValue?: SE.Money;
|
|
10
|
+
};
|
|
11
|
+
export type ItemsBreakdownProps = {
|
|
12
|
+
items: Item[];
|
|
13
|
+
};
|
|
14
|
+
export declare const ItemsBreakdown: ({ items }: ItemsBreakdownProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./loader";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CarrierAutoFunding } from "@shipengine/types";
|
|
2
|
+
import { AutoFundingFormPayload } from "./auto-funding-schema";
|
|
3
|
+
export type AutoFundingFormProps = {
|
|
4
|
+
defaultValues: CarrierAutoFunding;
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
onSubmit: (payload: AutoFundingFormPayload) => Promise<void> | void;
|
|
9
|
+
onToggle: (enabled: boolean) => Promise<void> | void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* This form that allows users to enable or disable auto funding, and
|
|
13
|
+
* configure auto funding settings in ShipEngine API.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AutoFundingForm: ({ defaultValues, errorMessage, hasError, isLoading, onSubmit, onToggle, }: AutoFundingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const autoFundingSchema: z.ZodObject<{
|
|
3
|
+
isEnabled: z.ZodBoolean;
|
|
4
|
+
lowBalancePurchaseThreshold: z.ZodObject<z.extendShape<{
|
|
5
|
+
amount: z.ZodNumber;
|
|
6
|
+
currency: z.ZodNativeEnum<typeof import("dist/shipengine-types/src").Currency>;
|
|
7
|
+
}, {
|
|
8
|
+
amount: z.ZodNumber;
|
|
9
|
+
}>, "strip", z.ZodTypeAny, {
|
|
10
|
+
amount: number;
|
|
11
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
12
|
+
}, {
|
|
13
|
+
amount: number;
|
|
14
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
15
|
+
}>;
|
|
16
|
+
maximumPurchasesPerDay: z.ZodNumber;
|
|
17
|
+
purchaseAmount: z.ZodObject<z.extendShape<{
|
|
18
|
+
amount: z.ZodNumber;
|
|
19
|
+
currency: z.ZodNativeEnum<typeof import("dist/shipengine-types/src").Currency>;
|
|
20
|
+
}, {
|
|
21
|
+
amount: z.ZodNumber;
|
|
22
|
+
}>, "strip", z.ZodTypeAny, {
|
|
23
|
+
amount: number;
|
|
24
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
25
|
+
}, {
|
|
26
|
+
amount: number;
|
|
27
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
28
|
+
}>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
isEnabled: boolean;
|
|
31
|
+
lowBalancePurchaseThreshold: {
|
|
32
|
+
amount: number;
|
|
33
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
34
|
+
};
|
|
35
|
+
maximumPurchasesPerDay: number;
|
|
36
|
+
purchaseAmount: {
|
|
37
|
+
amount: number;
|
|
38
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
isEnabled: boolean;
|
|
42
|
+
lowBalancePurchaseThreshold: {
|
|
43
|
+
amount: number;
|
|
44
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
45
|
+
};
|
|
46
|
+
maximumPurchasesPerDay: number;
|
|
47
|
+
purchaseAmount: {
|
|
48
|
+
amount: number;
|
|
49
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
export type AutoFundingFormFields = z.input<typeof autoFundingSchema>;
|
|
53
|
+
export type AutoFundingFormPayload = z.output<typeof autoFundingSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./auto-funding-form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./manual-funding-form";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ManualFundingFormPayload } from "./manual-funding-schema";
|
|
3
|
+
export type ManualFundingFormProps<T = undefined> = {
|
|
4
|
+
currentBalance: number;
|
|
5
|
+
onSubmit: (payload: ManualFundingFormPayload) => Promise<void> | void;
|
|
6
|
+
requiredAmount?: number;
|
|
7
|
+
} & ({
|
|
8
|
+
formId: string;
|
|
9
|
+
portalRef: React.RefObject<T>;
|
|
10
|
+
} | {
|
|
11
|
+
formId?: string;
|
|
12
|
+
portalRef?: never;
|
|
13
|
+
});
|
|
14
|
+
export declare const ManualFundingForm: <T extends Element>({ currentBalance, formId, onSubmit, portalRef, requiredAmount, }: ManualFundingFormProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const manualFundingSchema: z.ZodObject<{
|
|
3
|
+
funds: z.ZodObject<z.extendShape<{
|
|
4
|
+
amount: z.ZodNumber;
|
|
5
|
+
currency: z.ZodNativeEnum<typeof import("dist/shipengine-types/src").Currency>;
|
|
6
|
+
}, {
|
|
7
|
+
amount: z.ZodNumber;
|
|
8
|
+
}>, "strip", z.ZodTypeAny, {
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
11
|
+
}, {
|
|
12
|
+
amount: number;
|
|
13
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
14
|
+
}>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
funds: {
|
|
17
|
+
amount: number;
|
|
18
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
funds: {
|
|
22
|
+
amount: number;
|
|
23
|
+
currency: import("dist/shipengine-types/src").Currency;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
export type ManualFundingFormFields = z.input<typeof manualFundingSchema>;
|
|
27
|
+
export type ManualFundingFormPayload = z.output<typeof manualFundingSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./portal";
|