@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,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxSize, CheckboxProps } from './components/Checkbox';
|
|
3
|
+
export interface CheckboxInputProps {
|
|
4
|
+
/**
|
|
5
|
+
* The id attribute of the input.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* The checkbox input "checked" attribute.
|
|
10
|
+
*/
|
|
11
|
+
isChecked: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Custom content to be displayed to right of checkbox.
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Callback function when input is changed.
|
|
18
|
+
*/
|
|
19
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Additional classes to add.
|
|
22
|
+
*/
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Mark the input field as invalid and display a validation message.
|
|
26
|
+
* Pass a string or node to render a validation message below the input.
|
|
27
|
+
*/
|
|
28
|
+
error?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Additional clarifying text to help describe the input
|
|
31
|
+
*/
|
|
32
|
+
helpText?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Determines if the label is not shown for stylistic reasons.
|
|
35
|
+
* Note the label is still a required prop and will be used as the aria-label for accessibility reasons.
|
|
36
|
+
*/
|
|
37
|
+
hideLabel?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If the input should be disabled and not focusable.
|
|
40
|
+
*/
|
|
41
|
+
isDisabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the checkbox is rendered in an indeterminate state.
|
|
44
|
+
* NOTE: this change is only visual and it does not affect the checked or unchecked state of the checkbox.
|
|
45
|
+
*/
|
|
46
|
+
isIndeterminate?: CheckboxProps['isIndeterminate'];
|
|
47
|
+
/**
|
|
48
|
+
* The required and aria-required attributes on the input
|
|
49
|
+
*/
|
|
50
|
+
isRequired?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Callback function when input is blurred.
|
|
53
|
+
*/
|
|
54
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback function when input is focused.
|
|
57
|
+
*/
|
|
58
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Visual indicator that the field is required, that gets appended to the label
|
|
61
|
+
*/
|
|
62
|
+
requiredIndicator?: React.ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* The size of the checkbox.
|
|
65
|
+
*/
|
|
66
|
+
size?: CheckboxSize;
|
|
67
|
+
/**
|
|
68
|
+
* Additional props to be spread to rendered element
|
|
69
|
+
*/
|
|
70
|
+
[x: string]: any;
|
|
71
|
+
}
|
|
72
|
+
export declare const CheckboxInput: React.FC<CheckboxInputProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import { CheckboxInput } from './CheckboxInput';
|
|
4
|
+
declare const meta: Meta<typeof CheckboxInput>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Basic: () => React.JSX.Element;
|
|
7
|
+
export declare const Default: () => React.JSX.Element;
|
|
8
|
+
export declare const States: () => React.JSX.Element;
|
|
9
|
+
export declare const IndeterminateCheckboxes: () => React.JSX.Element;
|
|
10
|
+
export declare const Required: () => React.JSX.Element;
|
|
11
|
+
export declare const CustomRequiredIndicator: () => React.JSX.Element;
|
|
12
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
13
|
+
export declare const HelpText: () => React.JSX.Element;
|
|
14
|
+
export declare const CheckedInitialState: () => React.JSX.Element;
|
|
15
|
+
export declare const HiddenLabel: () => React.JSX.Element;
|
|
16
|
+
export declare const DisabledAndUnchecked: () => React.JSX.Element;
|
|
17
|
+
export declare const DisabledAndChecked: () => React.JSX.Element;
|
|
18
|
+
export declare const Error: () => React.JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ResponsiveProp } from '../../../types';
|
|
3
|
+
import { BoxProps } from '../../Box/Box';
|
|
4
|
+
type BaseSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type CheckboxSize = BaseSize | ResponsiveProp<BaseSize>;
|
|
6
|
+
export interface CheckboxProps extends Omit<BoxProps, 'radius' | 'background' | 'as' | 'height'> {
|
|
7
|
+
/**
|
|
8
|
+
* The id attribute of the input.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The checkbox input "checked" attribute.
|
|
13
|
+
*/
|
|
14
|
+
isChecked: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Custom content to be displayed to right of checkbox.
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function when input is changed.
|
|
21
|
+
*/
|
|
22
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Custom class to apply to the checkbox container.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Mark the input field as invalid and display a validation message.
|
|
29
|
+
* Pass a string or node to render a validation message below the input.
|
|
30
|
+
*/
|
|
31
|
+
error?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* id of the element that labels the Checkbox
|
|
34
|
+
*/
|
|
35
|
+
labelledby?: string;
|
|
36
|
+
/**
|
|
37
|
+
* If the input should be disabled and not focusable.
|
|
38
|
+
*/
|
|
39
|
+
isDisabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If the radio input should be hidden to make way for a custom checkbox.
|
|
42
|
+
*/
|
|
43
|
+
isHidden?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the checkbox is rendered in an indeterminate state.
|
|
46
|
+
* NOTE: this change is only visual and it does not affect the checked or unchecked state of the checkbox.
|
|
47
|
+
*/
|
|
48
|
+
isIndeterminate?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The required and aria-required attributes on the input
|
|
51
|
+
*/
|
|
52
|
+
isRequired?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Callback function when input is blurred.
|
|
55
|
+
*/
|
|
56
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Callback function when input is focused.
|
|
59
|
+
*/
|
|
60
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
61
|
+
/**
|
|
62
|
+
* The size of the checkbox.
|
|
63
|
+
*/
|
|
64
|
+
size?: CheckboxSize;
|
|
65
|
+
/**
|
|
66
|
+
* Value of the checkbox input element
|
|
67
|
+
*/
|
|
68
|
+
value?: string | number;
|
|
69
|
+
}
|
|
70
|
+
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '../../Box/Box';
|
|
3
|
+
import { CheckboxProps } from './Checkbox';
|
|
4
|
+
export interface CheckboxIconProps extends BoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Custom className to be applied to root node of component.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the input is in an error state. The icon will visually change accordingly.
|
|
11
|
+
*/
|
|
12
|
+
error?: CheckboxProps['error'];
|
|
13
|
+
/**
|
|
14
|
+
* The checkbox input "checked" attribute.
|
|
15
|
+
*/
|
|
16
|
+
isChecked?: CheckboxProps['isChecked'];
|
|
17
|
+
/**
|
|
18
|
+
* If the input should be disabled and not focusable.
|
|
19
|
+
*/
|
|
20
|
+
isDisabled?: CheckboxProps['isDisabled'];
|
|
21
|
+
/**
|
|
22
|
+
* Whether the checkbox is rendered in an indeterminate state.
|
|
23
|
+
* NOTE: this change is only visual and it does not affect the checked or unchecked state of the checkbox.
|
|
24
|
+
*/
|
|
25
|
+
isIndeterminate?: CheckboxProps['isIndeterminate'];
|
|
26
|
+
}
|
|
27
|
+
export declare const CheckboxIcon: React.FC<CheckboxIconProps>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DatePickerProps } from '../DatePicker/DatePicker';
|
|
3
|
+
import { TextInputProps } from '../TextInput/TextInput';
|
|
4
|
+
import { PopoverProps } from '../Popover/Popover';
|
|
5
|
+
export interface DateInputProps {
|
|
6
|
+
/**
|
|
7
|
+
* Props object for DatePicker component.
|
|
8
|
+
*/
|
|
9
|
+
datePickerProps: DatePickerProps;
|
|
10
|
+
/**
|
|
11
|
+
* Props object for TextInput component.
|
|
12
|
+
*/
|
|
13
|
+
textInputProps: Omit<TextInputProps, 'onChange'>;
|
|
14
|
+
/**
|
|
15
|
+
* Format for final date to be displayed.
|
|
16
|
+
* Relies on date-fns/format --> https://date-fns.org/v1.9.0/docs/format
|
|
17
|
+
*/
|
|
18
|
+
dateFormat?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Additional settings for formatting date.
|
|
21
|
+
*/
|
|
22
|
+
dateOptions?: {
|
|
23
|
+
/**
|
|
24
|
+
* The user's locale.
|
|
25
|
+
*/
|
|
26
|
+
locale?: globalThis.Locale | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Start of week.
|
|
29
|
+
*/
|
|
30
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Should determine which week is week 1 of a new year.
|
|
33
|
+
*/
|
|
34
|
+
firstWeekContainsDate?: number | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to accept unicode tokens in format.
|
|
37
|
+
* See here --> https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
38
|
+
*/
|
|
39
|
+
useAdditionalWeekYearTokens?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to accept unicode tokens in format.
|
|
42
|
+
* See here --> https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
43
|
+
*/
|
|
44
|
+
useAdditionalDayOfYearTokens?: boolean | undefined;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Props to pass down to the Popover component.
|
|
48
|
+
*/
|
|
49
|
+
popoverProps?: Omit<PopoverProps, 'children' | 'content' | 'isOpen'>;
|
|
50
|
+
/**
|
|
51
|
+
* Additional props to be spread to the `TextInput` element.
|
|
52
|
+
*/
|
|
53
|
+
[x: string]: any;
|
|
54
|
+
}
|
|
55
|
+
export declare const DateInput: FC<DateInputProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import { DateInput } from './DateInput';
|
|
4
|
+
declare const meta: Meta<typeof DateInput>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Basic: () => React.JSX.Element;
|
|
7
|
+
export declare const Default: () => React.JSX.Element;
|
|
8
|
+
export declare const DateRange: () => React.JSX.Element;
|
|
9
|
+
export declare const WithMinAndMaxDates: () => React.JSX.Element;
|
|
10
|
+
export declare const CustomDateFormat: () => React.JSX.Element;
|
|
11
|
+
export declare const InputBlurEvent: () => React.JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { FC, SyntheticEvent, ReactNode } from 'react';
|
|
2
|
+
import { ReactDatePickerProps } from 'react-datepicker';
|
|
3
|
+
export interface DatePickerProps extends ReactDatePickerProps<any, any> {
|
|
4
|
+
/**
|
|
5
|
+
* React children (to be rendered below the calendar dates).
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Custom classname to be applied to the DatePicker container.
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Callback that fires when a date is changed/selected.
|
|
14
|
+
*/
|
|
15
|
+
onChange: (date: Date | [Date, Date] | null, event?: React.SyntheticEvent<any> | undefined) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback that fires when a date is clicked.
|
|
18
|
+
*/
|
|
19
|
+
onSelect?: ((date: Date, event: SyntheticEvent<any, Event> | undefined) => void) | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Custom Class to be applied to a single day element based on a date.
|
|
22
|
+
*/
|
|
23
|
+
dayClassName?: ((date: Date) => string | null) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Custom Class to be applied to a single week element based on a date.
|
|
26
|
+
*/
|
|
27
|
+
weekClassName?: ((date: Date) => string | null) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Custom Class to be applied to a single month element based on a date.
|
|
30
|
+
*/
|
|
31
|
+
monthClassName?: ((date: Date) => string | null) | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Custom Class to be applied to a specific time.
|
|
34
|
+
*/
|
|
35
|
+
timeClassName?: ((date: Date) => string | null) | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Custom format for weekday.
|
|
38
|
+
*/
|
|
39
|
+
formatWeekDay?: (formattedDate: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Last allowable/shown date
|
|
42
|
+
*/
|
|
43
|
+
maxDate?: Date | null;
|
|
44
|
+
/**
|
|
45
|
+
* First allowable/shown date
|
|
46
|
+
*/
|
|
47
|
+
minDate?: Date | null;
|
|
48
|
+
/**
|
|
49
|
+
* Months to be shown at one time
|
|
50
|
+
*/
|
|
51
|
+
monthsShown?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Date that the calendar will open to by default.
|
|
54
|
+
*/
|
|
55
|
+
openToDate?: Date;
|
|
56
|
+
/**
|
|
57
|
+
* Currently selected date.
|
|
58
|
+
*/
|
|
59
|
+
selected?: Date | null;
|
|
60
|
+
/**
|
|
61
|
+
* Whether or not the picker will return a range of dates.
|
|
62
|
+
*/
|
|
63
|
+
selectsRange?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Start date in a range
|
|
66
|
+
*/
|
|
67
|
+
startDate?: Date | null;
|
|
68
|
+
/**
|
|
69
|
+
* Show month picker in two columns
|
|
70
|
+
*/
|
|
71
|
+
showTwoColumnMonthYearPicker?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* See full month name in the month picker
|
|
74
|
+
*/
|
|
75
|
+
showFullMonthYearPicker?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Use the month picker
|
|
78
|
+
*/
|
|
79
|
+
showMonthYearPicker?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Additional props to be spread to rendered element
|
|
82
|
+
*/
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
}
|
|
85
|
+
export declare const DatePicker: FC<DatePickerProps>;
|
|
86
|
+
export default DatePicker;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker } from './DatePicker';
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
declare const meta: Meta<typeof DatePicker>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const BasicExample: () => React.JSX.Element;
|
|
7
|
+
export declare const DateRange: () => React.JSX.Element;
|
|
8
|
+
export declare const MinAndMaxDates: () => React.JSX.Element;
|
|
9
|
+
export declare const MonthPicker: () => React.JSX.Element;
|
|
10
|
+
export declare const ShowMultipleMonths: () => React.JSX.Element;
|
|
11
|
+
export declare const WithTimePicker: () => React.JSX.Element;
|
|
12
|
+
export declare const OpenByDefaultOnASpecificDate: () => React.JSX.Element;
|
|
13
|
+
export declare const WithChildren: () => React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DetailsSummary } from './DetailsSummary';
|
|
3
|
+
import { BoxProps } from '../Box/Box';
|
|
4
|
+
export interface DetailsProps extends BoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the details below the summary are opened. Directly corresponds to `open` property in <details> element.
|
|
7
|
+
*/
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const DetailsBaseComponent: React.FC<DetailsProps>;
|
|
11
|
+
export interface DetailsStatic {
|
|
12
|
+
Summary: typeof DetailsSummary;
|
|
13
|
+
}
|
|
14
|
+
export type DetailsWithStaticComponents = typeof DetailsBaseComponent & DetailsStatic;
|
|
15
|
+
export declare const Details: DetailsWithStaticComponents;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { MouseEvent, KeyboardEvent } from 'react';
|
|
2
|
+
import { BoxProps } from '../Box/Box';
|
|
3
|
+
export interface DetailsSummaryProps extends BoxProps {
|
|
4
|
+
isDetailsOpen: boolean;
|
|
5
|
+
onToggle?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DetailsSummary: React.FC<DetailsSummaryProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
import { DimensionSize, CssDimensionValue } from '../../types';
|
|
3
|
+
export type DrawerPlacementType = 'left' | 'right' | 'top' | 'bottom';
|
|
4
|
+
export interface DrawerProps {
|
|
5
|
+
/**
|
|
6
|
+
* If the drawer is open
|
|
7
|
+
*/
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Handle zoom/pinch gestures on iOS devices when scroll locking is enabled.
|
|
11
|
+
*/
|
|
12
|
+
allowPinchZoom?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A drawer needs to be properly labeled to provide context for users with
|
|
15
|
+
* assistive technology such as screen readers. If a drawer is announced to
|
|
16
|
+
* the user without a label, it can be confusing and difficult to navigate.
|
|
17
|
+
*/
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The id of the element that should be used as the drawer's label by assistive technologies like screen readers.
|
|
21
|
+
*/
|
|
22
|
+
ariaLabelledBy?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Contents of the dialog.
|
|
25
|
+
*/
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Additional class names to add to the drawer content.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the drawer has a visible close button.
|
|
33
|
+
* If a title is defined, then a close button will be rendered
|
|
34
|
+
*/
|
|
35
|
+
closeButton?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If true, the drawer will close when the overlay is clicked
|
|
38
|
+
*/
|
|
39
|
+
closeOnOverlayClick?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The ref of the container where the drawer will be inserted into the DOM.
|
|
42
|
+
* By default, drawers are inserted in the document.body, but if need be they can
|
|
43
|
+
* be scoped as necessary.
|
|
44
|
+
*/
|
|
45
|
+
containerRef?: React.RefObject<Node>;
|
|
46
|
+
/**
|
|
47
|
+
* By default, focus is trapped within the drawer.
|
|
48
|
+
* If true, focus will not be trapped within the contents of the drawer.
|
|
49
|
+
*/
|
|
50
|
+
dangerouslyBypassFocusLock?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* By default, the drawer locks scrolling on the body, but in some cases you may want to allow for scrolling.
|
|
53
|
+
* If true, this will allow the body to scroll while the drawer is open.
|
|
54
|
+
*/
|
|
55
|
+
dangerouslyBypassScrollLock?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* If true, the overlay will not be rendered, scrolling for the entire page will remain enabled,
|
|
58
|
+
* and focus will not be locked to the contents of the drawer
|
|
59
|
+
*/
|
|
60
|
+
hideOverlay?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* By default the first focusable element will receive focus when the dialog
|
|
63
|
+
* opens but you can provide a ref to focus instead.
|
|
64
|
+
*
|
|
65
|
+
* @see Docs https://reach.tech/dialog#dialog-initialfocusref
|
|
66
|
+
*/
|
|
67
|
+
initialFocusRef?: RefObject<HTMLDivElement>;
|
|
68
|
+
/**
|
|
69
|
+
* Which edge of the viewport should the drawer appear from
|
|
70
|
+
*/
|
|
71
|
+
placement?: DrawerPlacementType;
|
|
72
|
+
/**
|
|
73
|
+
* Function that is called whenever the user either hits
|
|
74
|
+
* the "Escape" key, clicks the close button icon, or clicks the overlay.
|
|
75
|
+
*/
|
|
76
|
+
onDismiss?: (event?: React.SyntheticEvent) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Title to be displayed at the top of the Drawer.
|
|
79
|
+
* A close button will be rendered automatically if this prop is defined.
|
|
80
|
+
*/
|
|
81
|
+
title?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The width of the Drawer when opened. Can be given a standard css value (px, rem, em, %),
|
|
84
|
+
* or a [width token](/?path=/story/design-tokens-design-tokens--page#width)
|
|
85
|
+
*/
|
|
86
|
+
width?: DimensionSize | CssDimensionValue;
|
|
87
|
+
}
|
|
88
|
+
export declare const Drawer: React.FC<DrawerProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Drawer } from './Drawer';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Drawer>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const BasicUsage: () => React.JSX.Element;
|
|
7
|
+
export declare const Placement: () => React.JSX.Element;
|
|
8
|
+
export declare const DrawerHeader: () => React.JSX.Element;
|
|
9
|
+
export declare const TitleAndCloseButton: () => React.JSX.Element;
|
|
10
|
+
export declare const CloseButtonOnly: () => React.JSX.Element;
|
|
11
|
+
export declare const Width: () => React.JSX.Element;
|
|
12
|
+
export declare const Height: () => React.JSX.Element;
|
|
13
|
+
export declare const HiddenOverlay: () => React.JSX.Element;
|
|
14
|
+
export declare const InitialFocusRef: () => React.JSX.Element;
|
|
15
|
+
export declare const ContainedDrawer: () => React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '../Box/Box';
|
|
3
|
+
export interface FormControlProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* The input's id attribute. Used to programmatically tie the input with its label.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom content to be displayed above the input. If the label is hidden, will be used to set aria-label attribute.
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Mark the input field as invalid and display a validation message.
|
|
14
|
+
* Pass a string or node to render a validation message below the input.
|
|
15
|
+
*/
|
|
16
|
+
error?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Visually hide the label.
|
|
19
|
+
*/
|
|
20
|
+
hideLabel?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Additional clarifying text to help describe the input
|
|
23
|
+
*/
|
|
24
|
+
helpText?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* The input's disabled attribute
|
|
27
|
+
*/
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The required and aria-required attributes on the input
|
|
31
|
+
*/
|
|
32
|
+
isRequired?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Visual indicator that the field is required, that gets appended to the label
|
|
35
|
+
*/
|
|
36
|
+
requiredIndicator?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare const FormControl: React.ForwardRefExoticComponent<Omit<FormControlProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '../Box/Box';
|
|
3
|
+
export interface FormLabelProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* Content to be rendered inside the label.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The id of the form control that the label is labeling
|
|
10
|
+
*/
|
|
11
|
+
inputId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Custom class to pass to label element.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional clarifying text to that helps describe the field
|
|
18
|
+
*/
|
|
19
|
+
helpText?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Mark the label has disabled
|
|
22
|
+
*/
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* prop deprecated: no longer in use and will be remove in next major release.
|
|
26
|
+
*/
|
|
27
|
+
isFieldRequired?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Apply custom styling to labels for a radio input
|
|
30
|
+
*/
|
|
31
|
+
isRadioInputLabel?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Visual indicator that the field is required, that gets appended to the label
|
|
34
|
+
*/
|
|
35
|
+
requiredIndicator?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Additional props to be spread to rendered element
|
|
38
|
+
*/
|
|
39
|
+
[x: string]: any;
|
|
40
|
+
}
|
|
41
|
+
export declare const FormLabel: FC<FormLabelProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
chromatic: {
|
|
6
|
+
modes: {
|
|
7
|
+
light: {
|
|
8
|
+
theme: string;
|
|
9
|
+
};
|
|
10
|
+
dark: {
|
|
11
|
+
theme: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
export declare const FormikForm: () => React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { CheckboxInputProps } from '../../CheckboxInput/CheckboxInput';
|
|
4
|
+
export interface FormikCheckboxInputProps extends Omit<CheckboxInputProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLInputElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: CheckboxInputProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikCheckboxInput: React.FC<FormikCheckboxInputProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { RadioGroupProps } from '../../RadioGroup/RadioGroup';
|
|
4
|
+
export interface FormikRadioGroupProps extends Omit<RadioGroupProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLInputElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: RadioGroupProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikRadioGroup: React.FC<FormikRadioGroupProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { SelectInputProps } from '../../SelectInput/SelectInput';
|
|
4
|
+
export interface FormikSelectInputProps extends Omit<SelectInputProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLSelectElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: SelectInputProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikSelectInput: React.FC<FormikSelectInputProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormikTouched, FormikErrors, FieldAttributes, FormikValues } from 'formik';
|
|
3
|
+
import { SelectInputInsetProps } from '../../SelectInputInset/SelectInputInset';
|
|
4
|
+
export interface FormikSelectInputInsetProps extends Omit<SelectInputInsetProps, 'onChange'> {
|
|
5
|
+
field: FieldAttributes<HTMLSelectElement>;
|
|
6
|
+
form: {
|
|
7
|
+
touched: FormikTouched<FormikValues>;
|
|
8
|
+
errors: FormikErrors<FormikValues>;
|
|
9
|
+
};
|
|
10
|
+
onChange?: SelectInputInsetProps['onChange'];
|
|
11
|
+
}
|
|
12
|
+
export declare const FormikSelectInputInset: React.FC<FormikSelectInputInsetProps>;
|