@commercelayer/app-elements 0.0.80 → 0.1.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.
Files changed (127) hide show
  1. package/dist/{Async-a8cbdb5b.js → Async-566ec3f7.js} +3 -3
  2. package/dist/{InputDateComponent-a8c34dc1.js → InputDateComponent-4461b3e6.js} +3 -3
  3. package/dist/{Select-e581ae99.js → Select-89937223.js} +3 -3
  4. package/dist/helpers/appsNavigation.d.ts +1 -1
  5. package/dist/{main-dd440dc6.js → main-795be39b.js} +7119 -7022
  6. package/dist/main.d.ts +22 -38
  7. package/dist/main.js +97 -97
  8. package/dist/mocks/setup.d.ts +3 -0
  9. package/dist/{overrides-0673bab0.js → overrides-346bb0f6.js} +621 -618
  10. package/dist/providers/TokenProvider/TokenProvider.d.ts +15 -11
  11. package/dist/providers/TokenProvider/getInfoFromJwt.d.ts +3 -2
  12. package/dist/providers/TokenProvider/url.d.ts +3 -2
  13. package/dist/providers/TokenProvider/validateToken.d.ts +6 -1
  14. package/dist/style.css +1 -1
  15. package/dist/ui/atoms/Section.d.ts +31 -0
  16. package/dist/ui/atoms/Table/Table.d.ts +21 -0
  17. package/dist/ui/atoms/Table/Td.d.ts +8 -0
  18. package/dist/ui/atoms/{tables → Table}/index.d.ts +3 -2
  19. package/dist/ui/{lists → composite}/ListDetails.d.ts +1 -1
  20. package/dist/ui/composite/TableData.d.ts +23 -0
  21. package/dist/ui/forms/Form/index.d.ts +1 -0
  22. package/dist/ui/{hook-form → forms/Input}/HookedInput.d.ts +4 -4
  23. package/dist/ui/forms/{Input.d.ts → Input/Input.d.ts} +2 -3
  24. package/dist/ui/forms/Input/index.d.ts +2 -0
  25. package/dist/ui/{hook-form → forms/InputCheckbox}/HookedInputCheckbox.d.ts +4 -4
  26. package/dist/ui/forms/{InputCheckbox.d.ts → InputCheckbox/InputCheckbox.d.ts} +2 -2
  27. package/dist/ui/forms/InputCheckbox/index.d.ts +2 -0
  28. package/dist/ui/forms/InputCheckboxGroup.d.ts +2 -3
  29. package/dist/ui/{hook-form → forms/InputCurrency}/HookedInputCurrency.d.ts +4 -4
  30. package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +48 -0
  31. package/dist/ui/forms/InputCurrency/index.d.ts +3 -58
  32. package/dist/ui/forms/InputCurrency/utils.d.ts +10 -0
  33. package/dist/ui/forms/InputCurrencyRange.d.ts +8 -5
  34. package/dist/ui/{hook-form → forms/InputDate}/HookedInputDate.d.ts +4 -4
  35. package/dist/ui/forms/InputDate/InputDate.d.ts +4 -0
  36. package/dist/ui/forms/InputDate/InputDateComponent.d.ts +1 -2
  37. package/dist/ui/forms/InputDate/index.d.ts +2 -5
  38. package/dist/ui/{hook-form → forms/InputDateRange}/HookedInputDateRange.d.ts +4 -4
  39. package/dist/ui/forms/{InputDateRange.d.ts → InputDateRange/InputDateRange.d.ts} +3 -4
  40. package/dist/ui/forms/InputDateRange/index.d.ts +2 -0
  41. package/dist/ui/forms/InputFeedback.d.ts +2 -3
  42. package/dist/ui/forms/InputFile.d.ts +6 -2
  43. package/dist/ui/forms/InputJson.d.ts +2 -3
  44. package/dist/ui/{hook-form → forms/InputMetadata}/HookedInputMetadata.d.ts +3 -3
  45. package/dist/ui/forms/InputMetadata/index.d.ts +1 -0
  46. package/dist/ui/forms/InputRadioGroup.d.ts +9 -4
  47. package/dist/ui/forms/InputReadonly.d.ts +3 -3
  48. package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/Checkbox.d.ts +1 -1
  49. package/dist/ui/forms/InputResourceGroup/HookedInputResourceGroup.d.ts +15 -0
  50. package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +28 -0
  51. package/dist/ui/forms/InputResourceGroup/index.d.ts +2 -0
  52. package/dist/ui/forms/InputSelect/Async.d.ts +1 -1
  53. package/dist/ui/{hook-form → forms/InputSelect}/HookedInputSelect.d.ts +4 -4
  54. package/dist/ui/forms/InputSelect/InputSelect.d.ts +91 -0
  55. package/dist/ui/forms/InputSelect/Select.d.ts +1 -1
  56. package/dist/ui/forms/InputSelect/index.d.ts +2 -91
  57. package/dist/ui/forms/InputSimpleSelect/HookedInputSimpleSelect.d.ts +21 -0
  58. package/dist/ui/forms/InputSimpleSelect/InputSimpleSelect.d.ts +12 -0
  59. package/dist/ui/forms/InputSimpleSelect/index.d.ts +2 -0
  60. package/dist/ui/{hook-form → forms/InputSpinner}/HookedInputSpinner.d.ts +4 -4
  61. package/dist/ui/forms/{InputSpinner.d.ts → InputSpinner/InputSpinner.d.ts} +2 -3
  62. package/dist/ui/forms/InputSpinner/index.d.ts +2 -0
  63. package/dist/ui/{hook-form/HookedInputToggleBox.d.ts → forms/InputSwitch/HookedInputSwitch.d.ts} +6 -6
  64. package/dist/ui/forms/InputSwitch/InputSwitch.d.ts +5 -0
  65. package/dist/ui/forms/InputSwitch/index.d.ts +2 -0
  66. package/dist/ui/forms/InputTextArea.d.ts +2 -2
  67. package/dist/ui/forms/InputToggleButton/HookedInputToggleButton.d.ts +18 -0
  68. package/dist/ui/forms/{ToggleButtons.d.ts → InputToggleButton/InputToggleButton.d.ts} +7 -6
  69. package/dist/ui/forms/InputToggleButton/index.d.ts +2 -0
  70. package/dist/ui/forms/Label.d.ts +6 -3
  71. package/dist/ui/forms/Legend.d.ts +14 -0
  72. package/dist/ui/{hook-form → forms/ReactHookForm}/HookedValidationApiError.d.ts +3 -3
  73. package/dist/ui/{hook-form → forms/ReactHookForm}/HookedValidationError.d.ts +3 -3
  74. package/dist/ui/forms/ReactHookForm/index.d.ts +4 -0
  75. package/dist/ui/{hook-form → forms/ReactHookForm}/useValidationFeedback.d.ts +1 -1
  76. package/dist/ui/internals/InputWrapper.d.ts +6 -1
  77. package/dist/ui/resources/Filters/types.d.ts +4 -4
  78. package/dist/ui/resources/Filters/useFilters.d.ts +2 -1
  79. package/dist/ui/resources/ResourceList/ResourceList.d.ts +64 -0
  80. package/dist/ui/resources/ResourceList/index.d.ts +1 -45
  81. package/dist/{unsupportedIterableToArray-0f93b40f.js → unsupportedIterableToArray-a3020d44.js} +1 -1
  82. package/dist/utils/children.d.ts +4 -3
  83. package/dist/utils/extractHeaders.d.ts +2 -1
  84. package/dist/utils/text.d.ts +8 -1
  85. package/package.json +26 -26
  86. package/dist/ui/atoms/Legend.d.ts +0 -32
  87. package/dist/ui/atoms/tables/Td.d.ts +0 -9
  88. package/dist/ui/forms/InputToggleBox.d.ts +0 -9
  89. package/dist/ui/forms/InputToggleListBox.d.ts +0 -15
  90. package/dist/ui/forms/RadioButtons.d.ts +0 -19
  91. package/dist/ui/hook-form/HookedInputToggleListBox.d.ts +0 -21
  92. package/dist/ui/hook-form/HookedRelationshipSelector.d.ts +0 -18
  93. package/dist/ui/hook-form/HookedToggleButtons.d.ts +0 -18
  94. package/dist/ui/resources/RelationshipSelector/index.d.ts +0 -26
  95. package/dist/ui/resources/ResourceList/index.test.d.ts +0 -1
  96. package/dist/ui/tables/Table.d.ts +0 -10
  97. package/dist/ui/tables/TableData.d.ts +0 -14
  98. package/dist/utils/tests.d.ts +0 -1
  99. /package/dist/ui/atoms/{Legend.test.d.ts → Section.test.d.ts} +0 -0
  100. /package/dist/ui/{tables → atoms/Table}/Table.test.d.ts +0 -0
  101. /package/dist/ui/atoms/{tables → Table}/Th.d.ts +0 -0
  102. /package/dist/ui/atoms/{tables → Table}/Tr.d.ts +0 -0
  103. /package/dist/ui/{lists → composite}/List.d.ts +0 -0
  104. /package/dist/ui/{lists → composite}/List.test.d.ts +0 -0
  105. /package/dist/ui/{lists → composite}/ListDetails.test.d.ts +0 -0
  106. /package/dist/ui/{lists → composite}/ListDetailsItem.d.ts +0 -0
  107. /package/dist/ui/{lists → composite}/ListDetailsItem.test.d.ts +0 -0
  108. /package/dist/ui/{lists → composite}/ListItem.d.ts +0 -0
  109. /package/dist/ui/{lists → composite}/ListItem.test.d.ts +0 -0
  110. /package/dist/ui/{tables → composite}/TableData.test.d.ts +0 -0
  111. /package/dist/ui/{hook-form → forms/Form}/HookedForm.d.ts +0 -0
  112. /package/dist/ui/forms/{Input.test.d.ts → Input/Input.test.d.ts} +0 -0
  113. /package/dist/ui/forms/{InputCheckbox.test.d.ts → InputCheckbox/InputCheckbox.test.d.ts} +0 -0
  114. /package/dist/ui/forms/InputCurrency/{index.test.d.ts → InputCurrency.test.d.ts} +0 -0
  115. /package/dist/ui/forms/InputDate/{InputDate.test.d.ts → InputDateComponent.test.d.ts} +0 -0
  116. /package/dist/ui/forms/{InputDateRange.test.d.ts → InputDateRange/InputDateRange.test.d.ts} +0 -0
  117. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/FullList.d.ts +0 -0
  118. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/utils.d.ts +0 -0
  119. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/utils.test.d.ts +0 -0
  120. /package/dist/ui/forms/InputSelect/{index.test.d.ts → InputSelect.test.d.ts} +0 -0
  121. /package/dist/ui/forms/{InputSpinner.test.d.ts → InputSimpleSelect/InputSimpleSelect.test.d.ts} +0 -0
  122. /package/dist/ui/forms/{InputToggleBox.test.d.ts → InputSpinner/InputSpinner.test.d.ts} +0 -0
  123. /package/dist/ui/forms/{InputToggleListBox.test.d.ts → InputSwitch/InputSwitch.test.d.ts} +0 -0
  124. /package/dist/ui/forms/{RadioButtons.test.d.ts → InputToggleButton/InputToggleButton.test.d.ts} +0 -0
  125. /package/dist/ui/{hook-form → forms/ReactHookForm}/setApiFormErrors.d.ts +0 -0
  126. /package/dist/ui/{hook-form → forms/ReactHookForm}/setApiFormErrors.test.d.ts +0 -0
  127. /package/dist/ui/{forms/ToggleButtons.test.d.ts → resources/ResourceList/ResourceList.test.d.ts} +0 -0
