@ttoss/ui 5.0.6 → 5.0.8
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/LICENSE +21 -674
- package/dist/esm/index.js +902 -0
- package/dist/index.d.ts +143 -0
- package/package.json +8 -8
- package/src/components/ActionButton.tsx +0 -41
- package/src/components/Badge.tsx +0 -54
- package/src/components/Box.tsx +0 -1
- package/src/components/Button.tsx +0 -43
- package/src/components/Card.tsx +0 -1
- package/src/components/Checkbox.tsx +0 -36
- package/src/components/CloseButton.tsx +0 -49
- package/src/components/Container.tsx +0 -12
- package/src/components/Divider.tsx +0 -1
- package/src/components/Flex.tsx +0 -1
- package/src/components/Grid.tsx +0 -1
- package/src/components/Heading.tsx +0 -1
- package/src/components/HelpText.tsx +0 -31
- package/src/components/IconButton.tsx +0 -12
- package/src/components/Image.tsx +0 -1
- package/src/components/InfiniteLinearProgress.tsx +0 -38
- package/src/components/Input.tsx +0 -83
- package/src/components/InputNumber.tsx +0 -150
- package/src/components/InputPassword/InputPassword.tsx +0 -32
- package/src/components/InputPassword/useHidePassInput.ts +0 -26
- package/src/components/Label.tsx +0 -46
- package/src/components/LinearProgress.tsx +0 -4
- package/src/components/Link.tsx +0 -20
- package/src/components/Paragraph.tsx +0 -1
- package/src/components/Radio.tsx +0 -1
- package/src/components/Select.tsx +0 -284
- package/src/components/Slider.tsx +0 -1
- package/src/components/Spinner.tsx +0 -1
- package/src/components/Stack.tsx +0 -24
- package/src/components/Text.tsx +0 -1
- package/src/components/Textarea.tsx +0 -55
- package/src/index.ts +0 -58
- package/src/theme/ThemeProvider.tsx +0 -36
- package/src/theme/useTheme.ts +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as theme_ui from 'theme-ui';
|
|
2
|
+
import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, IconButtonProps, CheckboxProps as CheckboxProps$1, TextareaProps as TextareaProps$1, TextProps, FlexProps } from 'theme-ui';
|
|
3
|
+
export { BaseStyles, Box, BoxProps, Card, CardProps, ContainerProps, Divider, DividerProps, Flex, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Paragraph, ParagraphProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
|
|
4
|
+
export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
|
|
5
|
+
export { Keyframes, keyframes } from '@emotion/react';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { IconType } from '@ttoss/react-icons';
|
|
9
|
+
import { Props } from 'react-select';
|
|
10
|
+
|
|
11
|
+
type ThemeProviderProps = {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
theme?: Theme;
|
|
14
|
+
/**
|
|
15
|
+
* Fonts URLs.
|
|
16
|
+
*/
|
|
17
|
+
fonts?: string[];
|
|
18
|
+
};
|
|
19
|
+
declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
declare const useTheme: () => theme_ui.ThemeUIContextValue;
|
|
22
|
+
|
|
23
|
+
type BadgeProps = BadgeProps$1 & {
|
|
24
|
+
icon?: IconType;
|
|
25
|
+
chip?: boolean;
|
|
26
|
+
onDelete?: () => void;
|
|
27
|
+
};
|
|
28
|
+
declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
|
|
29
|
+
|
|
30
|
+
type ButtonProps = ButtonProps$1 & {
|
|
31
|
+
leftIcon?: IconType;
|
|
32
|
+
rightIcon?: IconType;
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
};
|
|
35
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
36
|
+
|
|
37
|
+
interface InputProps extends InputProps$1 {
|
|
38
|
+
leadingIcon?: IconType;
|
|
39
|
+
onLeadingIconClick?: () => void;
|
|
40
|
+
trailingIcon?: IconType;
|
|
41
|
+
onTrailingIconClick?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
44
|
+
|
|
45
|
+
type LabelProps = LabelProps$1 & {
|
|
46
|
+
tooltip?: boolean;
|
|
47
|
+
onTooltipClick?: () => void;
|
|
48
|
+
};
|
|
49
|
+
declare const Label: ({ children, onTooltipClick, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
51
|
+
type LinkProps = LinkProps$1 & {
|
|
52
|
+
quiet?: boolean;
|
|
53
|
+
};
|
|
54
|
+
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* We're using React Select component to build ttoss Select.
|
|
58
|
+
* More info about React Select: https://react-select.com/home
|
|
59
|
+
* ttoss Figma: https://www.figma.com/file/VrB76VkH4hKCDUe9iYhpYu/_Component-%2F-Forms-%2F-Select?type=design&mode=design&t=ZBIeOpqcvQn3yq2t-0
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
type SelectOptionValue = string | number | boolean;
|
|
63
|
+
type SelectOption = {
|
|
64
|
+
label: string;
|
|
65
|
+
value: SelectOptionValue;
|
|
66
|
+
};
|
|
67
|
+
type SelectOptions = SelectOption[];
|
|
68
|
+
/**
|
|
69
|
+
* TODO: remove this when we accept multi select.
|
|
70
|
+
*/
|
|
71
|
+
type IsMulti = false;
|
|
72
|
+
type SelectProps = Omit<Props<SelectOption, IsMulti>, 'styles' | 'value' | 'onChange' | 'components'> & SxProp & {
|
|
73
|
+
value?: SelectOptionValue;
|
|
74
|
+
onChange?: (value: SelectOptionValue | undefined) => void;
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
leadingIcon?: IconType;
|
|
77
|
+
trailingIcon?: IconType;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* https://react-select.com/home
|
|
81
|
+
*/
|
|
82
|
+
declare const Select: React.ForwardRefExoticComponent<Omit<Props<SelectOption, false>, "value" | "onChange" | "styles" | "components"> & SxProp & {
|
|
83
|
+
value?: SelectOptionValue;
|
|
84
|
+
onChange?: (value: SelectOptionValue | undefined) => void;
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
leadingIcon?: IconType;
|
|
87
|
+
trailingIcon?: IconType;
|
|
88
|
+
} & React.RefAttributes<any>>;
|
|
89
|
+
|
|
90
|
+
declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
91
|
+
|
|
92
|
+
interface CheckboxProps extends CheckboxProps$1 {
|
|
93
|
+
indeterminate?: boolean;
|
|
94
|
+
}
|
|
95
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
96
|
+
|
|
97
|
+
declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
interface TextareaProps extends TextareaProps$1 {
|
|
100
|
+
trailingIcon?: IconType;
|
|
101
|
+
}
|
|
102
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
103
|
+
|
|
104
|
+
declare const Container: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
105
|
+
|
|
106
|
+
type HelpTextProps = Omit<TextProps, 'variant'> & {
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
negative?: boolean;
|
|
109
|
+
};
|
|
110
|
+
declare const HelpText: ({ sx, disabled, negative, ...props }: HelpTextProps) => react_jsx_runtime.JSX.Element;
|
|
111
|
+
|
|
112
|
+
type CloseButtonProps = ButtonProps & {
|
|
113
|
+
label?: string;
|
|
114
|
+
onlyText?: boolean;
|
|
115
|
+
};
|
|
116
|
+
declare const CloseButton: React.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
117
|
+
|
|
118
|
+
type InputNumberProps = Omit<InputProps$1, 'type' | 'variant' | 'onChange'> & {
|
|
119
|
+
onChange: (value: number) => void;
|
|
120
|
+
value?: number;
|
|
121
|
+
infoIcon?: boolean;
|
|
122
|
+
onClickInfoIcon?: () => void;
|
|
123
|
+
};
|
|
124
|
+
declare const InputNumber: React.ForwardRefExoticComponent<Omit<InputNumberProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
125
|
+
|
|
126
|
+
type StackProps = FlexProps;
|
|
127
|
+
/**
|
|
128
|
+
* A component that renders its children in a column.
|
|
129
|
+
*/
|
|
130
|
+
declare const Stack: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLElement>>;
|
|
131
|
+
|
|
132
|
+
type InputPasswordProps = Omit<InputProps, 'trailingIcon' | 'onTrailingIconClick' | 'type'> & {
|
|
133
|
+
showPasswordByDefault?: boolean;
|
|
134
|
+
};
|
|
135
|
+
declare const InputPassword: React.ForwardRefExoticComponent<Omit<InputPasswordProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
136
|
+
|
|
137
|
+
type ActionButtonProps = Omit<ButtonProps, 'rightIcon' | 'leftIcon' | 'variant'> & {
|
|
138
|
+
icon: ButtonProps['leftIcon'];
|
|
139
|
+
variant?: 'default' | 'accent' | 'quiet';
|
|
140
|
+
};
|
|
141
|
+
declare const ActionButton: ({ icon, variant, sx, ...props }: ActionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
142
|
+
|
|
143
|
+
export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, useTheme };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.8",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"author": "ttoss",
|
|
6
7
|
"contributors": [
|
|
7
8
|
"Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)"
|
|
@@ -19,20 +20,19 @@
|
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"src"
|
|
23
|
+
"dist"
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@theme-ui/match-media": "^0.16.2",
|
|
28
28
|
"react-select": "^5.8.0",
|
|
29
29
|
"theme-ui": "^0.16.2",
|
|
30
|
-
"@ttoss/theme": "^1.7.
|
|
30
|
+
"@ttoss/theme": "^1.7.23"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@emotion/react": "^11",
|
|
34
34
|
"react": ">=16.8.0",
|
|
35
|
-
"@ttoss/react-icons": "^0.4.
|
|
35
|
+
"@ttoss/react-icons": "^0.4.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@emotion/react": "^11.11.4",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"jest": "^29.7.0",
|
|
43
43
|
"react": "^18.3.1",
|
|
44
44
|
"tsup": "^8.3.0",
|
|
45
|
-
"@ttoss/react-icons": "^0.4.
|
|
46
|
-
"@ttoss/test-utils": "^2.1.
|
|
47
|
-
"@ttoss/config": "^1.
|
|
45
|
+
"@ttoss/react-icons": "^0.4.4",
|
|
46
|
+
"@ttoss/test-utils": "^2.1.17",
|
|
47
|
+
"@ttoss/config": "^1.34.1"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"React",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Button, type ButtonProps } from './Button';
|
|
2
|
-
|
|
3
|
-
export type ActionButtonProps = Omit<
|
|
4
|
-
ButtonProps,
|
|
5
|
-
'rightIcon' | 'leftIcon' | 'variant'
|
|
6
|
-
> & {
|
|
7
|
-
icon: ButtonProps['leftIcon'];
|
|
8
|
-
variant?: 'default' | 'accent' | 'quiet';
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const ActionButton = ({
|
|
12
|
-
icon,
|
|
13
|
-
variant = 'default',
|
|
14
|
-
sx,
|
|
15
|
-
...props
|
|
16
|
-
}: ActionButtonProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<Button
|
|
19
|
-
variant={`buttons.actionButton.${variant}`}
|
|
20
|
-
leftIcon={icon}
|
|
21
|
-
sx={{
|
|
22
|
-
padding: 'sm',
|
|
23
|
-
gap: 'xs',
|
|
24
|
-
fontFamily: 'caption',
|
|
25
|
-
borderRadius: 'action',
|
|
26
|
-
outlineColor: 'transparent',
|
|
27
|
-
':disabled': props.disabled
|
|
28
|
-
? {
|
|
29
|
-
backgroundColor: 'muted',
|
|
30
|
-
color: 'onMuted',
|
|
31
|
-
cursor: 'not-allowed',
|
|
32
|
-
border: 'muted',
|
|
33
|
-
borderColor: 'onMuted',
|
|
34
|
-
}
|
|
35
|
-
: undefined,
|
|
36
|
-
...sx,
|
|
37
|
-
}}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|
package/src/components/Badge.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { type BadgeProps as BadgePropsUi, Badge as BadgeUi } from 'theme-ui';
|
|
2
|
-
import { Icon, IconType } from '@ttoss/react-icons';
|
|
3
|
-
import { Text } from '../components/Text';
|
|
4
|
-
|
|
5
|
-
export type BadgeProps = BadgePropsUi & {
|
|
6
|
-
icon?: IconType;
|
|
7
|
-
chip?: boolean;
|
|
8
|
-
onDelete?: () => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const Badge = ({
|
|
12
|
-
icon,
|
|
13
|
-
children,
|
|
14
|
-
sx,
|
|
15
|
-
chip,
|
|
16
|
-
onDelete,
|
|
17
|
-
...props
|
|
18
|
-
}: BadgeProps) => {
|
|
19
|
-
return (
|
|
20
|
-
<BadgeUi
|
|
21
|
-
sx={{
|
|
22
|
-
display: 'flex',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
fontFamily: 'caption',
|
|
25
|
-
fontWeight: 'normal',
|
|
26
|
-
lineHeight: 'base',
|
|
27
|
-
fontSize: 'sm',
|
|
28
|
-
paddingX: 'xs',
|
|
29
|
-
borderRadius: 'informative',
|
|
30
|
-
paddingY: '2xs',
|
|
31
|
-
gap: 'xs',
|
|
32
|
-
...sx,
|
|
33
|
-
}}
|
|
34
|
-
{...props}
|
|
35
|
-
>
|
|
36
|
-
{icon && <Icon inline icon={icon} />}
|
|
37
|
-
|
|
38
|
-
{children}
|
|
39
|
-
|
|
40
|
-
{chip && (
|
|
41
|
-
<Text
|
|
42
|
-
sx={{
|
|
43
|
-
cursor: 'pointer',
|
|
44
|
-
lineHeight: 0,
|
|
45
|
-
color: 'currentcolor',
|
|
46
|
-
alignSelf: 'center',
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
<Icon onClick={onDelete} inline icon="close" />
|
|
50
|
-
</Text>
|
|
51
|
-
)}
|
|
52
|
-
</BadgeUi>
|
|
53
|
-
);
|
|
54
|
-
};
|
package/src/components/Box.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Box, type BoxProps } from 'theme-ui';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
type ButtonProps as ButtonPropsUi,
|
|
4
|
-
Button as ButtonUi,
|
|
5
|
-
} from 'theme-ui';
|
|
6
|
-
import { Icon, IconType } from '@ttoss/react-icons';
|
|
7
|
-
|
|
8
|
-
export type ButtonProps = ButtonPropsUi & {
|
|
9
|
-
leftIcon?: IconType;
|
|
10
|
-
rightIcon?: IconType;
|
|
11
|
-
loading?: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
15
|
-
(props, ref) => {
|
|
16
|
-
const { children, leftIcon, rightIcon, loading, ...restProps } = props;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<ButtonUi
|
|
20
|
-
type="button"
|
|
21
|
-
{...restProps}
|
|
22
|
-
ref={ref}
|
|
23
|
-
sx={{
|
|
24
|
-
cursor: 'pointer',
|
|
25
|
-
paddingX: 'xl',
|
|
26
|
-
paddingY: 'lg',
|
|
27
|
-
fontFamily: 'body',
|
|
28
|
-
display: 'inline-flex',
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
gap: 'lg',
|
|
31
|
-
...restProps.sx,
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
{loading && <Icon inline icon="three-dots-loading" />}
|
|
35
|
-
{!loading && leftIcon && <Icon inline icon={leftIcon} />}
|
|
36
|
-
{children}
|
|
37
|
-
{rightIcon && <Icon inline icon={rightIcon} />}
|
|
38
|
-
</ButtonUi>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
Button.displayName = 'Button';
|
package/src/components/Card.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Card, type CardProps } from 'theme-ui';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Checkbox as CheckBoxUi,
|
|
4
|
-
CheckboxProps as CheckboxPropsUi,
|
|
5
|
-
} from 'theme-ui';
|
|
6
|
-
|
|
7
|
-
export interface CheckboxProps extends CheckboxPropsUi {
|
|
8
|
-
indeterminate?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
12
|
-
({ indeterminate = false, ...rest }, ref) => {
|
|
13
|
-
const innerRef = React.useRef<HTMLInputElement>(null);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* https://stackoverflow.com/a/68163315/8786986
|
|
17
|
-
*/
|
|
18
|
-
React.useImperativeHandle(ref, () => {
|
|
19
|
-
return innerRef.current as HTMLInputElement;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
if (innerRef.current) {
|
|
24
|
-
innerRef.current.indeterminate = indeterminate;
|
|
25
|
-
}
|
|
26
|
-
}, [indeterminate]);
|
|
27
|
-
|
|
28
|
-
if (indeterminate) {
|
|
29
|
-
return <input type="checkbox" ref={innerRef} {...rest} />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return <CheckBoxUi ref={innerRef} {...rest} />;
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
Checkbox.displayName = 'Checkbox';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Button, type ButtonProps } from './Button';
|
|
3
|
-
import { Icon } from '@ttoss/react-icons';
|
|
4
|
-
|
|
5
|
-
export type CloseButtonProps = ButtonProps & {
|
|
6
|
-
label?: string;
|
|
7
|
-
onlyText?: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const CloseButton = React.forwardRef<
|
|
11
|
-
HTMLButtonElement,
|
|
12
|
-
CloseButtonProps
|
|
13
|
-
>(({ label, sx, onlyText, ...props }, ref) => {
|
|
14
|
-
if (onlyText && !label) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Button
|
|
20
|
-
variant="buttons.closeButton"
|
|
21
|
-
type="button"
|
|
22
|
-
aria-label={label}
|
|
23
|
-
sx={{
|
|
24
|
-
fontFamily: 'caption',
|
|
25
|
-
fontSize: 'xs',
|
|
26
|
-
display: 'inline-flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
cursor: 'pointer',
|
|
29
|
-
lineHeight: 'normal',
|
|
30
|
-
gap: 'sm',
|
|
31
|
-
padding: 'sm',
|
|
32
|
-
width: 'fit-content',
|
|
33
|
-
transition: 'all 0.2s',
|
|
34
|
-
'& > iconify-icon': {
|
|
35
|
-
fontSize: 'base',
|
|
36
|
-
},
|
|
37
|
-
...sx,
|
|
38
|
-
}}
|
|
39
|
-
{...props}
|
|
40
|
-
ref={ref}
|
|
41
|
-
>
|
|
42
|
-
{label}
|
|
43
|
-
|
|
44
|
-
{!onlyText && <Icon icon="close" />}
|
|
45
|
-
</Button>
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
CloseButton.displayName = 'CloseButton';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { type ContainerProps, Container as ContainerUi } from 'theme-ui';
|
|
3
|
-
|
|
4
|
-
export type { ContainerProps };
|
|
5
|
-
|
|
6
|
-
export const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
|
|
7
|
-
(props, ref) => {
|
|
8
|
-
return <ContainerUi ref={ref} {...props} />;
|
|
9
|
-
}
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
Container.displayName = 'Container';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Divider, type DividerProps } from 'theme-ui';
|
package/src/components/Flex.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Flex, type FlexProps } from 'theme-ui';
|
package/src/components/Grid.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Grid, type GridProps } from 'theme-ui';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Heading, type HeadingProps } from 'theme-ui';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Text, TextProps } from './Text';
|
|
2
|
-
|
|
3
|
-
export type HelpTextProps = Omit<TextProps, 'variant'> & {
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
negative?: boolean;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const HelpText = ({
|
|
9
|
-
sx,
|
|
10
|
-
disabled,
|
|
11
|
-
negative,
|
|
12
|
-
...props
|
|
13
|
-
}: HelpTextProps) => {
|
|
14
|
-
const variant = ['text.help', negative ? 'negative' : undefined]
|
|
15
|
-
.filter(Boolean)
|
|
16
|
-
.join('.');
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Text
|
|
20
|
-
variant={variant}
|
|
21
|
-
sx={{
|
|
22
|
-
fontSize: 'sm',
|
|
23
|
-
fontFamily: 'caption',
|
|
24
|
-
lineHeight: 'base',
|
|
25
|
-
...sx,
|
|
26
|
-
}}
|
|
27
|
-
aria-disabled={disabled ? 'true' : undefined}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { type IconButtonProps, IconButton as IconButtonUi } from 'theme-ui';
|
|
3
|
-
|
|
4
|
-
export type { IconButtonProps };
|
|
5
|
-
|
|
6
|
-
export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
7
|
-
(props, ref) => {
|
|
8
|
-
return <IconButtonUi type="button" {...props} ref={ref} />;
|
|
9
|
-
}
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
IconButton.displayName = 'IconButton';
|
package/src/components/Image.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Image, type ImageProps } from 'theme-ui';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { LinearProgress } from './LinearProgress';
|
|
3
|
-
|
|
4
|
-
const MAX_PROGRESS = 100;
|
|
5
|
-
|
|
6
|
-
export const InfiniteLinearProgress = () => {
|
|
7
|
-
const [progress, setProgress] = React.useState(0);
|
|
8
|
-
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
const timer = setInterval(() => {
|
|
11
|
-
setProgress((oldProgress) => {
|
|
12
|
-
if (oldProgress === MAX_PROGRESS) {
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let diff = 0;
|
|
17
|
-
|
|
18
|
-
if (oldProgress > 0.97 * MAX_PROGRESS) {
|
|
19
|
-
diff -= 0.75 * MAX_PROGRESS;
|
|
20
|
-
} else if (oldProgress > 0.6 * MAX_PROGRESS) {
|
|
21
|
-
diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
|
|
22
|
-
} else {
|
|
23
|
-
diff = Math.random() * (MAX_PROGRESS * 0.02);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return Math.min(oldProgress + diff, MAX_PROGRESS);
|
|
27
|
-
});
|
|
28
|
-
}, 100);
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
clearInterval(timer);
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<LinearProgress max={MAX_PROGRESS} value={progress} role="progressbar" />
|
|
37
|
-
);
|
|
38
|
-
};
|
package/src/components/Input.tsx
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Flex, Text } from '..';
|
|
3
|
-
import { Icon, type IconType } from '@ttoss/react-icons';
|
|
4
|
-
import { InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
|
|
5
|
-
|
|
6
|
-
export interface InputProps extends InputPropsUI {
|
|
7
|
-
leadingIcon?: IconType;
|
|
8
|
-
onLeadingIconClick?: () => void;
|
|
9
|
-
trailingIcon?: IconType;
|
|
10
|
-
onTrailingIconClick?: () => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
14
|
-
(
|
|
15
|
-
{
|
|
16
|
-
leadingIcon,
|
|
17
|
-
trailingIcon: trailingIconProp,
|
|
18
|
-
onLeadingIconClick,
|
|
19
|
-
onTrailingIconClick,
|
|
20
|
-
className,
|
|
21
|
-
sx,
|
|
22
|
-
...inputProps
|
|
23
|
-
},
|
|
24
|
-
ref
|
|
25
|
-
) => {
|
|
26
|
-
const trailingIcon = inputProps['aria-invalid']
|
|
27
|
-
? 'warning-alt'
|
|
28
|
-
: trailingIconProp;
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Flex
|
|
32
|
-
className={className}
|
|
33
|
-
sx={{ ...sx, position: 'relative', padding: 0, border: 'none' }}
|
|
34
|
-
>
|
|
35
|
-
{leadingIcon && (
|
|
36
|
-
<Text
|
|
37
|
-
sx={{
|
|
38
|
-
position: 'absolute',
|
|
39
|
-
alignSelf: 'center',
|
|
40
|
-
left: '1rem',
|
|
41
|
-
cursor: onLeadingIconClick ? 'pointer' : 'default',
|
|
42
|
-
}}
|
|
43
|
-
onClick={onLeadingIconClick}
|
|
44
|
-
variant="leading-icon"
|
|
45
|
-
>
|
|
46
|
-
<Icon inline icon={leadingIcon} />
|
|
47
|
-
</Text>
|
|
48
|
-
)}
|
|
49
|
-
<InputUI
|
|
50
|
-
ref={ref}
|
|
51
|
-
sx={{
|
|
52
|
-
fontFamily: 'body',
|
|
53
|
-
paddingY: 'lg',
|
|
54
|
-
paddingX: 'xl',
|
|
55
|
-
...sx,
|
|
56
|
-
paddingLeft: leadingIcon ? '3xl' : undefined,
|
|
57
|
-
paddingRight: trailingIcon ? '3xl' : undefined,
|
|
58
|
-
margin: 0,
|
|
59
|
-
}}
|
|
60
|
-
className={className}
|
|
61
|
-
{...inputProps}
|
|
62
|
-
/>
|
|
63
|
-
|
|
64
|
-
{trailingIcon && (
|
|
65
|
-
<Text
|
|
66
|
-
sx={{
|
|
67
|
-
position: 'absolute',
|
|
68
|
-
right: '1rem',
|
|
69
|
-
alignSelf: 'center',
|
|
70
|
-
cursor: onTrailingIconClick ? 'pointer' : 'default',
|
|
71
|
-
}}
|
|
72
|
-
variant="trailing-icon"
|
|
73
|
-
onClick={onTrailingIconClick}
|
|
74
|
-
>
|
|
75
|
-
<Icon inline icon={trailingIcon} />
|
|
76
|
-
</Text>
|
|
77
|
-
)}
|
|
78
|
-
</Flex>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
Input.displayName = 'Input';
|