@hyphen/hyphen-components 2.9.0 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/Alert.constants.d.ts +8 -0
- package/dist/components/Alert/Alert.d.ts +51 -0
- package/dist/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/components/Alert/Alert.types.d.ts +7 -0
- package/dist/components/Badge/Badge.d.ts +31 -0
- package/dist/components/Badge/Badge.stories.d.ts +8 -0
- package/dist/components/Box/Box.d.ts +228 -0
- package/dist/components/Box/Box.stories.d.ts +42 -0
- package/dist/components/Button/Button.constants.d.ts +3 -0
- package/dist/components/Button/Button.d.ts +83 -0
- package/dist/components/Button/Button.stories.d.ts +14 -0
- package/dist/components/Card/Card.d.ts +17 -0
- package/dist/components/Card/Card.stories.d.ts +8 -0
- package/dist/components/Card/components/CardFooter/CardFooter.d.ts +13 -0
- package/dist/components/Card/components/CardHeader/CardHeader.d.ts +21 -0
- package/dist/components/Card/components/CardSection/CardSection.d.ts +46 -0
- package/dist/components/Card/components/index.d.ts +3 -0
- package/dist/components/CheckboxInput/CheckboxInput.d.ts +72 -0
- package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +18 -0
- package/dist/components/CheckboxInput/components/Checkbox.d.ts +71 -0
- package/dist/components/CheckboxInput/components/CheckboxIcon.d.ts +27 -0
- package/dist/components/DateInput/DateInput.d.ts +55 -0
- package/dist/components/DateInput/DateInput.stories.d.ts +11 -0
- package/dist/components/DatePicker/DatePicker.d.ts +86 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +13 -0
- package/dist/components/Details/Details.d.ts +15 -0
- package/dist/components/Details/Details.stories.d.ts +6 -0
- package/dist/components/Details/DetailsSummary.d.ts +7 -0
- package/dist/components/Drawer/Drawer.d.ts +88 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +15 -0
- package/dist/components/FormControl/FormControl.d.ts +38 -0
- package/dist/components/FormLabel/FormLabel.d.ts +41 -0
- package/dist/components/FormLabel/FormLabel.stories.d.ts +6 -0
- package/dist/components/Formik/Formik.stories.d.ts +18 -0
- package/dist/components/Formik/FormikCheckboxInput/FormikCheckboxInput.d.ts +12 -0
- package/dist/components/Formik/FormikRadioGroup/FormikRadioGroup.d.ts +12 -0
- package/dist/components/Formik/FormikSelectInput/FormikSelectInput.d.ts +12 -0
- package/dist/components/Formik/FormikSelectInputInset/FormikSelectInputInset.d.ts +12 -0
- package/dist/components/Formik/FormikSelectInputNative/FormikSelectInputNative.d.ts +12 -0
- package/dist/components/Formik/FormikTextInput/FormikTextInput.d.ts +12 -0
- package/dist/components/Formik/FormikTextInputInset/FormikTextInputInset.d.ts +12 -0
- package/dist/components/Formik/FormikTextareaInput/FormikTextareaInput.d.ts +12 -0
- package/dist/components/Formik/FormikTextareaInputInset/FormikTextareaInputInset.d.ts +12 -0
- package/dist/components/Formik/FormikTimePicker/FormikTimePicker.d.ts +12 -0
- package/dist/components/Formik/FormikTimePickerNative/FormikTimePickerNative.d.ts +12 -0
- package/dist/components/Formik/FormikToggle/FormikToggle.d.ts +12 -0
- package/dist/components/Heading/Heading.constants.d.ts +10 -0
- package/dist/components/Heading/Heading.d.ts +35 -0
- package/dist/components/Heading/Heading.stories.d.ts +9 -0
- package/dist/components/HelpText/HelpText.d.ts +12 -0
- package/dist/components/Icon/Icon.d.ts +22 -0
- package/dist/components/Icon/Icon.stories.d.ts +10 -0
- package/dist/components/InputValidationMessage/InputValidationMessage.d.ts +9 -0
- package/dist/components/Modal/Modal.d.ts +75 -0
- package/dist/components/Modal/Modal.stories.d.ts +11 -0
- package/dist/components/Modal/components/ModalBody/ModalBody.d.ts +4 -0
- package/dist/components/Modal/components/ModalFooter/ModalFooter.d.ts +4 -0
- package/dist/components/Modal/components/ModalHeader/ModalHeader.d.ts +16 -0
- package/dist/components/Modal/components/index.d.ts +4 -0
- package/dist/components/Pagination/Pagination.d.ts +51 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +8 -0
- package/dist/components/Pagination/Pagination.utilities.d.ts +11 -0
- package/dist/components/Popover/Popover.d.ts +80 -0
- package/dist/components/Popover/Popover.stories.d.ts +14 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +75 -0
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +16 -0
- package/dist/components/RadioGroup/RadioInput/RadioInput.d.ts +57 -0
- package/dist/components/RadioGroup/RadioInput/RadioInputIcon.d.ts +27 -0
- package/dist/components/ResponsiveProvider/ResponsiveProvider.d.ts +17 -0
- package/dist/components/ResponsiveProvider/ResponsiveProvider.stories.d.ts +7 -0
- package/dist/components/SelectInput/SelectInput.d.ts +110 -0
- package/dist/components/SelectInput/SelectInput.stories.d.ts +20 -0
- package/dist/components/SelectInputInset/SelectInputInset.d.ts +92 -0
- package/dist/components/SelectInputInset/SelectInputInset.stories.d.ts +12 -0
- package/dist/components/SelectInputNative/SelectInputNative.d.ts +43 -0
- package/dist/components/SelectInputNative/SelectInputNative.stories.d.ts +16 -0
- package/dist/components/Spinner/Spinner.d.ts +12 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +8 -0
- package/dist/components/Table/Table.d.ts +86 -0
- package/dist/components/Table/Table.stories.d.ts +31 -0
- package/dist/components/Table/TableBody/TableBody.d.ts +52 -0
- package/dist/components/Table/TableBody/TableBodyCell/TableBodyCell.d.ts +45 -0
- package/dist/components/Table/TableHead/TableHead.d.ts +46 -0
- package/dist/components/Table/TableHead/TableHeaderCell/TableHeaderCell.d.ts +65 -0
- package/dist/components/Table/common/TableRow/TableRow.d.ts +67 -0
- package/dist/components/TextInput/TextInput.d.ts +106 -0
- package/dist/components/TextInput/TextInput.stories.d.ts +19 -0
- package/dist/components/TextInputInset/TextInputInset.d.ts +102 -0
- package/dist/components/TextInputInset/TextInputInset.stories.d.ts +13 -0
- package/dist/components/TextareaInput/TextareaInput.d.ts +97 -0
- package/dist/components/TextareaInput/TextareaInput.stories.d.ts +23 -0
- package/dist/components/TextareaInputInset/TextareaInputInset.d.ts +105 -0
- package/dist/components/TextareaInputInset/TextareaInputInset.stories.d.ts +12 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +14 -0
- package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +6 -0
- package/dist/components/TimePicker/TimePicker.d.ts +35 -0
- package/dist/components/TimePicker/TimePicker.stories.d.ts +12 -0
- package/dist/components/TimePickerNative/TimePickerNative.d.ts +39 -0
- package/dist/components/TimePickerNative/TimePickerNative.stories.d.ts +11 -0
- package/dist/components/Toast/Toast.store.d.ts +36 -0
- package/dist/components/Toast/Toast.stories.d.ts +14 -0
- package/dist/components/Toast/Toast.types.d.ts +75 -0
- package/dist/components/Toast/ToastContainer.d.ts +43 -0
- package/dist/components/Toast/ToastNotification.d.ts +28 -0
- package/dist/components/Toast/index.d.ts +4 -0
- package/dist/components/Toast/toast.d.ts +20 -0
- package/dist/components/Toast/useToasts.d.ts +14 -0
- package/dist/components/Toggle/Toggle.d.ts +64 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +12 -0
- package/dist/constants/keyCodes.d.ts +2 -0
- package/dist/css/fonts.css +33 -0
- package/dist/css/index.css +32 -0
- package/dist/css/reset.css +98 -0
- package/dist/css/utilities.css +6049 -0
- package/dist/css/variables.css +418 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +9 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.stories.d.ts +6 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayouEffect.d.ts +2 -0
- package/dist/hooks/useOpenClose/useOpenClose.d.ts +39 -0
- package/dist/hooks/useOpenClose/useOpenClose.stories.d.ts +6 -0
- package/dist/hooks/useWindowSize/useWindowSize.d.ts +7 -0
- package/dist/hooks/useWindowSize/useWindowSize.stories.d.ts +6 -0
- package/dist/hyphen-components.cjs.development.js +4724 -0
- package/dist/hyphen-components.cjs.development.js.map +1 -0
- package/dist/hyphen-components.cjs.production.min.js +2 -0
- package/dist/hyphen-components.cjs.production.min.js.map +1 -0
- package/dist/hyphen-components.esm.js +4661 -0
- package/dist/hyphen-components.esm.js.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +8 -0
- package/dist/lib/cssShorthandToClasses.d.ts +4 -0
- package/dist/lib/doesStringIncludeCssUnit.d.ts +1 -0
- package/dist/lib/generateResponsiveClasses.d.ts +2 -0
- package/dist/lib/getAutoCompleteValue.d.ts +1 -0
- package/dist/lib/getColumnKeys.d.ts +3 -0
- package/dist/lib/getDimensionCss.d.ts +12 -0
- package/dist/lib/getElementType.d.ts +14 -0
- package/dist/lib/getFlexCss.d.ts +9 -0
- package/dist/lib/index.d.ts +15 -0
- package/dist/lib/isFunction.d.ts +2 -0
- package/dist/lib/mergeRefs.d.ts +2 -0
- package/dist/lib/prefersReducedMotion.d.ts +1 -0
- package/dist/lib/react-children-utilities/filter.d.ts +3 -0
- package/dist/lib/react-children-utilities/index.d.ts +1 -0
- package/dist/lib/reactRouterClickHandler.d.ts +12 -0
- package/dist/lib/resolveValue.d.ts +2 -0
- package/dist/lib/tokens.d.ts +22 -0
- package/dist/modes.d.ts +8 -0
- package/dist/types/index.d.ts +101 -0
- package/dist/types/lib.types.d.ts +3 -0
- package/package.json +2 -1
- package/src/components/Box/Box.tsx +1 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { SelectInputNativeProps } from '../../SelectInputNative/SelectInputNative';
|
|
4
|
+
export interface FormikSelectInputNativeProps extends Omit<SelectInputNativeProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLSelectElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: SelectInputNativeProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikSelectInputNative: React.FC<FormikSelectInputNativeProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { TextInputProps } from '../../TextInput/TextInput';
|
|
4
|
+
export interface FormikTextInputProps extends Omit<TextInputProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLInputElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: TextInputProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTextInput: React.FC<FormikTextInputProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { TextInputInsetProps } from '../../TextInputInset/TextInputInset';
|
|
4
|
+
export interface FormikTextInputInsetProps extends Omit<TextInputInsetProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLInputElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: TextInputInsetProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTextInputInset: React.FC<FormikTextInputInsetProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FormikValues, FieldAttributes } from 'formik';
|
|
3
|
+
import { TextareaInputProps } from '../../TextareaInput/TextareaInput';
|
|
4
|
+
export interface FormikTextareaInputProps extends Omit<TextareaInputProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLTextAreaElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: TextareaInputProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTextareaInput: FC<FormikTextareaInputProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FormikValues, FieldAttributes } from 'formik';
|
|
3
|
+
import { TextareaInputInsetProps } from '../../TextareaInputInset/TextareaInputInset';
|
|
4
|
+
export interface FormikTextareaInputInsetProps extends Omit<TextareaInputInsetProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLTextAreaElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: TextareaInputInsetProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTextareaInputInset: FC<FormikTextareaInputInsetProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FormikValues, FieldAttributes } from 'formik';
|
|
3
|
+
import { TimePickerProps } from '../../TimePicker/TimePicker';
|
|
4
|
+
export interface FormikTimePickerProps extends Omit<TimePickerProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLSelectElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: TimePickerProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTimePicker: FC<FormikTimePickerProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FormikValues, FieldAttributes } from 'formik';
|
|
3
|
+
import { TimePickerNativeProps } from '../../TimePickerNative/TimePickerNative';
|
|
4
|
+
export interface FormikTimePickerNativeProps extends Omit<TimePickerNativeProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLTextAreaElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange: TimePickerNativeProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikTimePickerNative: FC<FormikTimePickerNativeProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
export interface FormikToggleProps {
|
|
4
|
+
field: FieldAttributes<HTMLTextAreaElement>;
|
|
5
|
+
form: {
|
|
6
|
+
touched: FormikTouched<FormikValues>;
|
|
7
|
+
errors: FormikErrors<FormikValues>;
|
|
8
|
+
};
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikToggle: React.FC<FormikToggleProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type HEADING_LEVELS_TYPE = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
2
|
+
export declare const HEADING_LEVELS: HEADING_LEVELS_TYPE[];
|
|
3
|
+
export declare const HEADING_DEFAULT_SIZE_MAP: {
|
|
4
|
+
h1: string;
|
|
5
|
+
h2: string;
|
|
6
|
+
h3: string;
|
|
7
|
+
h4: string;
|
|
8
|
+
h5: string;
|
|
9
|
+
h6: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { FontColor, HeadingSize, ResponsiveProp } from '../../types';
|
|
3
|
+
import { HEADING_LEVELS_TYPE } from './Heading.constants';
|
|
4
|
+
export interface HeadingProps {
|
|
5
|
+
/**
|
|
6
|
+
* The DOM tag or react component to use for the element.
|
|
7
|
+
* Select the appropriate semantic element (h1-h6).
|
|
8
|
+
*/
|
|
9
|
+
as?: HEADING_LEVELS_TYPE;
|
|
10
|
+
/**
|
|
11
|
+
* Content of the heading. Can be a string or any valid DOM node.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Additional class names to add.
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A variant token identifier to use for the text variant. Available variants found:
|
|
20
|
+
* [here](https://github.com/hyphen/hyphen-design-tokens/blob/main/properties/color/font.json).
|
|
21
|
+
*/
|
|
22
|
+
color?: FontColor;
|
|
23
|
+
/**
|
|
24
|
+
* By default, size is determined by the chosen tag (e.g. h1 is bigger than h2).
|
|
25
|
+
* However, size can be set independently so that its size is appropriate for the surrounding content.
|
|
26
|
+
* Available sizes found:
|
|
27
|
+
* [here](https://github.com/hyphen/hyphen-design-tokens/blob/main/properties/size/font.json).
|
|
28
|
+
*/
|
|
29
|
+
size?: HeadingSize | ResponsiveProp<HeadingSize>;
|
|
30
|
+
/**
|
|
31
|
+
* Additional props to be spread to rendered element
|
|
32
|
+
*/
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export declare const Heading: FC<HeadingProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Heading } from './Heading';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Heading>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Levels: () => React.JSX.Element;
|
|
7
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
8
|
+
export declare const ResponsiveSizes: () => React.JSX.Element;
|
|
9
|
+
export declare const Colors: () => React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface HelpTextProps {
|
|
3
|
+
/**
|
|
4
|
+
* Contents of the help text.
|
|
5
|
+
*/
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Additional class names to add.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const HelpText: React.ForwardRefExoticComponent<HelpTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FontColor, FontSize, IconName, ResponsiveProp } from '../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export interface IconProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* A color token identifier to use for the text color.
|
|
7
|
+
*/
|
|
8
|
+
color?: FontColor | ResponsiveProp<FontColor>;
|
|
9
|
+
/**
|
|
10
|
+
* A [font size token](/?path=/docs/design-tokens-design-tokens--page#font-size) identifier
|
|
11
|
+
*/
|
|
12
|
+
size?: FontSize | ResponsiveProp<FontSize>;
|
|
13
|
+
/**
|
|
14
|
+
* Name of the icon
|
|
15
|
+
*/
|
|
16
|
+
name: IconName;
|
|
17
|
+
/**
|
|
18
|
+
* Additional props to be spread to rendered element
|
|
19
|
+
*/
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export declare const Icon: FC<IconProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Icon } from './Icon';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Icon>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: () => React.JSX.Element;
|
|
7
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
8
|
+
export declare const Colors: () => React.JSX.Element;
|
|
9
|
+
export declare const UnknownIcon: () => React.JSX.Element;
|
|
10
|
+
export declare const AvailableIcons: () => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Used by form inputs such as TextInput, to display a validation message for an invalid input.
|
|
4
|
+
*/
|
|
5
|
+
export interface InputValidationMessageProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
size?: 'xs' | 'sm' | 'md';
|
|
8
|
+
}
|
|
9
|
+
export declare const InputValidationMessage: FC<InputValidationMessageProps>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { CssOverflowValue } from '../../types';
|
|
3
|
+
import { BoxProps } from '../Box/Box';
|
|
4
|
+
import { ModalFooter, ModalHeader, ModalBody } from './components';
|
|
5
|
+
export interface ModalProps {
|
|
6
|
+
/**
|
|
7
|
+
* Handle zoom/pinch gestures on iOS devices when scroll locking is enabled.
|
|
8
|
+
*/
|
|
9
|
+
allowPinchZoom?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Each modal needs to be properly labeled to provide context for users with
|
|
12
|
+
* assistive technology such as screen readers. If a modal is announced to
|
|
13
|
+
* the user without a label, it can be confusing and difficult to navigate.
|
|
14
|
+
*/
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The id of the element that should be used as the Modal's label by assistive
|
|
18
|
+
* technologies like screen readers. Usually the id is set on the `Modal.Header`
|
|
19
|
+
*/
|
|
20
|
+
ariaLabelledBy?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Contents of the dialog.
|
|
23
|
+
*/
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Additional ClassNames to add to dialog.
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The ref of the container where the dialog will be inserted into the DOM.
|
|
31
|
+
* By default, Modals are inserted in the document.body, but if need be they can
|
|
32
|
+
* be scoped as necessary.
|
|
33
|
+
*/
|
|
34
|
+
containerRef?: React.RefObject<Node>;
|
|
35
|
+
/**
|
|
36
|
+
* At mobile viewport widths, the modal will take up the fullscreen
|
|
37
|
+
*/
|
|
38
|
+
fullScreenMobile?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* By default the first focusable element will receive focus when the dialog
|
|
41
|
+
* opens but you can provide a ref to focus instead.
|
|
42
|
+
*
|
|
43
|
+
* @see Docs https://reach.tech/dialog#dialog-initialfocusref
|
|
44
|
+
*/
|
|
45
|
+
initialFocusRef?: RefObject<HTMLDivElement>;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the modal is visible or not
|
|
48
|
+
*/
|
|
49
|
+
isOpen: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Max width for modal content. Uses the same maxWidth prop as the `Box` component,
|
|
52
|
+
* and as such can be responsive as well.
|
|
53
|
+
*/
|
|
54
|
+
maxWidth?: BoxProps['maxWidth'];
|
|
55
|
+
/**
|
|
56
|
+
* Function that is called whenever the user hits "Escape" key or clicks outside the modal.
|
|
57
|
+
*/
|
|
58
|
+
onDismiss: (event?: React.SyntheticEvent) => void;
|
|
59
|
+
/**
|
|
60
|
+
* The css overflow behavior of the Modal
|
|
61
|
+
*/
|
|
62
|
+
overflow?: CssOverflowValue;
|
|
63
|
+
/**
|
|
64
|
+
* Allows spread props
|
|
65
|
+
*/
|
|
66
|
+
[x: string]: any;
|
|
67
|
+
}
|
|
68
|
+
export declare const ModalBaseComponent: React.FC<ModalProps>;
|
|
69
|
+
export interface ModalStatic {
|
|
70
|
+
Body: typeof ModalBody;
|
|
71
|
+
Header: typeof ModalHeader;
|
|
72
|
+
Footer: typeof ModalFooter;
|
|
73
|
+
}
|
|
74
|
+
export type ModalWithStaticComponents = typeof ModalBaseComponent & ModalStatic;
|
|
75
|
+
export declare const Modal: ModalWithStaticComponents;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal } from './Modal';
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
declare const meta: Meta<typeof Modal>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const BasicUsage: () => React.JSX.Element;
|
|
7
|
+
export declare const BodyAndFooter: () => React.JSX.Element;
|
|
8
|
+
export declare const CloseButton: () => React.JSX.Element;
|
|
9
|
+
export declare const WithoutHeader: () => React.JSX.Element;
|
|
10
|
+
export declare const FullscreenMobile: () => React.JSX.Element;
|
|
11
|
+
export declare const MaxWidth: () => React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
export type ModalHeaderProps = {
|
|
3
|
+
/**
|
|
4
|
+
* id of the element containing the title, used by the Modal `aria-labelledby` prop
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Modal's header title
|
|
9
|
+
*/
|
|
10
|
+
title?: string;
|
|
11
|
+
/**
|
|
12
|
+
* If defined, will render a 'x' close button on the right side of the ModalHeader
|
|
13
|
+
*/
|
|
14
|
+
onDismiss?: (event?: React.SyntheticEvent) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const ModalHeader: FC<ModalHeaderProps>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
/**
|
|
4
|
+
* The current page number being displayed.
|
|
5
|
+
*/
|
|
6
|
+
activePage: number;
|
|
7
|
+
/**
|
|
8
|
+
* The number of list items contained in a page.
|
|
9
|
+
*/
|
|
10
|
+
itemsPerPage: number;
|
|
11
|
+
/**
|
|
12
|
+
* Callback fired when the user clicks a page or prev/next button.
|
|
13
|
+
*/
|
|
14
|
+
onChange: (pageNumber: number) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The total number of items in the list
|
|
17
|
+
*/
|
|
18
|
+
totalItemsCount: number;
|
|
19
|
+
/**
|
|
20
|
+
* Boolean to determine if individual page buttons (or dropdown are visible). Takes a `ResponsiveProp`
|
|
21
|
+
* if you want to render it differently at different breakpoints
|
|
22
|
+
*/
|
|
23
|
+
arePagesVisible?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Custom class to pass down to the pagination container.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Pass true to render a version of Pagination with smaller buttons.
|
|
30
|
+
*/
|
|
31
|
+
isCompact?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Boolean to determine if the list totals (and current range) are visible.
|
|
34
|
+
* NOTE: these are hidden on mobile regardless of this prop value.
|
|
35
|
+
*/
|
|
36
|
+
isTotalVisible?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The text (or react node) to pass to the NEXT page button.
|
|
39
|
+
*/
|
|
40
|
+
nextPageText?: string | ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Number of pages shown in paginator, not including navigation blocks (prev, next), as well as first, last pages.
|
|
43
|
+
* In other words the number of pages displayed 'in the middle', that the user can navigate to.
|
|
44
|
+
*/
|
|
45
|
+
numberOfPagesDisplayed?: number;
|
|
46
|
+
/**
|
|
47
|
+
* The text (or react node) to pass to the PREVIOUS page button.
|
|
48
|
+
*/
|
|
49
|
+
prevPageText?: string | ReactNode;
|
|
50
|
+
}
|
|
51
|
+
export declare const Pagination: FC<PaginationProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Pagination } from './Pagination';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Pagination>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: () => React.JSX.Element;
|
|
7
|
+
export declare const Compact: () => React.JSX.Element;
|
|
8
|
+
export declare const PageNumbers: () => React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Page {
|
|
2
|
+
isPage: boolean;
|
|
3
|
+
pageNumber: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const generatePages: (pageRange: number, pageTotal: number, activePage: number, numberOfPagesDisplayed: number) => Page[];
|
|
6
|
+
export declare const generatePageRange: (numberOfPagesDisplayed: number, pageTotal: number) => number;
|
|
7
|
+
export declare const generatePageTotal: (totalItemsCount: number, itemsPerPage: number) => number;
|
|
8
|
+
export declare const generateActiveListRange: (activePage: number, totalItemsCount: number, itemsPerPage: number) => {
|
|
9
|
+
first?: number;
|
|
10
|
+
last?: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Placement } from '@popperjs/core';
|
|
3
|
+
import { BackgroundColor } from '../../types';
|
|
4
|
+
import { BoxProps } from '../Box/Box';
|
|
5
|
+
export type PopoverProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Custom class to apply to the alert.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The trigger element
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Content of the tooltip. Can be any JSX node.
|
|
16
|
+
*/
|
|
17
|
+
content: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The Popover is a controlled input, and will be shown when `isOpen === true`.
|
|
20
|
+
*/
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Color of the arrow background. NOTE: That the arrowColor will default to the
|
|
24
|
+
* `background` color applied in the `contentContainerProps`, but can be overwritten
|
|
25
|
+
* by passing a specific value here.
|
|
26
|
+
*/
|
|
27
|
+
arrowColor?: BackgroundColor;
|
|
28
|
+
/**
|
|
29
|
+
* An object matching the interface of the `Box` component props.
|
|
30
|
+
* This is useful for styling the tooltip container using all the options available in
|
|
31
|
+
* a `Box`.
|
|
32
|
+
*/
|
|
33
|
+
contentContainerProps?: BoxProps;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the arrow is shown.
|
|
36
|
+
*/
|
|
37
|
+
hasArrow?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* How far (in pixels) the Popover element will be from the target.
|
|
40
|
+
* Note that this is from the edge of the target to the edge of the popover content,
|
|
41
|
+
* and it DOES NOT include the arrow element.
|
|
42
|
+
*/
|
|
43
|
+
offsetFromTarget?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Callback function to handle when a user clicks outside the Popover
|
|
46
|
+
*/
|
|
47
|
+
onClickOutside?: (event: MouseEvent | KeyboardEvent) => void;
|
|
48
|
+
/**
|
|
49
|
+
* The placement (position) of the Popover relative to its trigger.
|
|
50
|
+
*/
|
|
51
|
+
placement?: Placement;
|
|
52
|
+
/**
|
|
53
|
+
* Whether you want to trap focus in the Popover element when it is open.
|
|
54
|
+
* Read more about focus traps:
|
|
55
|
+
* [Here](https://allyjs.io/tutorials/accessible-dialog.html#trapping-focus-inside-the-dialog)
|
|
56
|
+
*/
|
|
57
|
+
trapFocus?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Additional props to be spread to rendered element
|
|
60
|
+
*/
|
|
61
|
+
[x: string]: any;
|
|
62
|
+
} & ({
|
|
63
|
+
/**
|
|
64
|
+
* Whether the element should be rendered outside its DOM structure
|
|
65
|
+
* for reasons of placement. Use this when the element is being cut-off or
|
|
66
|
+
* re-positioned due to lack of space in the parent container.
|
|
67
|
+
* NOTE: `portalTarget` is required if this is true.
|
|
68
|
+
*/
|
|
69
|
+
withPortal: true;
|
|
70
|
+
/**
|
|
71
|
+
* The target element where the Popover will be portaled to, when `withPortal === true`.
|
|
72
|
+
* `document.body` will work for many cases, but you can also use a custom container for this.
|
|
73
|
+
* Only required if withPortal is true.
|
|
74
|
+
*/
|
|
75
|
+
portalTarget: HTMLElement;
|
|
76
|
+
} | {
|
|
77
|
+
withPortal?: false;
|
|
78
|
+
portalTarget?: never;
|
|
79
|
+
});
|
|
80
|
+
export declare const Popover: FC<PopoverProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Popover } from './Popover';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Popover>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const BasicUsage: () => React.JSX.Element;
|
|
7
|
+
export declare const PopoverStyling: () => React.JSX.Element;
|
|
8
|
+
export declare const Placement: () => React.JSX.Element;
|
|
9
|
+
export declare const WithAPortal: () => React.JSX.Element;
|
|
10
|
+
export declare const HoverTrigger: () => React.JSX.Element;
|
|
11
|
+
export declare const RespondToOutsideClicks: () => React.JSX.Element;
|
|
12
|
+
export declare const TrappingFocus: () => React.JSX.Element;
|
|
13
|
+
export declare const WithoutAnArrow: () => React.JSX.Element;
|
|
14
|
+
export declare const OffsetDistance: () => React.JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { FC, ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
2
|
+
import { RadioInputProps } from './RadioInput/RadioInput';
|
|
3
|
+
export interface RadioGroupProps {
|
|
4
|
+
/**
|
|
5
|
+
* Radio group name.
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Callback function to call on change event.
|
|
10
|
+
*/
|
|
11
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Options for radio group.
|
|
14
|
+
*/
|
|
15
|
+
options: {
|
|
16
|
+
id: string;
|
|
17
|
+
value: string;
|
|
18
|
+
label: ReactNode;
|
|
19
|
+
disabled?: boolean | null;
|
|
20
|
+
}[];
|
|
21
|
+
/**
|
|
22
|
+
* Additional classes to add.
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Description to be displayed below the title, and above the RadioGroup.
|
|
27
|
+
*/
|
|
28
|
+
description?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the radios should be aligned in a row or in a column
|
|
31
|
+
*/
|
|
32
|
+
direction?: 'row' | 'column';
|
|
33
|
+
/**
|
|
34
|
+
* Mark the radio group as invalid and display a validation message.
|
|
35
|
+
* Pass a string or node to render a validation message below the input.
|
|
36
|
+
*/
|
|
37
|
+
error?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* If the radio group should be disabled and not focusable.
|
|
40
|
+
*/
|
|
41
|
+
isDisabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If the radio group is required or not
|
|
44
|
+
*/
|
|
45
|
+
isRequired?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Callback function to call on blur event.
|
|
48
|
+
*/
|
|
49
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback function to call on focus event.
|
|
52
|
+
*/
|
|
53
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Visual indicator that the field is required, that gets appended to the label
|
|
56
|
+
*/
|
|
57
|
+
requiredIndicator?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Size of the radio icons in the group.
|
|
60
|
+
*/
|
|
61
|
+
size?: RadioInputProps['size'];
|
|
62
|
+
/**
|
|
63
|
+
* Title to be displayed above the RadioGroup.
|
|
64
|
+
*/
|
|
65
|
+
title?: ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* The value of selected radio input.
|
|
68
|
+
*/
|
|
69
|
+
value?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Additional props to be spread to rendered element
|
|
72
|
+
*/
|
|
73
|
+
[x: string]: any;
|
|
74
|
+
}
|
|
75
|
+
export declare const RadioGroup: FC<RadioGroupProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioGroup } from './RadioGroup';
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
declare const meta: Meta<typeof RadioGroup>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: () => React.JSX.Element;
|
|
7
|
+
export declare const Title: () => React.JSX.Element;
|
|
8
|
+
export declare const TitleAndDescription: () => React.JSX.Element;
|
|
9
|
+
export declare const Required: () => React.JSX.Element;
|
|
10
|
+
export declare const CustomRequiredIndicator: () => React.JSX.Element;
|
|
11
|
+
export declare const PreSelectedOption: () => React.JSX.Element;
|
|
12
|
+
export declare const DisabledOption: () => React.JSX.Element;
|
|
13
|
+
export declare const DisabledGroup: () => React.JSX.Element;
|
|
14
|
+
export declare const Error: () => React.JSX.Element;
|
|
15
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
16
|
+
export declare const HorizontallyAligned: () => React.JSX.Element;
|