@@ -0,0 +1,48 @@
1
+ /// <reference types="react" />
2
+ import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
3
+ import { type CurrencyInputProps as ReactCurrencyInputFieldProps } from 'react-currency-input-field';
4
+ import { type CurrencyCode } from './currencies';
5
+ export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<ReactCurrencyInputFieldProps, 'onBlur' | 'onClick' | 'disabled'> {
6
+ /**
7
+ * HTML input id
8
+ */
9
+ id?: string;
10
+ /**
11
+ * Field name
12
+ */
13
+ name?: string;
14
+ /**
15
+ * Input placeholder
16
+ */
17
+ placeholder?: string;
18
+ /**
19
+ * optional css class names used for the input element
20
+ */
21
+ className?: string;
22
+ /**
23
+ * Valid 3-digit iso currency code (eg: EUR, USD, GBP)
24
+ */
25
+ currencyCode: Uppercase<CurrencyCode>;
26
+ /**
27
+ * Value in cents
28
+ */
29
+ cents?: number | null;
30
+ /**
31
+ * onChange callback triggered when during typing
32
+ */
33
+ onChange: (cents: number | null, formatted: string) => void;
34
+ /**
35
+ * hide currency symbol but keep the currency formatting
36
+ */
37
+ hideCurrencySymbol?: boolean;
38
+ /**
39
+ * Allow user to enter negative value
40
+ * @default false
41
+ */
42
+ allowNegativeValue?: boolean;
43
+ /**
44
+ * show (X) button to clear the input
45
+ */
46
+ isClearable?: boolean;
47
+ }
48
+ export declare const InputCurrency: import("react").ForwardRefExoticComponent<InputCurrencyProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,58 +1,3 @@
1
- /// <reference types="react" />
2
- import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
3
- import { type CurrencyInputProps } from 'react-currency-input-field';
4
- import { type CurrencyCode } from './currencies';
5
- export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<CurrencyInputProps, 'onBlur' | 'onClick' | 'disabled'> {
6
- /**
7
- * HTML input id
8
- */
9
- id?: string;
10
- /**
11
- * Field name
12
- */
13
- name?: string;
14
- /**
15
- * Input placeholder
16
- */
17
- placeholder?: string;
18
- /**
19
- * optional css class names used for the input element
20
- */
21
- className?: string;
22
- /**
23
- * Valid 3-digit iso currency code (eg: EUR, USD, GBP)
24
- */
25
- currencyCode: Uppercase<CurrencyCode>;
26
- /**
27
- * Value in cents
28
- */
29
- cents?: number | null;
30
- /**
31
- * onChange callback triggered when during typing
32
- */
33
- onChange: (cents: number | null, formatted: string) => void;
34
- /**
35
- * hide currency symbol but keep the currency formatting
36
- */
37
- hideCurrencySymbol?: boolean;
38
- /**
39
- * Allow user to enter negative value
40
- * @default false
41
- */
42
- allowNegativeValue?: boolean;
43
- /**
44
- * show (X) button to clear the input
45
- */
46
- isClearable?: boolean;
47
- }
48
- declare const InputCurrency: import("react").ForwardRefExoticComponent<InputCurrencyProps & import("react").RefAttributes<HTMLInputElement>>;
49
- /**
50
- * Format cents to currency.
51
- * Useful to display the returned value from `<InputCurrency>` component.
52
- *
53
- * Example: formatCentsToCurrency(100, 'EUR') -> €1,00
54
- * Example: formatCentsToCurrency(100000, 'USD') -> $1,000.00
55
- * Example: formatCentsToCurrency(100, 'JPY') -> ¥100
56
- **/
57
- declare function formatCentsToCurrency(cents: number, currencyCode: Uppercase<CurrencyCode>, stripZeroDecimals?: boolean): string;
58
- export { InputCurrency, formatCentsToCurrency };
1
+ export { HookedInputCurrency } from './HookedInputCurrency';
2
+ export { InputCurrency, type InputCurrencyProps } from './InputCurrency';
3
+ export { formatCentsToCurrency } from './utils';
@@ -24,3 +24,13 @@ export declare function addCurrencySymbol({ formattedValue, currency }: {
24
24
  * Example: CLF -> 0,0000
25
25
  */
26
26
  export declare function makePlaceholder(currency: Currency): string;
27
+ /**
28
+ * Format cents to currency.
29
+ * Useful to display the returned value from `<InputCurrency>` component.
30
+ *
31
+ * @example
32
+ * formatCentsToCurrency(100, 'EUR') //= €1,00
33
+ * formatCentsToCurrency(100000, 'USD') //= $1,000.00
34
+ * formatCentsToCurrency(100, 'JPY') //= ¥100
35
+ **/
36
+ export declare function formatCentsToCurrency(cents: number, currencyCode: Uppercase<CurrencyCode>, stripZeroDecimals?: boolean): string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { type InputCurrencyProps } from '../forms/InputCurrency';
2
3
  import { type CurrencyCode } from '../forms/InputCurrency/currencies';
3
- import { type InputCurrencyProps } from '../forms/InputCurrency/index';
4
4
  import { type InputWrapperBaseProps } from '../internals/InputWrapper';
5
5
  type Cents = InputCurrencyProps['cents'];
6
6
  export interface InputCurrencyRangeProps extends InputWrapperBaseProps {
@@ -14,12 +14,15 @@ export interface InputCurrencyRangeProps extends InputWrapperBaseProps {
14
14
  formatted: string;
15
15
  }, currency: Uppercase<CurrencyCode>) => void;
16
16
  placeholders?: [string, string];
17
- currencyList: Array<Uppercase<CurrencyCode>>;
17
+ currencyList: readonly [
18
+ Uppercase<CurrencyCode>,
19
+ ...Array<Uppercase<CurrencyCode>>
20
+ ];
18
21
  defaultCurrency?: Uppercase<CurrencyCode>;
19
22
  className?: string;
20
23
  }
21
- declare function InputCurrencyRange({ fromCents, toCents, placeholders, onChange, label, hint, currencyList, defaultCurrency, className, feedback }: InputCurrencyRangeProps): JSX.Element;
22
- declare namespace InputCurrencyRange {
24
+ export declare function InputCurrencyRange({ fromCents, toCents, placeholders, onChange, label, hint, currencyList, defaultCurrency, className, feedback }: InputCurrencyRangeProps): JSX.Element;
25
+ export declare namespace InputCurrencyRange {
23
26
  var displayName: string;
24
27
  }
25
- export { InputCurrencyRange };
28
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type InputDateProps } from '../forms/InputDate/InputDateComponent';
2
+ import { type InputDateProps } from './InputDateComponent';
3
3
  interface Props extends Omit<InputDateProps, 'onChange'> {
4
4
  /**
5
5
  * field name to match hook-form state
@@ -11,8 +11,8 @@ interface Props extends Omit<InputDateProps, 'onChange'> {
11
11
  * Value is stored in form state as iso date string (example: `"2023-08-01T22:00:00.000Z"` ).
12
12
  * @see InputDate
13
13
  */
14
- declare function HookedInputDate({ name, ...props }: Props): JSX.Element;
15
- declare namespace HookedInputDate {
14
+ export declare function HookedInputDate({ name, ...props }: Props): JSX.Element;
15
+ export declare namespace HookedInputDate {
16
16
  var displayName: string;
17
17
  }
18
- export { HookedInputDate };
18
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type DatePicker from 'react-datepicker';
3
+ import { type InputDateProps } from './InputDateComponent';
4
+ export declare const InputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
@@ -47,5 +47,4 @@ export interface InputDateProps extends InputWrapperBaseProps {
47
47
  */
48
48
  preventOpenOnFocus?: boolean;
49
49
  }
50
- declare const InputDateComponent: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
51
- export { InputDateComponent };
50
+ export declare const InputDateComponent: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
@@ -1,5 +1,2 @@
1
- /// <reference types="react" />
2
- import { type InputDateProps } from './InputDateComponent';
3
- import type DatePicker from 'react-datepicker';
4
- declare const InputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
5
- export { InputDate };
1
+ export { HookedInputDate } from './HookedInputDate';
2
+ export { InputDate } from './InputDate';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type InputDateRangeProps } from '../forms/InputDateRange';
2
+ import { type InputDateRangeProps } from './InputDateRange';
3
3
  interface Props extends Omit<InputDateRangeProps, 'onChange' | 'value'> {
4
4
  /**
5
5
  * field name to match hook-form state
@@ -12,8 +12,8 @@ interface Props extends Omit<InputDateRangeProps, 'onChange' | 'value'> {
12
12
  * (example: `["2023-08-01T22:00:00.000Z", "2023-08-14T22:00:00.000Z"]` ).
13
13
  * @see InputDateRange
14
14
  */
15
- declare function HookedInputDateRange({ name, ...props }: Props): JSX.Element;
16
- declare namespace HookedInputDateRange {
15
+ export declare function HookedInputDateRange({ name, ...props }: Props): JSX.Element;
16
+ export declare namespace HookedInputDateRange {
17
17
  var displayName: string;
18
18
  }
19
- export { HookedInputDateRange };
19
+ export {};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { type InputWrapperBaseProps } from '../internals/InputWrapper';
3
- import { type InputDateProps, type MaybeDate } from './InputDate/InputDateComponent';
2
+ import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
3
+ import { type InputDateProps, type MaybeDate } from '../InputDate/InputDateComponent';
4
4
  export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable' | 'format' | 'autoPlaceholder'>, InputWrapperBaseProps {
5
5
  /**
6
6
  * a tuple that represents the [from, to] dates
@@ -19,5 +19,4 @@ export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable'
19
19
  */
20
20
  toPlaceholder?: string;
21
21
  }
22
- declare const InputDateRange: import("react").ForwardRefExoticComponent<InputDateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
23
- export { InputDateRange };
22
+ export declare const InputDateRange: import("react").ForwardRefExoticComponent<InputDateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ export { HookedInputDateRange } from './HookedInputDateRange';
2
+ export { InputDateRange } from './InputDateRange';
@@ -5,8 +5,7 @@ export interface InputFeedbackProps {
5
5
  variant?: FeedbackVariant;
6
6
  className?: string;
7
7
  }
8
- declare function InputFeedback({ className, message, variant, ...rest }: InputFeedbackProps): JSX.Element;
9
- declare namespace InputFeedback {
8
+ export declare function InputFeedback({ className, message, variant, ...rest }: InputFeedbackProps): JSX.Element;
9
+ export declare namespace InputFeedback {
10
10
  var displayName: string;
11
11
  }
12
- export { InputFeedback };
@@ -1,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { type InputWrapperBaseProps } from '../internals/InputWrapper';
3
3
  interface InputFileProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
+ /**
5
+ * The title is shown within the input.
6
+ */
7
+ title: string;
4
8
  /**
5
9
  * If defined, it shows a progress bar at the bottom. It must be between 0 and 100.
6
10
  */
7
11
  progress?: number;
8
12
  }
9
- declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
10
- export { InputFile };
13
+ export declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
14
+ export {};
@@ -8,8 +8,7 @@ export interface InputJsonProps<JsonType> extends InputWrapperBaseProps {
8
8
  errorMessageText?: string;
9
9
  className?: string;
10
10
  }
11
- declare function InputJson<JsonType extends object>({ placeholder, validateFn, onDataReady, onDataResetRequest, errorMessageText, className, label, feedback, hint, ...rest }: InputJsonProps<JsonType>): JSX.Element;
12
- declare namespace InputJson {
11
+ export declare function InputJson<JsonType extends object>({ placeholder, validateFn, onDataReady, onDataResetRequest, errorMessageText, className, label, feedback, hint, ...rest }: InputJsonProps<JsonType>): JSX.Element;
12
+ export declare namespace InputJson {
13
13
  var displayName: string;
14
14
  }
15
- export { InputJson };
@@ -12,8 +12,8 @@ interface Props {
12
12
  * in the form state.
13
13
  * @see InputMetadata
14
14
  */
15
- declare function HookedInputMetadata({ name }: Props): JSX.Element;
16
- declare namespace HookedInputMetadata {
15
+ export declare function HookedInputMetadata({ name }: Props): JSX.Element;
16
+ export declare namespace HookedInputMetadata {
17
17
  var displayName: string;
18
18
  }
19
- export { HookedInputMetadata };
19
+ export {};
@@ -0,0 +1 @@
1
+ export { HookedInputMetadata } from './HookedInputMetadata';
@@ -10,6 +10,10 @@ export interface OptionItem {
10
10
  content: ReactNode;
11
11
  }
12
12
  export interface InputRadioGroupProps {
13
+ /**
14
+ * Text to be displayed on top of the list
15
+ */
16
+ title?: string;
13
17
  /**
14
18
  * Input name, will be used to set the html name for all radios
15
19
  */
@@ -31,18 +35,19 @@ export interface InputRadioGroupProps {
31
35
  */
32
36
  showInput?: boolean;
33
37
  /**
34
- * Define the `flex-direction`
35
- * @default 'column'
38
+ * Define how the item options are rendered
39
+ * @default list
36
40
  */
37
- direction?: 'column' | 'row';
41
+ viewMode?: 'list' | 'inline';
38
42
  }
39
43
  export declare const InputRadioGroup: import('../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
44
+ title?: string | undefined;
40
45
  name: string;
41
46
  options: OptionItem[];
42
47
  defaultValue?: string | undefined;
43
48
  onChange?: ((selected: string | undefined) => void) | undefined;
44
49
  showInput?: boolean | undefined;
45
- direction?: "row" | "column" | undefined;
50
+ viewMode?: "list" | "inline" | undefined;
46
51
  delayMs?: number | undefined;
47
52
  isLoading?: boolean | undefined;
48
53
  }>;
@@ -18,8 +18,8 @@ interface InputReadonlyProps extends InputWrapperBaseProps {
18
18
  */
19
19
  showCopyAction?: boolean;
20
20
  }
21
- declare function InputReadonly({ value, wrapperClassName, inputClassName, showCopyAction, label, hint, feedback, ...rest }: InputReadonlyProps): JSX.Element;
22
- declare namespace InputReadonly {
21
+ export declare function InputReadonly({ value, wrapperClassName, inputClassName, showCopyAction, label, hint, feedback, ...rest }: InputReadonlyProps): JSX.Element;
22
+ export declare namespace InputReadonly {
23
23
  var displayName: string;
24
24
  }
25
- export { InputReadonly };
25
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type InputCheckboxProps } from '../../forms/InputCheckbox';
2
+ import { type InputCheckboxProps } from '../../forms/InputCheckbox/InputCheckbox';
3
3
  import { type CommerceLayerClient } from '@commercelayer/sdk';
4
4
  import { type ListableResourceType } from '@commercelayer/sdk/lib/cjs/api';
5
5
  export interface CheckboxItem {
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { type InputResourceGroupProps } from './InputResourceGroup';
3
+ interface Props extends Omit<InputResourceGroupProps, 'onChange' | 'defaultValues'> {
4
+ /**
5
+ * field name to match hook-form state
6
+ */
7
+ name: string;
8
+ }
9
+ /**
10
+ * `InputResourceGroup` component ready to be used with the `react-hook-form` context.
11
+ * Since it will perform api requests to fetch list of options, it also needs to access `CoreSdkProvider` context.
12
+ * @see InputResourceGroup
13
+ */
14
+ export declare const HookedInputResourceGroup: React.FC<Props>;
15
+ export {};
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { type QueryFilter } from '@commercelayer/sdk/lib/cjs/query';
3
+ import { type FullListProps } from './FullList';
4
+ export interface InputResourceGroupProps extends Omit<FullListProps, 'totalCount'> {
5
+ /**
6
+ * Number of item to be shown in the preview list
7
+ * @default 5
8
+ */
9
+ previewLimit?: number;
10
+ /**
11
+ * SDK filter query to be applied when fetching the list of resources
12
+ */
13
+ filters?: QueryFilter;
14
+ /**
15
+ * Hide the component when there is only one item.
16
+ */
17
+ hideWhenSingleItem?: boolean;
18
+ /**
19
+ * Show icon in checkbox selectors
20
+ */
21
+ showCheckboxIcon?: boolean;
22
+ }
23
+ /**
24
+ * Input component that allows to select multiple resources. The list of options is automatically fetched from the API using the configuration provided as props.
25
+ * When number of fetched options is greater than `previewLimit` provided, a button will be shown to open an overlay with the full list of resources (infinite scrolling) and a search box on top.
26
+ * <blockquote type='info'>It's possible to mount the component with some `defaultValues` that will be always shown checked on top of the preview list, to ensure that user will always see the already checked options.</blockquote>
27
+ */
28
+ export declare const InputResourceGroup: React.FC<InputResourceGroupProps>;
@@ -0,0 +1,2 @@
1
+ export { HookedInputResourceGroup } from './HookedInputResourceGroup';
2
+ export { InputResourceGroup, type InputResourceGroupProps } from './InputResourceGroup';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type StylesConfig } from 'react-select';
3
3
  import { type SetRequired } from 'type-fest';
4
- import { type InputSelectProps, type SelectValue } from './';
4
+ import { type InputSelectProps, type SelectValue } from './InputSelect';
5
5
  interface AsyncSelectComponentProps extends Omit<SetRequired<InputSelectProps, 'loadAsyncValues'>, 'label' | 'hint'> {
6
6
  styles: StylesConfig<SelectValue>;
7
7
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type InputSelectProps } from '../forms/InputSelect';
2
+ import { type InputSelectProps } from './InputSelect';
3
3
  interface Props extends Omit<InputSelectProps, 'onSelect' | 'defaultValue'> {
4
4
  /**
5
5
  * field name to match hook-form state
@@ -27,8 +27,8 @@ interface Props extends Omit<InputSelectProps, 'onSelect' | 'defaultValue'> {
27
27
  * Value to be stored in the field can be controlled from the `pathToValue` prop.
28
28
  * @see InputSelect
29
29
  */
30
- declare function HookedInputSelect({ name, pathToValue, ...props }: Props): JSX.Element;
31
- declare namespace HookedInputSelect {
30
+ export declare function HookedInputSelect({ name, pathToValue, ...props }: Props): JSX.Element;
31
+ export declare namespace HookedInputSelect {
32
32
  var displayName: string;
33
33
  }
34
- export { HookedInputSelect };
34
+ export {};
@@ -0,0 +1,91 @@
1
+ import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
2
+ import { type FocusEventHandler } from 'react';
3
+ import { type MultiValue, type SingleValue } from 'react-select';
4
+ export type GroupedSelectValues = Array<{
5
+ label: string;
6
+ options: SelectValue[];
7
+ }>;
8
+ export interface SelectValue {
9
+ value: string | number;
10
+ label: string;
11
+ meta?: Record<string, any>;
12
+ }
13
+ export type PossibleSelectValue = MultiValue<SelectValue> | SingleValue<SelectValue>;
14
+ export interface InputSelectProps extends InputWrapperBaseProps {
15
+ initialValues: GroupedSelectValues | SelectValue[];
16
+ defaultValue?: SelectValue | SelectValue[];
17
+ placeholder?: string;
18
+ isLoading?: boolean;
19
+ loadingText?: string;
20
+ isClearable?: boolean;
21
+ isDisabled?: boolean;
22
+ isSearchable?: boolean;
23
+ isMulti?: boolean;
24
+ isOptionDisabled?: () => boolean;
25
+ onSelect: (value: PossibleSelectValue) => void;
26
+ onBlur?: FocusEventHandler<HTMLInputElement>;
27
+ name?: string;
28
+ menuIsOpen?: boolean;
29
+ noOptionsMessage?: string;
30
+ className?: string;
31
+ /**
32
+ * Function to load async values on search
33
+ */
34
+ loadAsyncValues?: (inputValue: string) => Promise<GroupedSelectValues | SelectValue[]>;
35
+ /**
36
+ * Debounce time in milliseconds for async search
37
+ * Only works when `loadAsyncValues` is provided
38
+ */
39
+ debounceMs?: number;
40
+ }
41
+ export declare function InputSelect({ label, hint, feedback, menuIsOpen, initialValues, defaultValue, isClearable, isLoading, loadingText, placeholder, isDisabled, isOptionDisabled, isSearchable, onSelect, isMulti, onBlur, name, className, loadAsyncValues, debounceMs, noOptionsMessage, ...rest }: InputSelectProps): JSX.Element;
42
+ export declare namespace InputSelect {
43
+ var displayName: string;
44
+ }
45
+ /**
46
+ * Helper function to understand and refine type of a single selected value
47
+ * @param selectedValue possible value returned from select component
48
+ * @returns true if selected value is single, from this point TypeScript will treat this as `SelectValue` type
49
+ */
50
+ export declare function isSingleValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue;
51
+ /**
52
+ * Helper function to understand and refine type of a set of selected values
53
+ * @param selectedValue possible value returned from select component
54
+ * @returns true if selected value is an array of selected values, from this point TypeScript will treat this as `SelectValue[]` type
55
+ */
56
+ export declare function isMultiValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue[];
57
+ /**
58
+ * Type-guard to check if prop `initialValues` is a GroupedSelectValues or SelectValue
59
+ */
60
+ export declare function isGroupedSelectValues(initialValues?: GroupedSelectValues | SelectValue[]): initialValues is GroupedSelectValues;
61
+ /**
62
+ * Helper function to extract only a specific property from the `SelectValue`
63
+ * @param selectedValue possible value returned from select component
64
+ * @param pathToValue optional path.to.property. Default is `value`
65
+ * @returns a string or an array of strings.
66
+ * Examples:
67
+ * ```
68
+ * flatSelectValues({value: 'ABCD', label: 'T-Shirt XL'})
69
+ * // returns 'ABCD'
70
+ *
71
+ * flatSelectValues([
72
+ * {value: 'ABCD', label: 'T-Shirt M'},
73
+ * {value: '1234', label: 'T-Shirt XL'},
74
+ * ], 'label')
75
+ * // returns ['T-Shirt M', 'T-Shirt XL']
76
+ * ```
77
+ */
78
+ export declare function flatSelectValues(selectedValue: PossibleSelectValue, pathToValue?: string): null | string | Array<string | number>;
79
+ /**
80
+ * To be used when storing the flatten value and there is the need
81
+ * to retrieve the `defaultValue` to pass as <InputSelect> prop
82
+ * @param currentValue the current value that is being stored in app state
83
+ * @param initialValues the array of SelectValue objects that should contain the `currentValue`
84
+ * @param pathToValue optional path.to.property. Default is `value`
85
+ * @returns the matched value or values, otherwise undefined.
86
+ */
87
+ export declare function getDefaultValueFromFlatten({ currentValue, initialValues, pathToValue }: {
88
+ currentValue?: string | Array<string | number> | null;
89
+ initialValues?: GroupedSelectValues | SelectValue[];
90
+ pathToValue?: string;
91
+ }): SelectValue | SelectValue[] | undefined;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type StylesConfig } from 'react-select';
3
- import { type InputSelectProps, type SelectValue } from './';
3
+ import { type InputSelectProps, type SelectValue } from './InputSelect';
4
4
  interface SelectComponentProps extends Omit<InputSelectProps, 'loadAsyncValues' | 'label' | 'hint'> {
5
5
  styles: StylesConfig<SelectValue>;
6
6
  }
@@ -1,91 +1,2 @@
1
- import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
2
- import { type FocusEventHandler } from 'react';
3
- import { type MultiValue, type SingleValue } from 'react-select';
4
- export type GroupedSelectValues = Array<{
5
- label: string;
6
- options: SelectValue[];
7
- }>;
8
- export interface SelectValue {
9
- value: string | number;
10
- label: string;
11
- meta?: Record<string, any>;
12
- }
13
- export type PossibleSelectValue = MultiValue<SelectValue> | SingleValue<SelectValue>;
14
- export interface InputSelectProps extends InputWrapperBaseProps {
15
- initialValues: GroupedSelectValues | SelectValue[];
16
- defaultValue?: SelectValue | SelectValue[];
17
- placeholder?: string;
18
- isLoading?: boolean;
19
- loadingText?: string;
20
- isClearable?: boolean;
21
- isDisabled?: boolean;
22
- isSearchable?: boolean;
23
- isMulti?: boolean;
24
- isOptionDisabled?: () => boolean;
25
- onSelect: (value: PossibleSelectValue) => void;
26
- onBlur?: FocusEventHandler<HTMLInputElement>;
27
- name?: string;
28
- menuIsOpen?: boolean;
29
- noOptionsMessage?: string;
30
- className?: string;
31
- /**
32
- * Function to load async values on search
33
- */
34
- loadAsyncValues?: (inputValue: string) => Promise<GroupedSelectValues | SelectValue[]>;
35
- /**
36
- * Debounce time in milliseconds for async search
37
- * Only works when `loadAsyncValues` is provided
38
- */
39
- debounceMs?: number;
40
- }
41
- export declare function InputSelect({ label, hint, feedback, menuIsOpen, initialValues, defaultValue, isClearable, isLoading, loadingText, placeholder, isDisabled, isOptionDisabled, isSearchable, onSelect, isMulti, onBlur, name, className, loadAsyncValues, debounceMs, noOptionsMessage, ...rest }: InputSelectProps): JSX.Element;
42
- export declare namespace InputSelect {
43
- var displayName: string;
44
- }
45
- /**
46
- * Helper function to understand and refine type of a single selected value
47
- * @param selectedValue possible value returned from select component
48
- * @returns true if selected value is single, from this point TypeScript will treat this as `SelectValue` type
49
- */
50
- export declare function isSingleValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue;
51
- /**
52
- * Helper function to understand and refine type of a set of selected values
53
- * @param selectedValue possible value returned from select component
54
- * @returns true if selected value is an array of selected values, from this point TypeScript will treat this as `SelectValue[]` type
55
- */
56
- export declare function isMultiValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue[];
57
- /**
58
- * Type-guard to check if prop `initialValues` is a GroupedSelectValues or SelectValue
59
- */
60
- export declare function isGroupedSelectValues(initialValues?: GroupedSelectValues | SelectValue[]): initialValues is GroupedSelectValues;
61
- /**
62
- * Helper function to extract only a specific property from the `SelectValue`
63
- * @param selectedValue possible value returned from select component
64
- * @param pathToValue optional path.to.property. Default is `value`
65
- * @returns a string or an array of strings.
66
- * Examples:
67
- * ```
68
- * flatSelectValues({value: 'ABCD', label: 'T-Shirt XL'})
69
- * // returns 'ABCD'
70
- *
71
- * flatSelectValues([
72
- * {value: 'ABCD', label: 'T-Shirt M'},
73
- * {value: '1234', label: 'T-Shirt XL'},
74
- * ], 'label')
75
- * // returns ['T-Shirt M', 'T-Shirt XL']
76
- * ```
77
- */
78
- export declare function flatSelectValues(selectedValue: PossibleSelectValue, pathToValue?: string): null | string | Array<string | number>;
79
- /**
80
- * To be used when storing the flatten value and there is the need
81
- * to retrieve the `defaultValue` to pass as <InputSelect> prop
82
- * @param currentValue the current value that is being stored in app state
83
- * @param initialValues the array of SelectValue objects that should contain the `currentValue`
84
- * @param pathToValue optional path.to.property. Default is `value`
85
- * @returns the matched value or values, otherwise undefined.
86
- */
87
- export declare function getDefaultValueFromFlatten({ currentValue, initialValues, pathToValue }: {
88
- currentValue?: string | Array<string | number> | null;
89
- initialValues?: GroupedSelectValues | SelectValue[];
90
- pathToValue?: string;
91
- }): SelectValue | SelectValue[] | undefined;
1
+ export { HookedInputSelect } from './HookedInputSelect';
2
+ export { InputSelect, flatSelectValues, getDefaultValueFromFlatten, isGroupedSelectValues, isMultiValueSelected, isSingleValueSelected, type InputSelectProps, type SelectValue } from './InputSelect';
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { type InputSimpleSelectProps } from './InputSimpleSelect';
3
+ interface Props extends InputSimpleSelectProps {
4
+ /**
5
+ * field name to match hook-form state
6
+ */
7
+ name: string;
8
+ /**
9
+ * show validation error message underneath
10
+ */
11
+ showValidation?: boolean;
12
+ }
13
+ /**
14
+ * `InputToggleListBox` component ready to be used with the `react-hook-form` context.
15
+ * @see InputSimpleSelect
16
+ */
17
+ export declare function HookedInputSimpleSelect({ name, showValidation, ...props }: Props): JSX.Element;
18
+ export declare namespace HookedInputSimpleSelect {
19
+ var displayName: string;
20
+ }
21
+ export {};