@ttoss/ui 1.31.4 → 1.31.6

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 CHANGED
@@ -33,14 +33,7 @@ import { useThemeUI } from "theme-ui";
33
33
  var useTheme = useThemeUI;
34
34
 
35
35
  // src/components/Badge.tsx
36
- import { Badge } from "theme-ui";
37
-
38
- // src/components/Box.tsx
39
- import { Box } from "theme-ui";
40
-
41
- // src/components/Button.tsx
42
- import * as React3 from "react";
43
- import { Button as ButtonUi } from "theme-ui";
36
+ import { Badge as BadgeUi } from "theme-ui";
44
37
 
45
38
  // src/components/Icon.tsx
46
39
  import * as React2 from "react";
@@ -55,8 +48,36 @@ var Icon = /*#__PURE__*/React2.forwardRef((props, ref) => {
55
48
  });
56
49
  Icon.displayName = "Icon";
57
50
 
58
- // src/components/Button.tsx
51
+ // src/components/Badge.tsx
59
52
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
53
+ var Badge = ({
54
+ icon,
55
+ children,
56
+ sx,
57
+ ...props
58
+ }) => {
59
+ return /* @__PURE__ */jsxs2(BadgeUi, {
60
+ sx: {
61
+ display: "flex",
62
+ alignItems: "center",
63
+ gap: "xs",
64
+ ...sx
65
+ },
66
+ ...props,
67
+ children: [icon && /* @__PURE__ */jsx3(Icon, {
68
+ inline: true,
69
+ icon
70
+ }), children]
71
+ });
72
+ };
73
+
74
+ // src/components/Box.tsx
75
+ import { Box } from "theme-ui";
76
+
77
+ // src/components/Button.tsx
78
+ import * as React3 from "react";
79
+ import { Button as ButtonUi } from "theme-ui";
80
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
60
81
  var Button = /*#__PURE__*/React3.forwardRef((props, ref) => {
61
82
  const {
62
83
  children,
@@ -64,7 +85,7 @@ var Button = /*#__PURE__*/React3.forwardRef((props, ref) => {
64
85
  rightIcon,
65
86
  ...restProps
66
87
  } = props;
67
- return /* @__PURE__ */jsxs2(ButtonUi, {
88
+ return /* @__PURE__ */jsxs3(ButtonUi, {
68
89
  ref,
69
90
  type: "button",
70
91
  ...restProps,
@@ -78,10 +99,10 @@ var Button = /*#__PURE__*/React3.forwardRef((props, ref) => {
78
99
  gap: "lg",
79
100
  ...restProps.sx
80
101
  },
81
- children: [leftIcon && /* @__PURE__ */jsx3(Icon, {
102
+ children: [leftIcon && /* @__PURE__ */jsx4(Icon, {
82
103
  inline: true,
83
104
  icon: leftIcon
84
- }), children, rightIcon && /* @__PURE__ */jsx3(Icon, {
105
+ }), children, rightIcon && /* @__PURE__ */jsx4(Icon, {
85
106
  inline: true,
86
107
  icon: rightIcon
87
108
  })]
@@ -110,18 +131,18 @@ import { Image } from "theme-ui";
110
131
  // src/components/Input.tsx
111
132
  import React4 from "react";
112
133
  import { Input as InputUI } from "theme-ui";
113
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
134
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
114
135
  var Input = /*#__PURE__*/React4.forwardRef(({
115
136
  leadingIcon,
116
137
  trailingIcon,
117
138
  sx,
118
139
  ...inputProps
119
140
  }, ref) => {
120
- return /* @__PURE__ */jsxs3(Flex, {
141
+ return /* @__PURE__ */jsxs4(Flex, {
121
142
  sx: {
122
143
  position: "relative"
123
144
  },
124
- children: [leadingIcon && /* @__PURE__ */jsx4(Text, {
145
+ children: [leadingIcon && /* @__PURE__ */jsx5(Text, {
125
146
  sx: {
126
147
  position: "absolute",
127
148
  alignSelf: "center",
@@ -130,10 +151,10 @@ var Input = /*#__PURE__*/React4.forwardRef(({
130
151
  lineHeight: 0
131
152
  },
132
153
  variant: "leading-icon",
133
- children: /* @__PURE__ */jsx4(Icon, {
154
+ children: /* @__PURE__ */jsx5(Icon, {
134
155
  icon: leadingIcon
135
156
  })
136
- }), /* @__PURE__ */jsx4(InputUI, {
157
+ }), /* @__PURE__ */jsx5(InputUI, {
137
158
  ref,
138
159
  sx: {
139
160
  paddingLeft: leadingIcon ? "3xl" : void 0,
@@ -141,7 +162,7 @@ var Input = /*#__PURE__*/React4.forwardRef(({
141
162
  ...sx
142
163
  },
143
164
  ...inputProps
144
- }), trailingIcon && /* @__PURE__ */jsx4(Text, {
165
+ }), trailingIcon && /* @__PURE__ */jsx5(Text, {
145
166
  sx: {
146
167
  position: "absolute",
147
168
  right: "1rem",
@@ -150,7 +171,7 @@ var Input = /*#__PURE__*/React4.forwardRef(({
150
171
  lineHeight: 0
151
172
  },
152
173
  variant: "trailing-icon",
153
- children: /* @__PURE__ */jsx4(Icon, {
174
+ children: /* @__PURE__ */jsx5(Icon, {
154
175
  icon: trailingIcon
155
176
  })
156
177
  })]
@@ -190,7 +211,7 @@ import { Checkbox } from "theme-ui";
190
211
 
191
212
  // src/components/InfiniteLinearProgress.tsx
192
213
  import * as React5 from "react";
193
- import { jsx as jsx5 } from "react/jsx-runtime";
214
+ import { jsx as jsx6 } from "react/jsx-runtime";
194
215
  var MAX_PROGRESS = 100;
195
216
  var InfiniteLinearProgress = () => {
196
217
  const [progress, setProgress] = React5.useState(0);
@@ -215,7 +236,7 @@ var InfiniteLinearProgress = () => {
215
236
  clearInterval(timer);
216
237
  };
217
238
  }, []);
218
- return /* @__PURE__ */jsx5(Progress, {
239
+ return /* @__PURE__ */jsx6(Progress, {
219
240
  max: MAX_PROGRESS,
220
241
  value: progress,
221
242
  role: "progressbar"
@@ -227,4 +248,19 @@ import { Textarea } from "theme-ui";
227
248
 
228
249
  // src/components/Container.tsx
229
250
  import { Container } from "theme-ui";
230
- export { Badge, BaseStyles, Box, Button, Card, Checkbox, Container, Divider, Flex, Grid, Heading, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
251
+
252
+ // src/components/HelpText.tsx
253
+ import { jsx as jsx7 } from "react/jsx-runtime";
254
+ var HelpText = ({
255
+ disabled,
256
+ negative,
257
+ ...props
258
+ }) => {
259
+ const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
260
+ return /* @__PURE__ */jsx7(Text, {
261
+ variant,
262
+ "aria-disabled": disabled ? "true" : void 0,
263
+ ...props
264
+ });
265
+ };
266
+ export { Badge, BaseStyles, Box, Button, Card, Checkbox, Container, Divider, Flex, Grid, Heading, HelpText, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, ButtonProps as ButtonProps$1, InputProps as InputProps$1 } from 'theme-ui';
3
- export { Badge, BadgeProps, BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Label, LabelProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, TextProps } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Label, LabelProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -23,6 +23,11 @@ type IconType = string | IconifyIcon;
23
23
  type IconProps = Omit<IconifyIconProps, 'ref'>;
24
24
  declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<IconifyIconHTMLElement | null>>;
25
25
 
26
+ type BadgeProps = BadgeProps$1 & {
27
+ icon: IconType;
28
+ };
29
+ declare const Badge: ({ icon, children, sx, ...props }: BadgeProps) => JSX.Element;
30
+
26
31
  type ButtonProps = ButtonProps$1 & {
27
32
  leftIcon?: IconType;
28
33
  rightIcon?: IconType;
@@ -37,4 +42,10 @@ declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "
37
42
 
38
43
  declare const InfiniteLinearProgress: () => JSX.Element;
39
44
 
40
- export { Button, ButtonProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
45
+ type HelpTextProps = Omit<TextProps, 'variant'> & {
46
+ disabled?: boolean;
47
+ negative?: boolean;
48
+ };
49
+ declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
50
+
51
+ export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
38
38
  // src/index.ts
39
39
  var src_exports = {};
40
40
  __export(src_exports, {
41
- Badge: () => import_theme_ui3.Badge,
41
+ Badge: () => Badge,
42
42
  BaseStyles: () => import_theme_ui25.BaseStyles,
43
43
  Box: () => import_theme_ui4.Box,
44
44
  Button: () => Button,
@@ -49,6 +49,7 @@ __export(src_exports, {
49
49
  Flex: () => import_theme_ui8.Flex,
50
50
  Grid: () => import_theme_ui9.Grid,
51
51
  Heading: () => import_theme_ui10.Heading,
52
+ HelpText: () => HelpText,
52
53
  Icon: () => Icon,
53
54
  IconButton: () => import_theme_ui20.IconButton,
54
55
  Image: () => import_theme_ui11.Image,
@@ -103,13 +104,6 @@ var useTheme = import_theme_ui2.useThemeUI;
103
104
  // src/components/Badge.tsx
104
105
  var import_theme_ui3 = require("theme-ui");
105
106
 
106
- // src/components/Box.tsx
107
- var import_theme_ui4 = require("theme-ui");
108
-
109
- // src/components/Button.tsx
110
- var React3 = __toESM(require("react"));
111
- var import_theme_ui5 = require("theme-ui");
112
-
113
107
  // src/components/Icon.tsx
114
108
  var React2 = __toESM(require("react"));
115
109
  var import_react2 = require("@iconify-icon/react");
@@ -123,8 +117,36 @@ var Icon = React2.forwardRef((props, ref) => {
123
117
  });
124
118
  Icon.displayName = "Icon";
125
119
 
126
- // src/components/Button.tsx
120
+ // src/components/Badge.tsx
127
121
  var import_jsx_runtime3 = require("react/jsx-runtime");
122
+ var Badge = ({
123
+ icon,
124
+ children,
125
+ sx,
126
+ ...props
127
+ }) => {
128
+ return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui3.Badge, {
129
+ sx: {
130
+ display: "flex",
131
+ alignItems: "center",
132
+ gap: "xs",
133
+ ...sx
134
+ },
135
+ ...props,
136
+ children: [icon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(Icon, {
137
+ inline: true,
138
+ icon
139
+ }), children]
140
+ });
141
+ };
142
+
143
+ // src/components/Box.tsx
144
+ var import_theme_ui4 = require("theme-ui");
145
+
146
+ // src/components/Button.tsx
147
+ var React3 = __toESM(require("react"));
148
+ var import_theme_ui5 = require("theme-ui");
149
+ var import_jsx_runtime4 = require("react/jsx-runtime");
128
150
  var Button = React3.forwardRef((props, ref) => {
129
151
  const {
130
152
  children,
@@ -132,7 +154,7 @@ var Button = React3.forwardRef((props, ref) => {
132
154
  rightIcon,
133
155
  ...restProps
134
156
  } = props;
135
- return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui5.Button, {
157
+ return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui5.Button, {
136
158
  ref,
137
159
  type: "button",
138
160
  ...restProps,
@@ -146,10 +168,10 @@ var Button = React3.forwardRef((props, ref) => {
146
168
  gap: "lg",
147
169
  ...restProps.sx
148
170
  },
149
- children: [leftIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(Icon, {
171
+ children: [leftIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
150
172
  inline: true,
151
173
  icon: leftIcon
152
- }), children, rightIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(Icon, {
174
+ }), children, rightIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
153
175
  inline: true,
154
176
  icon: rightIcon
155
177
  })]
@@ -178,18 +200,18 @@ var import_theme_ui11 = require("theme-ui");
178
200
  // src/components/Input.tsx
179
201
  var import_react3 = __toESM(require("react"));
180
202
  var import_theme_ui12 = require("theme-ui");
181
- var import_jsx_runtime4 = require("react/jsx-runtime");
203
+ var import_jsx_runtime5 = require("react/jsx-runtime");
182
204
  var Input = import_react3.default.forwardRef(({
183
205
  leadingIcon,
184
206
  trailingIcon,
185
207
  sx,
186
208
  ...inputProps
187
209
  }, ref) => {
188
- return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui8.Flex, {
210
+ return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_theme_ui8.Flex, {
189
211
  sx: {
190
212
  position: "relative"
191
213
  },
192
- children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
214
+ children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui16.Text, {
193
215
  sx: {
194
216
  position: "absolute",
195
217
  alignSelf: "center",
@@ -198,10 +220,10 @@ var Input = import_react3.default.forwardRef(({
198
220
  lineHeight: 0
199
221
  },
200
222
  variant: "leading-icon",
201
- children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
223
+ children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(Icon, {
202
224
  icon: leadingIcon
203
225
  })
204
- }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui12.Input, {
226
+ }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui12.Input, {
205
227
  ref,
206
228
  sx: {
207
229
  paddingLeft: leadingIcon ? "3xl" : void 0,
@@ -209,7 +231,7 @@ var Input = import_react3.default.forwardRef(({
209
231
  ...sx
210
232
  },
211
233
  ...inputProps
212
- }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
234
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui16.Text, {
213
235
  sx: {
214
236
  position: "absolute",
215
237
  right: "1rem",
@@ -218,7 +240,7 @@ var Input = import_react3.default.forwardRef(({
218
240
  lineHeight: 0
219
241
  },
220
242
  variant: "trailing-icon",
221
- children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
243
+ children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(Icon, {
222
244
  icon: trailingIcon
223
245
  })
224
246
  })]
@@ -258,7 +280,7 @@ var import_theme_ui22 = require("theme-ui");
258
280
 
259
281
  // src/components/InfiniteLinearProgress.tsx
260
282
  var React5 = __toESM(require("react"));
261
- var import_jsx_runtime5 = require("react/jsx-runtime");
283
+ var import_jsx_runtime6 = require("react/jsx-runtime");
262
284
  var MAX_PROGRESS = 100;
263
285
  var InfiniteLinearProgress = () => {
264
286
  const [progress, setProgress] = React5.useState(0);
@@ -283,7 +305,7 @@ var InfiniteLinearProgress = () => {
283
305
  clearInterval(timer);
284
306
  };
285
307
  }, []);
286
- return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui15.Progress, {
308
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Progress, {
287
309
  max: MAX_PROGRESS,
288
310
  value: progress,
289
311
  role: "progressbar"
@@ -295,6 +317,21 @@ var import_theme_ui23 = require("theme-ui");
295
317
 
296
318
  // src/components/Container.tsx
297
319
  var import_theme_ui24 = require("theme-ui");
320
+
321
+ // src/components/HelpText.tsx
322
+ var import_jsx_runtime7 = require("react/jsx-runtime");
323
+ var HelpText = ({
324
+ disabled,
325
+ negative,
326
+ ...props
327
+ }) => {
328
+ const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
329
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
330
+ variant,
331
+ "aria-disabled": disabled ? "true" : void 0,
332
+ ...props
333
+ });
334
+ };
298
335
  // Annotate the CommonJS export names for ESM import in node:
299
336
  0 && (module.exports = {
300
337
  Badge,
@@ -308,6 +345,7 @@ var import_theme_ui24 = require("theme-ui");
308
345
  Flex,
309
346
  Grid,
310
347
  Heading,
348
+ HelpText,
311
349
  Icon,
312
350
  IconButton,
313
351
  Image,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.4",
3
+ "version": "1.31.6",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -24,7 +24,7 @@
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
26
  "@theme-ui/match-media": "^0.15.5",
27
- "@ttoss/theme": "^1.4.4",
27
+ "@ttoss/theme": "^1.4.6",
28
28
  "theme-ui": "^0.15.5"
29
29
  },
30
30
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "f26363085030df7edfb2bcbf44aefed304d2b328"
49
+ "gitHead": "ce34db105b7f475a90660d77b194d6ea33b71960"
50
50
  }
@@ -1 +1,24 @@
1
- export { Badge, type BadgeProps } from 'theme-ui';
1
+ import { type BadgeProps as BadgePropsUi, Badge as BadgeUi } from 'theme-ui';
2
+
3
+ import { Icon, IconType } from './Icon';
4
+
5
+ export type BadgeProps = BadgePropsUi & {
6
+ icon: IconType;
7
+ };
8
+
9
+ export const Badge = ({ icon, children, sx, ...props }: BadgeProps) => {
10
+ return (
11
+ <BadgeUi
12
+ sx={{
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ gap: 'xs',
16
+ ...sx,
17
+ }}
18
+ {...props}
19
+ >
20
+ {icon && <Icon inline icon={icon} />}
21
+ {children}
22
+ </BadgeUi>
23
+ );
24
+ };
@@ -0,0 +1,20 @@
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 = ({ disabled, negative, ...props }: HelpTextProps) => {
9
+ const variant = ['text.help', negative ? 'negative' : undefined]
10
+ .filter(Boolean)
11
+ .join('.');
12
+
13
+ return (
14
+ <Text
15
+ variant={variant}
16
+ aria-disabled={disabled ? 'true' : undefined}
17
+ {...props}
18
+ />
19
+ );
20
+ };
package/src/index.ts CHANGED
@@ -32,3 +32,4 @@ export { Checkbox, type CheckboxProps } from './components/Checkbox';
32
32
  export { InfiniteLinearProgress } from './components/InfiniteLinearProgress';
33
33
  export { Textarea, type TextareaProps } from './components/Textarea';
34
34
  export { Container, type ContainerProps } from './components/Container';
35
+ export { HelpText, type HelpTextProps } from './components/HelpText';