@ttoss/ui 6.1.0 → 6.2.0
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/esm/index.js +1352 -0
- package/dist/index.d.ts +238 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { IconType } from '@ttoss/react-icons';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as theme_ui from 'theme-ui';
|
|
5
|
+
import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, CloseProps, TextProps, IconButtonProps as IconButtonProps$1, SxProp, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, FlexProps, SwitchProps, ThemeUIStyleObject, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
|
|
6
|
+
export { BaseStyles, Box, BoxProps, CardProps, ContainerProps, Divider, DividerProps, Flex, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Paragraph, ParagraphProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, SwitchProps, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
|
|
7
|
+
import { ITooltip } from 'react-tooltip';
|
|
8
|
+
import { Props } from 'react-select';
|
|
9
|
+
export { Keyframes, keyframes } from '@emotion/react';
|
|
10
|
+
export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
|
|
11
|
+
|
|
12
|
+
type ButtonProps = ButtonProps$1 & {
|
|
13
|
+
leftIcon?: IconType;
|
|
14
|
+
rightIcon?: IconType;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
|
|
19
|
+
type ActionButtonProps = Omit<ButtonProps, 'rightIcon' | 'leftIcon' | 'variant'> & {
|
|
20
|
+
icon: ButtonProps['leftIcon'];
|
|
21
|
+
variant?: 'default' | 'accent' | 'quiet';
|
|
22
|
+
};
|
|
23
|
+
declare const ActionButton: ({ icon, variant, sx, ...props }: ActionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
type BadgeProps = BadgeProps$1 & {
|
|
26
|
+
icon?: IconType;
|
|
27
|
+
chip?: boolean;
|
|
28
|
+
onDelete?: () => void;
|
|
29
|
+
};
|
|
30
|
+
declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
declare const Card: {
|
|
33
|
+
(props: CardProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
Title: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
Body: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
Footer: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
interface CheckboxProps extends CheckboxProps$1 {
|
|
40
|
+
indeterminate?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
|
|
44
|
+
type CloseButtonProps = CloseProps & {
|
|
45
|
+
ariaLabel?: string;
|
|
46
|
+
};
|
|
47
|
+
declare const CloseButton: (props: CloseButtonProps) => react_jsx_runtime.JSX.Element;
|
|
48
|
+
|
|
49
|
+
declare const Container: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
|
|
51
|
+
type HelpTextProps = Omit<TextProps, 'variant'> & {
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
negative?: boolean;
|
|
54
|
+
};
|
|
55
|
+
declare const HelpText: ({ sx, disabled, negative, ...props }: HelpTextProps) => react_jsx_runtime.JSX.Element;
|
|
56
|
+
|
|
57
|
+
type IconButtonProps = IconButtonProps$1 & {
|
|
58
|
+
icon?: string;
|
|
59
|
+
};
|
|
60
|
+
declare const IconButton: (props: IconButtonProps) => react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
|
|
63
|
+
|
|
64
|
+
type TooltipProps = ITooltip & SxProp;
|
|
65
|
+
declare const Tooltip: ({ variant, sx, ...props }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Props for the TooltipIcon component.
|
|
69
|
+
*/
|
|
70
|
+
interface TooltipIconProps {
|
|
71
|
+
/**
|
|
72
|
+
* The icon to display. Can be a string identifier or an icon object from @ttoss/react-icons.
|
|
73
|
+
*/
|
|
74
|
+
icon: IconType;
|
|
75
|
+
/**
|
|
76
|
+
* Optional click handler for the icon.
|
|
77
|
+
*/
|
|
78
|
+
onClick?: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Optional tooltip configuration.
|
|
81
|
+
* Pass tooltip props to display a tooltip when hovering over the icon.
|
|
82
|
+
* The 'variant' prop is excluded as it's controlled by the component's variant prop.
|
|
83
|
+
*/
|
|
84
|
+
tooltip?: Omit<TooltipProps, 'variant'>;
|
|
85
|
+
/**
|
|
86
|
+
* Test ID for testing purposes.
|
|
87
|
+
*/
|
|
88
|
+
'data-testid'?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Visual variant for both the text wrapper and tooltip.
|
|
91
|
+
* @default 'info'
|
|
92
|
+
*/
|
|
93
|
+
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
94
|
+
/**
|
|
95
|
+
* Additional styles to apply to the Text wrapper component.
|
|
96
|
+
*/
|
|
97
|
+
sx?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* TooltipIcon component renders an icon with an optional tooltip.
|
|
101
|
+
*
|
|
102
|
+
* This component is useful for displaying icons with explanatory tooltips,
|
|
103
|
+
* especially in contexts where space is limited or additional information
|
|
104
|
+
* should be revealed on hover.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* <TooltipIcon
|
|
109
|
+
* icon="info-circle"
|
|
110
|
+
* tooltip={{ children: 'Additional information' }}
|
|
111
|
+
* variant="info"
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <TooltipIcon
|
|
118
|
+
* icon="warning-alt"
|
|
119
|
+
* tooltip={{ children: 'Warning message', place: 'top' }}
|
|
120
|
+
* variant="warning"
|
|
121
|
+
* onClick={() => console.log('Clicked')}
|
|
122
|
+
* />
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare const TooltipIcon: ({ icon, onClick, tooltip, "data-testid": dataTestId, variant, sx, }: TooltipIconProps) => react_jsx_runtime.JSX.Element;
|
|
126
|
+
|
|
127
|
+
interface InputProps extends InputProps$1 {
|
|
128
|
+
leadingIcon?: TooltipIconProps | IconType;
|
|
129
|
+
trailingIcon?: TooltipIconProps | IconType;
|
|
130
|
+
}
|
|
131
|
+
declare const Input: ({ leadingIcon, trailingIcon: trailingIconProp, className, sx, ...inputProps }: InputProps) => react_jsx_runtime.JSX.Element;
|
|
132
|
+
|
|
133
|
+
type InputNumberProps = Omit<InputProps$1, 'type' | 'variant' | 'onChange'> & {
|
|
134
|
+
onChange: (value: number) => void;
|
|
135
|
+
value?: number;
|
|
136
|
+
infoIcon?: boolean;
|
|
137
|
+
onClickInfoIcon?: () => void;
|
|
138
|
+
};
|
|
139
|
+
declare const InputNumber: React.ForwardRefExoticComponent<Omit<InputNumberProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
140
|
+
|
|
141
|
+
type InputPasswordProps = Omit<InputProps, 'trailingIcon' | 'type'> & {
|
|
142
|
+
showPasswordByDefault?: boolean;
|
|
143
|
+
};
|
|
144
|
+
declare const InputPassword: ({ showPasswordByDefault, ...inputPasswordProps }: InputPasswordProps) => react_jsx_runtime.JSX.Element;
|
|
145
|
+
|
|
146
|
+
type LabelProps = LabelProps$1 & {
|
|
147
|
+
tooltip?: TooltipProps;
|
|
148
|
+
};
|
|
149
|
+
declare const Label: ({ children, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
|
|
150
|
+
|
|
151
|
+
type LinkProps = LinkProps$1 & {
|
|
152
|
+
quiet?: boolean;
|
|
153
|
+
};
|
|
154
|
+
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
155
|
+
|
|
156
|
+
interface SegmentedControlProps {
|
|
157
|
+
options: (string | number | {
|
|
158
|
+
label: React.ReactNode;
|
|
159
|
+
value: string | number;
|
|
160
|
+
disabled?: boolean;
|
|
161
|
+
})[];
|
|
162
|
+
value?: string | number;
|
|
163
|
+
defaultValue?: string | number;
|
|
164
|
+
onChange?: (value: string | number) => void;
|
|
165
|
+
disabled?: boolean;
|
|
166
|
+
className?: string;
|
|
167
|
+
sx?: FlexProps['sx'];
|
|
168
|
+
}
|
|
169
|
+
declare const SegmentedControl: ({ options, value: propValue, defaultValue, onChange, disabled, className, sx, ...rest }: SegmentedControlProps) => react_jsx_runtime.JSX.Element;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* We're using React Select component to build ttoss Select.
|
|
173
|
+
* More info about React Select: https://react-select.com/home
|
|
174
|
+
* ttoss Figma: https://www.figma.com/file/VrB76VkH4hKCDUe9iYhpYu/_Component-%2F-Forms-%2F-Select?type=design&mode=design&t=ZBIeOpqcvQn3yq2t-0
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
type SelectOptionValue = string | number | boolean;
|
|
178
|
+
type SelectOption = {
|
|
179
|
+
label: string;
|
|
180
|
+
value: SelectOptionValue;
|
|
181
|
+
};
|
|
182
|
+
type SelectOptions = SelectOption[];
|
|
183
|
+
/**
|
|
184
|
+
* TODO: remove this when we accept multi select.
|
|
185
|
+
*/
|
|
186
|
+
type IsMulti = false;
|
|
187
|
+
type SelectProps = Omit<Props<SelectOption, IsMulti>, 'styles' | 'value' | 'onChange' | 'components'> & SxProp & {
|
|
188
|
+
value?: SelectOptionValue;
|
|
189
|
+
onChange?: (value: SelectOptionValue | undefined) => void;
|
|
190
|
+
disabled?: boolean;
|
|
191
|
+
leadingIcon?: IconType;
|
|
192
|
+
trailingIcon?: IconType;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* https://react-select.com/home
|
|
196
|
+
*/
|
|
197
|
+
declare const Select: React.ForwardRefExoticComponent<Omit<Props<SelectOption, false>, "value" | "onChange" | "styles" | "components"> & SxProp & {
|
|
198
|
+
value?: SelectOptionValue;
|
|
199
|
+
onChange?: (value: SelectOptionValue | undefined) => void;
|
|
200
|
+
disabled?: boolean;
|
|
201
|
+
leadingIcon?: IconType;
|
|
202
|
+
trailingIcon?: IconType;
|
|
203
|
+
} & React.RefAttributes<any>>;
|
|
204
|
+
|
|
205
|
+
type StackProps = FlexProps;
|
|
206
|
+
/**
|
|
207
|
+
* A component that renders its children in a column.
|
|
208
|
+
*/
|
|
209
|
+
declare const Stack: (props: StackProps) => react_jsx_runtime.JSX.Element;
|
|
210
|
+
|
|
211
|
+
declare const Switch: (props: SwitchProps) => react_jsx_runtime.JSX.Element;
|
|
212
|
+
|
|
213
|
+
type TagVariant = 'accent' | 'positive' | 'caution' | 'muted' | 'negative' | 'primary' | 'secondary' | 'default';
|
|
214
|
+
type TagProps = {
|
|
215
|
+
children: React.ReactNode | React.ReactNode[];
|
|
216
|
+
variant?: TagVariant;
|
|
217
|
+
sx?: ThemeUIStyleObject;
|
|
218
|
+
};
|
|
219
|
+
declare const Tag: ({ children, variant, sx }: TagProps) => react_jsx_runtime.JSX.Element;
|
|
220
|
+
|
|
221
|
+
interface TextareaProps extends TextareaProps$1 {
|
|
222
|
+
trailingIcon?: IconType;
|
|
223
|
+
}
|
|
224
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
225
|
+
|
|
226
|
+
type ThemeProviderProps = {
|
|
227
|
+
children?: React.ReactNode;
|
|
228
|
+
theme?: Theme;
|
|
229
|
+
/**
|
|
230
|
+
* Fonts URLs.
|
|
231
|
+
*/
|
|
232
|
+
fonts?: string[];
|
|
233
|
+
};
|
|
234
|
+
declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) => react_jsx_runtime.JSX.Element;
|
|
235
|
+
|
|
236
|
+
declare const useTheme: () => theme_ui.ThemeUIContextValue;
|
|
237
|
+
|
|
238
|
+
export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, type IconButtonProps, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipIcon, type TooltipIconProps, type TooltipProps, useTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"react": "^19.2.1",
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"@ttoss/config": "^1.35.12",
|
|
48
|
-
"@ttoss/
|
|
49
|
-
"@ttoss/
|
|
48
|
+
"@ttoss/test-utils": "^4.0.2",
|
|
49
|
+
"@ttoss/react-icons": "^0.5.6"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"React",
|