@ttoss/ui 1.31.12 → 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
@@ -197,7 +197,51 @@ import { Progress } from "theme-ui";
197
197
  import { Text } from "theme-ui";
198
198
 
199
199
  // src/components/Select.tsx
200
- 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";
201
245
 
202
246
  // src/components/Spinner.tsx
203
247
  import { Spinner } from "theme-ui";
@@ -215,12 +259,12 @@ import { Slider } from "theme-ui";
215
259
  import { Checkbox } from "theme-ui";
216
260
 
217
261
  // src/components/InfiniteLinearProgress.tsx
218
- import * as React5 from "react";
219
- import { jsx as jsx6 } from "react/jsx-runtime";
262
+ import * as React6 from "react";
263
+ import { jsx as jsx7 } from "react/jsx-runtime";
220
264
  var MAX_PROGRESS = 100;
221
265
  var InfiniteLinearProgress = () => {
222
- const [progress, setProgress] = React5.useState(0);
223
- React5.useEffect(() => {
266
+ const [progress, setProgress] = React6.useState(0);
267
+ React6.useEffect(() => {
224
268
  const timer = setInterval(() => {
225
269
  setProgress(oldProgress => {
226
270
  if (oldProgress === MAX_PROGRESS) {
@@ -241,7 +285,7 @@ var InfiniteLinearProgress = () => {
241
285
  clearInterval(timer);
242
286
  };
243
287
  }, []);
244
- return /* @__PURE__ */jsx6(Progress, {
288
+ return /* @__PURE__ */jsx7(Progress, {
245
289
  max: MAX_PROGRESS,
246
290
  value: progress,
247
291
  role: "progressbar"
@@ -255,14 +299,14 @@ import { Textarea } from "theme-ui";
255
299
  import { Container } from "theme-ui";
256
300
 
257
301
  // src/components/HelpText.tsx
258
- import { jsx as jsx7 } from "react/jsx-runtime";
302
+ import { jsx as jsx8 } from "react/jsx-runtime";
259
303
  var HelpText = ({
260
304
  disabled,
261
305
  negative,
262
306
  ...props
263
307
  }) => {
264
308
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
265
- return /* @__PURE__ */jsx7(Text, {
309
+ return /* @__PURE__ */jsx8(Text, {
266
310
  variant,
267
311
  "aria-disabled": disabled ? "true" : void 0,
268
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,
@@ -267,6 +267,50 @@ var import_theme_ui16 = require("theme-ui");
267
267
 
268
268
  // src/components/Select.tsx
269
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";
270
314
 
271
315
  // src/components/Spinner.tsx
272
316
  var import_theme_ui18 = require("theme-ui");
@@ -284,12 +328,12 @@ var import_theme_ui21 = require("theme-ui");
284
328
  var import_theme_ui22 = require("theme-ui");
285
329
 
286
330
  // src/components/InfiniteLinearProgress.tsx
287
- var React5 = __toESM(require("react"));
288
- var import_jsx_runtime6 = require("react/jsx-runtime");
331
+ var React6 = __toESM(require("react"));
332
+ var import_jsx_runtime7 = require("react/jsx-runtime");
289
333
  var MAX_PROGRESS = 100;
290
334
  var InfiniteLinearProgress = () => {
291
- const [progress, setProgress] = React5.useState(0);
292
- React5.useEffect(() => {
335
+ const [progress, setProgress] = React6.useState(0);
336
+ React6.useEffect(() => {
293
337
  const timer = setInterval(() => {
294
338
  setProgress(oldProgress => {
295
339
  if (oldProgress === MAX_PROGRESS) {
@@ -310,7 +354,7 @@ var InfiniteLinearProgress = () => {
310
354
  clearInterval(timer);
311
355
  };
312
356
  }, []);
313
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Progress, {
357
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui15.Progress, {
314
358
  max: MAX_PROGRESS,
315
359
  value: progress,
316
360
  role: "progressbar"
@@ -324,14 +368,14 @@ var import_theme_ui23 = require("theme-ui");
324
368
  var import_theme_ui24 = require("theme-ui");
325
369
 
326
370
  // src/components/HelpText.tsx
327
- var import_jsx_runtime7 = require("react/jsx-runtime");
371
+ var import_jsx_runtime8 = require("react/jsx-runtime");
328
372
  var HelpText = ({
329
373
  disabled,
330
374
  negative,
331
375
  ...props
332
376
  }) => {
333
377
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
334
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
378
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui16.Text, {
335
379
  variant,
336
380
  "aria-disabled": disabled ? "true" : void 0,
337
381
  ...props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.12",
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.11",
27
+ "@ttoss/theme": "^1.4.12",
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": "6f711c5bb31c7b7b347477910cc0da1fe165509e"
49
+ "gitHead": "2fda7636a4a10c1085a17df991fb3fc0ac28f816"
50
50
  }
@@ -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';