@ttoss/ui 1.30.4 → 1.30.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
@@ -2566,7 +2566,56 @@ import { Image } from "theme-ui";
2566
2566
 
2567
2567
  // src/components/Input.tsx
2568
2568
  init_tsup_inject();
2569
- import { Input } from "theme-ui";
2569
+ import React5 from "react";
2570
+ import { Input as InputUI } from "theme-ui";
2571
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
2572
+ var Input = React5.forwardRef(
2573
+ ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
2574
+ return /* @__PURE__ */ jsxs3(Flex, { sx: { position: "relative" }, children: [
2575
+ leadingIcon && /* @__PURE__ */ jsx4(
2576
+ Text,
2577
+ {
2578
+ sx: {
2579
+ position: "absolute",
2580
+ alignSelf: "center",
2581
+ fontSize: "lg",
2582
+ left: "1rem",
2583
+ lineHeight: 0
2584
+ },
2585
+ variant: "leading-icon",
2586
+ children: /* @__PURE__ */ jsx4(Icon2, { icon: leadingIcon })
2587
+ }
2588
+ ),
2589
+ /* @__PURE__ */ jsx4(
2590
+ InputUI,
2591
+ {
2592
+ ref,
2593
+ sx: {
2594
+ paddingLeft: leadingIcon ? "3xl" : void 0,
2595
+ paddingRight: trailingIcon ? "3xl" : void 0,
2596
+ ...sx
2597
+ },
2598
+ ...inputProps
2599
+ }
2600
+ ),
2601
+ trailingIcon && /* @__PURE__ */ jsx4(
2602
+ Text,
2603
+ {
2604
+ sx: {
2605
+ position: "absolute",
2606
+ right: "1rem",
2607
+ alignSelf: "center",
2608
+ fontSize: "lg",
2609
+ lineHeight: 0
2610
+ },
2611
+ variant: "trailing-icon",
2612
+ children: /* @__PURE__ */ jsx4(Icon2, { icon: trailingIcon })
2613
+ }
2614
+ )
2615
+ ] });
2616
+ }
2617
+ );
2618
+ Input.displayName = "Input";
2570
2619
 
2571
2620
  // src/components/Label.tsx
2572
2621
  init_tsup_inject();
@@ -2608,12 +2657,12 @@ import { Checkbox } from "theme-ui";
2608
2657
 
2609
2658
  // src/components/InfiniteLinearProgress.tsx
2610
2659
  init_tsup_inject();
2611
- import * as React5 from "react";
2612
- import { jsx as jsx4 } from "react/jsx-runtime";
2660
+ import * as React6 from "react";
2661
+ import { jsx as jsx5 } from "react/jsx-runtime";
2613
2662
  var MAX_PROGRESS = 100;
