@hyphen/hyphen-components 2.9.0 → 2.9.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.
- 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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FC, ReactNode, MouseEvent, KeyboardEvent } from 'react';
|
|
2
|
+
import { AlertVariant } from './Alert.types';
|
|
3
|
+
export interface AlertProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom class to apply to the alert.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom text to use as a close button.
|
|
10
|
+
*/
|
|
11
|
+
closeText?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the alert as an icon that corresponds to its variant (Success, warning, etc.).
|
|
14
|
+
*/
|
|
15
|
+
hasIcon?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the alert can be closed by the user. If `true` it will render
|
|
18
|
+
* the 'close' icon on the right hand side of the alert.
|
|
19
|
+
*/
|
|
20
|
+
isClosable?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Renders a version of the alert with smaller padding.
|
|
23
|
+
*/
|
|
24
|
+
isCompact?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The text message or ReactNode to be rendered in the alert.
|
|
27
|
+
*/
|
|
28
|
+
message?: string | ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the alert can be closed by the user. If `true` it will render
|
|
31
|
+
* the 'close' icon on the right hand side of the alert.
|
|
32
|
+
*/
|
|
33
|
+
onClose?: (event: MouseEvent<HTMLOrSVGElement> | KeyboardEvent<HTMLSpanElement>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* A render function that returns JSX if preferred over a static ReactNode or string.
|
|
36
|
+
*/
|
|
37
|
+
render?: () => ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* The title for the alert.
|
|
40
|
+
*/
|
|
41
|
+
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The type/color of the alert to show.
|
|
44
|
+
*/
|
|
45
|
+
variant?: AlertVariant;
|
|
46
|
+
/**
|
|
47
|
+
* Additional props to be spread to rendered element
|
|
48
|
+
*/
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
}
|
|
51
|
+
export declare const Alert: FC<AlertProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Alert } from './Alert';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Alert>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Overview: () => React.JSX.Element;
|
|
7
|
+
export declare const Variants: () => React.JSX.Element;
|
|
8
|
+
export declare const Closable: () => React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { FontSize, BaseSpacing, ResponsiveProp } from '../../types';
|
|
3
|
+
export type BadgeSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type BadgeVariant = 'light-grey' | 'dark-grey' | 'inverse' | 'green' | 'yellow' | 'blue' | 'red' | 'purple' | 'hyphen';
|
|
5
|
+
export type BadgeSizeAttributes = {
|
|
6
|
+
fontSize: FontSize;
|
|
7
|
+
padding: BaseSpacing;
|
|
8
|
+
};
|
|
9
|
+
export interface BadgeProps {
|
|
10
|
+
/**
|
|
11
|
+
* Custom class to apply to the badge container div.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The text message or ReactNode to be rendered in the badge.
|
|
16
|
+
*/
|
|
17
|
+
message?: string | ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The size of the button.
|
|
20
|
+
*/
|
|
21
|
+
size?: BadgeSize | ResponsiveProp<BadgeSize>;
|
|
22
|
+
/**
|
|
23
|
+
* The type/color of the badge to show.
|
|
24
|
+
*/
|
|
25
|
+
variant?: BadgeVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Additional props to be spread to rendered element
|
|
28
|
+
*/
|
|
29
|
+
[x: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export declare const Badge: FC<BadgeProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { Badge } from './Badge';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Badge>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Overview: () => React.JSX.Element;
|
|
7
|
+
export declare const Variants: () => React.JSX.Element;
|
|
8
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as CSS from 'csstype';
|
|
2
|
+
import { BaseSpacing, BorderRadiusSize, BorderSize, BoxShadowSize, CssAlignContentValue, CssAlignItemsValue, CssDisplayValue, CssFlexDirectionValue, CssFlexValue, CssJustifyContentValue, CssOverflowValue, CssTextAlignValue, DimensionSize, FontColor, FontFamily, FontSize, FontWeight, ResponsiveProp, SpacingSize, ZIndexSize, BackgroundColor, BorderColor } from '../../types';
|
|
3
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
4
|
+
import { KnownKeys } from '../../types/lib.types';
|
|
5
|
+
export type HoverableBoxProperties = 'color' | 'borderColor' | 'shadow' | 'background';
|
|
6
|
+
export interface BoxProps {
|
|
7
|
+
/**
|
|
8
|
+
* The element type to be rendered.
|
|
9
|
+
*/
|
|
10
|
+
as?: string;
|
|
11
|
+
/**
|
|
12
|
+
* How to align the contents along the cross axis.
|
|
13
|
+
*/
|
|
14
|
+
alignItems?: CssAlignItemsValue | ResponsiveProp<CssAlignItemsValue>;
|
|
15
|
+
/**
|
|
16
|
+
* How to align the contents when there is extra space in the cross axis.
|
|
17
|
+
* This property has no effect when there is only one line of flex items.
|
|
18
|
+
*/
|
|
19
|
+
alignContent?: CssAlignContentValue | ResponsiveProp<CssAlignContentValue>;
|
|
20
|
+
/**
|
|
21
|
+
* How to align along the cross axis when contained in a Box.
|
|
22
|
+
* This allows the default alignment (or the one specified by `align`) to be overridden for the individual Box.
|
|
23
|
+
*/
|
|
24
|
+
alignSelf?: CssAlignItemsValue | ResponsiveProp<CssAlignItemsValue>;
|
|
25
|
+
/**
|
|
26
|
+
* Any valid background color token, or a `url()` for an image
|
|
27
|
+
*/
|
|
28
|
+
background?: BackgroundColor;
|
|
29
|
+
/**
|
|
30
|
+
* Any valid border color token
|
|
31
|
+
*/
|
|
32
|
+
borderColor?: BorderColor;
|
|
33
|
+
/**
|
|
34
|
+
* Width of the Box's border
|
|
35
|
+
* Can be a single [border width token](/?path=/docs/foundation-design-tokens--docs#border-width).
|
|
36
|
+
* Can also be a string of [border width tokens](/?path=/docs/foundation-design-tokens--docs#border-width)
|
|
37
|
+
* that models itself after the css shorthand property,
|
|
38
|
+
* where you can set the border width on all four sides of an element.
|
|
39
|
+
* e.g: "0 sm xs 0" --> top: 0, right: sm, bottom: xs, left: 0;
|
|
40
|
+
*/
|
|
41
|
+
borderWidth?: BorderSize | string | ResponsiveProp<BorderSize | string>;
|
|
42
|
+
/**
|
|
43
|
+
* Additional class names to add
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The amount of spacing (implemented as margin) between child elements.
|
|
48
|
+
* Can be a single [spacing value](/?path=/docs/foundation-design-tokens--docs#spacing).
|
|
49
|
+
* NOTE: this prop is incompatible with reverse flex direction values (row-reverse, column-reverse).
|
|
50
|
+
* For grid and flex layouts, use 'gap' instead.
|
|
51
|
+
*/
|
|
52
|
+
childGap?: SpacingSize | ResponsiveProp<SpacingSize>;
|
|
53
|
+
/**
|
|
54
|
+
* The box's contents
|
|
55
|
+
*/
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* A color token identifier to use for the text color.
|
|
59
|
+
*/
|
|
60
|
+
color?: FontColor;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the gaps (gutters) between columns.
|
|
63
|
+
*/
|
|
64
|
+
columnGap?: BaseSpacing | ResponsiveProp<BaseSpacing>;
|
|
65
|
+
/**
|
|
66
|
+
* Cursor style. Use any standard CSS value.
|
|
67
|
+
*/
|
|
68
|
+
cursor?: CSS.Property.Cursor;
|
|
69
|
+
/**
|
|
70
|
+
* Sets how flex items are placed inside the Box, defining the main axis and the direction
|
|
71
|
+
* NOTE: reverse directions are incompatible with the `childGap` prop.
|
|
72
|
+
*/
|
|
73
|
+
direction?: CssFlexDirectionValue | ResponsiveProp<CssFlexDirectionValue>;
|
|
74
|
+
/**
|
|
75
|
+
* Display property. Only select values supported.
|
|
76
|
+
*/
|
|
77
|
+
display?: CssDisplayValue | ResponsiveProp<CssDisplayValue>;
|
|
78
|
+
/**
|
|
79
|
+
* Can be used as shorthand for the flexbox css properties `flex-grow`, `flex-shrink`, `flex-basis`
|
|
80
|
+
*/
|
|
81
|
+
flex?: CssFlexValue | ResponsiveProp<CssFlexValue>;
|
|
82
|
+
/**
|
|
83
|
+
* Pass style modifiers for focus states. The following properties can be modified on focus.
|
|
84
|
+
* `* background`
|
|
85
|
+
* `* borderColor`
|
|
86
|
+
* `* borderWidth`
|
|
87
|
+
* `* color`
|
|
88
|
+
* `* shadow`
|
|
89
|
+
*/
|
|
90
|
+
focus?: {
|
|
91
|
+
background?: BoxProps['background'];
|
|
92
|
+
borderColor?: BoxProps['borderColor'];
|
|
93
|
+
borderWidth?: BoxProps['borderWidth'];
|
|
94
|
+
color?: BoxProps['color'];
|
|
95
|
+
shadow?: BoxProps['shadow'];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The [font family token](/?path=/docs/foundation-design-tokens--docs#font-family) identifier for the Box's text
|
|
99
|
+
*/
|
|
100
|
+
fontFamily?: FontFamily | ResponsiveProp<FontFamily>;
|
|
101
|
+
/**
|
|
102
|
+
* The [font size token](/?path=/docs/foundation-design-tokens--docs#font-size) identifier for the Box's text
|
|
103
|
+
*/
|
|
104
|
+
fontSize?: FontSize | ResponsiveProp<FontSize>;
|
|
105
|
+
/**
|
|
106
|
+
* The [font weight token](/?path=/docs/design-tokens-design-tokens--page#font-weight) identifier for the Box's text
|
|
107
|
+
*/
|
|
108
|
+
fontWeight?: FontWeight | ResponsiveProp<FontWeight>;
|
|
109
|
+
/**
|
|
110
|
+
* The height of the element. Can be given a standard css value (px, rem, em, %),
|
|
111
|
+
* or a [height token](/?path=/docs/foundation-design-tokens--docs#height)
|
|
112
|
+
*/
|
|
113
|
+
height?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
114
|
+
/**
|
|
115
|
+
* Pass style modifiers for hover states. The following properties can be modified on hover:
|
|
116
|
+
* `* background`
|
|
117
|
+
* `* borderColor`
|
|
118
|
+
* `* borderWidth`
|
|
119
|
+
* `* color`
|
|
120
|
+
* `* fontSize`
|
|
121
|
+
* `* shadow`
|
|
122
|
+
*/
|
|
123
|
+
hover?: {
|
|
124
|
+
background?: BoxProps['background'];
|
|
125
|
+
borderColor?: BoxProps['borderColor'];
|
|
126
|
+
borderWidth?: BoxProps['borderWidth'];
|
|
127
|
+
color?: BoxProps['color'];
|
|
128
|
+
fontSize?: BoxProps['fontSize'];
|
|
129
|
+
shadow?: BoxProps['shadow'];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Sets the gaps (gutters) between rows and columns.
|
|
133
|
+
*/
|
|
134
|
+
gap?: BaseSpacing | ResponsiveProp<BaseSpacing>;
|
|
135
|
+
/**
|
|
136
|
+
* How space between and around content items is distributed along the main-axis a flex Box
|
|
137
|
+
*/
|
|
138
|
+
justifyContent?: CssJustifyContentValue | ResponsiveProp<CssJustifyContentValue>;
|
|
139
|
+
/**
|
|
140
|
+
* Amount of space around the element.
|
|
141
|
+
* Can be a single [spacing value](/?path=/docs/foundation-design-tokens--docs#spacing).
|
|
142
|
+
* Can also be a string of [spacing value](/?path=/docs/foundation-design-tokens--docs#spacing)
|
|
143
|
+
* that models itself after the css shorthand property,
|
|
144
|
+
* where you can set the margin area on all four sides of an element. It is shorthand for top, right, bottom, left.
|
|
145
|
+
*/
|
|
146
|
+
margin?: BaseSpacing | ResponsiveProp<BaseSpacing>;
|
|
147
|
+
/**
|
|
148
|
+
* The maximum height of the element. Can be given a standard css value (px, rem, em, %),
|
|
149
|
+
* or a [height token](/?path=/docs/foundation-design-tokens--docs#height)
|
|
150
|
+
*/
|
|
151
|
+
maxHeight?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
152
|
+
/**
|
|
153
|
+
* The minimum height of the element. Can be given a standard css value (px, rem, em, %),
|
|
154
|
+
* or a [height token](/?path=/docs/foundation-design-tokens--docs#height)
|
|
155
|
+
*/
|
|
156
|
+
minHeight?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
157
|
+
/**
|
|
158
|
+
* The maximum width of the element. Can be given a standard css value (px, rem, em, %),
|
|
159
|
+
* or a [width token](/?path=/docs/foundation-design-tokens--docs#width)
|
|
160
|
+
*/
|
|
161
|
+
maxWidth?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
162
|
+
/**
|
|
163
|
+
* The minimum width of the element. Can be given a standard css value (px, rem, em, %),
|
|
164
|
+
* or a [width token](/?path=/docs/foundation-design-tokens--docs#width)
|
|
165
|
+
*/
|
|
166
|
+
minWidth?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
167
|
+
/**
|
|
168
|
+
* The css overflow behavior of the Box
|
|
169
|
+
*/
|
|
170
|
+
overflow?: CssOverflowValue | ResponsiveProp<CssOverflowValue>;
|
|
171
|
+
/**
|
|
172
|
+
* Amount of space within the element around the Box contents.
|
|
173
|
+
* Can be a single [spacing value](/?path=/docs/foundation-design-tokens--docs#spacing).
|
|
174
|
+
* Can also be a string of [spacing value](/?path=/docs/foundation-design-tokens--docs#spacing)
|
|
175
|
+
* that models itself after the css shorthand property,
|
|
176
|
+
* where you can set the margin area on all four sides of an element. It is shorthand for top, right, bottom, left.
|
|
177
|
+
*/
|
|
178
|
+
padding?: BaseSpacing | ResponsiveProp<BaseSpacing>;
|
|
179
|
+
/**
|
|
180
|
+
* CSS position property.
|
|
181
|
+
*/
|
|
182
|
+
position?: CSS.Property.Position | ResponsiveProp<CSS.Property.Position>;
|
|
183
|
+
/**
|
|
184
|
+
* Set the radius of all corners
|
|
185
|
+
*/
|
|
186
|
+
radius?: BorderRadiusSize | ResponsiveProp<BorderRadiusSize>;
|
|
187
|
+
/**
|
|
188
|
+
* Sets the gaps (gutters) between rows.
|
|
189
|
+
*/
|
|
190
|
+
rowGap?: BaseSpacing | ResponsiveProp<BaseSpacing>;
|
|
191
|
+
/**
|
|
192
|
+
* The size of the drop shadow applied to the Box
|
|
193
|
+
*/
|
|
194
|
+
shadow?: BoxShadowSize | ResponsiveProp<BoxShadowSize>;
|
|
195
|
+
/**
|
|
196
|
+
* CSS Style object
|
|
197
|
+
*/
|
|
198
|
+
style?: CSSProperties;
|
|
199
|
+
/**
|
|
200
|
+
* the alignment of the text
|
|
201
|
+
*/
|
|
202
|
+
textAlign?: CssTextAlignValue | ResponsiveProp<CssTextAlignValue>;
|
|
203
|
+
/**
|
|
204
|
+
* By default, a Box's items will all try to fit onto one line.
|
|
205
|
+
* Change that and allow the items to wrap as needed wrap
|
|
206
|
+
*/
|
|
207
|
+
wrap?: boolean | ResponsiveProp<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* The width of the element. Can be given a standard css value (px, rem, em, %),
|
|
210
|
+
* or a [width token](/?path=/docs/foundation-design-tokens--docs#width)
|
|
211
|
+
*/
|
|
212
|
+
width?: DimensionSize | ResponsiveProp<DimensionSize> | string;
|
|
213
|
+
/**
|
|
214
|
+
* ZIndex value for the element. Can be one of the predetermined token values.
|
|
215
|
+
* Can be responsive.
|
|
216
|
+
*/
|
|
217
|
+
zIndex?: ZIndexSize | ResponsiveProp<ZIndexSize>;
|
|
218
|
+
/**
|
|
219
|
+
* Additional props to be spread to rendered element
|
|
220
|
+
*/
|
|
221
|
+
[x: string]: any;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A `<Box>` is a layout component to build UIs with consistent padding and spacing between
|
|
225
|
+
* elements.
|
|
226
|
+
*/
|
|
227
|
+
export declare const Box: FC<BoxProps>;
|
|
228
|
+
export declare const boxPropsKeys: (keyof Pick<BoxProps, KnownKeys<BoxProps>>)[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import { Box } from './Box';
|
|
4
|
+
declare const meta: Meta<typeof Box>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Overview: () => React.JSX.Element;
|
|
7
|
+
export declare const Background: () => React.JSX.Element;
|
|
8
|
+
export declare const Border: () => React.JSX.Element;
|
|
9
|
+
export declare const Gap: () => React.JSX.Element;
|
|
10
|
+
export declare const ChildGap: () => React.JSX.Element;
|
|
11
|
+
export declare const FlexAuto: () => React.JSX.Element;
|
|
12
|
+
export declare const FlexDirection: () => React.JSX.Element;
|
|
13
|
+
export declare const FlexShrinkGrow: () => React.JSX.Element;
|
|
14
|
+
export declare const FlexJustify: () => React.JSX.Element;
|
|
15
|
+
export declare const FlexAlign: () => React.JSX.Element;
|
|
16
|
+
export declare const FlexAlignContent: () => React.JSX.Element;
|
|
17
|
+
export declare const FontColor: () => React.JSX.Element;
|
|
18
|
+
export declare const FontSizes: () => React.JSX.Element;
|
|
19
|
+
export declare const FontWeights: () => React.JSX.Element;
|
|
20
|
+
export declare const FontFamily: () => React.JSX.Element;
|
|
21
|
+
export declare const TextAlign: () => React.JSX.Element;
|
|
22
|
+
export declare const Margin: () => React.JSX.Element;
|
|
23
|
+
export declare const Padding: () => React.JSX.Element;
|
|
24
|
+
export declare const Radius: () => React.JSX.Element;
|
|
25
|
+
export declare const Shadow: () => React.JSX.Element;
|
|
26
|
+
export declare const Width: () => React.JSX.Element;
|
|
27
|
+
export declare const WidthTokens: () => React.JSX.Element;
|
|
28
|
+
export declare const WidthPercentages: () => React.JSX.Element;
|
|
29
|
+
export declare const WidthMax: () => React.JSX.Element;
|
|
30
|
+
export declare const WidthMin: () => React.JSX.Element;
|
|
31
|
+
export declare const Height: () => React.JSX.Element;
|
|
32
|
+
export declare const HeightTokens: () => React.JSX.Element;
|
|
33
|
+
export declare const HeightPercentages: () => React.JSX.Element;
|
|
34
|
+
export declare const HeightMax: () => React.JSX.Element;
|
|
35
|
+
export declare const HeightMin: () => React.JSX.Element;
|
|
36
|
+
export declare const Overflow: () => React.JSX.Element;
|
|
37
|
+
export declare const Cursor: () => React.JSX.Element;
|
|
38
|
+
export declare const Position: () => React.JSX.Element;
|
|
39
|
+
export declare const Hover: () => React.JSX.Element;
|
|
40
|
+
export declare const Focus: () => React.JSX.Element;
|
|
41
|
+
export declare const Responsive: () => React.JSX.Element;
|
|
42
|
+
export declare const Omit: () => React.JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { IconName, ResponsiveProp } from '../../types';
|
|
2
|
+
import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, FocusEvent, MouseEvent, ReactNode } from 'react';
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger';
|
|
4
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface BaseButtonProps {
|
|
6
|
+
/**
|
|
7
|
+
* Contents of the button.
|
|
8
|
+
*/
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Additional ClassNames to add to button.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Button takes up the full width of its parent container.
|
|
16
|
+
*/
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Name of the icon to include before the button text
|
|
20
|
+
*/
|
|
21
|
+
iconPrefix?: IconName;
|
|
22
|
+
/**
|
|
23
|
+
* Name of the icon to include after the button text
|
|
24
|
+
*/
|
|
25
|
+
iconSuffix?: IconName;
|
|
26
|
+
/**
|
|
27
|
+
* A unique identifier for the button.
|
|
28
|
+
*/
|
|
29
|
+
id?: string;
|
|
30
|
+
/**
|
|
31
|
+
* URL to navigate to when clicked. Passing this attribute automatically
|
|
32
|
+
* renders an anchor <a> tag, NOT a <button> element.
|
|
33
|
+
*/
|
|
34
|
+
href?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Disables the button, making it inoperable.
|
|
37
|
+
*/
|
|
38
|
+
isDisabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Replaces the button text with a loading indicator and disables the button.
|
|
41
|
+
*/
|
|
42
|
+
isLoading?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Prop reserved for when component is wrapped by `<Link>` from react-router.
|
|
45
|
+
*/
|
|
46
|
+
navigate?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Callback when Button is pressed.
|
|
49
|
+
*/
|
|
50
|
+
onClick?: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Callback when focus leaves Button.
|
|
53
|
+
*/
|
|
54
|
+
onBlur?: (event: FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback when Button receives focus.
|
|
57
|
+
*/
|
|
58
|
+
onFocus?: (event: FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Specify the tabIndex of the button.
|
|
61
|
+
*/
|
|
62
|
+
tabIndex?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Useful when using button as an anchor tag.
|
|
65
|
+
*/
|
|
66
|
+
target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
67
|
+
/**
|
|
68
|
+
* The size of the button.
|
|
69
|
+
*/
|
|
70
|
+
size?: ButtonSize | ResponsiveProp<ButtonSize>;
|
|
71
|
+
/**
|
|
72
|
+
* The color variant of the button
|
|
73
|
+
*/
|
|
74
|
+
variant?: ButtonVariant;
|
|
75
|
+
}
|
|
76
|
+
export type AnchorButtonProps = {
|
|
77
|
+
as: 'a';
|
|
78
|
+
} & BaseButtonProps & Omit<React.DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, 'ref'>;
|
|
79
|
+
export type NormalButtonProps = {
|
|
80
|
+
as?: 'button';
|
|
81
|
+
} & BaseButtonProps & Omit<React.DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, 'ref'>;
|
|
82
|
+
export type ButtonProps = NormalButtonProps | AnchorButtonProps;
|
|
83
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
declare const meta: Meta<typeof Button>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: () => React.JSX.Element;
|
|
7
|
+
export declare const Variants: () => React.JSX.Element;
|
|
8
|
+
export declare const Sizes: () => React.JSX.Element;
|
|
9
|
+
export declare const FullWidth: () => React.JSX.Element;
|
|
10
|
+
export declare const Icons: () => React.JSX.Element;
|
|
11
|
+
export declare const IconButton: () => React.JSX.Element;
|
|
12
|
+
export declare const Loading: () => React.JSX.Element;
|
|
13
|
+
export declare const Disabled: () => React.JSX.Element;
|
|
14
|
+
export declare const Anchor: () => React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BoxProps } from '../Box/Box';
|
|
2
|
+
import { CardFooter, CardHeader, CardSection } from './components';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
export interface CardProps extends BoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* The Card's contents.
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const CardBaseComponent: React.FC<CardProps>;
|
|
11
|
+
export interface CardStatic {
|
|
12
|
+
Header: typeof CardHeader;
|
|
13
|
+
Section: typeof CardSection;
|
|
14
|
+
Footer: typeof CardFooter;
|
|
15
|
+
}
|
|
16
|
+
export type CardWithStaticComponents = typeof CardBaseComponent & CardStatic;
|
|
17
|
+
export declare const Card: CardWithStaticComponents;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Card } from './Card';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const meta: Meta<typeof Card>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const OverviewCard: () => React.JSX.Element;
|
|
7
|
+
export declare const ExampleSignUpForm: () => React.JSX.Element;
|
|
8
|
+
export declare const ExampleFullBleedPhotos: () => React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BoxProps } from '../../../Box/Box';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
export interface CardFooterProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* Contents of the Footer.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Additional props to be spread to rendered element
|
|
10
|
+
*/
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export declare const CardFooter: FC<CardFooterProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '../../../Box/Box';
|
|
3
|
+
export interface CardHeaderProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* contents of the Header
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Additional class names to add
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The title of the card
|
|
14
|
+
*/
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Additional props to be spread to rendered element
|
|
18
|
+
*/
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export declare const CardHeader: FC<CardHeaderProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BoxProps } from '../../../Box/Box';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
export interface CardSectionProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* Any valid background color token, or a `url()` for an image
|
|
6
|
+
*/
|
|
7
|
+
background?: BoxProps['background'];
|
|
8
|
+
/**
|
|
9
|
+
* If defined as a prop, this value will take higher precedence than the corresponding component design token value
|
|
10
|
+
* Any valid border color token
|
|
11
|
+
* Or a responsive prop with borderColor for each breakpoint.
|
|
12
|
+
*/
|
|
13
|
+
borderColor?: BoxProps['borderColor'];
|
|
14
|
+
/**
|
|
15
|
+
* If defined as a prop, this value will take higher precedence than the corresponding component design token value
|
|
16
|
+
* Width of the section's border
|
|
17
|
+
* Can be a single [border width token](/?path=/docs/foundation-design-tokens--docs#border-width).
|
|
18
|
+
* Can also be a string of [border width tokens](/?path=/docs/foundation-design-tokens--docs#border-width)
|
|
19
|
+
* that models itself after the css shorthand property,
|
|
20
|
+
* where you can set the border width on all four sides of an element.
|
|
21
|
+
* e.g: "0 sm xs 0" --> top: 0, right: sm, bottom: xs, left: 0;
|
|
22
|
+
*/
|
|
23
|
+
borderWidth?: BoxProps['borderWidth'];
|
|
24
|
+
/**
|
|
25
|
+
* Contents of the Section.
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Custom class to be applied to section container.
|
|
30
|
+
*/
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Visually subdued the appearance of the section.
|
|
34
|
+
*/
|
|
35
|
+
subdued?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Title for the section.
|
|
38
|
+
*/
|
|
39
|
+
title?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Additional props to be spread to rendered element
|
|
42
|
+
*/
|
|
43
|
+
[x: string]: any;
|
|
44
|
+
}
|
|
45
|
+
export declare const CardSection: FC<CardSectionProps>;
|
|
46
|
+
export default CardSection;
|