@commercelayer/app-elements 0.0.19 → 0.0.20

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.
Files changed (80) hide show
  1. package/dist/{Async-01069344.js → Async-86d7b52d.js} +18 -17
  2. package/dist/{InputDateComponent-7cc64865.js → InputDateComponent-8fe235f4.js} +2542 -2381
  3. package/dist/{Select-207fa38b.js → Select-c5f20a31.js} +2 -2
  4. package/dist/helpers/date.d.ts +2 -2
  5. package/dist/hooks/useClickAway.d.ts +1 -1
  6. package/dist/{main-29e2c4ad.js → main-b7422b94.js} +843 -706
  7. package/dist/main.d.ts +1 -1
  8. package/dist/main.js +22 -21
  9. package/dist/{overrides-ded5eb26.js → overrides-c4c3ace4.js} +1630 -1529
  10. package/dist/providers/CoreSdkProvider/index.d.ts +2 -2
  11. package/dist/providers/CoreSdkProvider/makeSdkClient.d.ts +1 -1
  12. package/dist/providers/ErrorBoundary.d.ts +1 -1
  13. package/dist/providers/TokenProvider/getInfoFromJwt.d.ts +1 -1
  14. package/dist/providers/TokenProvider/index.d.ts +3 -4
  15. package/dist/providers/TokenProvider/reducer.d.ts +2 -2
  16. package/dist/providers/TokenProvider/storage.d.ts +2 -2
  17. package/dist/providers/TokenProvider/types.d.ts +6 -6
  18. package/dist/providers/TokenProvider/url.d.ts +1 -1
  19. package/dist/providers/TokenProvider/validateToken.d.ts +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/ui/atoms/A.d.ts +0 -1
  22. package/dist/ui/atoms/Avatar.d.ts +0 -1
  23. package/dist/ui/atoms/Badge.d.ts +1 -1
  24. package/dist/ui/atoms/Button.d.ts +3 -4
  25. package/dist/ui/atoms/Card.d.ts +0 -1
  26. package/dist/ui/atoms/Container.d.ts +0 -1
  27. package/dist/ui/atoms/EmptyState.d.ts +2 -2
  28. package/dist/ui/atoms/FlexRow.d.ts +2 -3
  29. package/dist/ui/atoms/Hint.d.ts +2 -2
  30. package/dist/ui/atoms/Icon.d.ts +18 -19
  31. package/dist/ui/atoms/Legend.d.ts +1 -1
  32. package/dist/ui/atoms/PageHeading.d.ts +2 -3
  33. package/dist/ui/atoms/RadialProgress.d.ts +1 -1
  34. package/dist/ui/atoms/Skeleton.d.ts +1 -1
  35. package/dist/ui/atoms/SkeletonTemplate.d.ts +5 -5
  36. package/dist/ui/atoms/Spacer.d.ts +2 -3
  37. package/dist/ui/atoms/Stack.d.ts +1 -1
  38. package/dist/ui/atoms/StatusDot.d.ts +1 -1
  39. package/dist/ui/atoms/Tabs.d.ts +1 -1
  40. package/dist/ui/atoms/Text.d.ts +6 -7
  41. package/dist/ui/atoms/dropdown/DropdownMenu.d.ts +0 -1
  42. package/dist/ui/atoms/dropdown/DropdownMenuDivider.d.ts +0 -1
  43. package/dist/ui/atoms/dropdown/DropdownMenuItem.d.ts +0 -1
  44. package/dist/ui/atoms/tables/Td.d.ts +0 -1
  45. package/dist/ui/atoms/tables/Th.d.ts +0 -1
  46. package/dist/ui/atoms/tables/Tr.d.ts +0 -1
  47. package/dist/ui/composite/ContextMenu.d.ts +0 -1
  48. package/dist/ui/composite/PageLayout.d.ts +2 -2
  49. package/dist/ui/composite/Report.d.ts +1 -1
  50. package/dist/ui/forms/Input.d.ts +2 -3
  51. package/dist/ui/forms/InputCheckbox.d.ts +3 -4
  52. package/dist/ui/forms/InputDate/InputDateComponent.d.ts +3 -4
  53. package/dist/ui/forms/InputDate/index.d.ts +3 -4
  54. package/dist/ui/forms/InputDateRange.d.ts +3 -4
  55. package/dist/ui/forms/InputFeedback.d.ts +1 -1
  56. package/dist/ui/forms/InputFile.d.ts +2 -3
  57. package/dist/ui/forms/InputJson.d.ts +1 -1
  58. package/dist/ui/forms/InputReadonly.d.ts +1 -1
  59. package/dist/ui/forms/InputSelect/Async.d.ts +3 -3
  60. package/dist/ui/forms/InputSelect/Select.d.ts +2 -2
  61. package/dist/ui/forms/InputSelect/index.d.ts +23 -6
  62. package/dist/ui/forms/InputSelect/overrides.d.ts +2 -2
  63. package/dist/ui/forms/InputSelect/styles.d.ts +3 -3
  64. package/dist/ui/forms/InputTextArea.d.ts +2 -3
  65. package/dist/ui/forms/InputToggleBox.d.ts +1 -2
  66. package/dist/ui/forms/InputToggleListBox.d.ts +1 -2
  67. package/dist/ui/forms/InputWrapper.d.ts +2 -2
  68. package/dist/ui/forms/Label.d.ts +0 -1
  69. package/dist/ui/forms/RadioButtons.d.ts +4 -5
  70. package/dist/ui/forms/ToggleButtons.d.ts +5 -6
  71. package/dist/ui/lists/List.d.ts +3 -3
  72. package/dist/ui/lists/ListDetails.d.ts +1 -1
  73. package/dist/ui/lists/ListDetailsItem.d.ts +1 -1
  74. package/dist/ui/lists/ListItem.d.ts +4 -5
  75. package/dist/ui/resources/ResourceList/index.d.ts +5 -5
  76. package/dist/ui/resources/ResourceList/infiniteFetcher.d.ts +3 -3
  77. package/dist/ui/resources/ResourceList/reducer.d.ts +2 -2
  78. package/dist/ui/tables/TableData.d.ts +1 -1
  79. package/dist/utils/children.d.ts +1 -1
  80. package/package.json +22 -22
