@commercelayer/app-elements 0.0.1

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 (88) hide show
  1. package/LICENSE +21 -0
  2. package/dist/@types/Elements.d.ts +1 -0
  3. package/dist/Async-ba6be658.js +80 -0
  4. package/dist/InputDateComponent-89d2ab03.js +8923 -0
  5. package/dist/Select-72746d2c.js +34 -0
  6. package/dist/helpers/date.d.ts +8 -0
  7. package/dist/helpers/downloadJsonAsFile.d.ts +9 -0
  8. package/dist/hooks/useClickAway.d.ts +2 -0
  9. package/dist/main-dc0e3952.js +5009 -0
  10. package/dist/main.d.ts +55 -0
  11. package/dist/main.js +67 -0
  12. package/dist/overrides-52d8822b.js +4253 -0
  13. package/dist/providers/CoreSdkProvider/index.d.ts +20 -0
  14. package/dist/providers/CoreSdkProvider/makeSdkClient.d.ts +7 -0
  15. package/dist/providers/ErrorBoundary.d.ts +19 -0
  16. package/dist/providers/TokenProvider/getAccessTokenFromUrl.d.ts +1 -0
  17. package/dist/providers/TokenProvider/getInfoFromJwt.d.ts +7 -0
  18. package/dist/providers/TokenProvider/index.d.ts +62 -0
  19. package/dist/providers/TokenProvider/reducer.d.ts +21 -0
  20. package/dist/providers/TokenProvider/storage.d.ts +14 -0
  21. package/dist/providers/TokenProvider/types.d.ts +44 -0
  22. package/dist/providers/TokenProvider/url.d.ts +7 -0
  23. package/dist/providers/TokenProvider/validateToken.d.ts +24 -0
  24. package/dist/style.css +1 -0
  25. package/dist/ui/atoms/A.d.ts +8 -0
  26. package/dist/ui/atoms/Badge.d.ts +11 -0
  27. package/dist/ui/atoms/BlockCode.d.ts +11 -0
  28. package/dist/ui/atoms/Button.d.ts +23 -0
  29. package/dist/ui/atoms/Card.d.ts +8 -0
  30. package/dist/ui/atoms/Container.d.ts +20 -0
  31. package/dist/ui/atoms/CopyToClipboard.d.ts +19 -0
  32. package/dist/ui/atoms/DelayShow.d.ts +10 -0
  33. package/dist/ui/atoms/EmptyState.d.ts +13 -0
  34. package/dist/ui/atoms/FormFooter.d.ts +10 -0
  35. package/dist/ui/atoms/Hint.d.ts +11 -0
  36. package/dist/ui/atoms/Icon.d.ts +37 -0
  37. package/dist/ui/atoms/Legend.d.ts +20 -0
  38. package/dist/ui/atoms/PageHeading.d.ts +39 -0
  39. package/dist/ui/atoms/Pagination.d.ts +27 -0
  40. package/dist/ui/atoms/Skeleton.d.ts +41 -0
  41. package/dist/ui/atoms/Spacer.d.ts +28 -0
  42. package/dist/ui/atoms/StatusDot.d.ts +9 -0
  43. package/dist/ui/atoms/StatusIcon.d.ts +16 -0
  44. package/dist/ui/atoms/Tabs.d.ts +46 -0
  45. package/dist/ui/atoms/Text.d.ts +21 -0
  46. package/dist/ui/atoms/dropdown/DropdownMenu.d.ts +10 -0
  47. package/dist/ui/atoms/dropdown/DropdownMenuDivider.d.ts +9 -0
  48. package/dist/ui/atoms/dropdown/DropdownMenuItem.d.ts +10 -0
  49. package/dist/ui/atoms/dropdown/index.d.ts +3 -0
  50. package/dist/ui/atoms/tables/Td.d.ts +9 -0
  51. package/dist/ui/atoms/tables/Th.d.ts +9 -0
  52. package/dist/ui/atoms/tables/Tr.d.ts +9 -0
  53. package/dist/ui/atoms/tables/index.d.ts +3 -0
  54. package/dist/ui/composite/ContextMenu.d.ts +10 -0
  55. package/dist/ui/composite/PageError.d.ts +30 -0
  56. package/dist/ui/composite/PageLayout.d.ts +17 -0
  57. package/dist/ui/composite/PageSkeleton.d.ts +10 -0
  58. package/dist/ui/composite/Report.d.ts +19 -0
  59. package/dist/ui/forms/Input.d.ts +14 -0
  60. package/dist/ui/forms/InputDate/InputDateComponent.d.ts +45 -0
  61. package/dist/ui/forms/InputDate/index.d.ts +5 -0
  62. package/dist/ui/forms/InputDateRange.d.ts +23 -0
  63. package/dist/ui/forms/InputFeedback.d.ts +11 -0
  64. package/dist/ui/forms/InputFile.d.ts +10 -0
  65. package/dist/ui/forms/InputJson.d.ts +14 -0
  66. package/dist/ui/forms/InputReadonly.d.ts +24 -0
  67. package/dist/ui/forms/InputSelect/Async.d.ts +11 -0
  68. package/dist/ui/forms/InputSelect/Select.d.ts +10 -0
  69. package/dist/ui/forms/InputSelect/index.d.ts +59 -0
  70. package/dist/ui/forms/InputSelect/overrides.d.ts +10 -0
  71. package/dist/ui/forms/InputSelect/styles.d.ts +4 -0
  72. package/dist/ui/forms/InputTextArea.d.ts +6 -0
  73. package/dist/ui/forms/InputToggleBox.d.ts +9 -0
  74. package/dist/ui/forms/InputToggleListBox.d.ts +15 -0
  75. package/dist/ui/forms/InputWrapper.d.ts +34 -0
  76. package/dist/ui/forms/Label.d.ts +9 -0
  77. package/dist/ui/forms/RadioButtons.d.ts +18 -0
  78. package/dist/ui/lists/List.d.ts +37 -0
  79. package/dist/ui/lists/ListDetails.d.ts +32 -0
  80. package/dist/ui/lists/ListDetailsItem.d.ts +22 -0
  81. package/dist/ui/lists/ListItem.d.ts +12 -0
  82. package/dist/ui/lists/ListItemTask.d.ts +33 -0
  83. package/dist/ui/tables/Table.d.ts +10 -0
  84. package/dist/ui/tables/TableData.d.ts +13 -0
  85. package/dist/utils/children.d.ts +15 -0
  86. package/dist/utils/extractHeaders.d.ts +6 -0
  87. package/dist/utils/pagination.d.ts +43 -0
  88. package/package.json +70 -0
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from 'react';
2
+ interface SkeletonProps {
3
+ /**
4
+ * This prevents Skeleton to appear immediately.
5
+ * It can be used when loading times are too short and you don't want flashing of content
6
+ */
7
+ delayMs?: number;
8
+ /**
9
+ * Manly <SkeletonItem /> components should be used as children.
10
+ * But you might want to also pass a grid or something else that has <SkeletonItem /> as children
11
+ */
12
+ children: ReactNode;
13
+ }
14
+ declare function Skeleton({ children, delayMs, ...rest }: SkeletonProps): JSX.Element;
15
+ declare namespace Skeleton {
16
+ var displayName: string;
17
+ }
18
+ interface SkeletonItemProps {
19
+ /**
20
+ * CSS classes
21
+ */
22
+ className?: string;
23
+ /**
24
+ * Can be `box` (default) to render a rectangular shape or `circle`
25
+ */
26
+ type?: 'box' | 'circle';
27
+ /**
28
+ * CSS dimension for width. It can be number if expressed in pixels or string.
29
+ * Example: `16`, `1rem` or '100%'.
30
+ * If no className is provided, the default value is `100%`.
31
+ */
32
+ width?: string | number;
33
+ /**
34
+ * CSS dimension for height. It can be number if expressed in pixels or string.
35
+ * Example: `16`, `1rem` or '100%'.
36
+ * If no className is provided, the default value is `1em`.
37
+ */
38
+ height?: string | number;
39
+ }
40
+ export declare function SkeletonItem({ className, type, width, height, ...rest }: SkeletonItemProps): JSX.Element;
41
+ export { Skeleton };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ export interface SpacingProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * Value to be applied as `margin-top`
6
+ */
7
+ top?: SpacingValues;
8
+ /**
9
+ * Value to be applied as `margin-bottom`.
10
+ */
11
+ bottom?: SpacingValues;
12
+ children?: ReactNode;
13
+ }
14
+ /**
15
+ * Possible values are:
16
+ * 2: 0.5rem, 8px
17
+ * 4: 1rem, 16px
18
+ * 6: 1.5rem, 24px
19
+ * 8: 2rem, 32px
20
+ * 12: 3rem, 48px
21
+ * 14: 3.5rem, 56px
22
+ */
23
+ export declare type SpacingValues = '2' | '4' | '6' | '8' | '12' | '14';
24
+ declare function Spacer({ top, bottom, children, ...rest }: SpacingProps): JSX.Element;
25
+ declare namespace Spacer {
26
+ var displayName: string;
27
+ }
28
+ export { Spacer };
@@ -0,0 +1,9 @@
1
+ export declare type DotVariant = 'success' | 'danger' | 'warning';
2
+ export interface StatusDotProps {
3
+ variant: DotVariant;
4
+ }
5
+ declare function StatusDot({ variant, ...rest }: StatusDotProps): JSX.Element;
6
+ declare namespace StatusDot {
7
+ var displayName: string;
8
+ }
9
+ export { StatusDot };
@@ -0,0 +1,16 @@
1
+ export declare type StatusUI = 'success' | 'danger' | 'pending' | 'progress';
2
+ export interface StatusIconProps {
3
+ /**
4
+ * A different icon will be displayed depending on the status. When status is `progress` we can also pass a `percentage` prop
5
+ */
6
+ status: StatusUI;
7
+ /**
8
+ * Only used when `status` is progress. Accepts number from 0 to 100
9
+ */
10
+ percentage?: number;
11
+ }
12
+ declare function StatusIcon({ status, percentage, ...rest }: StatusIconProps): JSX.Element;
13
+ declare namespace StatusIcon {
14
+ var displayName: string;
15
+ }
16
+ export { StatusIcon };
@@ -0,0 +1,46 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface Props {
3
+ /**
4
+ * Used for accessability
5
+ */
6
+ id?: string;
7
+ className?: string;
8
+ /**
9
+ * Event the fires every time a tab is activated. Note that this also fires on first render.
10
+ */
11
+ onTabSwitch?: (tabIndex: number) => void;
12
+ /**
13
+ * Children can only be <Tab> components
14
+ * Example:
15
+ * ```
16
+ * <Tabs>
17
+ * <Tab name="First tab">My content<Tab>
18
+ * <Tab name="Second tab">Another content<Tab>
19
+ * </Tabs>
20
+ * ```
21
+ */
22
+ children: Array<React.ReactElement<TabProps, typeof Tab> | null>;
23
+ /**
24
+ * This controls whether the content of inactive panels should be un-mounted or kept mounted but hidden.
25
+ */
26
+ keepAlive?: boolean;
27
+ }
28
+ declare function Tabs({ id, children, onTabSwitch, className, keepAlive, ...rest }: Props): JSX.Element;
29
+ declare namespace Tabs {
30
+ var displayName: string;
31
+ }
32
+ interface TabProps {
33
+ /**
34
+ * This is the tab name used to render the Tab Navigation on top
35
+ */
36
+ name: string;
37
+ /**
38
+ * Tab Panel content
39
+ */
40
+ children: ReactNode;
41
+ }
42
+ declare function Tab({ children }: TabProps): React.ReactElement;
43
+ declare namespace Tab {
44
+ var displayName: string;
45
+ }
46
+ export { Tab, Tabs };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ export declare type TextVariant = 'danger' | 'success' | 'primary' | 'orange' | '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';
8
+ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
9
+ children?: ReactNode;
10
+ variant?: TextVariant;
11
+ size?: TextSize;
12
+ weight?: TextWeight;
13
+ align?: TextAlignment;
14
+ wrap?: TextWrap;
15
+ tag?: 'div' | 'span';
16
+ }
17
+ declare function Text({ children, className, variant, weight, size, align, wrap, tag, ...rest }: TextProps): JSX.Element;
18
+ declare namespace Text {
19
+ var displayName: string;
20
+ }
21
+ export { Text };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Props extends React.HTMLAttributes<HTMLElement> {
3
+ children?: React.ReactNode;
4
+ arrow?: 'none';
5
+ }
6
+ declare function DropdownMenu({ children, arrow, ...rest }: Props): JSX.Element;
7
+ declare namespace DropdownMenu {
8
+ var displayName: string;
9
+ }
10
+ export { DropdownMenu };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props extends React.HTMLAttributes<HTMLElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ declare function DropdownMenuDivider({ children, ...rest }: Props): JSX.Element;
6
+ declare namespace DropdownMenuDivider {
7
+ var displayName: string;
8
+ }
9
+ export { DropdownMenuDivider };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Props extends React.HTMLAttributes<HTMLElement> {
3
+ label: string;
4
+ icon?: React.ReactNode;
5
+ }
6
+ declare function DropdownMenuItem({ label, icon, ...rest }: Props): JSX.Element;
7
+ declare namespace DropdownMenuItem {
8
+ var displayName: string;
9
+ }
10
+ export { DropdownMenuItem };
@@ -0,0 +1,3 @@
1
+ export { DropdownMenu } from './DropdownMenu';
2
+ export { DropdownMenuItem } from './DropdownMenuItem';
3
+ export { DropdownMenuDivider } from './DropdownMenuDivider';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props extends React.TdHTMLAttributes<HTMLElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ declare function Td({ children, ...rest }: Props): JSX.Element;
6
+ declare namespace Td {
7
+ var displayName: string;
8
+ }
9
+ export { Td };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props extends React.ThHTMLAttributes<HTMLElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ declare function Th({ children, ...rest }: Props): JSX.Element;
6
+ declare namespace Th {
7
+ var displayName: string;
8
+ }
9
+ export { Th };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props extends React.HTMLAttributes<HTMLElement> {
3
+ children?: React.ReactNode;
4
+ }
5
+ declare function Tr({ children, ...rest }: Props): JSX.Element;
6
+ declare namespace Tr {
7
+ var displayName: string;
8
+ }
9
+ export { Tr };
@@ -0,0 +1,3 @@
1
+ export { Tr } from './Tr';
2
+ export { Th } from './Th';
3
+ export { Td } from './Td';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ menuLabel?: React.ReactNode;
4
+ menuItems: React.ReactNode;
5
+ }
6
+ declare function ContextMenu({ menuLabel, menuItems, ...rest }: Props): JSX.Element;
7
+ declare namespace ContextMenu {
8
+ var displayName: string;
9
+ }
10
+ export { ContextMenu };
@@ -0,0 +1,30 @@
1
+ interface PageErrorProps {
2
+ /**
3
+ * Main page title wrapped in a h1 element
4
+ */
5
+ pageTitle?: string;
6
+ /**
7
+ * Optional callback that will be called when "go back" button is pressed
8
+ * If missing, the "go back" button will not be shown
9
+ */
10
+ onGoBack?: () => void;
11
+ /**
12
+ * The name of the error to be show above the detailed message text.
13
+ * Example: 'Not Found'
14
+ */
15
+ errorName: string;
16
+ /**
17
+ * Detailed message that explains the error better.
18
+ * Example: 'We could not find the page you are looking for.'
19
+ */
20
+ errorDescription: string;
21
+ /**
22
+ * Any element that can be used as CTA to help the user to navigate away from this error page
23
+ */
24
+ actionButton?: JSX.Element;
25
+ }
26
+ declare function PageError({ pageTitle, onGoBack, errorName, errorDescription, actionButton, ...rest }: PageErrorProps): JSX.Element;
27
+ declare namespace PageError {
28
+ var displayName: string;
29
+ }
30
+ export { PageError };
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { PageHeadingProps } from '../atoms/PageHeading';
3
+ export interface PageLayoutProps extends Omit<PageHeadingProps, 'badgeVariant' | 'badgeLabel'> {
4
+ /**
5
+ * Page content
6
+ */
7
+ children: ReactNode;
8
+ /**
9
+ * When mode is `test`, it will render a `TEST DATA` Badge to inform user api is working in test mode.
10
+ */
11
+ mode?: 'test' | 'live';
12
+ }
13
+ declare function PageLayout({ title, description, onGoBack, children, actionButton, mode, ...rest }: PageLayoutProps): JSX.Element;
14
+ declare namespace PageLayout {
15
+ var displayName: string;
16
+ }
17
+ export { PageLayout };
@@ -0,0 +1,10 @@
1
+ interface PageSkeletonProps {
2
+ layout?: 'list' | 'details';
3
+ hasHeaderDescription?: boolean;
4
+ delayMs?: number;
5
+ }
6
+ declare function PageSkeleton({ layout, hasHeaderDescription, delayMs }: PageSkeletonProps): JSX.Element;
7
+ declare namespace PageSkeleton {
8
+ var displayName: string;
9
+ }
10
+ export { PageSkeleton };
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ interface ReportItem {
3
+ label: string;
4
+ count: ReactNode;
5
+ linkUrl?: string;
6
+ linkLabel?: string;
7
+ downloadJsonAsFile?: object;
8
+ downloadJsonFilename?: string;
9
+ }
10
+ export interface ReportProps {
11
+ items: ReportItem[];
12
+ isLoading?: boolean;
13
+ loadingLines?: number;
14
+ }
15
+ declare function Report({ items, isLoading, loadingLines, ...rest }: ReportProps): JSX.Element;
16
+ declare namespace Report {
17
+ var displayName: string;
18
+ }
19
+ export { Report };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { InputWrapperBaseProps } from '../forms/InputWrapper';
3
+ export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
+ /**
5
+ * controlled type
6
+ */
7
+ type?: 'text' | 'number' | 'password' | 'tel' | 'url' | 'email';
8
+ /**
9
+ * optional css class names used for the input element
10
+ */
11
+ className?: string;
12
+ }
13
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
14
+ export { Input };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import DatePicker from 'react-datepicker';
3
+ import { InputWrapperBaseProps } from '../../forms/InputWrapper';
4
+ export declare type MaybeDate = Date | null;
5
+ export interface InputDateProps extends InputWrapperBaseProps {
6
+ /**
7
+ * controlled value
8
+ */
9
+ value?: MaybeDate;
10
+ /**
11
+ * callback fired when value is changed
12
+ */
13
+ onChange: (date: MaybeDate) => void;
14
+ /**
15
+ * optional css class names used for the outer wrapper/container element
16
+ */
17
+ wrapperClassName?: string;
18
+ /**
19
+ * optional css class names used for the input element
20
+ */
21
+ inputClassName?: string;
22
+ /**
23
+ * optional placeholder text
24
+ */
25
+ placeholder?: string;
26
+ /**
27
+ * string to be parsed as formatter (eg. MM/dd/yyyy, dd-MM-yy, ect...).
28
+ * When undefined, will autodetect format from user's browser
29
+ */
30
+ format?: string;
31
+ /**
32
+ * disable selection of previous dates
33
+ */
34
+ minDate?: Date;
35
+ /**
36
+ * set placeholder as detected date format
37
+ */
38
+ autoPlaceholder?: boolean;
39
+ /**
40
+ * enables a button to clear the selected date
41
+ */
42
+ isClearable?: boolean;
43
+ }
44
+ declare const InputDateComponent: React.ForwardRefExoticComponent<InputDateProps & React.RefAttributes<DatePicker<never, undefined>>>;
45
+ export { InputDateComponent };
@@ -0,0 +1,5 @@
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>>>;
5
+ export { InputDate };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { InputDateProps, MaybeDate } from './InputDate/InputDateComponent';
3
+ import { InputWrapperBaseProps } from '../forms/InputWrapper';
4
+ export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable' | 'format' | 'autoPlaceholder'>, InputWrapperBaseProps {
5
+ /**
6
+ * a tuple that represents the [from, to] dates
7
+ */
8
+ value: [MaybeDate, MaybeDate];
9
+ /**
10
+ * callback triggered when one of the two dates changes
11
+ */
12
+ onChange: (dates: [MaybeDate, MaybeDate]) => void;
13
+ /**
14
+ * optional placeholder text for the `from` date
15
+ */
16
+ fromPlaceholder?: string;
17
+ /**
18
+ * optional placeholder text for the `to` date
19
+ */
20
+ toPlaceholder?: string;
21
+ }
22
+ declare const InputDateRange: React.ForwardRefExoticComponent<InputDateRangeProps & React.RefAttributes<HTMLDivElement>>;
23
+ export { InputDateRange };
@@ -0,0 +1,11 @@
1
+ export declare type FeedbackVariant = 'danger' | 'success' | 'warning';
2
+ export interface InputFeedbackProps {
3
+ message: string;
4
+ variant?: FeedbackVariant;
5
+ className?: string;
6
+ }
7
+ declare function InputFeedback({ className, message, variant, ...rest }: InputFeedbackProps): JSX.Element;
8
+ declare namespace InputFeedback {
9
+ var displayName: string;
10
+ }
11
+ export { InputFeedback };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { InputWrapperBaseProps } from '../forms/InputWrapper';
3
+ interface InputFileProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
+ /**
5
+ * If defined, it shows a progress bar at the bottom. It must be between 0 and 100.
6
+ */
7
+ progress?: number;
8
+ }
9
+ declare const InputFile: React.ForwardRefExoticComponent<InputFileProps & React.RefAttributes<HTMLInputElement>>;
10
+ export { InputFile };
@@ -0,0 +1,14 @@
1
+ import { InputWrapperBaseProps } from './InputWrapper';
2
+ export interface InputJsonProps<JsonType> extends InputWrapperBaseProps {
3
+ placeholder: object;
4
+ validateFn: (json: any) => JsonType;
5
+ onDataReady: (validJson: JsonType) => void;
6
+ onDataResetRequest: () => void;
7
+ errorMessageText?: string;
8
+ className?: string;
9
+ }
10
+ declare function InputJson<JsonType extends object>({ placeholder, validateFn, onDataReady, onDataResetRequest, errorMessageText, className, label, feedback, hint, ...rest }: InputJsonProps<JsonType>): JSX.Element;
11
+ declare namespace InputJson {
12
+ var displayName: string;
13
+ }
14
+ export { InputJson };
@@ -0,0 +1,24 @@
1
+ import { InputWrapperBaseProps } from './InputWrapper';
2
+ interface InputReadonlyProps extends InputWrapperBaseProps {
3
+ /**
4
+ * controlled value
5
+ */
6
+ value?: string;
7
+ /**
8
+ * optional css class names used for the outer wrapper/container element
9
+ */
10
+ wrapperClassName?: string;
11
+ /**
12
+ * optional css class names used for the input element
13
+ */
14
+ inputClassName?: string;
15
+ /**
16
+ * optional prop to define whether to show or not the Copy to clipboard button
17
+ */
18
+ showCopyAction?: boolean;
19
+ }
20
+ declare function InputReadonly({ value, wrapperClassName, inputClassName, showCopyAction, label, hint, feedback, ...rest }: InputReadonlyProps): JSX.Element;
21
+ declare namespace InputReadonly {
22
+ var displayName: string;
23
+ }
24
+ export { InputReadonly };
@@ -0,0 +1,11 @@
1
+ import { InputSelectProps, SelectValue } from './';
2
+ import { StylesConfig } from 'react-select';
3
+ import { SetRequired } from 'type-fest';
4
+ interface AsyncSelectComponentProps extends Omit<SetRequired<InputSelectProps, 'loadAsyncValues'>, 'label' | 'hint'> {
5
+ styles: StylesConfig<SelectValue>;
6
+ }
7
+ declare function AsyncSelectComponent({ onSelect, noOptionsMessage, initialValues, loadAsyncValues, ...rest }: AsyncSelectComponentProps): JSX.Element;
8
+ declare namespace AsyncSelectComponent {
9
+ var displayName: string;
10
+ }
11
+ export { AsyncSelectComponent };
@@ -0,0 +1,10 @@
1
+ import { InputSelectProps, SelectValue } from './';
2
+ import { StylesConfig } from 'react-select';
3
+ interface SelectComponentProps extends Omit<InputSelectProps, 'loadAsyncValues' | 'label' | 'hint'> {
4
+ styles: StylesConfig<SelectValue>;
5
+ }
6
+ declare function SelectComponent({ onSelect, noOptionsMessage, initialValues, ...rest }: SelectComponentProps): JSX.Element;
7
+ declare namespace SelectComponent {
8
+ var displayName: string;
9
+ }
10
+ export { SelectComponent };
@@ -0,0 +1,59 @@
1
+ import { FocusEventHandler } from 'react';
2
+ import { MultiValue, SingleValue } from 'react-select';
3
+ import { InputWrapperBaseProps } from '../../forms/InputWrapper';
4
+ export declare 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 declare 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
+ onSelect: (value: PossibleSelectValue) => void;
25
+ onBlur?: FocusEventHandler<HTMLInputElement>;
26
+ name?: string;
27
+ menuIsOpen?: boolean;
28
+ noOptionsMessage?: string;
29
+ className?: string;
30
+ loadAsyncValues?: (inputValue: string) => Promise<GroupedSelectValues | SelectValue[]>;
31
+ }
32
+ declare function InputSelect({ label, hint, feedback, menuIsOpen, initialValues, defaultValue, isClearable, isLoading, loadingText, placeholder, isDisabled, isSearchable, onSelect, isMulti, onBlur, name, className, loadAsyncValues, noOptionsMessage, ...rest }: InputSelectProps): JSX.Element;
33
+ declare namespace InputSelect {
34
+ var displayName: string;
35
+ }
36
+ /**
37
+ * Helper function to understand and refine type of a single selected value
38
+ * @param selectedValue possible value returned from select component
39
+ * @returns true if selected value is single, from this point TypeScript will treat this as `SelectValue` type
40
+ */
41
+ export declare function isSingleValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue;
42
+ /**
43
+ * Helper function to extract only the `value` from the `SelectValue`
44
+ * @param selectedValue possible value returned from select component
45
+ * @returns a string or an array of strings.
46
+ * Examples:
47
+ * ```
48
+ * {value: 'ABCD', label: 'T-Shirt XL'}
49
+ * // returns 'ABCD'
50
+ *
51
+ * [
52
+ * {value: 'ABCD', label: 'T-Shirt M'},
53
+ * {value: '1234', label: 'T-Shirt XL'},
54
+ * ]
55
+ * // returns ['ABCD', '1234']
56
+ * ```
57
+ */
58
+ export declare function flatSelectValues(selectedValue: PossibleSelectValue): null | string | Array<string | number>;
59
+ export { InputSelect };
@@ -0,0 +1,10 @@
1
+ import { DropdownIndicatorProps, ClearIndicatorProps } from 'react-select';
2
+ import { SelectValue } from '.';
3
+ declare function DropdownIndicator(props: DropdownIndicatorProps<SelectValue>): JSX.Element;
4
+ declare function ClearIndicator(props: ClearIndicatorProps<SelectValue>): JSX.Element;
5
+ declare const selectComponentOverrides: {
6
+ DropdownIndicator: typeof DropdownIndicator;
7
+ IndicatorSeparator: () => null;
8
+ ClearIndicator: typeof ClearIndicator;
9
+ };
10
+ export default selectComponentOverrides;
@@ -0,0 +1,4 @@
1
+ import { StylesConfig } from 'react-select';
2
+ import { SelectValue } from '.';
3
+ import { InputFeedbackProps } from '../../forms/InputFeedback';
4
+ export declare const getSelectStyles: (feedbackVariant?: InputFeedbackProps['variant']) => StylesConfig<SelectValue>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { InputWrapperBaseProps } from '../forms/InputWrapper';
3
+ interface InputTextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, InputWrapperBaseProps {
4
+ }
5
+ declare const InputTextArea: React.ForwardRefExoticComponent<InputTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export { InputTextArea };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface InputToggleBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
3
+ id: string;
4
+ label: string;
5
+ description?: React.ReactNode;
6
+ className?: string;
7
+ }
8
+ declare const InputToggleBox: React.ForwardRefExoticComponent<InputToggleBoxProps & React.RefAttributes<HTMLInputElement>>;
9
+ export { InputToggleBox };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface InputToggleListBoxOption {
3
+ value: string;
4
+ label: string;
5
+ }
6
+ export interface InputToggleListBoxProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'value' | 'onSelect'> {
7
+ id: string;
8
+ label: string;
9
+ description?: React.ReactNode;
10
+ value?: string;
11
+ options: InputToggleListBoxOption[];
12
+ className?: string;
13
+ }
14
+ declare const InputToggleListBox: React.ForwardRefExoticComponent<InputToggleListBoxProps & React.RefAttributes<HTMLSelectElement>>;
15
+ export { InputToggleListBox };