@ndlib/component-library 0.0.33 → 0.0.35
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/composites/EmptyState/EmptyState.stories.d.ts +1 -0
- package/dist/components/composites/EmptyState/EmptyState.stories.js +5 -1
- package/dist/components/composites/EmptyState/index.d.ts +5 -0
- package/dist/components/composites/EmptyState/index.js +8 -2
- package/dist/components/elements/Button/index.d.ts +2 -0
- package/dist/components/elements/Fields/Select/Select.stories.d.ts +1 -0
- package/dist/components/elements/Fields/Select/Select.stories.js +4 -1
- package/dist/components/elements/Fields/Select/index.d.ts +2 -1
- package/dist/components/elements/Fields/Select/index.js +20 -6
- package/dist/components/elements/Fields/TextInput/TextInput.stories.d.ts +1 -0
- package/dist/components/elements/Fields/TextInput/TextInput.stories.js +5 -2
- package/dist/components/elements/Fields/TextInput/index.d.ts +15 -0
- package/dist/components/elements/Fields/TextInput/index.js +28 -6
- package/dist/components/elements/Icon/index.js +12 -2
- package/dist/components/elements/List/List.stories.d.ts +1 -0
- package/dist/components/elements/List/List.stories.js +6 -0
- package/dist/components/elements/List/index.d.ts +7 -0
- package/dist/components/elements/List/index.js +37 -15
- package/dist/components/elements/ListBox/index.d.ts +2 -0
- package/dist/components/elements/Pill/index.d.ts +2 -0
- package/dist/components/elements/text/Label/index.d.ts +1 -0
- package/dist/components/elements/text/Label/index.js +2 -2
- package/dist/components/elements/text/Paragraph/index.d.ts +2 -0
- package/dist/components/elements/text/Paragraph/index.js +2 -2
- package/dist/components/elements/text/ReadMore/index.d.ts +4 -0
- package/dist/components/elements/text/ReadMore/index.js +1 -1
- package/dist/components/providers/ui.js +1 -0
- package/dist/theme/custom.d.ts +5 -0
- package/dist/theme/custom.js +6 -0
- package/dist/theme/index.d.ts +9 -3
- package/dist/theme/index.js +2 -2
- package/dist/theme/typography.d.ts +7 -0
- package/dist/theme/typography.js +40 -9
- package/package.json +1 -1
|
@@ -4,5 +4,6 @@ declare const meta: Meta<typeof EmptyState>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof EmptyState>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const Small: Story;
|
|
7
8
|
export declare const CustomMessage: Story;
|
|
8
9
|
export declare const CustomIcon: Story;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { EmptyState } from '.';
|
|
2
|
+
import { EMPTY_STATE_SIZE, EmptyState } from '.';
|
|
3
3
|
import NotInterestedIcon from '@mui/icons-material/NotInterested';
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'Composites/EmptyState',
|
|
@@ -11,6 +11,10 @@ export const Default = {
|
|
|
11
11
|
render: () => _jsx(EmptyState, {}),
|
|
12
12
|
args: {},
|
|
13
13
|
};
|
|
14
|
+
export const Small = {
|
|
15
|
+
render: () => _jsx(EmptyState, { size: EMPTY_STATE_SIZE.SM }),
|
|
16
|
+
args: {},
|
|
17
|
+
};
|
|
14
18
|
export const CustomMessage = {
|
|
15
19
|
render: () => _jsx(EmptyState, { message: "Custom message" }),
|
|
16
20
|
args: {},
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { StyledElementProps } from '../../../theme';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export declare enum EMPTY_STATE_SIZE {
|
|
4
|
+
SM = "SM",
|
|
5
|
+
LG = "LG"
|
|
6
|
+
}
|
|
3
7
|
type EmptyStateProps = StyledElementProps<HTMLDivElement, {
|
|
4
8
|
icon?: React.FC;
|
|
9
|
+
size?: EMPTY_STATE_SIZE;
|
|
5
10
|
message?: string;
|
|
6
11
|
}>;
|
|
7
12
|
export declare const DEFAULT_MESSAGE = "No results found.";
|
|
@@ -19,8 +19,14 @@ import { Icon } from '../../elements/Icon';
|
|
|
19
19
|
import { FONT_SIZE } from '../../../theme/typography';
|
|
20
20
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
21
21
|
const SearchOffIcon = importedDefaultComponentShim(_SearchOffIcon);
|
|
22
|
+
export var EMPTY_STATE_SIZE;
|
|
23
|
+
(function (EMPTY_STATE_SIZE) {
|
|
24
|
+
EMPTY_STATE_SIZE["SM"] = "SM";
|
|
25
|
+
EMPTY_STATE_SIZE["LG"] = "LG";
|
|
26
|
+
})(EMPTY_STATE_SIZE || (EMPTY_STATE_SIZE = {}));
|
|
22
27
|
export const DEFAULT_MESSAGE = 'No results found.';
|
|
23
28
|
export const EmptyState = (_a) => {
|
|
24
|
-
var { icon, message, sx } = _a, rest = __rest(_a, ["icon", "message", "sx"]);
|
|
25
|
-
|
|
29
|
+
var { icon, message, size: sizeProp, sx } = _a, rest = __rest(_a, ["icon", "message", "size", "sx"]);
|
|
30
|
+
const size = sizeProp || EMPTY_STATE_SIZE.LG;
|
|
31
|
+
return (_jsxs(Column, Object.assign({ sx: Object.assign({ width: '100%', alignItems: 'center', justifyContent: 'center', mt: size === EMPTY_STATE_SIZE.SM ? 3 : 5 }, sx) }, rest, { children: [_jsx(Row, { children: _jsx(Icon, { icon: icon || SearchOffIcon, size: size === EMPTY_STATE_SIZE.SM ? FONT_SIZE.ML : FONT_SIZE.XL, color: COLOR.GRAY }) }), _jsx(Row, Object.assign({ sx: { mt: size === EMPTY_STATE_SIZE.SM ? 0 : 1 } }, { children: _jsx(Paragraph, Object.assign({ sx: { color: COLOR.GRAY }, size: size === EMPTY_STATE_SIZE.SM ? PARAGRAPH_SIZE.MD : PARAGRAPH_SIZE.LG }, { children: message || DEFAULT_MESSAGE })) }))] })));
|
|
26
32
|
};
|
|
@@ -40,6 +40,8 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
40
40
|
accessibleLabel?: string | undefined;
|
|
41
41
|
loading?: boolean | undefined;
|
|
42
42
|
disabled?: boolean | undefined;
|
|
43
|
+
} & {
|
|
44
|
+
htmlFor?: string | undefined;
|
|
43
45
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
44
46
|
type LinkButtonProps = Omit<ButtonProps, 'type' | 'color' | 'textColor'>;
|
|
45
47
|
export declare const LinkButton: React.FC<LinkButtonProps>;
|
|
@@ -28,5 +28,8 @@ const StatefulSelect = (props) => {
|
|
|
28
28
|
return (_jsx(Select, Object.assign({ options: options }, props, { value: value, onSelectOption: setValue, placeholder: "Select A Fruit..." })));
|
|
29
29
|
};
|
|
30
30
|
export const Default = {
|
|
31
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt:
|
|
31
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 } })] }))) })),
|
|
32
|
+
};
|
|
33
|
+
export const WithLabel = {
|
|
34
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
|
|
32
35
|
};
|
|
@@ -7,10 +7,11 @@ type SelectProps<Value extends Key, Option extends BasicOption<Value>> = StyledE
|
|
|
7
7
|
size?: INPUT_SIZE;
|
|
8
8
|
leftIcon?: React.FC<any>;
|
|
9
9
|
value: Value;
|
|
10
|
+
label?: string;
|
|
10
11
|
onSelectOption: (value: Value) => void;
|
|
11
12
|
options: Option[];
|
|
12
13
|
renderOption: RenderOption<Value, Option>;
|
|
13
14
|
renderOptionLabel: RenderOptionLabel<Option>;
|
|
14
15
|
}, string>;
|
|
15
|
-
export declare function Select<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }: SelectProps<Value, Option>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function Select<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }: SelectProps<Value, Option>): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
3
|
import _ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
4
4
|
import { useFloating, size as sizeMiddleware, offset, autoPlacement, } from '@floating-ui/react';
|
|
5
5
|
import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
|
|
6
6
|
import { useTheme } from '../../../../theme';
|
|
7
|
-
import { INPUT_SIZE } from '../TextInput';
|
|
7
|
+
import { INPUT_SIZE, labelOffsetMap, labelTypographyMap } from '../TextInput';
|
|
8
8
|
import { ListBox } from '../../ListBox';
|
|
9
9
|
import { BUTTON_SIZE, BUTTON_TYPE, Button } from '../../Button';
|
|
10
10
|
import { defaultRenderOptionLabel, getOptionId, } from '../option';
|
|
11
11
|
import { useUniqueHtmlId } from '../../../../utils/hooks/useUniqueHtmlId';
|
|
12
12
|
import { KEY_CODES, importedDefaultComponentShim } from '../../../../utils/misc';
|
|
13
13
|
import { COLOR } from '../../../../theme/colors';
|
|
14
|
+
import { Box } from '../../layout/Box';
|
|
15
|
+
import { Label } from '../../text/Label';
|
|
14
16
|
const ArrowDropDownIcon = importedDefaultComponentShim(_ArrowDropDownIcon);
|
|
15
17
|
const typographyMap = {
|
|
16
18
|
[INPUT_SIZE.SM]: TYPOGRAPHY_TYPE.PARAGRAPH_SMALL,
|
|
@@ -18,7 +20,7 @@ const typographyMap = {
|
|
|
18
20
|
[INPUT_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
|
|
19
21
|
};
|
|
20
22
|
const defaultHeight = {
|
|
21
|
-
[INPUT_SIZE.SM]: '
|
|
23
|
+
[INPUT_SIZE.SM]: '2.25rem',
|
|
22
24
|
[INPUT_SIZE.MD]: '2.5rem',
|
|
23
25
|
[INPUT_SIZE.LG]: '3rem',
|
|
24
26
|
};
|
|
@@ -28,9 +30,10 @@ const buttonSizeMap = {
|
|
|
28
30
|
[INPUT_SIZE.LG]: BUTTON_SIZE.LG,
|
|
29
31
|
};
|
|
30
32
|
const DEFAULT_WIDTH = '16rem';
|
|
31
|
-
export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }) {
|
|
33
|
+
export function Select({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }) {
|
|
32
34
|
const theme = useTheme();
|
|
33
35
|
const listboxId = useUniqueHtmlId('select-list-box');
|
|
36
|
+
const inputId = useUniqueHtmlId('select-input');
|
|
34
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
35
38
|
const [stagedOptionValue, setStagedOptionValue] = useState();
|
|
36
39
|
const currentOption = useMemo(() => {
|
|
@@ -113,7 +116,16 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelect
|
|
|
113
116
|
const typography = typographyMap[size];
|
|
114
117
|
const typographyStyles = getTypographyStyles(typography);
|
|
115
118
|
const renderOptionLabel = renderOptionLabelParam || defaultRenderOptionLabel;
|
|
116
|
-
return (_jsxs(
|
|
119
|
+
return (_jsxs(Box, Object.assign({ sx: { position: 'relative' } }, { children: [_jsx(Label, Object.assign({ htmlFor: inputId, typography: labelTypographyMap[size], sx: {
|
|
120
|
+
position: 'absolute',
|
|
121
|
+
color: COLOR.ND_PROVOST_BLUE,
|
|
122
|
+
backgroundColor: COLOR.WHITE,
|
|
123
|
+
left: '0.5rem',
|
|
124
|
+
lineHeight: 1,
|
|
125
|
+
zIndex: theme.zIndex.LABEL,
|
|
126
|
+
px: size === INPUT_SIZE.SM ? 1 : 2,
|
|
127
|
+
top: labelOffsetMap[size],
|
|
128
|
+
} }, { children: label })), _jsx(Button, Object.assign({ ref: refs.setReference,
|
|
117
129
|
// A11y attributes
|
|
118
130
|
role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
|
|
119
131
|
? getOptionId(stagedOptionValue)
|
|
@@ -133,5 +145,7 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelect
|
|
|
133
145
|
} }, typographyStyles), sx), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon }, { children: currentOption ? renderOptionLabel(currentOption) : placeholder })), isOpen && (_jsx(ListBox, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
|
|
134
146
|
onSelectOption && onSelectOption(option.value);
|
|
135
147
|
close();
|
|
136
|
-
}, ref: refs.setFloating, renderOption: renderOption,
|
|
148
|
+
}, ref: refs.setFloating, renderOption: renderOption, sx: {
|
|
149
|
+
zIndex: theme.zIndex.DROPDOWN,
|
|
150
|
+
}, style: Object.assign(Object.assign({ minWidth: dropdownMinWidth }, floatingStyles), { zIndex: 1 }) }))] })));
|
|
137
151
|
}
|
|
@@ -18,8 +18,11 @@ const sizes = [
|
|
|
18
18
|
];
|
|
19
19
|
const StatefulInput = (props) => {
|
|
20
20
|
const [value, setValue] = useState('');
|
|
21
|
-
return
|
|
21
|
+
return _jsx(TextInput, Object.assign({ value: value, onChange: setValue }, props));
|
|
22
22
|
};
|
|
23
23
|
export const Default = {
|
|
24
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt:
|
|
24
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt: 2 } })] }))) })),
|
|
25
|
+
};
|
|
26
|
+
export const WithLabel = {
|
|
27
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, label: "Search", sx: { mt: 2 } })] }))) })),
|
|
25
28
|
};
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
/** @jsxImportSource theme-ui */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
|
|
3
4
|
import { StyledElementProps } from '../../../../theme';
|
|
4
5
|
export declare enum INPUT_SIZE {
|
|
5
6
|
SM = "sm",
|
|
6
7
|
MD = "md",
|
|
7
8
|
LG = "lg"
|
|
8
9
|
}
|
|
10
|
+
export declare const labelTypographyMap: {
|
|
11
|
+
sm: TYPOGRAPHY_TYPE;
|
|
12
|
+
md: TYPOGRAPHY_TYPE;
|
|
13
|
+
lg: TYPOGRAPHY_TYPE;
|
|
14
|
+
};
|
|
15
|
+
export declare const labelOffsetMap: {
|
|
16
|
+
sm: string;
|
|
17
|
+
md: string;
|
|
18
|
+
lg: string;
|
|
19
|
+
};
|
|
9
20
|
export type TextInputProps = StyledElementProps<HTMLInputElement, {
|
|
10
21
|
size?: INPUT_SIZE;
|
|
11
22
|
leftIcon?: React.FC<any>;
|
|
12
23
|
inline?: boolean;
|
|
24
|
+
label?: string;
|
|
13
25
|
value: string;
|
|
14
26
|
onChange?: (value: string) => void;
|
|
15
27
|
onChangeRaw?: (e: string | React.ChangeEvent) => void;
|
|
@@ -21,7 +33,10 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
|
21
33
|
size?: INPUT_SIZE | undefined;
|
|
22
34
|
leftIcon?: React.FC<any> | undefined;
|
|
23
35
|
inline?: boolean | undefined;
|
|
36
|
+
label?: string | undefined;
|
|
24
37
|
value: string;
|
|
25
38
|
onChange?: ((value: string) => void) | undefined;
|
|
26
39
|
onChangeRaw?: ((e: string | React.ChangeEvent) => void) | undefined;
|
|
40
|
+
} & {
|
|
41
|
+
htmlFor?: string | undefined;
|
|
27
42
|
} & React.RefAttributes<any>>;
|
|
@@ -16,6 +16,8 @@ import { TYPOGRAPHY_TYPE, getIconSize, getTypographyStyles, } from '../../../../
|
|
|
16
16
|
import { useTheme } from '../../../../theme';
|
|
17
17
|
import { Icon } from '../../Icon';
|
|
18
18
|
import { COLOR } from '../../../../theme/colors';
|
|
19
|
+
import { Label } from '../../text/Label';
|
|
20
|
+
import { useUniqueHtmlId } from '../../../../utils/hooks/useUniqueHtmlId';
|
|
19
21
|
export var INPUT_SIZE;
|
|
20
22
|
(function (INPUT_SIZE) {
|
|
21
23
|
INPUT_SIZE["SM"] = "sm";
|
|
@@ -27,18 +29,29 @@ const typographyMap = {
|
|
|
27
29
|
[INPUT_SIZE.MD]: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM,
|
|
28
30
|
[INPUT_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
|
|
29
31
|
};
|
|
32
|
+
export const labelTypographyMap = {
|
|
33
|
+
[INPUT_SIZE.SM]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
|
|
34
|
+
[INPUT_SIZE.MD]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
|
|
35
|
+
[INPUT_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_MEDIUM,
|
|
36
|
+
};
|
|
37
|
+
export const labelOffsetMap = {
|
|
38
|
+
[INPUT_SIZE.SM]: '-0.375rem',
|
|
39
|
+
[INPUT_SIZE.MD]: '-0.45rem',
|
|
40
|
+
[INPUT_SIZE.LG]: '-0.5rem',
|
|
41
|
+
};
|
|
30
42
|
const defaultPaddingX = {
|
|
31
43
|
[INPUT_SIZE.SM]: 2,
|
|
32
44
|
[INPUT_SIZE.MD]: 3,
|
|
33
45
|
[INPUT_SIZE.LG]: 3,
|
|
34
46
|
};
|
|
35
47
|
const defaultHeight = {
|
|
36
|
-
[INPUT_SIZE.SM]: '
|
|
48
|
+
[INPUT_SIZE.SM]: '2.25rem',
|
|
37
49
|
[INPUT_SIZE.MD]: '2.5rem',
|
|
38
50
|
[INPUT_SIZE.LG]: '3rem',
|
|
39
51
|
};
|
|
40
52
|
export const TextInput = React.forwardRef((_a, ref) => {
|
|
41
|
-
var { value, onChange, onChangeRaw, onClick, inline, size: sizeParam, leftIcon, sx } = _a, rest = __rest(_a, ["value", "onChange", "onChangeRaw", "onClick", "inline", "size", "leftIcon", "sx"]);
|
|
53
|
+
var { value, label, onChange, onChangeRaw, onClick, inline, size: sizeParam, leftIcon, sx } = _a, rest = __rest(_a, ["value", "label", "onChange", "onChangeRaw", "onClick", "inline", "size", "leftIcon", "sx"]);
|
|
54
|
+
const id = useUniqueHtmlId('text-input');
|
|
42
55
|
const theme = useTheme();
|
|
43
56
|
const size = sizeParam || INPUT_SIZE.MD;
|
|
44
57
|
const display = inline === false ? 'flex' : 'inline-flex';
|
|
@@ -46,8 +59,8 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
46
59
|
const height = defaultHeight[size];
|
|
47
60
|
const typography = typographyMap[size];
|
|
48
61
|
const typographyStyles = getTypographyStyles(typography);
|
|
49
|
-
return (_jsxs("div", Object.assign({ ref: ref, onClick: onClick, sx: Object.assign(Object.assign({ height,
|
|
50
|
-
display, px: paddingX, border: 'solid 1px', borderColor: COLOR.GRAY, borderRadius: '4px', flexDirection: 'row', alignItems: 'center', ':hover': {
|
|
62
|
+
return (_jsxs("div", Object.assign({ ref: ref, onClick: onClick, id: id, sx: Object.assign(Object.assign({ height,
|
|
63
|
+
display, px: paddingX, border: 'solid 1px', borderColor: COLOR.GRAY, borderRadius: '4px', flexDirection: 'row', position: 'relative', alignItems: 'center', ':hover': {
|
|
51
64
|
boxShadow: theme.boxShadow.NORMAL,
|
|
52
65
|
}, ':focus': {
|
|
53
66
|
boxShadow: theme.boxShadow.NORMAL,
|
|
@@ -57,7 +70,16 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
57
70
|
} })), _jsx("input", Object.assign({ value: value, onChange: (event) => {
|
|
58
71
|
onChange && onChange(event.target.value);
|
|
59
72
|
onChangeRaw && onChangeRaw(event);
|
|
60
|
-
}, sx: Object.assign(Object.assign({ px: 0, py: 0, border: 'none' }, typographyStyles), { ':focus': {
|
|
73
|
+
}, sx: Object.assign(Object.assign({ px: 0, py: 0, width: '100%', border: 'none' }, typographyStyles), { ':focus': {
|
|
61
74
|
outline: 'none',
|
|
62
|
-
} }) }, rest))]
|
|
75
|
+
} }) }, rest)), label && (_jsx(Label, Object.assign({ htmlFor: id, typography: labelTypographyMap[size], sx: {
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
color: COLOR.ND_PROVOST_BLUE,
|
|
78
|
+
backgroundColor: COLOR.WHITE,
|
|
79
|
+
left: '0.5rem',
|
|
80
|
+
lineHeight: 1,
|
|
81
|
+
zIndex: theme.zIndex.LABEL,
|
|
82
|
+
px: size === INPUT_SIZE.SM ? 1 : 2,
|
|
83
|
+
top: labelOffsetMap[size],
|
|
84
|
+
} }, { children: label })))] })));
|
|
63
85
|
});
|
|
@@ -13,10 +13,20 @@ import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
|
13
13
|
/** @jsxImportSource theme-ui */
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { COLOR, colors } from '../../../theme/colors';
|
|
16
|
+
import { useEnvironment } from '../../providers/env';
|
|
16
17
|
export const Icon = (_a) => {
|
|
17
|
-
var { icon, size, color, sx } = _a, rest = __rest(_a, ["icon", "size", "color", "sx"]);
|
|
18
|
+
var { icon, size, color, sx, onClick } = _a, rest = __rest(_a, ["icon", "size", "color", "sx", "onClick"]);
|
|
18
19
|
const InnerComponent = icon;
|
|
19
|
-
|
|
20
|
+
const { flagInDevelopment } = useEnvironment();
|
|
21
|
+
if (onClick && !rest['aria-label']) {
|
|
22
|
+
flagInDevelopment('Icon component with onClick should have an aria-label and tabIndex={0}');
|
|
23
|
+
}
|
|
24
|
+
return (_jsx("div", Object.assign({ tabIndex: onClick ? 0 : undefined, role: onClick ? 'button' : 'none', sx: Object.assign(Object.assign({}, sx), { fontSize: size, display: 'flex', alignItems: 'center', justifyContent: 'center', ':hover': onClick
|
|
25
|
+
? {
|
|
26
|
+
cursor: 'pointer',
|
|
27
|
+
transform: 'scale(1.05)',
|
|
28
|
+
}
|
|
29
|
+
: {} }) }, rest, { children: React.createElement(InnerComponent, {
|
|
20
30
|
fontSize: 'inherit',
|
|
21
31
|
style: {
|
|
22
32
|
color: colors[color || COLOR.PRIMARY],
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
3
|
+
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
|
4
|
+
import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
|
|
3
5
|
import { LIST_SIZE, List, ListItem } from './index';
|
|
4
6
|
import { Row } from '../layout/Row';
|
|
5
7
|
import { Column } from '../layout/Column';
|
|
6
8
|
import { HEADING_SIZE, Heading } from '../text/Heading';
|
|
7
9
|
import { GROUP_TYPE, Group } from '../Group';
|
|
8
10
|
import { COLOR } from '../../..';
|
|
11
|
+
import { FONT_SIZE } from '../../../theme/typography';
|
|
9
12
|
const meta = {
|
|
10
13
|
title: 'Elements/List',
|
|
11
14
|
component: List,
|
|
@@ -29,3 +32,6 @@ export const Ordered = {
|
|
|
29
32
|
export const CustomIcon = {
|
|
30
33
|
render: () => (_jsx(Row, { children: _jsxs(List, Object.assign({ icon: ChevronRightIcon, iconColor: COLOR.PRIMARY }, { children: [_jsx(ListItem, Object.assign({ index: 0 }, { children: "List Item 1" })), _jsx(ListItem, Object.assign({ index: 1 }, { children: "List Item 2" })), _jsx(ListItem, Object.assign({ index: 2 }, { children: "List Item 3" }))] })) })),
|
|
31
34
|
};
|
|
35
|
+
export const CustomIconPerItem = {
|
|
36
|
+
render: () => (_jsx(Row, { children: _jsxs(List, Object.assign({ iconSize: FONT_SIZE.ML }, { children: [_jsx(ListItem, Object.assign({ index: 0, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Unfavorite" }, { children: "Favorite 1" })), _jsx(ListItem, Object.assign({ index: 1, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Favorite" }, { children: "Favorited 2" })), _jsx(ListItem, Object.assign({ index: 2, icon: BookmarkBorderIcon, onIconClick: () => { }, iconLabel: "Favorite" }, { children: "Not Favorited" }))] })) })),
|
|
37
|
+
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { StyledElementProps } from '../../../theme';
|
|
4
4
|
import { COLOR } from '../../..';
|
|
5
|
+
import { FONT_SIZE } from '../../../theme/typography';
|
|
5
6
|
type ListProps = StyledElementProps<HTMLUListElement, {
|
|
6
7
|
ordered?: boolean;
|
|
7
8
|
size?: LIST_SIZE;
|
|
8
9
|
icon?: React.FC<any>;
|
|
9
10
|
iconColor?: COLOR;
|
|
11
|
+
iconSize?: FONT_SIZE;
|
|
10
12
|
}>;
|
|
11
13
|
export declare enum LIST_SIZE {
|
|
12
14
|
SM = "sm",
|
|
@@ -16,6 +18,11 @@ export declare enum LIST_SIZE {
|
|
|
16
18
|
export declare const List: React.FC<ListProps>;
|
|
17
19
|
type ListItemProps = StyledElementProps<HTMLLIElement, {
|
|
18
20
|
index: number;
|
|
21
|
+
icon?: React.FC<any>;
|
|
22
|
+
iconSize?: FONT_SIZE;
|
|
23
|
+
iconColor?: COLOR;
|
|
24
|
+
iconLabel?: string;
|
|
25
|
+
onIconClick?: () => void;
|
|
19
26
|
}>;
|
|
20
27
|
export declare const ListItem: React.FC<ListItemProps>;
|
|
21
28
|
export {};
|
|
@@ -20,6 +20,9 @@ import { COLOR, Label, TYPOGRAPHY_TYPE } from '../../..';
|
|
|
20
20
|
import { FONT_SIZE, getTypographyStyles } from '../../../theme/typography';
|
|
21
21
|
import { Icon } from '../Icon';
|
|
22
22
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
23
|
+
import { useLinesHeight } from '../text/ReadMore';
|
|
24
|
+
import { Column } from '../layout/Column';
|
|
25
|
+
import { useEnvironment } from '../../providers/env';
|
|
23
26
|
const CircleIcon = importedDefaultComponentShim(_CircleIcon);
|
|
24
27
|
const CircleOutlinedIcon = importedDefaultComponentShim(_CircleOutlinedIcon);
|
|
25
28
|
const SquareIcon = importedDefaultComponentShim(_SquareIcon);
|
|
@@ -35,6 +38,11 @@ const marginSizeMap = {
|
|
|
35
38
|
[LIST_SIZE.MD]: 3,
|
|
36
39
|
[LIST_SIZE.LG]: 4,
|
|
37
40
|
};
|
|
41
|
+
const iconSizeMap = {
|
|
42
|
+
[LIST_SIZE.SM]: FONT_SIZE.XXS,
|
|
43
|
+
[LIST_SIZE.MD]: FONT_SIZE.XXS,
|
|
44
|
+
[LIST_SIZE.LG]: FONT_SIZE.XS,
|
|
45
|
+
};
|
|
38
46
|
const defaultIcons = [
|
|
39
47
|
CircleIcon,
|
|
40
48
|
CircleOutlinedIcon,
|
|
@@ -42,39 +50,53 @@ const defaultIcons = [
|
|
|
42
50
|
SquareOutlinedIcon,
|
|
43
51
|
];
|
|
44
52
|
const sizeTypographyMap = {
|
|
45
|
-
[LIST_SIZE.SM]: TYPOGRAPHY_TYPE.
|
|
46
|
-
[LIST_SIZE.MD]: TYPOGRAPHY_TYPE.
|
|
47
|
-
[LIST_SIZE.LG]: TYPOGRAPHY_TYPE.
|
|
53
|
+
[LIST_SIZE.SM]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_SMALL,
|
|
54
|
+
[LIST_SIZE.MD]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM,
|
|
55
|
+
[LIST_SIZE.LG]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE,
|
|
48
56
|
};
|
|
49
57
|
const ListConfigContext = React.createContext({
|
|
50
58
|
size: LIST_SIZE.MD,
|
|
51
59
|
ordered: false,
|
|
52
60
|
icon: CircleIcon,
|
|
53
61
|
iconColor: COLOR.TEXT,
|
|
62
|
+
iconSize: undefined,
|
|
54
63
|
depth: -1,
|
|
55
64
|
});
|
|
56
65
|
const useListConfig = () => React.useContext(ListConfigContext);
|
|
57
|
-
export const List = ({ sx, size, ordered, icon, iconColor, children, }) => {
|
|
58
|
-
const { depth: parentDepth, size: parentSize, iconColor: parentIconColor, } = useListConfig();
|
|
66
|
+
export const List = ({ sx, size: sizeParam, ordered, icon, iconSize: iconSizeParam, iconColor: iconColorParam, children, }) => {
|
|
67
|
+
const { depth: parentDepth, size: parentSize, iconColor: parentIconColor, iconSize: parentIconSize, } = useListConfig();
|
|
59
68
|
const depth = parentDepth + 1;
|
|
60
69
|
const defaultStyles = Object.assign({ listStyleType: 'none' }, getTypographyStyles());
|
|
61
70
|
const defaultIcon = defaultIcons[depth] || CircleIcon;
|
|
71
|
+
const size = sizeParam || parentSize || LIST_SIZE.MD;
|
|
72
|
+
const iconSize = iconSizeParam || parentIconSize || iconSizeMap[size];
|
|
73
|
+
const iconColor = iconColorParam || parentIconColor || COLOR.TEXT;
|
|
62
74
|
return (_jsx(ListConfigContext.Provider, Object.assign({ value: {
|
|
63
|
-
size
|
|
75
|
+
size,
|
|
64
76
|
icon: icon || defaultIcon,
|
|
65
|
-
iconColor
|
|
77
|
+
iconColor,
|
|
78
|
+
iconSize,
|
|
66
79
|
ordered: ordered || false,
|
|
67
80
|
depth,
|
|
68
81
|
} }, { children: ordered ? (_jsx("ul", Object.assign({ sx: Object.assign(Object.assign({}, defaultStyles), sx) }, { children: children }))) : (_jsx("ol", Object.assign({ sx: Object.assign(Object.assign({}, defaultStyles), sx) }, { children: children }))) })));
|
|
69
82
|
};
|
|
70
83
|
export const ListItem = (_a) => {
|
|
71
|
-
var { index, sx, children } = _a, rest = __rest(_a, ["index", "sx", "children"]);
|
|
72
|
-
const { ordered, icon, iconColor, size, depth } = useListConfig();
|
|
84
|
+
var { index, sx, icon: iconParam, iconSize: iconSizeParam, iconColor: iconColorParam, onIconClick, onClick, children, iconLabel } = _a, rest = __rest(_a, ["index", "sx", "icon", "iconSize", "iconColor", "onIconClick", "onClick", "children", "iconLabel"]);
|
|
85
|
+
const { ordered, icon: listIcon, iconColor: listIconColor, iconSize: listIconSize, size, depth, } = useListConfig();
|
|
86
|
+
const { flagInDevelopment } = useEnvironment();
|
|
87
|
+
if (onIconClick && !iconLabel) {
|
|
88
|
+
flagInDevelopment('ListItem component with onIconClick should have an iconLabel prop for accessibility');
|
|
89
|
+
}
|
|
90
|
+
const icon = iconParam || listIcon;
|
|
91
|
+
const iconSize = iconSizeParam || listIconSize;
|
|
92
|
+
const iconColor = iconColorParam || listIconColor;
|
|
93
|
+
const typography = sizeTypographyMap[size];
|
|
73
94
|
const typographyStyles = getTypographyStyles(sizeTypographyMap[size]);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
const lineHeight = useLinesHeight({ typography, lines: 1 });
|
|
96
|
+
return (_jsxs("li", Object.assign({ sx: Object.assign(Object.assign({ depth, display: 'flex', mt: index === 0 && depth === 0 ? 0 : marginSizeMap[size], ml: 1 }, typographyStyles), sx) }, rest, { children: [ordered ? (_jsxs(Label, Object.assign({ standalone: true, sx: { mr: 2 } }, { children: [index + 1, "."] }))) : (_jsx(Column, Object.assign({ sx: { height: lineHeight }, justify: "center" }, { children: _jsx(Icon, { icon: icon, color: iconColor, size: iconSize, onClick: onIconClick, "aria-label": iconLabel, sx: {
|
|
97
|
+
mr: 3,
|
|
98
|
+
alignItems: 'flex-start',
|
|
99
|
+
} }) }))), _jsx("div", Object.assign({ sx: {
|
|
100
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
101
|
+
}, tabIndex: onClick ? 0 : undefined }, { children: children }))] })));
|
|
80
102
|
};
|
|
@@ -26,6 +26,8 @@ export declare const ListBox: <Value extends React.Key = string, Option extends
|
|
|
26
26
|
onUpPress?: (() => void) | undefined;
|
|
27
27
|
onSelect?: (() => void) | undefined;
|
|
28
28
|
onBlur?: (() => void) | undefined;
|
|
29
|
+
} & {
|
|
30
|
+
htmlFor?: string | undefined;
|
|
29
31
|
} & {
|
|
30
32
|
ref?: React.ForwardedRef<HTMLDivElement> | undefined;
|
|
31
33
|
}) => any;
|
|
@@ -25,10 +25,10 @@ export const SIZE_TYPOGRAPHY_MAP = {
|
|
|
25
25
|
[LABEL_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_LARGE,
|
|
26
26
|
};
|
|
27
27
|
export const Label = (_a) => {
|
|
28
|
-
var { sx, size, standalone } = _a, rest = __rest(_a, ["sx", "size", "standalone"]);
|
|
28
|
+
var { sx, size, standalone, typography: typographyParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "typography"]);
|
|
29
29
|
const { labelId, labelTargetId, type: groupType } = useGroup();
|
|
30
30
|
const { flagInDevelopment } = useEnvironment();
|
|
31
|
-
const typography = SIZE_TYPOGRAPHY_MAP[size || LABEL_SIZE.MD];
|
|
31
|
+
const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || LABEL_SIZE.MD];
|
|
32
32
|
if (groupType !== GROUP_TYPE.GROUP && !standalone) {
|
|
33
33
|
flagInDevelopment('Label component should be used within a Group component with property type={GROUP_TYPE.GROUP} or given the standalone flag');
|
|
34
34
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** @jsxImportSource theme-ui */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
|
|
3
4
|
import { StyledElementProps } from '../../../../theme';
|
|
4
5
|
type ParagraphProps = StyledElementProps<HTMLSpanElement, {
|
|
5
6
|
size?: PARAGRAPH_SIZE;
|
|
7
|
+
typography?: TYPOGRAPHY_TYPE;
|
|
6
8
|
}>;
|
|
7
9
|
export declare enum PARAGRAPH_SIZE {
|
|
8
10
|
SM = "sm",
|
|
@@ -23,7 +23,7 @@ const SIZE_TYPOGRAPHY_MAP = {
|
|
|
23
23
|
[PARAGRAPH_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
|
|
24
24
|
};
|
|
25
25
|
export const Paragraph = (_a) => {
|
|
26
|
-
var { size, sx } = _a, rest = __rest(_a, ["size", "sx"]);
|
|
27
|
-
const typography = SIZE_TYPOGRAPHY_MAP[size || PARAGRAPH_SIZE.MD];
|
|
26
|
+
var { size, typography: typographyParam, sx } = _a, rest = __rest(_a, ["size", "typography", "sx"]);
|
|
27
|
+
const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || PARAGRAPH_SIZE.MD];
|
|
28
28
|
return (_jsx("div", Object.assign({ sx: Object.assign(Object.assign(Object.assign({}, getTypographyStyles(typography)), { my: 1 }), sx) }, rest)));
|
|
29
29
|
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { StyledElementProps } from '../../../../theme';
|
|
4
4
|
import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
|
|
5
|
+
export declare const useLinesHeight: (args: {
|
|
6
|
+
lines: number;
|
|
7
|
+
typography: TYPOGRAPHY_TYPE;
|
|
8
|
+
}) => string;
|
|
5
9
|
export declare const ReadMore: React.FC<StyledElementProps<HTMLDivElement, {
|
|
6
10
|
typography: TYPOGRAPHY_TYPE;
|
|
7
11
|
lines: number;
|
|
@@ -33,7 +33,7 @@ const ReadMoreLink = (props) => {
|
|
|
33
33
|
cursor: 'pointer',
|
|
34
34
|
} }, { children: "Read More..." })) })));
|
|
35
35
|
};
|
|
36
|
-
const useLinesHeight = (args) => {
|
|
36
|
+
export const useLinesHeight = (args) => {
|
|
37
37
|
const theme = useTheme();
|
|
38
38
|
const styles = getTypographyStyles(args.typography);
|
|
39
39
|
const fontSize = styles.fontSize;
|
|
@@ -6,5 +6,6 @@ import { AlertsProvider } from './alerts';
|
|
|
6
6
|
import { FontLoader } from '../../FontLoader';
|
|
7
7
|
import { GlobalStyles } from '../../theme/GlobalStyles';
|
|
8
8
|
export const UiProvider = ({ env, components, alertsConfig, children, loadFonts, loadGlobalStyles, }) => {
|
|
9
|
+
console.log('here');
|
|
9
10
|
return (_jsxs(EnvironmentProvider, Object.assign({ env: env }, { children: [_jsx(ComponentConfigProvider, Object.assign({ config: components || {} }, { children: _jsx(ThemeProvider, { children: _jsx(AlertsProvider, Object.assign({}, alertsConfig, { children: children })) }) })), loadGlobalStyles && _jsx(GlobalStyles, {}), loadFonts && _jsx(FontLoader, {})] })));
|
|
10
11
|
};
|
package/dist/theme/custom.d.ts
CHANGED
package/dist/theme/custom.js
CHANGED
|
@@ -4,3 +4,9 @@ export var BOX_SHADOW;
|
|
|
4
4
|
BOX_SHADOW["NORMAL"] = "0 0 8px #dfdfdf";
|
|
5
5
|
BOX_SHADOW["EMPHASIZED"] = "0 0 12px #d3d3d3";
|
|
6
6
|
})(BOX_SHADOW || (BOX_SHADOW = {}));
|
|
7
|
+
export var Z_INDEX;
|
|
8
|
+
(function (Z_INDEX) {
|
|
9
|
+
Z_INDEX[Z_INDEX["NORMAL"] = 1] = "NORMAL";
|
|
10
|
+
Z_INDEX[Z_INDEX["LABEL"] = 2] = "LABEL";
|
|
11
|
+
Z_INDEX[Z_INDEX["DROPDOWN"] = 3] = "DROPDOWN";
|
|
12
|
+
})(Z_INDEX || (Z_INDEX = {}));
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { ThemeUICSSObject } from 'theme-ui';
|
|
3
3
|
import { FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT } from './typography';
|
|
4
4
|
import { COLOR } from './colors';
|
|
5
|
-
import { BOX_SHADOW } from './custom';
|
|
5
|
+
import { BOX_SHADOW, Z_INDEX } from './custom';
|
|
6
6
|
export declare const BREAKPOINTS: string[];
|
|
7
7
|
export declare const SPACING: string[];
|
|
8
8
|
export declare const theme: {
|
|
@@ -57,6 +57,7 @@ export declare const theme: {
|
|
|
57
57
|
space: string[];
|
|
58
58
|
boxShadow: typeof BOX_SHADOW;
|
|
59
59
|
breakpoints: string[];
|
|
60
|
+
zIndex: typeof Z_INDEX;
|
|
60
61
|
fonts: {
|
|
61
62
|
branded: string;
|
|
62
63
|
branded2: string;
|
|
@@ -64,6 +65,7 @@ export declare const theme: {
|
|
|
64
65
|
normal: string;
|
|
65
66
|
};
|
|
66
67
|
fontSizes: {
|
|
68
|
+
xxs: string;
|
|
67
69
|
xs: string;
|
|
68
70
|
sm: string;
|
|
69
71
|
ms: string;
|
|
@@ -91,13 +93,15 @@ export type StylesProp = ThemeUICSSObject & {
|
|
|
91
93
|
fontSize?: FONT_SIZE;
|
|
92
94
|
font?: FONT;
|
|
93
95
|
fontWeight?: FONT_WEIGHT;
|
|
94
|
-
lineHeight?: LINE_HEIGHT;
|
|
96
|
+
lineHeight?: LINE_HEIGHT | number;
|
|
95
97
|
boxShadow?: BOX_SHADOW;
|
|
96
98
|
};
|
|
97
99
|
export type StyledElementProps<E extends Element, CustomProps = object, Children = React.ReactNode> = {
|
|
98
100
|
sx?: StylesProp;
|
|
99
101
|
children?: Children;
|
|
100
|
-
} & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps
|
|
102
|
+
} & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps & {
|
|
103
|
+
htmlFor?: string;
|
|
104
|
+
};
|
|
101
105
|
export declare const useTheme: () => {
|
|
102
106
|
colors: {
|
|
103
107
|
text: string;
|
|
@@ -150,6 +154,7 @@ export declare const useTheme: () => {
|
|
|
150
154
|
space: string[];
|
|
151
155
|
boxShadow: typeof BOX_SHADOW;
|
|
152
156
|
breakpoints: string[];
|
|
157
|
+
zIndex: typeof Z_INDEX;
|
|
153
158
|
fonts: {
|
|
154
159
|
branded: string;
|
|
155
160
|
branded2: string;
|
|
@@ -157,6 +162,7 @@ export declare const useTheme: () => {
|
|
|
157
162
|
normal: string;
|
|
158
163
|
};
|
|
159
164
|
fontSizes: {
|
|
165
|
+
xxs: string;
|
|
160
166
|
xs: string;
|
|
161
167
|
sm: string;
|
|
162
168
|
ms: string;
|
package/dist/theme/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ThemeUIProvider, useThemeUI } from 'theme-ui';
|
|
3
3
|
import { fontStyles, } from './typography';
|
|
4
4
|
import { colors } from './colors';
|
|
5
|
-
import { BOX_SHADOW } from './custom';
|
|
5
|
+
import { BOX_SHADOW, Z_INDEX } from './custom';
|
|
6
6
|
export const BREAKPOINTS = ['576px', '768px', '992px', '1200px', '1400px'];
|
|
7
7
|
export const SPACING = [
|
|
8
8
|
'0rem',
|
|
@@ -15,7 +15,7 @@ export const SPACING = [
|
|
|
15
15
|
'3rem',
|
|
16
16
|
'4rem',
|
|
17
17
|
];
|
|
18
|
-
export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS });
|
|
18
|
+
export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS, zIndex: Z_INDEX });
|
|
19
19
|
export const useTheme = () => {
|
|
20
20
|
const { theme } = useThemeUI();
|
|
21
21
|
return theme;
|
|
@@ -6,6 +6,7 @@ export declare enum FONT {
|
|
|
6
6
|
NORMAL = "normal"
|
|
7
7
|
}
|
|
8
8
|
export declare enum FONT_SIZE {
|
|
9
|
+
XXS = "xxs",
|
|
9
10
|
XS = "xs",
|
|
10
11
|
SM = "sm",
|
|
11
12
|
MS = "ms",
|
|
@@ -26,6 +27,7 @@ export declare enum LINE_HEIGHT {
|
|
|
26
27
|
CONDENSED = "condensed"
|
|
27
28
|
}
|
|
28
29
|
export declare const fontSizeMap: {
|
|
30
|
+
xxs: string;
|
|
29
31
|
xs: string;
|
|
30
32
|
sm: string;
|
|
31
33
|
ms: string;
|
|
@@ -43,6 +45,7 @@ export declare const fontStyles: {
|
|
|
43
45
|
normal: string;
|
|
44
46
|
};
|
|
45
47
|
fontSizes: {
|
|
48
|
+
xxs: string;
|
|
46
49
|
xs: string;
|
|
47
50
|
sm: string;
|
|
48
51
|
ms: string;
|
|
@@ -67,6 +70,10 @@ export declare enum TYPOGRAPHY_TYPE {
|
|
|
67
70
|
PARAGRAPH_SMALL = "paragraphSmall",
|
|
68
71
|
PARAGRAPH_MEDIUM = "paragraphMedium",
|
|
69
72
|
PARAGRAPH_LARGE = "paragraphLarge",
|
|
73
|
+
CONDENSED_TEXT_XSMALL = "condensedTextXSmall",
|
|
74
|
+
CONDENSED_TEXT_SMALL = "condensedTextSmall",
|
|
75
|
+
CONDENSED_TEXT_MEDIUM = "condensedTextMedium",
|
|
76
|
+
CONDENSED_TEXT_LARGE = "condensedTextLarge",
|
|
70
77
|
HEADING_SMALL = "headingSmall",
|
|
71
78
|
HEADING_MEDIUM = "headingMedium",
|
|
72
79
|
HEADING_LARGE = "headingLarge",
|
package/dist/theme/typography.js
CHANGED
|
@@ -8,6 +8,7 @@ export var FONT;
|
|
|
8
8
|
})(FONT || (FONT = {}));
|
|
9
9
|
export var FONT_SIZE;
|
|
10
10
|
(function (FONT_SIZE) {
|
|
11
|
+
FONT_SIZE["XXS"] = "xxs";
|
|
11
12
|
FONT_SIZE["XS"] = "xs";
|
|
12
13
|
FONT_SIZE["SM"] = "sm";
|
|
13
14
|
FONT_SIZE["MS"] = "ms";
|
|
@@ -19,12 +20,13 @@ export var FONT_SIZE;
|
|
|
19
20
|
})(FONT_SIZE || (FONT_SIZE = {}));
|
|
20
21
|
export const getIconSize = (fontSize) => {
|
|
21
22
|
return {
|
|
22
|
-
[FONT_SIZE.
|
|
23
|
-
[FONT_SIZE.
|
|
24
|
-
[FONT_SIZE.
|
|
25
|
-
[FONT_SIZE.
|
|
26
|
-
[FONT_SIZE.
|
|
27
|
-
[FONT_SIZE.
|
|
23
|
+
[FONT_SIZE.XXS]: FONT_SIZE.XS,
|
|
24
|
+
[FONT_SIZE.XS]: FONT_SIZE.SM,
|
|
25
|
+
[FONT_SIZE.SM]: FONT_SIZE.SM,
|
|
26
|
+
[FONT_SIZE.MS]: FONT_SIZE.MD,
|
|
27
|
+
[FONT_SIZE.MD]: FONT_SIZE.MD,
|
|
28
|
+
[FONT_SIZE.ML]: FONT_SIZE.LG,
|
|
29
|
+
[FONT_SIZE.LG]: FONT_SIZE.LG,
|
|
28
30
|
[FONT_SIZE.XL]: FONT_SIZE.XXL,
|
|
29
31
|
[FONT_SIZE.XXL]: FONT_SIZE.XXL,
|
|
30
32
|
}[fontSize];
|
|
@@ -41,6 +43,7 @@ export var LINE_HEIGHT;
|
|
|
41
43
|
LINE_HEIGHT["CONDENSED"] = "condensed";
|
|
42
44
|
})(LINE_HEIGHT || (LINE_HEIGHT = {}));
|
|
43
45
|
export const fontSizeMap = {
|
|
46
|
+
[FONT_SIZE.XXS]: '0.675rem',
|
|
44
47
|
[FONT_SIZE.XS]: '0.75rem',
|
|
45
48
|
[FONT_SIZE.SM]: '0.875rem',
|
|
46
49
|
[FONT_SIZE.MS]: '1rem',
|
|
@@ -78,6 +81,10 @@ export var TYPOGRAPHY_TYPE;
|
|
|
78
81
|
TYPOGRAPHY_TYPE["PARAGRAPH_SMALL"] = "paragraphSmall";
|
|
79
82
|
TYPOGRAPHY_TYPE["PARAGRAPH_MEDIUM"] = "paragraphMedium";
|
|
80
83
|
TYPOGRAPHY_TYPE["PARAGRAPH_LARGE"] = "paragraphLarge";
|
|
84
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_XSMALL"] = "condensedTextXSmall";
|
|
85
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_SMALL"] = "condensedTextSmall";
|
|
86
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_MEDIUM"] = "condensedTextMedium";
|
|
87
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_LARGE"] = "condensedTextLarge";
|
|
81
88
|
TYPOGRAPHY_TYPE["HEADING_SMALL"] = "headingSmall";
|
|
82
89
|
TYPOGRAPHY_TYPE["HEADING_MEDIUM"] = "headingMedium";
|
|
83
90
|
TYPOGRAPHY_TYPE["HEADING_LARGE"] = "headingLarge";
|
|
@@ -114,6 +121,30 @@ export const typographyStyleMap = {
|
|
|
114
121
|
lineHeight: LINE_HEIGHT.NORMAL,
|
|
115
122
|
fontWeight: FONT_WEIGHT.NORMAL,
|
|
116
123
|
},
|
|
124
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_XSMALL]: {
|
|
125
|
+
fontFamily: FONT.NORMAL,
|
|
126
|
+
fontSize: FONT_SIZE.XS,
|
|
127
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
128
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
129
|
+
},
|
|
130
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_SMALL]: {
|
|
131
|
+
fontFamily: FONT.NORMAL,
|
|
132
|
+
fontSize: FONT_SIZE.SM,
|
|
133
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
134
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
135
|
+
},
|
|
136
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM]: {
|
|
137
|
+
fontFamily: FONT.NORMAL,
|
|
138
|
+
fontSize: FONT_SIZE.MS,
|
|
139
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
140
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
141
|
+
},
|
|
142
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE]: {
|
|
143
|
+
fontFamily: FONT.NORMAL,
|
|
144
|
+
fontSize: FONT_SIZE.MD,
|
|
145
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
146
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
147
|
+
},
|
|
117
148
|
[TYPOGRAPHY_TYPE.HEADING_SMALL]: {
|
|
118
149
|
fontFamily: FONT.NORMAL,
|
|
119
150
|
fontSize: FONT_SIZE.MD,
|
|
@@ -142,19 +173,19 @@ export const typographyStyleMap = {
|
|
|
142
173
|
fontFamily: FONT.NORMAL,
|
|
143
174
|
fontSize: FONT_SIZE.SM,
|
|
144
175
|
fontWeight: FONT_WEIGHT.BOLD,
|
|
145
|
-
lineHeight: LINE_HEIGHT.
|
|
176
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
146
177
|
},
|
|
147
178
|
[TYPOGRAPHY_TYPE.CONTROL_MEDIUM]: {
|
|
148
179
|
fontFamily: FONT.NORMAL,
|
|
149
180
|
fontSize: FONT_SIZE.MS,
|
|
150
181
|
fontWeight: FONT_WEIGHT.BOLD,
|
|
151
|
-
lineHeight: LINE_HEIGHT.
|
|
182
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
152
183
|
},
|
|
153
184
|
[TYPOGRAPHY_TYPE.CONTROL_LARGE]: {
|
|
154
185
|
fontFamily: FONT.NORMAL,
|
|
155
186
|
fontSize: FONT_SIZE.ML,
|
|
156
187
|
fontWeight: FONT_WEIGHT.BOLD,
|
|
157
|
-
lineHeight: LINE_HEIGHT.
|
|
188
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
158
189
|
},
|
|
159
190
|
[TYPOGRAPHY_TYPE.HEADLINE_SMALL]: {
|
|
160
191
|
fontFamily: FONT.SERIF,
|