@ttoss/ui 1.31.11 → 1.31.13

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
@@ -129,50 +129,54 @@ import { Heading } from "theme-ui";
129
129
  import { Image } from "theme-ui";
130
130
 
131
131
  // src/components/Input.tsx
132
- import React4 from "react";
133
132
  import { Input as InputUI } from "theme-ui";
133
+ import React4 from "react";
134
134
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
135
135
  var Input = /*#__PURE__*/React4.forwardRef(({
136
136
  leadingIcon,
137
137
  trailingIcon,
138
+ className,
138
139
  sx,
139
140
  ...inputProps
140
141
  }, ref) => {
141
142
  return /* @__PURE__ */jsxs4(Flex, {
143
+ className,
142
144
  sx: {
145
+ ...sx,
143
146
  position: "relative",
144
- width: "100%",
145
- ...sx
147
+ padding: 0,
148
+ border: "none"
146
149
  },
147
150
  children: [leadingIcon && /* @__PURE__ */jsx5(Text, {
148
151
  sx: {
149
152
  position: "absolute",
150
153
  alignSelf: "center",
151
- fontSize: "base",
152
- left: "1rem",
153
- lineHeight: 0
154
+ left: "1rem"
154
155
  },
155
156
  variant: "leading-icon",
156
157
  children: /* @__PURE__ */jsx5(Icon, {
158
+ inline: true,
157
159
  icon: leadingIcon
158
160
  })
159
161
  }), /* @__PURE__ */jsx5(InputUI, {
160
162
  ref,
161
163
  sx: {
164
+ ...sx,
162
165
  paddingLeft: leadingIcon ? "3xl" : void 0,
163
- paddingRight: trailingIcon ? "3xl" : void 0
166
+ paddingRight: trailingIcon ? "3xl" : void 0,
167
+ margin: 0
164
168
  },
169
+ className,
165
170
  ...inputProps
166
171
  }), trailingIcon && /* @__PURE__ */jsx5(Text, {
167
172
  sx: {
168
173
  position: "absolute",
169
174
  right: "1rem",
170
- alignSelf: "center",
171
- fontSize: "base",
172
- lineHeight: 0
175
+ alignSelf: "center"
173
176
  },
174
177
  variant: "trailing-icon",
175
178
  children: /* @__PURE__ */jsx5(Icon, {
179
+ inline: true,
176
180
  icon: trailingIcon
177
181
  })
178
182
  })]
@@ -193,7 +197,51 @@ import { Progress } from "theme-ui";
193
197
  import { Text } from "theme-ui";
194
198
 
195
199
  // src/components/Select.tsx
196
- import { Select } from "theme-ui";
200
+ import { Select as SelectUi } from "theme-ui";
201
+ import React5 from "react";
202
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
203
+ var Select = /*#__PURE__*/React5.forwardRef(({
204
+ arrow,
205
+ ...props
206
+ }, ref) => {
207
+ return /* @__PURE__ */jsx6(SelectUi, {
208
+ arrow: /* @__PURE__ */jsxs5(Fragment2, {
209
+ children: [arrow ?? /* @__PURE__ */jsx6(Text, {
210
+ sx: {
211
+ marginLeft: ({
212
+ space
213
+ }) => {
214
+ return space?.["2xl"] ? "-2xl" : "-28px";
215
+ },
216
+ alignSelf: "center",
217
+ pointerEvents: "none",
218
+ lineHeight: 0
219
+ },
220
+ children: /* @__PURE__ */jsx6(Icon, {
221
+ icon: "picker-down"
222
+ })
223
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx6(Text, {
224
+ className: "error-icon",
225
+ sx: {
226
+ marginLeft: ({
227
+ space
228
+ }) => {
229
+ return space?.["2xl"] ? `calc(-${space["2xl"]} - 10px)` : "-44px";
230
+ },
231
+ alignSelf: "center",
232
+ pointerEvents: "none",
233
+ lineHeight: 0
234
+ },
235
+ children: /* @__PURE__ */jsx6(Icon, {
236
+ icon: "error"
237
+ })
238
+ })]
239
+ }),
240
+ ref,
241
+ ...props
242
+ });
243
+ });
244
+ Select.displayName = "Select";
197
245
 
198
246
  // src/components/Spinner.tsx
199
247
  import { Spinner } from "theme-ui";
@@ -211,12 +259,12 @@ import { Slider } from "theme-ui";
211
259
  import { Checkbox } from "theme-ui";
212
260
 
213
261
  // src/components/InfiniteLinearProgress.tsx
214
- import * as React5 from "react";
215
- import { jsx as jsx6 } from "react/jsx-runtime";
262
+ import * as React6 from "react";
263
+ import { jsx as jsx7 } from "react/jsx-runtime";
216
264
  var MAX_PROGRESS = 100;
217
265
  var InfiniteLinearProgress = () => {
218
- const [progress, setProgress] = React5.useState(0);
219
- React5.useEffect(() => {
266
+ const [progress, setProgress] = React6.useState(0);
267
+ React6.useEffect(() => {
220
268
  const timer = setInterval(() => {
221
269
  setProgress(oldProgress => {
222
270
  if (oldProgress === MAX_PROGRESS) {
@@ -237,7 +285,7 @@ var InfiniteLinearProgress = () => {
237
285
  clearInterval(timer);
238
286
  };
239
287
  }, []);
240
- return /* @__PURE__ */jsx6(Progress, {
288
+ return /* @__PURE__ */jsx7(Progress, {
241
289
  max: MAX_PROGRESS,
242
290
  value: progress,
243
291
  role: "progressbar"
@@ -251,14 +299,14 @@ import { Textarea } from "theme-ui";
251
299
  import { Container } from "theme-ui";
252
300
 
253
301
  // src/components/HelpText.tsx
254
- import { jsx as jsx7 } from "react/jsx-runtime";
302
+ import { jsx as jsx8 } from "react/jsx-runtime";
255
303
  var HelpText = ({
256
304
  disabled,
257
305
  negative,
258
306
  ...props
259
307
  }) => {
260
308
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
261
- return /* @__PURE__ */jsx7(Text, {
309
+ return /* @__PURE__ */jsx8(Text, {
262
310
  variant,
263
311
  "aria-disabled": disabled ? "true" : void 0,
264
312
  ...props
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui 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';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, SelectProps as SelectProps$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, 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';
@@ -40,6 +40,9 @@ type InputProps = InputProps$1 & {
40
40
  };
41
41
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
42
42
 
43
+ type SelectProps = SelectProps$1;
44
+ declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps$1, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
45
+
43
46
  declare const InfiniteLinearProgress: () => JSX.Element;
44
47
 
45
48
  type HelpTextProps = Omit<TextProps, 'variant'> & {
@@ -48,4 +51,4 @@ type HelpTextProps = Omit<TextProps, 'variant'> & {
48
51
  };
49
52
  declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
50
53
 
51
- export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
54
+ export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ __export(src_exports, {
59
59
  LinearProgress: () => import_theme_ui15.Progress,
60
60
  Link: () => import_theme_ui14.Link,
61
61
  Radio: () => import_theme_ui19.Radio,
62
- Select: () => import_theme_ui17.Select,
62
+ Select: () => Select,
63
63
  Slider: () => import_theme_ui21.Slider,
64
64
  Spinner: () => import_theme_ui18.Spinner,
65
65
  Text: () => import_theme_ui16.Text,
@@ -198,50 +198,54 @@ var import_theme_ui10 = require("theme-ui");
198
198
  var import_theme_ui11 = require("theme-ui");
199
199
 
200
200
  // src/components/Input.tsx
201
- var import_react3 = __toESM(require("react"));
202
201
  var import_theme_ui12 = require("theme-ui");
202
+ var import_react3 = __toESM(require("react"));
203
203
  var import_jsx_runtime5 = require("react/jsx-runtime");
204
204
  var Input = import_react3.default.forwardRef(({
205
205
  leadingIcon,
206
206
  trailingIcon,
207
+ className,
207
208
  sx,
208
209
  ...inputProps
209
210
  }, ref) => {
210
211
  return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_theme_ui8.Flex, {
212
+ className,
211
213
  sx: {
214
+ ...sx,
212
215
  position: "relative",
213
- width: "100%",
214
- ...sx
216
+ padding: 0,
217
+ border: "none"
215
218
  },
216
219
  children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui16.Text, {
217
220
  sx: {
218
221
  position: "absolute",
219
222
  alignSelf: "center",
220
- fontSize: "base",
221
- left: "1rem",
222
- lineHeight: 0
223
+ left: "1rem"
223
224
  },
224
225
  variant: "leading-icon",
225
226
  children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(Icon, {
227
+ inline: true,
226
228
  icon: leadingIcon
227
229
  })
228
230
  }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui12.Input, {
229
231
  ref,
230
232
  sx: {
233
+ ...sx,
231
234
  paddingLeft: leadingIcon ? "3xl" : void 0,
232
- paddingRight: trailingIcon ? "3xl" : void 0
235
+ paddingRight: trailingIcon ? "3xl" : void 0,
236
+ margin: 0
233
237
  },
238
+ className,
234
239
  ...inputProps
235
240
  }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui16.Text, {
236
241
  sx: {
237
242
  position: "absolute",
238
243
  right: "1rem",
239
- alignSelf: "center",
240
- fontSize: "base",
241
- lineHeight: 0
244
+ alignSelf: "center"
242
245
  },
243
246
  variant: "trailing-icon",
244
247
  children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(Icon, {
248
+ inline: true,
245
249
  icon: trailingIcon
246
250
  })
247
251
  })]
@@ -263,6 +267,50 @@ var import_theme_ui16 = require("theme-ui");
263
267
 
264
268
  // src/components/Select.tsx
265
269
  var import_theme_ui17 = require("theme-ui");
270
+ var import_react4 = __toESM(require("react"));
271
+ var import_jsx_runtime6 = require("react/jsx-runtime");
272
+ var Select = import_react4.default.forwardRef(({
273
+ arrow,
274
+ ...props
275
+ }, ref) => {
276
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui17.Select, {
277
+ arrow: /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
278
+ children: [arrow ?? /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
279
+ sx: {
280
+ marginLeft: ({
281
+ space
282
+ }) => {
283
+ return space?.["2xl"] ? "-2xl" : "-28px";
284
+ },
285
+ alignSelf: "center",
286
+ pointerEvents: "none",
287
+ lineHeight: 0
288
+ },
289
+ children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
290
+ icon: "picker-down"
291
+ })
292
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
293
+ className: "error-icon",
294
+ sx: {
295
+ marginLeft: ({
296
+ space
297
+ }) => {
298
+ return space?.["2xl"] ? `calc(-${space["2xl"]} - 10px)` : "-44px";
299
+ },
300
+ alignSelf: "center",
301
+ pointerEvents: "none",
302
+ lineHeight: 0
303
+ },
304
+ children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
305
+ icon: "error"
306
+ })
307
+ })]
308
+ }),
309
+ ref,
310
+ ...props
311
+ });
312
+ });
313
+ Select.displayName = "Select";
266
314
 
267
315
  // src/components/Spinner.tsx
268
316
  var import_theme_ui18 = require("theme-ui");
@@ -280,12 +328,12 @@ var import_theme_ui21 = require("theme-ui");
280
328
  var import_theme_ui22 = require("theme-ui");
281
329
 
282
330
  // src/components/InfiniteLinearProgress.tsx
283
- var React5 = __toESM(require("react"));
284
- var import_jsx_runtime6 = require("react/jsx-runtime");
331
+ var React6 = __toESM(require("react"));
332
+ var import_jsx_runtime7 = require("react/jsx-runtime");
285
333
  var MAX_PROGRESS = 100;
286
334
  var InfiniteLinearProgress = () => {
287
- const [progress, setProgress] = React5.useState(0);
288
- React5.useEffect(() => {
335
+ const [progress, setProgress] = React6.useState(0);
336
+ React6.useEffect(() => {
289
337
  const timer = setInterval(() => {
290
338
  setProgress(oldProgress => {
291
339
  if (oldProgress === MAX_PROGRESS) {
@@ -306,7 +354,7 @@ var InfiniteLinearProgress = () => {
306
354
  clearInterval(timer);
307
355
  };
308
356
  }, []);
309
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Progress, {
357
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui15.Progress, {
310
358
  max: MAX_PROGRESS,
311
359
  value: progress,
312
360
  role: "progressbar"
@@ -320,14 +368,14 @@ var import_theme_ui23 = require("theme-ui");
320
368
  var import_theme_ui24 = require("theme-ui");
321
369
 
322
370
  // src/components/HelpText.tsx
323
- var import_jsx_runtime7 = require("react/jsx-runtime");
371
+ var import_jsx_runtime8 = require("react/jsx-runtime");
324
372
  var HelpText = ({
325
373
  disabled,
326
374
  negative,
327
375
  ...props
328
376
  }) => {
329
377
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
330
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
378
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui16.Text, {
331
379
  variant,
332
380
  "aria-disabled": disabled ? "true" : void 0,
333
381
  ...props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.11",
3
+ "version": "1.31.13",
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.10",
27
+ "@ttoss/theme": "^1.4.12",
28
28
  "theme-ui": "^0.15.5"
29
29
  },
30
30
  "peerDependencies": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@ttoss/config": "^1.29.3",
35
- "@ttoss/test-utils": "^1.21.1",
35
+ "@ttoss/test-utils": "^1.21.2",
36
36
  "@types/jest": "^29.5.0",
37
37
  "jest": "^29.5.0",
38
38
  "react": "^18.2.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "39abc27c77c2587edc8d877ccb121783611791a4"
49
+ "gitHead": "2fda7636a4a10c1085a17df991fb3fc0ac28f816"
50
50
  }
@@ -1,7 +1,6 @@
1
1
  import { Flex, Icon, type IconType, Text } from '..';
2
- import React from 'react';
3
-
4
2
  import { type InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
3
+ import React from 'react';
5
4
 
6
5
  export type InputProps = InputPropsUI & {
7
6
  leadingIcon?: IconType;
@@ -9,29 +8,33 @@ export type InputProps = InputPropsUI & {
9
8
  };
10
9
 
11
10
  export const Input = React.forwardRef<HTMLInputElement, InputProps>(
12
- ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
11
+ ({ leadingIcon, trailingIcon, className, sx, ...inputProps }, ref) => {
13
12
  return (
14
- <Flex sx={{ position: 'relative', width: '100%', ...sx }}>
13
+ <Flex
14
+ className={className}
15
+ sx={{ ...sx, position: 'relative', padding: 0, border: 'none' }}
16
+ >
15
17
  {leadingIcon && (
16
18
  <Text
17
19
  sx={{
18
20
  position: 'absolute',
19
21
  alignSelf: 'center',
20
- fontSize: 'base',
21
22
  left: '1rem',
22
- lineHeight: 0,
23
23
  }}
24
24
  variant="leading-icon"
25
25
  >
26
- <Icon icon={leadingIcon} />
26
+ <Icon inline icon={leadingIcon} />
27
27
  </Text>
28
28
  )}
29
29
  <InputUI
30
30
  ref={ref}
31
31
  sx={{
32
+ ...sx,
32
33
  paddingLeft: leadingIcon ? '3xl' : undefined,
33
34
  paddingRight: trailingIcon ? '3xl' : undefined,
35
+ margin: 0,
34
36
  }}
37
+ className={className}
35
38
  {...inputProps}
36
39
  />
37
40
 
@@ -41,12 +44,10 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
41
44
  position: 'absolute',
42
45
  right: '1rem',
43
46
  alignSelf: 'center',
44
- fontSize: 'base',
45
- lineHeight: 0,
46
47
  }}
47
48
  variant="trailing-icon"
48
49
  >
49
- <Icon icon={trailingIcon} />
50
+ <Icon inline icon={trailingIcon} />
50
51
  </Text>
51
52
  )}
52
53
  </Flex>
@@ -1 +1,57 @@
1
- export { Select, type SelectProps } from 'theme-ui';
1
+ import { Icon, Text } from '..';
2
+ import {
3
+ type SelectProps as SelectPropsUi,
4
+ Select as SelectUi,
5
+ } from 'theme-ui';
6
+ import React from 'react';
7
+
8
+ export type SelectProps = SelectPropsUi;
9
+
10
+ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
11
+ ({ arrow, ...props }, ref) => {
12
+ return (
13
+ <SelectUi
14
+ // https://theme-ui.com/components/select#custom-arrow-icon
15
+ arrow={
16
+ <>
17
+ {arrow ?? (
18
+ <Text
19
+ sx={{
20
+ marginLeft: ({ space }: any) => {
21
+ return space?.['2xl'] ? '-2xl' : '-28px';
22
+ },
23
+ alignSelf: 'center',
24
+ pointerEvents: 'none',
25
+ lineHeight: 0,
26
+ }}
27
+ >
28
+ <Icon icon="picker-down" />
29
+ </Text>
30
+ )}
31
+
32
+ {props['aria-invalid'] === 'true' && (
33
+ <Text
34
+ className="error-icon"
35
+ sx={{
36
+ marginLeft: ({ space }: any) => {
37
+ return space?.['2xl']
38
+ ? `calc(-${space['2xl']} - 10px)`
39
+ : '-44px';
40
+ },
41
+ alignSelf: 'center',
42
+ pointerEvents: 'none',
43
+ lineHeight: 0,
44
+ }}
45
+ >
46
+ <Icon icon="error" />
47
+ </Text>
48
+ )}
49
+ </>
50
+ }
51
+ ref={ref}
52
+ {...props}
53
+ />
54
+ );
55
+ }
56
+ );
57
+ Select.displayName = 'Select';