2614
2663
  var InfiniteLinearProgress = () => {
2615
- const [progress, setProgress] = React5.useState(0);
2616
- React5.useEffect(() => {
2664
+ const [progress, setProgress] = React6.useState(0);
2665
+ React6.useEffect(() => {
2617
2666
  const timer = setInterval(() => {
2618
2667
  setProgress((oldProgress) => {
2619
2668
  if (oldProgress === MAX_PROGRESS) {
@@ -2634,7 +2683,7 @@ var InfiniteLinearProgress = () => {
2634
2683
  clearInterval(timer);
2635
2684
  };
2636
2685
  }, []);
2637
- return /* @__PURE__ */ jsx4(Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
2686
+ return /* @__PURE__ */ jsx5(Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
2638
2687
  };
2639
2688
 
2640
2689
  // src/components/Textarea.tsx
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, ButtonProps as ButtonProps$1 } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, Image, ImageProps, Input, InputProps, 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, ButtonProps as ButtonProps$1, InputProps as InputProps$1 } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, 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
+ import React__default from 'react';
6
7
  import { IconifyIconProps, IconifyIconHTMLElement } from '@iconify-icon/react';
8
+ import { IconifyIcon } from '@iconify/types';
7
9
 
8
10
  type ThemeProviderProps = {
9
11
  children?: React.ReactNode;
@@ -23,9 +25,16 @@ type ButtonProps = ButtonProps$1 & {
23
25
  };
24
26
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
25
27
 
28
+ type InputProps = InputProps$1 & {
29
+ leadingIcon?: IconType;
30
+ trailingIcon?: IconType;
31
+ };
32
+ declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
33
+
34
+ type IconType = string | IconifyIcon;
26
35
  type IconProps = Omit<IconifyIconProps, 'ref'>;
27
36
  declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<IconifyIconHTMLElement | null>>;
28
37
 
29
38
  declare const InfiniteLinearProgress: () => JSX.Element;
30
39
 
31
- export { Button, ButtonProps, Icon, IconProps, InfiniteLinearProgress, ThemeProvider, ThemeProviderProps, useTheme };
40
+ export { Button, ButtonProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -168,7 +168,7 @@ __export(src_exports, {
168
168
  Icon: () => Icon2,
169
169
  Image: () => import_theme_ui10.Image,
170
170
  InfiniteLinearProgress: () => InfiniteLinearProgress,
171
- Input: () => import_theme_ui11.Input,
171
+ Input: () => Input,
172
172
  Label: () => import_theme_ui12.Label,
173
173
  LinearProgress: () => import_theme_ui14.Progress,
174
174
  Link: () => import_theme_ui13.Link,
@@ -2602,7 +2602,56 @@ var import_theme_ui10 = require("theme-ui");
2602
2602
 
2603
2603
  // src/components/Input.tsx
2604
2604
  init_tsup_inject();
2605
+ var import_react4 = __toESM(require("react"));
2605
2606
  var import_theme_ui11 = require("theme-ui");
2607
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2608
+ var Input = import_react4.default.forwardRef(
2609
+ ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
2610
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_theme_ui7.Flex, { sx: { position: "relative" }, children: [
2611
+ leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2612
+ import_theme_ui15.Text,
2613
+ {
2614
+ sx: {
2615
+ position: "absolute",
2616
+ alignSelf: "center",
2617
+ fontSize: "lg",
2618
+ left: "1rem",
2619
+ lineHeight: 0
2620
+ },
2621
+ variant: "leading-icon",
2622
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2, { icon: leadingIcon })
2623
+ }
2624
+ ),
2625
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2626
+ import_theme_ui11.Input,
2627
+ {
2628
+ ref,
2629
+ sx: {
2630
+ paddingLeft: leadingIcon ? "3xl" : void 0,
2631
+ paddingRight: trailingIcon ? "3xl" : void 0,
2632
+ ...sx
2633
+ },
2634
+ ...inputProps
2635
+ }
2636
+ ),
2637
+ trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2638
+ import_theme_ui15.Text,
2639
+ {
2640
+ sx: {
2641
+ position: "absolute",
2642
+ right: "1rem",
2643
+ alignSelf: "center",
2644
+ fontSize: "lg",
2645
+ lineHeight: 0
2646
+ },
2647
+ variant: "trailing-icon",
2648
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2, { icon: trailingIcon })
2649
+ }
2650
+ )
2651
+ ] });
2652
+ }
2653
+ );
2654
+ Input.displayName = "Input";
2606
2655
 
2607
2656
  // src/components/Label.tsx
2608
2657
  init_tsup_inject();
@@ -2642,12 +2691,12 @@ var import_theme_ui20 = require("theme-ui");
2642
2691
 
2643
2692
  // src/components/InfiniteLinearProgress.tsx
2644
2693
  init_tsup_inject();
2645
- var React5 = __toESM(require("react"));
2646
- var import_jsx_runtime4 = require("react/jsx-runtime");
2694
+ var React6 = __toESM(require("react"));
2695
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2647
2696
  var MAX_PROGRESS = 100;
2648
2697
  var InfiniteLinearProgress = () => {
2649
- const [progress, setProgress] = React5.useState(0);
2650
- React5.useEffect(() => {
2698
+ const [progress, setProgress] = React6.useState(0);
2699
+ React6.useEffect(() => {
2651
2700
  const timer = setInterval(() => {
2652
2701
  setProgress((oldProgress) => {
2653
2702
  if (oldProgress === MAX_PROGRESS) {
@@ -2668,7 +2717,7 @@ var InfiniteLinearProgress = () => {
2668
2717
  clearInterval(timer);
2669
2718
  };
2670
2719
  }, []);
2671
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_theme_ui14.Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
2720
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_theme_ui14.Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
2672
2721
  };
2673
2722
 
2674
2723
  // src/components/Textarea.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.30.4",
3
+ "version": "1.30.6",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "d07df43f2a4a997636e950f5362a7a8090705c99"
48
+ "gitHead": "0a6b947e6dc4386ff80861cbed8c119c6bd39f47"
49
49
  }
@@ -4,6 +4,9 @@ import {
4
4
  IconifyIconHTMLElement,
5
5
  IconifyIconProps,
6
6
  } from '@iconify-icon/react';
7
+ import type { IconifyIcon as IconifyIconType } from '@iconify/types';
8
+
9
+ export type IconType = string | IconifyIconType;
7
10
 
8
11
  export type IconProps = Omit<IconifyIconProps, 'ref'>;
9
12
 
@@ -1 +1,58 @@
1
- export { Input, type InputProps } from 'theme-ui';
1
+ import { Flex, Icon, type IconType, Text } from '..';
2
+ import React from 'react';
3
+
4
+ import { type InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
5
+
6
+ export type InputProps = InputPropsUI & {
7
+ leadingIcon?: IconType;
8
+ trailingIcon?: IconType;
9
+ };
10
+
11
+ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
12
+ ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
13
+ return (
14
+ <Flex sx={{ position: 'relative' }}>
15
+ {leadingIcon && (
16
+ <Text
17
+ sx={{
18
+ position: 'absolute',
19
+ alignSelf: 'center',
20
+ fontSize: 'lg',
21
+ left: '1rem',
22
+ lineHeight: 0,
23
+ }}
24
+ variant="leading-icon"
25
+ >
26
+ <Icon icon={leadingIcon} />
27
+ </Text>
28
+ )}
29
+ <InputUI
30
+ ref={ref}
31
+ sx={{
32
+ paddingLeft: leadingIcon ? '3xl' : undefined,
33
+ paddingRight: trailingIcon ? '3xl' : undefined,
34
+ ...sx,
35
+ }}
36
+ {...inputProps}
37
+ />
38
+
39
+ {trailingIcon && (
40
+ <Text
41
+ sx={{
42
+ position: 'absolute',
43
+ right: '1rem',
44
+ alignSelf: 'center',
45
+ fontSize: 'lg',
46
+ lineHeight: 0,
47
+ }}
48
+ variant="trailing-icon"
49
+ >
50
+ <Icon icon={trailingIcon} />
51
+ </Text>
52
+ )}
53
+ </Flex>
54
+ );
55
+ }
56
+ );
57
+
58
+ Input.displayName = 'Input';
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ export { Text, type TextProps } from './components/Text';
24
24
  export { Select, type SelectProps } from './components/Select';
25
25
  export { Spinner, type SpinnerProps } from './components/Spinner';
26
26
  export { Radio, type RadioProps } from './components/Radio';
27
- export { Icon, type IconProps } from './components/Icon';
27
+ export { Icon, type IconProps, type IconType } from './components/Icon';
28
28
  export { Slider, type SliderProps } from './components/Slider';
29
29
  export { Checkbox, type CheckboxProps } from './components/Checkbox';
30
30
  export { InfiniteLinearProgress } from './components/InfiniteLinearProgress';