@ttoss/ui 1.30.3 → 1.30.5
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 +83 -12
- package/dist/index.d.ts +15 -6
- package/dist/index.js +83 -12
- package/package.json +2 -2
- package/src/components/Icon.tsx +14 -375
- package/src/components/Input.tsx +88 -1
package/dist/esm/index.js
CHANGED
|
@@ -491,13 +491,14 @@ import { Box } from "theme-ui";
|
|
|
491
491
|
|
|
492
492
|
// src/components/Button.tsx
|
|
493
493
|
init_tsup_inject();
|
|
494
|
-
import * as
|
|
494
|
+
import * as React4 from "react";
|
|
495
495
|
import {
|
|
496
496
|
Button as ButtonUi
|
|
497
497
|
} from "theme-ui";
|
|
498
498
|
|
|
499
499
|
// src/components/Icon.tsx
|
|
500
500
|
init_tsup_inject();
|
|
501
|
+
import * as React3 from "react";
|
|
501
502
|
|
|
502
503
|
// ../../node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
503
504
|
init_tsup_inject();
|
|
@@ -2492,9 +2493,12 @@ var Icon = React2.forwardRef(
|
|
|
2492
2493
|
|
|
2493
2494
|
// src/components/Icon.tsx
|
|
2494
2495
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2495
|
-
var Icon2 = (
|
|
2496
|
-
|
|
2497
|
-
};
|
|
2496
|
+
var Icon2 = React3.forwardRef(
|
|
2497
|
+
(props, ref) => {
|
|
2498
|
+
return /* @__PURE__ */ jsx2(Icon, { ref, "data-testid": "iconify-icon", ...props });
|
|
2499
|
+
}
|
|
2500
|
+
);
|
|
2501
|
+
Icon2.displayName = "Icon";
|
|
2498
2502
|
|
|
2499
2503
|
// src/components/Button.tsx
|
|
2500
2504
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -2507,8 +2511,8 @@ var RenderIcon = ({ icon }) => {
|
|
|
2507
2511
|
}
|
|
2508
2512
|
return /* @__PURE__ */ jsx3(Fragment2, { children: icon });
|
|
2509
2513
|
};
|
|
2510
|
-
var MemoizedRenderIcon =
|
|
2511
|
-
var Button =
|
|
2514
|
+
var MemoizedRenderIcon = React4.memo(RenderIcon);
|
|
2515
|
+
var Button = React4.forwardRef(
|
|
2512
2516
|
(props, ref) => {
|
|
2513
2517
|
const { children, leftIcon, rightIcon, ...restProps } = props;
|
|
2514
2518
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -2562,7 +2566,74 @@ import { Image } from "theme-ui";
|
|
|
2562
2566
|
|
|
2563
2567
|
// src/components/Input.tsx
|
|
2564
2568
|
init_tsup_inject();
|
|
2565
|
-
import
|
|
2569
|
+
import React5 from "react";
|
|
2570
|
+
import { Input as InputUI } from "theme-ui";
|
|
2571
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
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
|
+
};
|
|
2578
|
+
var Input = React5.forwardRef(
|
|
2579
|
+
({ 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
|
+
return /* @__PURE__ */ jsxs3(Flex, { sx: { position: "relative" }, children: [
|
|
2593
|
+
leadingIcon && /* @__PURE__ */ jsx4(
|
|
2594
|
+
Text,
|
|
2595
|
+
{
|
|
2596
|
+
sx: {
|
|
2597
|
+
position: "absolute",
|
|
2598
|
+
alignSelf: "center",
|
|
2599
|
+
fontSize: "lg",
|
|
2600
|
+
left: "lg",
|
|
2601
|
+
lineHeight: 0
|
|
2602
|
+
},
|
|
2603
|
+
variant: "leading-icon",
|
|
2604
|
+
children: leadingIconElement
|
|
2605
|
+
}
|
|
2606
|
+
),
|
|
2607
|
+
/* @__PURE__ */ jsx4(
|
|
2608
|
+
InputUI,
|
|
2609
|
+
{
|
|
2610
|
+
ref,
|
|
2611
|
+
sx: {
|
|
2612
|
+
paddingLeft: leadingIcon ? "3xl" : void 0,
|
|
2613
|
+
paddingRight: trailingIcon ? "3xl" : void 0,
|
|
2614
|
+
...sx
|
|
2615
|
+
},
|
|
2616
|
+
...inputProps
|
|
2617
|
+
}
|
|
2618
|
+
),
|
|
2619
|
+
trailingIcon && /* @__PURE__ */ jsx4(
|
|
2620
|
+
Text,
|
|
2621
|
+
{
|
|
2622
|
+
sx: {
|
|
2623
|
+
position: "absolute",
|
|
2624
|
+
right: "lg",
|
|
2625
|
+
alignSelf: "center",
|
|
2626
|
+
fontSize: "lg",
|
|
2627
|
+
lineHeight: 0
|
|
2628
|
+
},
|
|
2629
|
+
variant: "trailing-icon",
|
|
2630
|
+
children: trailingIconElement
|
|
2631
|
+
}
|
|
2632
|
+
)
|
|
2633
|
+
] });
|
|
2634
|
+
}
|
|
2635
|
+
);
|
|
2636
|
+
Input.displayName = "Input";
|
|
2566
2637
|
|
|
2567
2638
|
// src/components/Label.tsx
|
|
2568
2639
|
init_tsup_inject();
|
|
@@ -2604,12 +2675,12 @@ import { Checkbox } from "theme-ui";
|
|
|
2604
2675
|
|
|
2605
2676
|
// src/components/InfiniteLinearProgress.tsx
|
|
2606
2677
|
init_tsup_inject();
|
|
2607
|
-
import * as
|
|
2608
|
-
import { jsx as
|
|
2678
|
+
import * as React6 from "react";
|
|
2679
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2609
2680
|
var MAX_PROGRESS = 100;
|
|
2610
2681
|
var InfiniteLinearProgress = () => {
|
|
2611
|
-
const [progress, setProgress] =
|
|
2612
|
-
|
|
2682
|
+
const [progress, setProgress] = React6.useState(0);
|
|
2683
|
+
React6.useEffect(() => {
|
|
2613
2684
|
const timer = setInterval(() => {
|
|
2614
2685
|
setProgress((oldProgress) => {
|
|
2615
2686
|
if (oldProgress === MAX_PROGRESS) {
|
|
@@ -2630,7 +2701,7 @@ var InfiniteLinearProgress = () => {
|
|
|
2630
2701
|
clearInterval(timer);
|
|
2631
2702
|
};
|
|
2632
2703
|
}, []);
|
|
2633
|
-
return /* @__PURE__ */
|
|
2704
|
+
return /* @__PURE__ */ jsx5(Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
|
|
2634
2705
|
};
|
|
2635
2706
|
|
|
2636
2707
|
// 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,
|
|
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
|
|
6
|
+
import React__default from 'react';
|
|
7
|
+
import { IconifyIcon } from '@iconify/types';
|
|
8
|
+
import { IconifyIconProps, IconifyIconHTMLElement } from '@iconify-icon/react';
|
|
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
|
|
|
26
|
-
type
|
|
27
|
-
|
|
28
|
+
type IconType = string | React__default.ReactNode | IconifyIcon;
|
|
29
|
+
type InputProps = InputProps$1 & {
|
|
30
|
+
leadingIcon?: IconType;
|
|
31
|
+
trailingIcon?: IconType;
|
|
32
|
+
};
|
|
33
|
+
declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
34
|
+
|
|
35
|
+
type IconProps = Omit<IconifyIconProps, 'ref'>;
|
|
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, 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: () =>
|
|
171
|
+
Input: () => Input,
|
|
172
172
|
Label: () => import_theme_ui12.Label,
|
|
173
173
|
LinearProgress: () => import_theme_ui14.Progress,
|
|
174
174
|
Link: () => import_theme_ui13.Link,
|
|
@@ -529,11 +529,12 @@ var import_theme_ui3 = require("theme-ui");
|
|
|
529
529
|
|
|
530
530
|
// src/components/Button.tsx
|
|
531
531
|
init_tsup_inject();
|
|
532
|
-
var
|
|
532
|
+
var React4 = __toESM(require("react"));
|
|
533
533
|
var import_theme_ui4 = require("theme-ui");
|
|
534
534
|
|
|
535
535
|
// src/components/Icon.tsx
|
|
536
536
|
init_tsup_inject();
|
|
537
|
+
var React3 = __toESM(require("react"));
|
|
537
538
|
|
|
538
539
|
// ../../node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
539
540
|
init_tsup_inject();
|
|
@@ -2528,9 +2529,12 @@ var Icon = import_react2.default.forwardRef(
|
|
|
2528
2529
|
|
|
2529
2530
|
// src/components/Icon.tsx
|
|
2530
2531
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2531
|
-
var Icon2 = (
|
|
2532
|
-
|
|
2533
|
-
};
|
|
2532
|
+
var Icon2 = React3.forwardRef(
|
|
2533
|
+
(props, ref) => {
|
|
2534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { ref, "data-testid": "iconify-icon", ...props });
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
Icon2.displayName = "Icon";
|
|
2534
2538
|
|
|
2535
2539
|
// src/components/Button.tsx
|
|
2536
2540
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -2543,8 +2547,8 @@ var RenderIcon = ({ icon }) => {
|
|
|
2543
2547
|
}
|
|
2544
2548
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: icon });
|
|
2545
2549
|
};
|
|
2546
|
-
var MemoizedRenderIcon =
|
|
2547
|
-
var Button =
|
|
2550
|
+
var MemoizedRenderIcon = React4.memo(RenderIcon);
|
|
2551
|
+
var Button = React4.forwardRef(
|
|
2548
2552
|
(props, ref) => {
|
|
2549
2553
|
const { children, leftIcon, rightIcon, ...restProps } = props;
|
|
2550
2554
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -2598,7 +2602,74 @@ var import_theme_ui10 = require("theme-ui");
|
|
|
2598
2602
|
|
|
2599
2603
|
// src/components/Input.tsx
|
|
2600
2604
|
init_tsup_inject();
|
|
2605
|
+
var import_react4 = __toESM(require("react"));
|
|
2601
2606
|
var import_theme_ui11 = require("theme-ui");
|
|
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
|
+
var Input = import_react4.default.forwardRef(
|
|
2615
|
+
({ 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
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_theme_ui7.Flex, { sx: { position: "relative" }, children: [
|
|
2629
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2630
|
+
import_theme_ui15.Text,
|
|
2631
|
+
{
|
|
2632
|
+
sx: {
|
|
2633
|
+
position: "absolute",
|
|
2634
|
+
alignSelf: "center",
|
|
2635
|
+
fontSize: "lg",
|
|
2636
|
+
left: "lg",
|
|
2637
|
+
lineHeight: 0
|
|
2638
|
+
},
|
|
2639
|
+
variant: "leading-icon",
|
|
2640
|
+
children: leadingIconElement
|
|
2641
|
+
}
|
|
2642
|
+
),
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2644
|
+
import_theme_ui11.Input,
|
|
2645
|
+
{
|
|
2646
|
+
ref,
|
|
2647
|
+
sx: {
|
|
2648
|
+
paddingLeft: leadingIcon ? "3xl" : void 0,
|
|
2649
|
+
paddingRight: trailingIcon ? "3xl" : void 0,
|
|
2650
|
+
...sx
|
|
2651
|
+
},
|
|
2652
|
+
...inputProps
|
|
2653
|
+
}
|
|
2654
|
+
),
|
|
2655
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2656
|
+
import_theme_ui15.Text,
|
|
2657
|
+
{
|
|
2658
|
+
sx: {
|
|
2659
|
+
position: "absolute",
|
|
2660
|
+
right: "lg",
|
|
2661
|
+
alignSelf: "center",
|
|
2662
|
+
fontSize: "lg",
|
|
2663
|
+
lineHeight: 0
|
|
2664
|
+
},
|
|
2665
|
+
variant: "trailing-icon",
|
|
2666
|
+
children: trailingIconElement
|
|
2667
|
+
}
|
|
2668
|
+
)
|
|
2669
|
+
] });
|
|
2670
|
+
}
|
|
2671
|
+
);
|
|
2672
|
+
Input.displayName = "Input";
|
|
2602
2673
|
|
|
2603
2674
|
// src/components/Label.tsx
|
|
2604
2675
|
init_tsup_inject();
|
|
@@ -2638,12 +2709,12 @@ var import_theme_ui20 = require("theme-ui");
|
|
|
2638
2709
|
|
|
2639
2710
|
// src/components/InfiniteLinearProgress.tsx
|
|
2640
2711
|
init_tsup_inject();
|
|
2641
|
-
var
|
|
2642
|
-
var
|
|
2712
|
+
var React6 = __toESM(require("react"));
|
|
2713
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2643
2714
|
var MAX_PROGRESS = 100;
|
|
2644
2715
|
var InfiniteLinearProgress = () => {
|
|
2645
|
-
const [progress, setProgress] =
|
|
2646
|
-
|
|
2716
|
+
const [progress, setProgress] = React6.useState(0);
|
|
2717
|
+
React6.useEffect(() => {
|
|
2647
2718
|
const timer = setInterval(() => {
|
|
2648
2719
|
setProgress((oldProgress) => {
|
|
2649
2720
|
if (oldProgress === MAX_PROGRESS) {
|
|
@@ -2664,7 +2735,7 @@ var InfiniteLinearProgress = () => {
|
|
|
2664
2735
|
clearInterval(timer);
|
|
2665
2736
|
};
|
|
2666
2737
|
}, []);
|
|
2667
|
-
return /* @__PURE__ */ (0,
|
|
2738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_theme_ui14.Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
|
|
2668
2739
|
};
|
|
2669
2740
|
|
|
2670
2741
|
// src/components/Textarea.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.5",
|
|
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": "9a1d05dc6546c74a3f83835e4dcef00bc7040b6b"
|
|
49
49
|
}
|
package/src/components/Icon.tsx
CHANGED
|
@@ -1,377 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Icon as IconifyIcon,
|
|
4
|
+
IconifyIconHTMLElement,
|
|
4
5
|
IconifyIconProps,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
| 'summary'
|
|
15
|
-
| 'title'
|
|
16
|
-
| 'pattern'
|
|
17
|
-
| 'accept'
|
|
18
|
-
| 'acceptCharset'
|
|
19
|
-
| 'action'
|
|
20
|
-
| 'allowFullScreen'
|
|
21
|
-
| 'allowTransparency'
|
|
22
|
-
| 'alt'
|
|
23
|
-
| 'as'
|
|
24
|
-
| 'async'
|
|
25
|
-
| 'autoComplete'
|
|
26
|
-
| 'autoFocus'
|
|
27
|
-
| 'autoPlay'
|
|
28
|
-
| 'capture'
|
|
29
|
-
| 'cellPadding'
|
|
30
|
-
| 'cellSpacing'
|
|
31
|
-
| 'charSet'
|
|
32
|
-
| 'challenge'
|
|
33
|
-
| 'checked'
|
|
34
|
-
| 'classID'
|
|
35
|
-
| 'cols'
|
|
36
|
-
| 'colSpan'
|
|
37
|
-
| 'content'
|
|
38
|
-
| 'controls'
|
|
39
|
-
| 'coords'
|
|
40
|
-
| 'crossOrigin'
|
|
41
|
-
| 'dateTime'
|
|
42
|
-
| 'default'
|
|
43
|
-
| 'defer'
|
|
44
|
-
| 'disabled'
|
|
45
|
-
| 'download'
|
|
46
|
-
| 'encType'
|
|
47
|
-
| 'formAction'
|
|
48
|
-
| 'formEncType'
|
|
49
|
-
| 'formMethod'
|
|
50
|
-
| 'formNoValidate'
|
|
51
|
-
| 'formTarget'
|
|
52
|
-
| 'frameBorder'
|
|
53
|
-
| 'headers'
|
|
54
|
-
| 'height'
|
|
55
|
-
| 'high'
|
|
56
|
-
| 'href'
|
|
57
|
-
| 'hrefLang'
|
|
58
|
-
| 'htmlFor'
|
|
59
|
-
| 'httpEquiv'
|
|
60
|
-
| 'integrity'
|
|
61
|
-
| 'keyParams'
|
|
62
|
-
| 'keyType'
|
|
63
|
-
| 'kind'
|
|
64
|
-
| 'list'
|
|
65
|
-
| 'loop'
|
|
66
|
-
| 'low'
|
|
67
|
-
| 'manifest'
|
|
68
|
-
| 'marginHeight'
|
|
69
|
-
| 'marginWidth'
|
|
70
|
-
| 'max'
|
|
71
|
-
| 'maxLength'
|
|
72
|
-
| 'media'
|
|
73
|
-
| 'mediaGroup'
|
|
74
|
-
| 'method'
|
|
75
|
-
| 'min'
|
|
76
|
-
| 'minLength'
|
|
77
|
-
| 'multiple'
|
|
78
|
-
| 'muted'
|
|
79
|
-
| 'name'
|
|
80
|
-
| 'noValidate'
|
|
81
|
-
| 'open'
|
|
82
|
-
| 'optimum'
|
|
83
|
-
| 'placeholder'
|
|
84
|
-
| 'playsInline'
|
|
85
|
-
| 'poster'
|
|
86
|
-
| 'preload'
|
|
87
|
-
| 'readOnly'
|
|
88
|
-
| 'rel'
|
|
89
|
-
| 'required'
|
|
90
|
-
| 'reversed'
|
|
91
|
-
| 'rows'
|
|
92
|
-
| 'rowSpan'
|
|
93
|
-
| 'sandbox'
|
|
94
|
-
| 'scope'
|
|
95
|
-
| 'scoped'
|
|
96
|
-
| 'scrolling'
|
|
97
|
-
| 'seamless'
|
|
98
|
-
| 'selected'
|
|
99
|
-
| 'shape'
|
|
100
|
-
| 'size'
|
|
101
|
-
| 'sizes'
|
|
102
|
-
| 'src'
|
|
103
|
-
| 'srcDoc'
|
|
104
|
-
| 'srcLang'
|
|
105
|
-
| 'srcSet'
|
|
106
|
-
| 'start'
|
|
107
|
-
| 'step'
|
|
108
|
-
| 'target'
|
|
109
|
-
| 'type'
|
|
110
|
-
| 'useMap'
|
|
111
|
-
| 'value'
|
|
112
|
-
| 'width'
|
|
113
|
-
| 'wmode'
|
|
114
|
-
| 'wrap'
|
|
115
|
-
| 'defaultChecked'
|
|
116
|
-
| 'defaultValue'
|
|
117
|
-
| 'suppressContentEditableWarning'
|
|
118
|
-
| 'suppressHydrationWarning'
|
|
119
|
-
| 'accessKey'
|
|
120
|
-
| 'className'
|
|
121
|
-
| 'contentEditable'
|
|
122
|
-
| 'contextMenu'
|
|
123
|
-
| 'dir'
|
|
124
|
-
| 'draggable'
|
|
125
|
-
| 'hidden'
|
|
126
|
-
| 'id'
|
|
127
|
-
| 'lang'
|
|
128
|
-
| 'nonce'
|
|
129
|
-
| 'spellCheck'
|
|
130
|
-
| 'tabIndex'
|
|
131
|
-
| 'translate'
|
|
132
|
-
| 'radioGroup'
|
|
133
|
-
| 'role'
|
|
134
|
-
| 'about'
|
|
135
|
-
| 'datatype'
|
|
136
|
-
| 'inlist'
|
|
137
|
-
| 'prefix'
|
|
138
|
-
| 'property'
|
|
139
|
-
| 'resource'
|
|
140
|
-
| 'typeof'
|
|
141
|
-
| 'vocab'
|
|
142
|
-
| 'autoCapitalize'
|
|
143
|
-
| 'autoCorrect'
|
|
144
|
-
| 'autoSave'
|
|
145
|
-
| 'color'
|
|
146
|
-
| 'itemProp'
|
|
147
|
-
| 'itemScope'
|
|
148
|
-
| 'itemType'
|
|
149
|
-
| 'itemID'
|
|
150
|
-
| 'itemRef'
|
|
151
|
-
| 'results'
|
|
152
|
-
| 'security'
|
|
153
|
-
| 'unselectable'
|
|
154
|
-
| 'inputMode'
|
|
155
|
-
| 'is'
|
|
156
|
-
| 'aria-activedescendant'
|
|
157
|
-
| 'aria-atomic'
|
|
158
|
-
| 'aria-autocomplete'
|
|
159
|
-
| 'aria-busy'
|
|
160
|
-
| 'aria-checked'
|
|
161
|
-
| 'aria-colcount'
|
|
162
|
-
| 'aria-colindex'
|
|
163
|
-
| 'aria-colspan'
|
|
164
|
-
| 'aria-controls'
|
|
165
|
-
| 'aria-current'
|
|
166
|
-
| 'aria-describedby'
|
|
167
|
-
| 'aria-details'
|
|
168
|
-
| 'aria-disabled'
|
|
169
|
-
| 'aria-dropeffect'
|
|
170
|
-
| 'aria-errormessage'
|
|
171
|
-
| 'aria-expanded'
|
|
172
|
-
| 'aria-flowto'
|
|
173
|
-
| 'aria-grabbed'
|
|
174
|
-
| 'aria-haspopup'
|
|
175
|
-
| 'aria-hidden'
|
|
176
|
-
| 'aria-invalid'
|
|
177
|
-
| 'aria-keyshortcuts'
|
|
178
|
-
| 'aria-label'
|
|
179
|
-
| 'aria-labelledby'
|
|
180
|
-
| 'aria-level'
|
|
181
|
-
| 'aria-live'
|
|
182
|
-
| 'aria-modal'
|
|
183
|
-
| 'aria-multiline'
|
|
184
|
-
| 'aria-multiselectable'
|
|
185
|
-
| 'aria-orientation'
|
|
186
|
-
| 'aria-owns'
|
|
187
|
-
| 'aria-placeholder'
|
|
188
|
-
| 'aria-posinset'
|
|
189
|
-
| 'aria-pressed'
|
|
190
|
-
| 'aria-readonly'
|
|
191
|
-
| 'aria-relevant'
|
|
192
|
-
| 'aria-required'
|
|
193
|
-
| 'aria-roledescription'
|
|
194
|
-
| 'aria-rowcount'
|
|
195
|
-
| 'aria-rowindex'
|
|
196
|
-
| 'aria-rowspan'
|
|
197
|
-
| 'aria-selected'
|
|
198
|
-
| 'aria-setsize'
|
|
199
|
-
| 'aria-sort'
|
|
200
|
-
| 'aria-valuemax'
|
|
201
|
-
| 'aria-valuemin'
|
|
202
|
-
| 'aria-valuenow'
|
|
203
|
-
| 'aria-valuetext'
|
|
204
|
-
| 'children'
|
|
205
|
-
| 'dangerouslySetInnerHTML'
|
|
206
|
-
| 'onCopy'
|
|
207
|
-
| 'onCopyCapture'
|
|
208
|
-
| 'onCut'
|
|
209
|
-
| 'onCutCapture'
|
|
210
|
-
| 'onPaste'
|
|
211
|
-
| 'onPasteCapture'
|
|
212
|
-
| 'onCompositionEnd'
|
|
213
|
-
| 'onCompositionEndCapture'
|
|
214
|
-
| 'onCompositionStart'
|
|
215
|
-
| 'onCompositionStartCapture'
|
|
216
|
-
| 'onCompositionUpdate'
|
|
217
|
-
| 'onCompositionUpdateCapture'
|
|
218
|
-
| 'onFocus'
|
|
219
|
-
| 'onFocusCapture'
|
|
220
|
-
| 'onBlur'
|
|
221
|
-
| 'onBlurCapture'
|
|
222
|
-
| 'onChange'
|
|
223
|
-
| 'onChangeCapture'
|
|
224
|
-
| 'onBeforeInput'
|
|
225
|
-
| 'onBeforeInputCapture'
|
|
226
|
-
| 'onInput'
|
|
227
|
-
| 'onInputCapture'
|
|
228
|
-
| 'onReset'
|
|
229
|
-
| 'onResetCapture'
|
|
230
|
-
| 'onSubmit'
|
|
231
|
-
| 'onSubmitCapture'
|
|
232
|
-
| 'onInvalid'
|
|
233
|
-
| 'onInvalidCapture'
|
|
234
|
-
| 'onLoad'
|
|
235
|
-
| 'onLoadCapture'
|
|
236
|
-
| 'onError'
|
|
237
|
-
| 'onErrorCapture'
|
|
238
|
-
| 'onKeyDown'
|
|
239
|
-
| 'onKeyDownCapture'
|
|
240
|
-
| 'onKeyPress'
|
|
241
|
-
| 'onKeyPressCapture'
|
|
242
|
-
| 'onKeyUp'
|
|
243
|
-
| 'onKeyUpCapture'
|
|
244
|
-
| 'onAbort'
|
|
245
|
-
| 'onAbortCapture'
|
|
246
|
-
| 'onCanPlay'
|
|
247
|
-
| 'onCanPlayCapture'
|
|
248
|
-
| 'onCanPlayThrough'
|
|
249
|
-
| 'onCanPlayThroughCapture'
|
|
250
|
-
| 'onDurationChange'
|
|
251
|
-
| 'onDurationChangeCapture'
|
|
252
|
-
| 'onEmptied'
|
|
253
|
-
| 'onEmptiedCapture'
|
|
254
|
-
| 'onEncrypted'
|
|
255
|
-
| 'onEncryptedCapture'
|
|
256
|
-
| 'onEnded'
|
|
257
|
-
| 'onEndedCapture'
|
|
258
|
-
| 'onLoadedData'
|
|
259
|
-
| 'onLoadedDataCapture'
|
|
260
|
-
| 'onLoadedMetadata'
|
|
261
|
-
| 'onLoadedMetadataCapture'
|
|
262
|
-
| 'onLoadStart'
|
|
263
|
-
| 'onLoadStartCapture'
|
|
264
|
-
| 'onPause'
|
|
265
|
-
| 'onPauseCapture'
|
|
266
|
-
| 'onPlay'
|
|
267
|
-
| 'onPlayCapture'
|
|
268
|
-
| 'onPlaying'
|
|
269
|
-
| 'onPlayingCapture'
|
|
270
|
-
| 'onProgress'
|
|
271
|
-
| 'onProgressCapture'
|
|
272
|
-
| 'onRateChange'
|
|
273
|
-
| 'onRateChangeCapture'
|
|
274
|
-
| 'onResize'
|
|
275
|
-
| 'onResizeCapture'
|
|
276
|
-
| 'onSeeked'
|
|
277
|
-
| 'onSeekedCapture'
|
|
278
|
-
| 'onSeeking'
|
|
279
|
-
| 'onSeekingCapture'
|
|
280
|
-
| 'onStalled'
|
|
281
|
-
| 'onStalledCapture'
|
|
282
|
-
| 'onSuspend'
|
|
283
|
-
| 'onSuspendCapture'
|
|
284
|
-
| 'onTimeUpdate'
|
|
285
|
-
| 'onTimeUpdateCapture'
|
|
286
|
-
| 'onVolumeChange'
|
|
287
|
-
| 'onVolumeChangeCapture'
|
|
288
|
-
| 'onWaiting'
|
|
289
|
-
| 'onWaitingCapture'
|
|
290
|
-
| 'onAuxClick'
|
|
291
|
-
| 'onAuxClickCapture'
|
|
292
|
-
| 'onClick'
|
|
293
|
-
| 'onClickCapture'
|
|
294
|
-
| 'onContextMenu'
|
|
295
|
-
| 'onContextMenuCapture'
|
|
296
|
-
| 'onDoubleClick'
|
|
297
|
-
| 'onDoubleClickCapture'
|
|
298
|
-
| 'onDrag'
|
|
299
|
-
| 'onDragCapture'
|
|
300
|
-
| 'onDragEnd'
|
|
301
|
-
| 'onDragEndCapture'
|
|
302
|
-
| 'onDragEnter'
|
|
303
|
-
| 'onDragEnterCapture'
|
|
304
|
-
| 'onDragExit'
|
|
305
|
-
| 'onDragExitCapture'
|
|
306
|
-
| 'onDragLeave'
|
|
307
|
-
| 'onDragLeaveCapture'
|
|
308
|
-
| 'onDragOver'
|
|
309
|
-
| 'onDragOverCapture'
|
|
310
|
-
| 'onDragStart'
|
|
311
|
-
| 'onDragStartCapture'
|
|
312
|
-
| 'onDrop'
|
|
313
|
-
| 'onDropCapture'
|
|
314
|
-
| 'onMouseDown'
|
|
315
|
-
| 'onMouseDownCapture'
|
|
316
|
-
| 'onMouseEnter'
|
|
317
|
-
| 'onMouseLeave'
|
|
318
|
-
| 'onMouseMove'
|
|
319
|
-
| 'onMouseMoveCapture'
|
|
320
|
-
| 'onMouseOut'
|
|
321
|
-
| 'onMouseOutCapture'
|
|
322
|
-
| 'onMouseOver'
|
|
323
|
-
| 'onMouseOverCapture'
|
|
324
|
-
| 'onMouseUp'
|
|
325
|
-
| 'onMouseUpCapture'
|
|
326
|
-
| 'onSelect'
|
|
327
|
-
| 'onSelectCapture'
|
|
328
|
-
| 'onTouchCancel'
|
|
329
|
-
| 'onTouchCancelCapture'
|
|
330
|
-
| 'onTouchEnd'
|
|
331
|
-
| 'onTouchEndCapture'
|
|
332
|
-
| 'onTouchMove'
|
|
333
|
-
| 'onTouchMoveCapture'
|
|
334
|
-
| 'onTouchStart'
|
|
335
|
-
| 'onTouchStartCapture'
|
|
336
|
-
| 'onPointerDown'
|
|
337
|
-
| 'onPointerDownCapture'
|
|
338
|
-
| 'onPointerMove'
|
|
339
|
-
| 'onPointerMoveCapture'
|
|
340
|
-
| 'onPointerUp'
|
|
341
|
-
| 'onPointerUpCapture'
|
|
342
|
-
| 'onPointerCancel'
|
|
343
|
-
| 'onPointerCancelCapture'
|
|
344
|
-
| 'onPointerEnter'
|
|
345
|
-
| 'onPointerEnterCapture'
|
|
346
|
-
| 'onPointerLeave'
|
|
347
|
-
| 'onPointerLeaveCapture'
|
|
348
|
-
| 'onPointerOver'
|
|
349
|
-
| 'onPointerOverCapture'
|
|
350
|
-
| 'onPointerOut'
|
|
351
|
-
| 'onPointerOutCapture'
|
|
352
|
-
| 'onGotPointerCapture'
|
|
353
|
-
| 'onGotPointerCaptureCapture'
|
|
354
|
-
| 'onLostPointerCapture'
|
|
355
|
-
| 'onLostPointerCaptureCapture'
|
|
356
|
-
| 'onScroll'
|
|
357
|
-
| 'onScrollCapture'
|
|
358
|
-
| 'onWheel'
|
|
359
|
-
| 'onWheelCapture'
|
|
360
|
-
| 'onAnimationStart'
|
|
361
|
-
| 'onAnimationStartCapture'
|
|
362
|
-
| 'onAnimationEnd'
|
|
363
|
-
| 'onAnimationEndCapture'
|
|
364
|
-
| 'onAnimationIteration'
|
|
365
|
-
| 'onAnimationIterationCapture'
|
|
366
|
-
| 'onTransitionEnd'
|
|
367
|
-
| 'onTransitionEndCapture'
|
|
368
|
-
| 'key'
|
|
369
|
-
| 'icon'
|
|
370
|
-
| 'mode'
|
|
371
|
-
| 'inline'
|
|
372
|
-
| 'flip'
|
|
373
|
-
>;
|
|
6
|
+
} from '@iconify-icon/react';
|
|
7
|
+
|
|
8
|
+
export type IconProps = Omit<IconifyIconProps, 'ref'>;
|
|
9
|
+
|
|
10
|
+
export const Icon = React.forwardRef<IconifyIconHTMLElement | null, IconProps>(
|
|
11
|
+
(props, ref) => {
|
|
12
|
+
return <IconifyIcon ref={ref} data-testid="iconify-icon" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
);
|
|
374
15
|
|
|
375
|
-
|
|
376
|
-
return <IconUI {...props} />;
|
|
377
|
-
};
|
|
16
|
+
Icon.displayName = 'Icon';
|
package/src/components/Input.tsx
CHANGED
|
@@ -1 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
import { Flex, Icon, Text } from '..';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { IconifyIcon } from '@iconify/types';
|
|
4
|
+
|
|
5
|
+
import { type InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
|
|
6
|
+
|
|
7
|
+
type IconType = string | React.ReactNode | IconifyIcon;
|
|
8
|
+
|
|
9
|
+
export type InputProps = InputPropsUI & {
|
|
10
|
+
leadingIcon?: IconType;
|
|
11
|
+
trailingIcon?: IconType;
|
|
12
|
+
};
|
|
13
|
+
|
|
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
|
+
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
26
|
+
({ 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
|
+
return (
|
|
44
|
+
<Flex sx={{ position: 'relative' }}>
|
|
45
|
+
{leadingIcon && (
|
|
46
|
+
<Text
|
|
47
|
+
sx={{
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
alignSelf: 'center',
|
|
50
|
+
fontSize: 'lg',
|
|
51
|
+
left: 'lg',
|
|
52
|
+
lineHeight: 0,
|
|
53
|
+
}}
|
|
54
|
+
variant="leading-icon"
|
|
55
|
+
>
|
|
56
|
+
{leadingIconElement}
|
|
57
|
+
</Text>
|
|
58
|
+
)}
|
|
59
|
+
<InputUI
|
|
60
|
+
ref={ref}
|
|
61
|
+
sx={{
|
|
62
|
+
paddingLeft: leadingIcon ? '3xl' : undefined,
|
|
63
|
+
paddingRight: trailingIcon ? '3xl' : undefined,
|
|
64
|
+
...sx,
|
|
65
|
+
}}
|
|
66
|
+
{...inputProps}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
{trailingIcon && (
|
|
70
|
+
<Text
|
|
71
|
+
sx={{
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
right: 'lg',
|
|
74
|
+
alignSelf: 'center',
|
|
75
|
+
fontSize: 'lg',
|
|
76
|
+
lineHeight: 0,
|
|
77
|
+
}}
|
|
78
|
+
variant="trailing-icon"
|
|
79
|
+
>
|
|
80
|
+
{trailingIconElement}
|
|
81
|
+
</Text>
|
|
82
|
+
)}
|
|
83
|
+
</Flex>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
Input.displayName = 'Input';
|