@@ -1,10 +1,9 @@
1
- import React from 'react';
2
- import { ReactNode } from 'react';
3
- export declare type TextVariant = 'danger' | 'success' | 'primary' | 'warning' | 'info' | 'plain';
4
- export declare type TextSize = 'small' | 'regular' | 'large' | 'inherit';
5
- export declare type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold' | 'inherit';
6
- export declare type TextAlignment = 'center' | 'left' | 'right' | 'inherit';
7
- export declare type TextWrap = 'normal' | 'nowrap' | 'inherit';
1
+ import { type ReactNode } from 'react';
2
+ export type TextVariant = 'danger' | 'success' | 'primary' | 'warning' | 'info' | 'plain';
3
+ export type TextSize = 'small' | 'regular' | 'large' | 'inherit';
4
+ export type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold' | 'inherit';
5
+ export type TextAlignment = 'center' | 'left' | 'right' | 'inherit';
6
+ export type TextWrap = 'normal' | 'nowrap' | 'inherit';
8
7
  export interface TextProps extends React.HTMLAttributes<HTMLElement> {
9
8
  children?: ReactNode;
10
9
  variant?: TextVariant;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.HTMLAttributes<HTMLElement> {
3
2
  children?: React.ReactNode;
4
3
  arrow?: 'none';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.HTMLAttributes<HTMLElement> {
3
2
  children?: React.ReactNode;
4
3
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.HTMLAttributes<HTMLElement> {
3
2
  label: string;
4
3
  icon?: React.ReactNode;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.TdHTMLAttributes<HTMLElement> {
3
2
  children?: React.ReactNode;
4
3
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.ThHTMLAttributes<HTMLElement> {
3
2
  children?: React.ReactNode;
4
3
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.HTMLAttributes<HTMLElement> {
3
2
  children?: React.ReactNode;
4
3
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props {
3
2
  menuLabel?: React.ReactNode;
4
3
  menuItems: React.ReactNode;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- import { PageHeadingProps } from '../atoms/PageHeading';
1
+ import { type ReactNode } from 'react';
2
+ import { type PageHeadingProps } from '../atoms/PageHeading';
3
3
  export interface PageLayoutProps extends Pick<PageHeadingProps, 'title' | 'description' | 'onGoBack' | 'actionButton' | 'gap'> {
4
4
  /**
5
5
  * Page content
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface ReportItem {
3
3
  label: string;
4
4
  count: ReactNode;
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
1
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
3
2
  export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
3
  /**
5
4
  * controlled type
@@ -10,5 +9,5 @@ export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLA
10
9
  */
11
10
  className?: string;
12
11
  }
13
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
12
+ declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
14
13
  export { Input };
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
3
- import { ReactNode } from 'react';
1
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
2
+ import { type ReactNode } from 'react';
4
3
  export interface InputCheckboxProps extends Omit<InputWrapperBaseProps, 'label'>, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
5
4
  /**
6
5
  * Icon component
@@ -9,5 +8,5 @@ export interface InputCheckboxProps extends Omit<InputWrapperBaseProps, 'label'>
9
8
  icon?: JSX.Element;
10
9
  children: ReactNode;
11
10
  }
12
- declare const InputCheckbox: React.ForwardRefExoticComponent<InputCheckboxProps & React.RefAttributes<HTMLInputElement>>;
11
+ declare const InputCheckbox: import("react").ForwardRefExoticComponent<InputCheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
13
12
  export { InputCheckbox };
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
1
  import DatePicker from 'react-datepicker';
3
- import { InputWrapperBaseProps } from '../../forms/InputWrapper';
4
- export declare type MaybeDate = Date | null;
2
+ import { type InputWrapperBaseProps } from '../../forms/InputWrapper';
3
+ export type MaybeDate = Date | null;
5
4
  export interface InputDateProps extends InputWrapperBaseProps {
6
5
  /**
7
6
  * controlled value
@@ -41,5 +40,5 @@ export interface InputDateProps extends InputWrapperBaseProps {
41
40
  */
42
41
  isClearable?: boolean;
43
42
  }
44
- declare const InputDateComponent: React.ForwardRefExoticComponent<InputDateProps & React.RefAttributes<DatePicker<never, undefined>>>;
43
+ declare const InputDateComponent: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
45
44
  export { InputDateComponent };
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { InputDateProps } from './InputDateComponent';
3
- import DatePicker from 'react-datepicker';
4
- declare const InputDate: React.ForwardRefExoticComponent<InputDateProps & React.RefAttributes<DatePicker<never, undefined>>>;
1
+ import { type InputDateProps } from './InputDateComponent';
2
+ import type DatePicker from 'react-datepicker';
3
+ declare const InputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
5
4
  export { InputDate };
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { InputDateProps, MaybeDate } from './InputDate/InputDateComponent';
3
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
1
+ import { type InputDateProps, type MaybeDate } from './InputDate/InputDateComponent';
2
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
4
3
  export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable' | 'format' | 'autoPlaceholder'>, InputWrapperBaseProps {
5
4
  /**
6
5
  * a tuple that represents the [from, to] dates
@@ -19,5 +18,5 @@ export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable'
19
18
  */
20
19
  toPlaceholder?: string;
21
20
  }
22
- declare const InputDateRange: React.ForwardRefExoticComponent<InputDateRangeProps & React.RefAttributes<HTMLDivElement>>;
21
+ declare const InputDateRange: import("react").ForwardRefExoticComponent<InputDateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
23
22
  export { InputDateRange };
@@ -1,4 +1,4 @@
1
- export declare type FeedbackVariant = 'danger' | 'success' | 'warning';
1
+ export type FeedbackVariant = 'danger' | 'success' | 'warning';
2
2
  export interface InputFeedbackProps {
3
3
  message: string;
4
4
  variant?: FeedbackVariant;
@@ -1,10 +1,9 @@
1
- import React from 'react';
2
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
1
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
3
2
  interface InputFileProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
3
  /**
5
4
  * If defined, it shows a progress bar at the bottom. It must be between 0 and 100.
6
5
  */
7
6
  progress?: number;
8
7
  }
9
- declare const InputFile: React.ForwardRefExoticComponent<InputFileProps & React.RefAttributes<HTMLInputElement>>;
8
+ declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
10
9
  export { InputFile };
@@ -1,4 +1,4 @@
1
- import { InputWrapperBaseProps } from './InputWrapper';
1
+ import { type InputWrapperBaseProps } from './InputWrapper';
2
2
  export interface InputJsonProps<JsonType> extends InputWrapperBaseProps {
3
3
  placeholder: object;
4
4
  validateFn: (json: any) => JsonType;
@@ -1,4 +1,4 @@
1
- import { InputWrapperBaseProps } from './InputWrapper';
1
+ import { type InputWrapperBaseProps } from './InputWrapper';
2
2
  interface InputReadonlyProps extends InputWrapperBaseProps {
3
3
  /**
4
4
  * controlled value
@@ -1,6 +1,6 @@
1
- import { InputSelectProps, SelectValue } from './';
2
- import { StylesConfig } from 'react-select';
3
- import { SetRequired } from 'type-fest';
1
+ import { type InputSelectProps, type SelectValue } from './';
2
+ import { type StylesConfig } from 'react-select';
3
+ import { type SetRequired } from 'type-fest';
4
4
  interface AsyncSelectComponentProps extends Omit<SetRequired<InputSelectProps, 'loadAsyncValues'>, 'label' | 'hint'> {
5
5
  styles: StylesConfig<SelectValue>;
6
6
  }
@@ -1,5 +1,5 @@
1
- import { InputSelectProps, SelectValue } from './';
2
- import { StylesConfig } from 'react-select';
1
+ import { type InputSelectProps, type SelectValue } from './';
2
+ import { type StylesConfig } from 'react-select';
3
3
  interface SelectComponentProps extends Omit<InputSelectProps, 'loadAsyncValues' | 'label' | 'hint'> {
4
4
  styles: StylesConfig<SelectValue>;
5
5
  }
@@ -1,7 +1,7 @@
1
- import { FocusEventHandler } from 'react';
2
- import { MultiValue, SingleValue } from 'react-select';
3
- import { InputWrapperBaseProps } from '../../forms/InputWrapper';
4
- export declare type GroupedSelectValues = Array<{
1
+ import { type FocusEventHandler } from 'react';
2
+ import { type MultiValue, type SingleValue } from 'react-select';
3
+ import { type InputWrapperBaseProps } from '../../forms/InputWrapper';
4
+ export type GroupedSelectValues = Array<{
5
5
  label: string;
6
6
  options: SelectValue[];
7
7
  }>;
@@ -10,7 +10,7 @@ export interface SelectValue {
10
10
  label: string;
11
11
  meta?: Record<string, any>;
12
12
  }
13
- export declare type PossibleSelectValue = MultiValue<SelectValue> | SingleValue<SelectValue>;
13
+ export type PossibleSelectValue = MultiValue<SelectValue> | SingleValue<SelectValue>;
14
14
  export interface InputSelectProps extends InputWrapperBaseProps {
15
15
  initialValues: GroupedSelectValues | SelectValue[];
16
16
  defaultValue?: SelectValue | SelectValue[];
@@ -39,10 +39,14 @@ declare namespace InputSelect {
39
39
  * @returns true if selected value is single, from this point TypeScript will treat this as `SelectValue` type
40
40
  */
41
41
  export declare function isSingleValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue;
42
+ /**
43
+ * Type-guard to check if prop `initialValues` is a GroupedSelectValues or SelectValue
44
+ */
45
+ export declare function isGroupedSelectValues(initialValues?: GroupedSelectValues | SelectValue[]): initialValues is GroupedSelectValues;
42
46
  /**
43
47
  * Helper function to extract only a specific property from the `SelectValue`
44
48
  * @param selectedValue possible value returned from select component
45
- * @param path path.to.property. Default is `value`
49
+ * @param pathToValue optional path.to.property. Default is `value`
46
50
  * @returns a string or an array of strings.
47
51
  * Examples:
48
52
  * ```
@@ -57,4 +61,17 @@ export declare function isSingleValueSelected(selectedValue: PossibleSelectValue
57
61
  * ```
58
62
  */
59
63
  export declare function flatSelectValues(selectedValue: PossibleSelectValue, pathToValue?: string): null | string | Array<string | number>;
64
+ /**
65
+ * To be used when storing the flatten value and there is the need
66
+ * to retrieve the `defaultValue` to pass as <InputSelect> prop
67
+ * @param currentValue the current value that is being stored in app state
68
+ * @param initialValues the array of SelectValue objects that should contain the `currentValue`
69
+ * @param pathToValue optional path.to.property. Default is `value`
70
+ * @returns the matched value or values, otherwise undefined.
71
+ */
72
+ export declare function getDefaultValueFromFlatten({ currentValue, initialValues, pathToValue }: {
73
+ currentValue?: string | Array<string | number> | null;
74
+ initialValues?: GroupedSelectValues | SelectValue[];
75
+ pathToValue?: string;
76
+ }): SelectValue | SelectValue[] | undefined;
60
77
  export { InputSelect };
@@ -1,5 +1,5 @@
1
- import { DropdownIndicatorProps, ClearIndicatorProps } from 'react-select';
2
- import { SelectValue } from '.';
1
+ import { type DropdownIndicatorProps, type ClearIndicatorProps } from 'react-select';
2
+ import { type SelectValue } from '.';
3
3
  declare function DropdownIndicator(props: DropdownIndicatorProps<SelectValue>): JSX.Element;
4
4
  declare function ClearIndicator(props: ClearIndicatorProps<SelectValue>): JSX.Element;
5
5
  declare const selectComponentOverrides: {
@@ -1,4 +1,4 @@
1
- import { StylesConfig } from 'react-select';
2
- import { SelectValue } from '.';
3
- import { InputFeedbackProps } from '../../forms/InputFeedback';
1
+ import { type StylesConfig } from 'react-select';
2
+ import { type SelectValue } from '.';
3
+ import { type InputFeedbackProps } from '../../forms/InputFeedback';
4
4
  export declare const getSelectStyles: (feedbackVariant?: InputFeedbackProps['variant']) => StylesConfig<SelectValue>;
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
1
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
3
2
  interface InputTextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, InputWrapperBaseProps {
4
3
  }
5
- declare const InputTextArea: React.ForwardRefExoticComponent<InputTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
4
+ declare const InputTextArea: import("react").ForwardRefExoticComponent<InputTextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
6
5
  export { InputTextArea };
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  export interface InputToggleBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
3
2
  id: string;
4
3
  label: string;
5
4
  description?: React.ReactNode;
6
5
  className?: string;
7
6
  }
8
- declare const InputToggleBox: React.ForwardRefExoticComponent<InputToggleBoxProps & React.RefAttributes<HTMLInputElement>>;
7
+ declare const InputToggleBox: import("react").ForwardRefExoticComponent<InputToggleBoxProps & import("react").RefAttributes<HTMLInputElement>>;
9
8
  export { InputToggleBox };
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  export interface InputToggleListBoxOption {
3
2
  value: string;
4
3
  label: string;
@@ -11,5 +10,5 @@ export interface InputToggleListBoxProps extends Omit<React.SelectHTMLAttributes
11
10
  options: InputToggleListBoxOption[];
12
11
  className?: string;
13
12
  }
14
- declare const InputToggleListBox: React.ForwardRefExoticComponent<InputToggleListBoxProps & React.RefAttributes<HTMLSelectElement>>;
13
+ declare const InputToggleListBox: import("react").ForwardRefExoticComponent<InputToggleListBoxProps & import("react").RefAttributes<HTMLSelectElement>>;
15
14
  export { InputToggleListBox };
@@ -1,5 +1,5 @@
1
- import { HintProps } from '../atoms/Hint';
2
- import { InputFeedbackProps } from '../forms/InputFeedback';
1
+ import { type HintProps } from '../atoms/Hint';
2
+ import { type InputFeedbackProps } from '../forms/InputFeedback';
3
3
  export interface InputWrapperBaseProps {
4
4
  /**
5
5
  * optional input label
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface Props extends React.LabelHTMLAttributes<HTMLLabelElement> {
3
2
  gap?: boolean;
4
3
  }
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import { InputHTMLAttributes } from 'react';
3
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
4
- export declare type RadioOptionValue = string | number | boolean;
1
+ import { type InputHTMLAttributes } from 'react';
2
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
3
+ export type RadioOptionValue = string | number | boolean;
5
4
  export interface RadioOption {
6
5
  value: RadioOptionValue;
7
6
  label: string;
@@ -14,5 +13,5 @@ export interface RadioButtonsProps extends InputWrapperBaseProps {
14
13
  className?: string;
15
14
  onBlur?: InputHTMLAttributes<HTMLInputElement>['onBlur'];
16
15
  }
17
- declare const RadioButtons: React.ForwardRefExoticComponent<RadioButtonsProps & React.RefAttributes<HTMLInputElement>>;
16
+ declare const RadioButtons: import("react").ForwardRefExoticComponent<RadioButtonsProps & import("react").RefAttributes<HTMLInputElement>>;
18
17
  export { RadioButtons };
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import { InputWrapperBaseProps } from '../forms/InputWrapper';
3
- import { Simplify } from 'type-fest';
4
- export declare type ToggleButtonValue = string | boolean | number;
1
+ import { type InputWrapperBaseProps } from '../forms/InputWrapper';
2
+ import { type Simplify } from 'type-fest';
3
+ export type ToggleButtonValue = string | boolean | number;
5
4
  export interface ToggleButtonOption {
6
5
  label: string;
7
6
  value: ToggleButtonValue;
@@ -13,14 +12,14 @@ interface BaseProps extends InputWrapperBaseProps, Omit<React.HTMLAttributes<HTM
13
12
  interface SingleValueProps {
14
13
  mode: 'single';
15
14
  value?: ToggleButtonValue;
16
- onChange: (value: ToggleButtonValue) => void;
15
+ onChange: (value?: ToggleButtonValue) => void;
17
16
  }
18
17
  interface MultiValuesProps {
19
18
  mode: 'multi';
20
19
  value?: ToggleButtonValue[];
21
20
  onChange: (values: ToggleButtonValue[]) => void;
22
21
  }
23
- export declare type ToggleButtonsProps = Simplify<BaseProps & (SingleValueProps | MultiValuesProps)>;
22
+ export type ToggleButtonsProps = Simplify<BaseProps & (SingleValueProps | MultiValuesProps)>;
24
23
  declare function ToggleButtons({ options, value, mode, onChange, label, hint, feedback, ...rest }: ToggleButtonsProps): JSX.Element;
25
24
  declare namespace ToggleButtons {
26
25
  var displayName: string;
@@ -1,6 +1,6 @@
1
- import { PaginationProps } from '../atoms/Pagination';
2
- import { ReactNode } from 'react';
3
- export declare type ListPagination = {
1
+ import { type PaginationProps } from '../atoms/Pagination';
2
+ import { type ReactNode } from 'react';
3
+ export type ListPagination = {
4
4
  recordsPerPage: number;
5
5
  recordCount: number;
6
6
  } & Omit<PaginationProps, 'className' | 'isDisabled'>;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  export interface DetailsListProps {
3
3
  /**
4
4
  * Optional title to show on top of the list
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface ListDetailsItemProps {
3
3
  /**
4
4
  * label to show on the left side. In a key/value pair, this is the `key`
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import { FlexRowProps } from '../atoms/FlexRow';
3
- import { FC } from 'react';
4
- declare type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
1
+ import { type FlexRowProps } from '../atoms/FlexRow';
2
+ import { type FC } from 'react';
3
+ type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
5
4
  /**
6
5
  * Icon component
7
6
  * Example: `<Icon>` or `<RadialProgress>` or `<Avatar>`
@@ -16,7 +15,7 @@ declare type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
16
15
  */
17
16
  borderStyle?: 'dashed' | 'solid';
18
17
  };
19
- export declare type ListItemProps = Props & (({
18
+ export type ListItemProps = Props & (({
20
19
  /**
21
20
  * HTML tag to render
22
21
  */
@@ -1,8 +1,8 @@
1
- import { EmptyStateProps } from '../../atoms/EmptyState';
2
- import { LegendProps } from '../../atoms/Legend';
3
- import { CommerceLayerClient, QueryParamsList } from '@commercelayer/sdk';
4
- import { FC } from 'react';
5
- import { ListableResource, Resource } from './infiniteFetcher';
1
+ import { type EmptyStateProps } from '../../atoms/EmptyState';
2
+ import { type LegendProps } from '../../atoms/Legend';
3
+ import { type CommerceLayerClient, type QueryParamsList } from '@commercelayer/sdk';
4
+ import { type FC } from 'react';
5
+ import { type ListableResource, type Resource } from './infiniteFetcher';
6
6
  export interface ResourceListProps<TResource extends ListableResource> extends Pick<LegendProps, 'title' | 'actionButton'> {
7
7
  type: TResource;
8
8
  query?: Omit<QueryParamsList, 'pageNumber'>;
@@ -1,7 +1,7 @@
1
1
  import type { CommerceLayerClient, QueryParamsList } from '@commercelayer/sdk';
2
- export declare type ListableResource = Exclude<keyof CommerceLayerClient, 'addRawResponseReader' | 'addRawResponseReader' | 'addRequestInterceptor' | 'addResponseInterceptor' | 'application' | 'config' | 'currentOrganization' | 'isApiError' | 'openApiSchemaVersion' | 'organization' | 'removeInterceptor' | 'removeRawResponseReader' | 'resources'>;
3
- declare type ListResource<TResource extends ListableResource> = Awaited<ReturnType<CommerceLayerClient[TResource]['list']>>;
4
- export declare type Resource<TResource extends ListableResource> = ListResource<TResource>[number];
2
+ export type ListableResource = Exclude<keyof CommerceLayerClient, 'addRawResponseReader' | 'addRawResponseReader' | 'addRequestInterceptor' | 'addResponseInterceptor' | 'application' | 'config' | 'currentOrganization' | 'isApiError' | 'openApiSchemaVersion' | 'organization' | 'removeInterceptor' | 'removeRawResponseReader' | 'resources'>;
3
+ type ListResource<TResource extends ListableResource> = Awaited<ReturnType<CommerceLayerClient[TResource]['list']>>;
4
+ export type Resource<TResource extends ListableResource> = ListResource<TResource>[number];
5
5
  export interface FetcherResponse<TResource> {
6
6
  list: TResource[];
7
7
  meta: {
@@ -1,4 +1,4 @@
1
- import { FetcherResponse, Resource, ListableResource } from './infiniteFetcher';
1
+ import { type FetcherResponse, type Resource, type ListableResource } from './infiniteFetcher';
2
2
  interface ResourceListInternalState<TResource extends ListableResource> {
3
3
  isLoading: boolean;
4
4
  error?: {
@@ -7,7 +7,7 @@ interface ResourceListInternalState<TResource extends ListableResource> {
7
7
  data?: FetcherResponse<Resource<TResource>> | undefined;
8
8
  }
9
9
  export declare const initialState: ResourceListInternalState<any>;
10
- declare type Action<TResource extends ListableResource> = {
10
+ type Action<TResource extends ListableResource> = {
11
11
  type: 'prepare';
12
12
  } | {
13
13
  type: 'loaded';
@@ -1,5 +1,5 @@
1
1
  export interface TableDataProps {
2
- data: Array<Record<string, string | Object>>;
2
+ data: Array<Record<string, string | Record<string, unknown>>>;
3
3
  className?: string;
4
4
  limit?: number;
5
5
  title?: string;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  export declare function isFunctionComponent(child: any): child is {
3
3
  type: React.FunctionComponent<any>;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -20,44 +20,44 @@
20
20
  "pnpm": ">=7"
21
21
  },
22
22
  "dependencies": {
23
- "@commercelayer/sdk": "4.25.0",
24
- "@types/lodash": "^4.14.191",
25
- "@types/react": "^18.0.26",
26
- "@types/react-datepicker": "^4.8.0",
27
- "@types/react-dom": "^18.0.9",
23
+ "@commercelayer/sdk": "5.0.0",
24
+ "@types/lodash": "^4.14.192",
25
+ "@types/react": "^18.0.33",
26
+ "@types/react-datepicker": "^4.10.0",
27
+ "@types/react-dom": "^18.0.11",
28
28
  "classnames": "^2.3.2",
29
29
  "jwt-decode": "^3.1.2",
30
30
  "lodash": "^4.17.21",
31
31
  "react": "^18.2.0",
32
- "react-datepicker": "^4.8.0",
32
+ "react-datepicker": "^4.11.0",
33
33
  "react-dom": "^18.2.0",
34
- "react-select": "^5.7.0",
34
+ "react-select": "^5.7.2",
35
35
  "ts-invariant": "^0.10.3",
36
- "type-fest": "^3.6.1"
36
+ "type-fest": "^3.7.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@commercelayer/eslint-config-ts-react": "^0.1.3",
39
+ "@commercelayer/eslint-config-ts-react": "^1.0.0",
40
40
  "@tailwindcss/forms": "^0.5.3",
41
41
  "@testing-library/jest-dom": "^5.16.5",
42
42
  "@testing-library/react": "^13.4.0",
43
- "@types/node": "^18.11.17",
43
+ "@types/node": "^18.15.11",
44
44
  "@types/testing-library__jest-dom": "^5.14.5",
45
- "@vitejs/plugin-react": "^3.0.0",
46
- "autoprefixer": "^10.4.13",
45
+ "@vitejs/plugin-react": "^3.1.0",
46
+ "autoprefixer": "^10.4.14",
47
47
  "cross-fetch": "^3.1.5",
48
48
  "date-fns": "^2.29.3",
49
49
  "date-fns-tz": "^2.0.0",
50
- "eslint": "^8.30.0",
51
- "jsdom": "^20.0.3",
52
- "msw": "^1.0.0",
50
+ "eslint": "^8.37.0",
51
+ "jsdom": "^21.1.1",
52
+ "msw": "^1.2.1",
53
53
  "phosphor-react": "^1.4.1",
54
54
  "polished": "^4.2.2",
55
- "postcss": "^8.4.20",
56
- "tailwindcss": "^3.2.4",
57
- "typescript": "^4.9.4",
58
- "vite": "^4.0.3",
59
- "vite-plugin-dts": "^1.7.1",
60
- "vitest": "^0.26.2"
55
+ "postcss": "^8.4.21",
56
+ "tailwindcss": "^3.3.1",
57
+ "typescript": "^5.0.3",
58
+ "vite": "^4.2.1",
59
+ "vite-plugin-dts": "^2.2.0",
60
+ "vitest": "^0.29.8"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@commercelayer/sdk": "^4.x"