@ttoss/ui 1.30.5 → 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 +5 -23
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -22
- package/package.json +2 -2
- package/src/components/Icon.tsx +3 -0
- package/src/components/Input.tsx +5 -35
- package/src/index.ts +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2568,27 +2568,9 @@ import { Image } from "theme-ui";
|
|
|
2568
2568
|
init_tsup_inject();
|
|
2569
2569
|
import React5 from "react";
|
|
2570
2570
|
import { Input as InputUI } from "theme-ui";
|
|
2571
|
-
import {
|
|
2572
|
-
var renderIcon2 = (icon) => {
|
|
2573
|
-
if (typeof icon === "string" || typeof icon === "object" && !!icon?.body) {
|
|
2574
|
-
return /* @__PURE__ */ jsx4(Icon2, { icon });
|
|
2575
|
-
}
|
|
2576
|
-
return /* @__PURE__ */ jsx4(Fragment3, { children: icon });
|
|
2577
|
-
};
|
|
2571
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2578
2572
|
var Input = React5.forwardRef(
|
|
2579
2573
|
({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
|
|
2580
|
-
const leadingIconElement = React5.useMemo(() => {
|
|
2581
|
-
if (!leadingIcon) {
|
|
2582
|
-
return null;
|
|
2583
|
-
}
|
|
2584
|
-
return renderIcon2(leadingIcon);
|
|
2585
|
-
}, [leadingIcon]);
|
|
2586
|
-
const trailingIconElement = React5.useMemo(() => {
|
|
2587
|
-
if (!trailingIcon) {
|
|
2588
|
-
return null;
|
|
2589
|
-
}
|
|
2590
|
-
return renderIcon2(trailingIcon);
|
|
2591
|
-
}, [trailingIcon]);
|
|
2592
2574
|
return /* @__PURE__ */ jsxs3(Flex, { sx: { position: "relative" }, children: [
|
|
2593
2575
|
leadingIcon && /* @__PURE__ */ jsx4(
|
|
2594
2576
|
Text,
|
|
@@ -2597,11 +2579,11 @@ var Input = React5.forwardRef(
|
|
|
2597
2579
|
position: "absolute",
|
|
2598
2580
|
alignSelf: "center",
|
|
2599
2581
|
fontSize: "lg",
|
|
2600
|
-
left: "
|
|
2582
|
+
left: "1rem",
|
|
2601
2583
|
lineHeight: 0
|
|
2602
2584
|
},
|
|
2603
2585
|
variant: "leading-icon",
|
|
2604
|
-
children:
|
|
2586
|
+
children: /* @__PURE__ */ jsx4(Icon2, { icon: leadingIcon })
|
|
2605
2587
|
}
|
|
2606
2588
|
),
|
|
2607
2589
|
/* @__PURE__ */ jsx4(
|
|
@@ -2621,13 +2603,13 @@ var Input = React5.forwardRef(
|
|
|
2621
2603
|
{
|
|
2622
2604
|
sx: {
|
|
2623
2605
|
position: "absolute",
|
|
2624
|
-
right: "
|
|
2606
|
+
right: "1rem",
|
|
2625
2607
|
alignSelf: "center",
|
|
2626
2608
|
fontSize: "lg",
|
|
2627
2609
|
lineHeight: 0
|
|
2628
2610
|
},
|
|
2629
2611
|
variant: "trailing-icon",
|
|
2630
|
-
children:
|
|
2612
|
+
children: /* @__PURE__ */ jsx4(Icon2, { icon: trailingIcon })
|
|
2631
2613
|
}
|
|
2632
2614
|
)
|
|
2633
2615
|
] });
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Co
|
|
|
4
4
|
export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default from 'react';
|
|
7
|
-
import { IconifyIcon } from '@iconify/types';
|
|
8
7
|
import { IconifyIconProps, IconifyIconHTMLElement } from '@iconify-icon/react';
|
|
8
|
+
import { IconifyIcon } from '@iconify/types';
|
|
9
9
|
|
|
10
10
|
type ThemeProviderProps = {
|
|
11
11
|
children?: React.ReactNode;
|
|
@@ -25,16 +25,16 @@ type ButtonProps = ButtonProps$1 & {
|
|
|
25
25
|
};
|
|
26
26
|
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
27
|
|
|
28
|
-
type IconType = string | React__default.ReactNode | IconifyIcon;
|
|
29
28
|
type InputProps = InputProps$1 & {
|
|
30
29
|
leadingIcon?: IconType;
|
|
31
30
|
trailingIcon?: IconType;
|
|
32
31
|
};
|
|
33
32
|
declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
34
33
|
|
|
34
|
+
type IconType = string | IconifyIcon;
|
|
35
35
|
type IconProps = Omit<IconifyIconProps, 'ref'>;
|
|
36
36
|
declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<IconifyIconHTMLElement | null>>;
|
|
37
37
|
|
|
38
38
|
declare const InfiniteLinearProgress: () => JSX.Element;
|
|
39
39
|
|
|
40
|
-
export { Button, ButtonProps, Icon, IconProps, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
|
|
40
|
+
export { Button, ButtonProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -2605,26 +2605,8 @@ init_tsup_inject();
|
|
|
2605
2605
|
var import_react4 = __toESM(require("react"));
|
|
2606
2606
|
var import_theme_ui11 = require("theme-ui");
|
|
2607
2607
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2608
|
-
var renderIcon2 = (icon) => {
|
|
2609
|
-
if (typeof icon === "string" || typeof icon === "object" && !!icon?.body) {
|
|
2610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2, { icon });
|
|
2611
|
-
}
|
|
2612
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: icon });
|
|
2613
|
-
};
|
|
2614
2608
|
var Input = import_react4.default.forwardRef(
|
|
2615
2609
|
({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
|
|
2616
|
-
const leadingIconElement = import_react4.default.useMemo(() => {
|
|
2617
|
-
if (!leadingIcon) {
|
|
2618
|
-
return null;
|
|
2619
|
-
}
|
|
2620
|
-
return renderIcon2(leadingIcon);
|
|
2621
|
-
}, [leadingIcon]);
|
|
2622
|
-
const trailingIconElement = import_react4.default.useMemo(() => {
|
|
2623
|
-
if (!trailingIcon) {
|
|
2624
|
-
return null;
|
|
2625
|
-
}
|
|
2626
|
-
return renderIcon2(trailingIcon);
|
|
2627
|
-
}, [trailingIcon]);
|
|
2628
2610
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_theme_ui7.Flex, { sx: { position: "relative" }, children: [
|
|
2629
2611
|
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2630
2612
|
import_theme_ui15.Text,
|
|
@@ -2633,11 +2615,11 @@ var Input = import_react4.default.forwardRef(
|
|
|
2633
2615
|
position: "absolute",
|
|
2634
2616
|
alignSelf: "center",
|
|
2635
2617
|
fontSize: "lg",
|
|
2636
|
-
left: "
|
|
2618
|
+
left: "1rem",
|
|
2637
2619
|
lineHeight: 0
|
|
2638
2620
|
},
|
|
2639
2621
|
variant: "leading-icon",
|
|
2640
|
-
children:
|
|
2622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2, { icon: leadingIcon })
|
|
2641
2623
|
}
|
|
2642
2624
|
),
|
|
2643
2625
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2657,13 +2639,13 @@ var Input = import_react4.default.forwardRef(
|
|
|
2657
2639
|
{
|
|
2658
2640
|
sx: {
|
|
2659
2641
|
position: "absolute",
|
|
2660
|
-
right: "
|
|
2642
|
+
right: "1rem",
|
|
2661
2643
|
alignSelf: "center",
|
|
2662
2644
|
fontSize: "lg",
|
|
2663
2645
|
lineHeight: 0
|
|
2664
2646
|
},
|
|
2665
2647
|
variant: "trailing-icon",
|
|
2666
|
-
children:
|
|
2648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2, { icon: trailingIcon })
|
|
2667
2649
|
}
|
|
2668
2650
|
)
|
|
2669
2651
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "1.30.
|
|
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": "
|
|
48
|
+
"gitHead": "0a6b947e6dc4386ff80861cbed8c119c6bd39f47"
|
|
49
49
|
}
|
package/src/components/Icon.tsx
CHANGED
|
@@ -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
|
|
package/src/components/Input.tsx
CHANGED
|
@@ -1,45 +1,15 @@
|
|
|
1
|
-
import { Flex, Icon, Text } from '..';
|
|
1
|
+
import { Flex, Icon, type IconType, Text } from '..';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { IconifyIcon } from '@iconify/types';
|
|
4
3
|
|
|
5
4
|
import { type InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
|
|
6
5
|
|
|
7
|
-
type IconType = string | React.ReactNode | IconifyIcon;
|
|
8
|
-
|
|
9
6
|
export type InputProps = InputPropsUI & {
|
|
10
7
|
leadingIcon?: IconType;
|
|
11
8
|
trailingIcon?: IconType;
|
|
12
9
|
};
|
|
13
10
|
|
|
14
|
-
const renderIcon = (icon: IconType) => {
|
|
15
|
-
if (
|
|
16
|
-
typeof icon === 'string' ||
|
|
17
|
-
(typeof icon === 'object' && !!(icon as IconifyIcon)?.body)
|
|
18
|
-
) {
|
|
19
|
-
return <Icon icon={icon as string | IconifyIcon} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return <>{icon}</>;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
11
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
26
12
|
({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
|
|
27
|
-
const leadingIconElement = React.useMemo(() => {
|
|
28
|
-
if (!leadingIcon) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return renderIcon(leadingIcon);
|
|
33
|
-
}, [leadingIcon]);
|
|
34
|
-
|
|
35
|
-
const trailingIconElement = React.useMemo(() => {
|
|
36
|
-
if (!trailingIcon) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return renderIcon(trailingIcon);
|
|
41
|
-
}, [trailingIcon]);
|
|
42
|
-
|
|
43
13
|
return (
|
|
44
14
|
<Flex sx={{ position: 'relative' }}>
|
|
45
15
|
{leadingIcon && (
|
|
@@ -48,12 +18,12 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
48
18
|
position: 'absolute',
|
|
49
19
|
alignSelf: 'center',
|
|
50
20
|
fontSize: 'lg',
|
|
51
|
-
left: '
|
|
21
|
+
left: '1rem',
|
|
52
22
|
lineHeight: 0,
|
|
53
23
|
}}
|
|
54
24
|
variant="leading-icon"
|
|
55
25
|
>
|
|
56
|
-
{
|
|
26
|
+
<Icon icon={leadingIcon} />
|
|
57
27
|
</Text>
|
|
58
28
|
)}
|
|
59
29
|
<InputUI
|
|
@@ -70,14 +40,14 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
70
40
|
<Text
|
|
71
41
|
sx={{
|
|
72
42
|
position: 'absolute',
|
|
73
|
-
right: '
|
|
43
|
+
right: '1rem',
|
|
74
44
|
alignSelf: 'center',
|
|
75
45
|
fontSize: 'lg',
|
|
76
46
|
lineHeight: 0,
|
|
77
47
|
}}
|
|
78
48
|
variant="trailing-icon"
|
|
79
49
|
>
|
|
80
|
-
{
|
|
50
|
+
<Icon icon={trailingIcon} />
|
|
81
51
|
</Text>
|
|
82
52
|
)}
|
|
83
53
|
</Flex>
|
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';
|