@commercelayer/app-elements 0.0.47 → 0.0.49

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.
@@ -30,6 +30,14 @@ export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<Currency
30
30
  * onChange callback triggered when during typing
31
31
  */
32
32
  onChange: (cents: number | null, formatted: string) => void;
33
+ /**
34
+ * hide currency symbol but keep the currency formatting
35
+ */
36
+ hideCurrencySymbol?: boolean;
37
+ /**
38
+ * show (X) button to clear the input
39
+ */
40
+ isClearable?: boolean;
33
41
  }
34
42
  declare const InputCurrency: import("react").ForwardRefExoticComponent<InputCurrencyProps & import("react").RefAttributes<HTMLInputElement>>;
35
43
  /**
@@ -40,5 +48,5 @@ declare const InputCurrency: import("react").ForwardRefExoticComponent<InputCurr
40
48
  * Example: formatCentsToCurrency(100000, 'USD') -> $1,000.00
41
49
  * Example: formatCentsToCurrency(100, 'JPY') -> ¥100
42
50
  **/
43
- declare function formatCentsToCurrency(cents: number, currencyCode: Uppercase<CurrencyCode>): string;
51
+ declare function formatCentsToCurrency(cents: number, currencyCode: Uppercase<CurrencyCode>, stripZeroDecimals?: boolean): string;
44
52
  export { InputCurrency, formatCentsToCurrency };
@@ -0,0 +1,24 @@
1
+ import { type CurrencyCode } from '../forms/InputCurrency/currencies';
2
+ import { type InputCurrencyProps } from '../forms/InputCurrency/index';
3
+ import { type InputWrapperBaseProps } from '../internals/InputWrapper';
4
+ type Cents = InputCurrencyProps['cents'];
5
+ export interface InputCurrencyRangeProps extends InputWrapperBaseProps {
6
+ fromCents?: Cents;
7
+ toCents?: Cents;
8
+ onChange: (from: {
9
+ cents: Cents;
10
+ formatted: string;
11
+ }, to: {
12
+ cents: Cents;
13
+ formatted: string;
14
+ }, currency: Uppercase<CurrencyCode>) => void;
15
+ placeholders?: [string, string];
16
+ currencyList: Array<Uppercase<CurrencyCode>>;
17
+ defaultCurrency?: Uppercase<CurrencyCode>;
18
+ className?: string;
19
+ }
20
+ declare function InputCurrencyRange({ fromCents, toCents, placeholders, onChange, label, hint, currencyList, defaultCurrency, className, feedback }: InputCurrencyRangeProps): JSX.Element;
21
+ declare namespace InputCurrencyRange {
22
+ var displayName: string;
23
+ }
24
+ export { InputCurrencyRange };
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface OptionItem {
3
+ /**
4
+ * Item identifier, must be unique and will be used for the onChange callback
5
+ */
6
+ value: string;
7
+ /**
8
+ * Item content to be displayed in the central section of the row
9
+ */
10
+ content: ReactNode;
11
+ }
12
+ export interface InputRadioGroupProps {
13
+ /**
14
+ * Input name, will be used to set the html name for all radios
15
+ */
16
+ name: string;
17
+ /**
18
+ * List of options to render as radio
19
+ */
20
+ options: OptionItem[];
21
+ /**
22
+ * Default value
23
+ */
24
+ defaultValue?: string;
25
+ /**
26
+ * Callback triggered when the user update the selection
27
+ */
28
+ onChange?: (selected: string | undefined) => void;
29
+ /**
30
+ * Show input element
31
+ */
32
+ showInput?: boolean;
33
+ /**
34
+ * Define the `flex-direction`
35
+ * @default 'column'
36
+ */
37
+ direction?: 'column' | 'row';
38
+ }
39
+ declare function InputRadioGroup({ name, options, defaultValue, onChange, showInput, direction }: InputRadioGroupProps): JSX.Element;
40
+ declare namespace InputRadioGroup {
41
+ var displayName: string;
42
+ }
43
+ export { InputRadioGroup };
@@ -4,6 +4,15 @@ export interface InputSpinnerProps extends InputWrapperBaseProps, Omit<React.Inp
4
4
  max?: number;
5
5
  defaultValue?: number;
6
6
  onChange: (value: number) => void;
7
+ /**
8
+ * When true the input will not be editable by keyboard, but quantity can be changed only via buttons.
9
+ * Plus keyboard will not be displayed on mobile devices and the input will not be tabbable/focusable, but only the buttons will be.
10
+ */
11
+ disableKeyboard?: boolean;
12
+ /**
13
+ * Makes the entire component disabled, quantity cannot be changed in any way
14
+ */
15
+ disabled?: boolean;
7
16
  }
8
17
  declare const InputSpinner: import("react").ForwardRefExoticComponent<InputSpinnerProps & import("react").RefAttributes<HTMLInputElement>>;
9
18
  export { InputSpinner };
@@ -13,5 +13,7 @@ export interface RadioButtonsProps extends InputWrapperBaseProps {
13
13
  className?: string;
14
14
  onBlur?: InputHTMLAttributes<HTMLInputElement>['onBlur'];
15
15
  }
16
- declare const RadioButtons: import("react").ForwardRefExoticComponent<RadioButtonsProps & import("react").RefAttributes<HTMLInputElement>>;
17
- export { RadioButtons };
16
+ /**
17
+ * @deprecated
18
+ */
19
+ export declare const RadioButtons: import("react").ForwardRefExoticComponent<RadioButtonsProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -23,7 +23,7 @@ export interface InputWrapperProps extends InputWrapperBaseProps {
23
23
  */
24
24
  className?: string;
25
25
  name?: string;
26
- children: JSX.Element | JSX.Element[];
26
+ children: React.ReactNode;
27
27
  }
28
28
  declare function InputWrapper({ label, children, className, hint, feedback, name, ...rest }: InputWrapperProps): JSX.Element;
29
29
  declare namespace InputWrapper {
@@ -7,11 +7,19 @@ type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
7
7
  */
8
8
  icon?: JSX.Element;
9
9
  /**
10
- * Specify `none` to remove side gutter
10
+ * Icon alignment
11
+ * @default 'top'
11
12
  */
12
- gutter?: 'none';
13
+ alignIcon?: 'top' | 'center' | 'bottom';
14
+ /**
15
+ * Control the horizontal padding (`x`) or vertical padding (`y`).
16
+ * You can specify `none` to remove the padding.
17
+ * @default 'xy'
18
+ */
19
+ padding?: 'xy' | 'x' | 'y' | 'none';
13
20
  /**
14
21
  * Border style to render
22
+ * @default 'solid'
15
23
  */
16
24
  borderStyle?: 'dashed' | 'solid' | 'none';
17
25
  };
@@ -9,10 +9,10 @@ export declare function getShipmentRate(shipment: Shipment): Rate | undefined;
9
9
  */
10
10
  export declare function hasSingleTracking(shipment: Shipment): boolean;
11
11
  /**
12
- * Check whether the `shipment` has tracking information or not.
12
+ * Check whether the `shipment` has been purchased.
13
13
  * @param shipment Shipment
14
14
  */
15
- export declare function hasTracking(shipment: Shipment): boolean;
15
+ export declare function hasBeenPurchased(shipment: Shipment): boolean;
16
16
  /**
17
17
  * @docs https://www.easypost.com/docs/api#tracking-detail-object
18
18
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"