@luxfi/ui 7.4.9 → 7.4.11
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/accordion.cjs +107 -166
- package/dist/accordion.d.cts +18 -51
- package/dist/accordion.d.ts +18 -51
- package/dist/accordion.js +109 -166
- package/dist/chrome.cjs +193 -379
- package/dist/chrome.js +195 -379
- package/dist/collapsible.cjs +35 -26
- package/dist/collapsible.d.cts +2 -1
- package/dist/collapsible.d.ts +2 -1
- package/dist/collapsible.js +34 -24
- package/dist/dialog.d.cts +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/drawer.cjs +92 -115
- package/dist/drawer.d.cts +43 -10
- package/dist/drawer.d.ts +43 -10
- package/dist/drawer.js +94 -115
- package/dist/field.cjs +60 -109
- package/dist/field.d.cts +0 -1
- package/dist/field.d.ts +0 -1
- package/dist/field.js +61 -109
- package/dist/heading.cjs +10 -17
- package/dist/heading.d.cts +0 -2
- package/dist/heading.d.ts +0 -2
- package/dist/heading.js +10 -17
- package/dist/icon-button.cjs +82 -82
- package/dist/icon-button.d.cts +16 -12
- package/dist/icon-button.d.ts +16 -12
- package/dist/icon-button.js +82 -82
- package/dist/index.cjs +1073 -1419
- package/dist/index.d.cts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1075 -1414
- package/dist/input-group.cjs +11 -12
- package/dist/input-group.js +11 -12
- package/dist/input.cjs +27 -27
- package/dist/input.d.cts +21 -1
- package/dist/input.d.ts +21 -1
- package/dist/input.js +25 -28
- package/dist/menu.cjs +160 -271
- package/dist/menu.d.cts +41 -57
- package/dist/menu.d.ts +41 -57
- package/dist/menu.js +161 -251
- package/dist/next.cjs +6 -10
- package/dist/next.js +5 -9
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/select.cjs +40 -39
- package/dist/select.d.cts +35 -4
- package/dist/select.d.ts +35 -4
- package/dist/select.js +40 -38
- package/dist/separator.cjs +8 -33
- package/dist/separator.js +8 -33
- package/dist/tabs.cjs +108 -197
- package/dist/tabs.d.cts +16 -60
- package/dist/tabs.d.ts +16 -60
- package/dist/tabs.js +109 -196
- package/dist/textarea.cjs +56 -27
- package/dist/textarea.js +57 -28
- package/dist/toaster.cjs +97 -79
- package/dist/toaster.d.cts +7 -8
- package/dist/toaster.d.ts +7 -8
- package/dist/toaster.js +78 -80
- package/package.json +2 -16
- package/src/accordion.tsx +173 -227
- package/src/collapsible.tsx +55 -52
- package/src/drawer.tsx +123 -115
- package/src/engine.ts +0 -25
- package/src/field.tsx +68 -124
- package/src/heading.tsx +22 -26
- package/src/icon-button.tsx +134 -141
- package/src/ink.tsx +37 -0
- package/src/input-group.tsx +21 -12
- package/src/input.tsx +41 -32
- package/src/menu.tsx +224 -397
- package/src/next.ts +32 -1
- package/src/popover.tsx +1 -1
- package/src/select.tsx +80 -59
- package/src/separator.tsx +13 -34
- package/src/tabs.tsx +166 -296
- package/src/textarea.tsx +19 -29
- package/src/toaster.tsx +118 -86
- package/tokens.css +61 -0
package/dist/tabs.js
CHANGED
|
@@ -1,213 +1,126 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import { Tabs, useTabsContext, Text } from '@hanzo/gui';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { Children, createElement } from 'react';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
7
|
// src/tabs.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
var ink = (children, Wrap = Text, props = {}) => {
|
|
9
|
+
let hasText = false;
|
|
10
|
+
Children.forEach(children, (child) => {
|
|
11
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
12
|
+
});
|
|
13
|
+
if (!hasText) return children;
|
|
14
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
16
15
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
className,
|
|
27
|
-
...rest
|
|
28
|
-
} = props;
|
|
29
|
-
const handleValueChange = React.useCallback(
|
|
30
|
-
(value) => {
|
|
31
|
-
if (!onValueChange) return;
|
|
32
|
-
onValueChange({ value });
|
|
33
|
-
},
|
|
34
|
-
[onValueChange]
|
|
35
|
-
);
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
-
RadixTabs.Root,
|
|
38
|
-
{
|
|
39
|
-
ref,
|
|
40
|
-
"data-variant": variant,
|
|
41
|
-
"data-size": size,
|
|
42
|
-
"data-fitted": fitted ? "" : void 0,
|
|
43
|
-
className: cn(
|
|
44
|
-
"relative",
|
|
45
|
-
ROOT_SIZE_CLASSES[size],
|
|
46
|
-
className
|
|
47
|
-
),
|
|
48
|
-
onValueChange: onValueChange ? handleValueChange : void 0,
|
|
49
|
-
...rest
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
var TabsList = React.forwardRef(
|
|
55
|
-
function TabsList2(props, ref) {
|
|
56
|
-
const {
|
|
57
|
-
className,
|
|
58
|
-
// Strip Chakra style props
|
|
59
|
-
flexWrap: _flexWrap,
|
|
60
|
-
alignItems: _alignItems,
|
|
61
|
-
whiteSpace: _whiteSpace,
|
|
62
|
-
bgColor: _bgColor,
|
|
63
|
-
marginBottom: _marginBottom,
|
|
64
|
-
mx: _mx,
|
|
65
|
-
px: _px,
|
|
66
|
-
w: _w,
|
|
67
|
-
overflowX: _overflowX,
|
|
68
|
-
overscrollBehaviorX: _overscrollBehaviorX,
|
|
69
|
-
css: _css,
|
|
70
|
-
position: _position,
|
|
71
|
-
boxShadow: _boxShadow,
|
|
72
|
-
top: _top,
|
|
73
|
-
zIndex: _zIndex,
|
|
74
|
-
style: styleProp,
|
|
75
|
-
asChild,
|
|
76
|
-
loop,
|
|
77
|
-
...rest
|
|
78
|
-
} = props;
|
|
79
|
-
return /* @__PURE__ */ jsx(
|
|
80
|
-
RadixTabs.List,
|
|
81
|
-
{
|
|
82
|
-
ref,
|
|
83
|
-
asChild,
|
|
84
|
-
loop,
|
|
85
|
-
className: cn(
|
|
86
|
-
"inline-flex w-full relative isolate flex-row",
|
|
87
|
-
"min-h-[var(--tabs-height,2.5rem)]",
|
|
88
|
-
className
|
|
89
|
-
),
|
|
90
|
-
style: styleProp,
|
|
91
|
-
...rest
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
var TRIGGER_BASE = "outline-none min-w-[var(--tabs-height,2.5rem)] h-[var(--tabs-height,2.5rem)] flex items-center relative cursor-pointer gap-2 focus-visible:z-[1] focus-visible:outline-2 focus-visible:outline-offset-0 disabled:cursor-not-allowed disabled:opacity-50";
|
|
97
|
-
var TRIGGER_SIZE_CLASSES = {
|
|
98
|
-
sm: "py-1 px-3 text-sm",
|
|
99
|
-
md: "py-2 px-4 text-base",
|
|
100
|
-
free: ""
|
|
16
|
+
var Shape = React.createContext({
|
|
17
|
+
variant: "solid",
|
|
18
|
+
size: "md",
|
|
19
|
+
fitted: false
|
|
20
|
+
});
|
|
21
|
+
var SIZE = {
|
|
22
|
+
sm: { height: 32, minWidth: 32, paddingVertical: 4, paddingHorizontal: 12, fontSize: 14 },
|
|
23
|
+
md: { height: 40, minWidth: 40, paddingVertical: 8, paddingHorizontal: 16, fontSize: 16 },
|
|
24
|
+
free: {}
|
|
101
25
|
};
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
26
|
+
var SELECTED_BG = "var(--color-selected-control-bg)";
|
|
27
|
+
var SELECTED_FG = "var(--color-selected-control-text)";
|
|
28
|
+
var VARIANT = {
|
|
29
|
+
solid: {
|
|
30
|
+
rest: {
|
|
31
|
+
fontWeight: "600",
|
|
32
|
+
borderRadius: 6,
|
|
33
|
+
color: "var(--color-tabs-solid-fg)",
|
|
34
|
+
hoverStyle: { color: "var(--color-hover)" }
|
|
35
|
+
},
|
|
36
|
+
active: { backgroundColor: SELECTED_BG, color: SELECTED_FG }
|
|
37
|
+
},
|
|
38
|
+
secondary: {
|
|
39
|
+
rest: {
|
|
40
|
+
fontWeight: "500",
|
|
41
|
+
borderRadius: 6,
|
|
42
|
+
borderWidth: 2,
|
|
43
|
+
borderColor: "var(--color-tabs-secondary-border)",
|
|
44
|
+
color: "var(--color-tabs-secondary-fg)",
|
|
45
|
+
hoverStyle: { color: "var(--color-hover)", borderColor: "var(--color-hover)" }
|
|
46
|
+
},
|
|
47
|
+
active: { backgroundColor: SELECTED_BG, color: SELECTED_FG, borderColor: "transparent" }
|
|
48
|
+
},
|
|
49
|
+
segmented: {
|
|
50
|
+
rest: {
|
|
51
|
+
borderWidth: 2,
|
|
52
|
+
borderColor: SELECTED_BG,
|
|
53
|
+
color: "var(--color-text-primary)",
|
|
54
|
+
hoverStyle: { color: "var(--color-hover)" }
|
|
55
|
+
},
|
|
56
|
+
active: { backgroundColor: SELECTED_BG, borderColor: SELECTED_BG, color: SELECTED_FG }
|
|
57
|
+
},
|
|
58
|
+
unstyled: { rest: {}, active: {} }
|
|
107
59
|
};
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
left: _left,
|
|
125
|
-
visibility: _visibility,
|
|
60
|
+
var LIST_HEIGHT = { sm: 32, md: 40, free: void 0 };
|
|
61
|
+
var TabsRoot = ({
|
|
62
|
+
variant = "solid",
|
|
63
|
+
size = "md",
|
|
64
|
+
fitted = false,
|
|
65
|
+
onValueChange,
|
|
66
|
+
...rest
|
|
67
|
+
}) => {
|
|
68
|
+
const shape = React.useMemo(() => ({ variant, size, fitted }), [variant, size, fitted]);
|
|
69
|
+
return /* @__PURE__ */ jsx(Shape.Provider, { value: shape, children: /* @__PURE__ */ jsx(
|
|
70
|
+
Tabs,
|
|
71
|
+
{
|
|
72
|
+
unstyled: true,
|
|
73
|
+
position: "relative",
|
|
74
|
+
orientation: "horizontal",
|
|
75
|
+
onValueChange: onValueChange ? (value) => onValueChange({ value }) : void 0,
|
|
126
76
|
...rest
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
RadixTabs.Trigger,
|
|
133
|
-
{
|
|
134
|
-
ref: mergedRef,
|
|
135
|
-
className: cn(
|
|
136
|
-
"group",
|
|
137
|
-
TRIGGER_BASE,
|
|
138
|
-
TRIGGER_SIZE_CLASSES[size],
|
|
139
|
-
TRIGGER_VARIANT_CLASSES[variant],
|
|
140
|
-
fitted && "flex-1 text-center justify-center",
|
|
141
|
-
className
|
|
142
|
-
),
|
|
143
|
-
...rest
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
var TabsContent = React.forwardRef(
|
|
149
|
-
function TabsContent2(props, ref) {
|
|
150
|
-
const { className, padding: _padding, ...rest } = props;
|
|
151
|
-
return /* @__PURE__ */ jsx(
|
|
152
|
-
RadixTabs.Content,
|
|
153
|
-
{
|
|
154
|
-
ref,
|
|
155
|
-
className: cn(
|
|
156
|
-
"w-full pt-[var(--tabs-content-padding,1.5rem)]",
|
|
157
|
-
"focus-visible:outline-2 focus-visible:outline-offset-[-2px]",
|
|
158
|
-
className
|
|
159
|
-
),
|
|
160
|
-
...rest
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
var COUNTER_OVERLOAD = 50;
|
|
166
|
-
var TabsCounter = ({ count }) => {
|
|
167
|
-
if (count === void 0 || count === null) {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
77
|
+
}
|
|
78
|
+
) });
|
|
79
|
+
};
|
|
80
|
+
var TabsList = (props) => {
|
|
81
|
+
const { size } = React.useContext(Shape);
|
|
170
82
|
return /* @__PURE__ */ jsx(
|
|
171
|
-
|
|
83
|
+
Tabs.List,
|
|
172
84
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
85
|
+
unstyled: true,
|
|
86
|
+
width: "100%",
|
|
87
|
+
position: "relative",
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
backgroundColor: "transparent",
|
|
90
|
+
minHeight: LIST_HEIGHT[size],
|
|
91
|
+
...props
|
|
178
92
|
}
|
|
179
93
|
);
|
|
180
94
|
};
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
} else {
|
|
204
|
-
ref.current = instance;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
209
|
-
refs
|
|
95
|
+
var TabsTrigger = ({ children, ...props }) => {
|
|
96
|
+
const { variant, size, fitted } = React.useContext(Shape);
|
|
97
|
+
const { rest, active } = VARIANT[variant];
|
|
98
|
+
const selected = useTabsContext().value === props.value;
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
Tabs.Tab,
|
|
101
|
+
{
|
|
102
|
+
unstyled: true,
|
|
103
|
+
flexDirection: "row",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
justifyContent: "center",
|
|
106
|
+
position: "relative",
|
|
107
|
+
cursor: "pointer",
|
|
108
|
+
gap: 8,
|
|
109
|
+
borderWidth: 0,
|
|
110
|
+
...SIZE[size],
|
|
111
|
+
...rest,
|
|
112
|
+
...selected ? active : null,
|
|
113
|
+
...fitted ? { flex: 1 } : null,
|
|
114
|
+
...props,
|
|
115
|
+
children: ink(children, void 0, { fontSize: "inherit", color: "inherit", fontWeight: "inherit" })
|
|
116
|
+
}
|
|
210
117
|
);
|
|
211
|
-
}
|
|
118
|
+
};
|
|
119
|
+
var TabsContent = ({ children, ...props }) => /* @__PURE__ */ jsx(Tabs.Content, { unstyled: true, width: "100%", paddingTop: 24, backgroundColor: "transparent", ...props, children: ink(children) });
|
|
120
|
+
var COUNTER_OVERLOAD = 50;
|
|
121
|
+
var TabsCounter = ({ count }) => {
|
|
122
|
+
if (count === void 0 || count === null) return null;
|
|
123
|
+
return /* @__PURE__ */ jsx(Text, { color: count > 0 ? "var(--color-text-secondary)" : "var(--color-text-disabled)", children: count > COUNTER_OVERLOAD ? `${COUNTER_OVERLOAD}+` : count });
|
|
124
|
+
};
|
|
212
125
|
|
|
213
126
|
export { TabsContent, TabsCounter, TabsList, TabsRoot, TabsTrigger };
|
package/dist/textarea.cjs
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var clsx = require('clsx');
|
|
7
|
-
var tailwindMerge = require('tailwind-merge');
|
|
8
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
7
|
|
|
10
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -12,31 +10,59 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
|
|
14
12
|
// src/textarea.tsx
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
22
|
-
"hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]",
|
|
23
|
-
"focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]",
|
|
24
|
-
"focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]",
|
|
25
|
-
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
26
|
-
"read-only:opacity-70",
|
|
27
|
-
"data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]"
|
|
28
|
-
].join(" ");
|
|
29
|
-
var TEXTAREA_SIZE_CLASSES = {
|
|
30
|
-
xs: "px-2 py-1 text-xs rounded",
|
|
31
|
-
sm: "px-3 py-2 text-sm rounded-md",
|
|
32
|
-
md: "px-4 py-2 text-base rounded-md",
|
|
33
|
-
lg: "px-4 py-3 text-lg rounded-lg",
|
|
34
|
-
"2xl": "px-4 py-3 text-xl rounded-lg"
|
|
13
|
+
var SIZE = {
|
|
14
|
+
xs: { height: 24, paddingHorizontal: 8, fontSize: 12, borderRadius: 4 },
|
|
15
|
+
sm: { height: 32, paddingHorizontal: 12, fontSize: 14, borderRadius: 6 },
|
|
16
|
+
md: { height: 40, paddingHorizontal: 16, fontSize: 16, borderRadius: 6 },
|
|
17
|
+
lg: { height: 48, paddingHorizontal: 16, fontSize: 18, borderRadius: 8 },
|
|
18
|
+
"2xl": { height: 56, paddingHorizontal: 16, fontSize: 20, borderRadius: 8 }
|
|
35
19
|
};
|
|
36
|
-
var
|
|
37
|
-
outline: "
|
|
38
|
-
filled:
|
|
39
|
-
unstyled:
|
|
20
|
+
var VARIANT = {
|
|
21
|
+
outline: { borderWidth: 1, borderStyle: "solid" },
|
|
22
|
+
filled: { borderWidth: 0, backgroundColor: "var(--color-input-filled-bg)" },
|
|
23
|
+
unstyled: { borderWidth: 0, backgroundColor: "transparent", padding: 0, height: "auto" }
|
|
24
|
+
};
|
|
25
|
+
var CONTROL = {
|
|
26
|
+
width: "100%",
|
|
27
|
+
outlineWidth: 0,
|
|
28
|
+
backgroundColor: "var(--color-input-bg)",
|
|
29
|
+
color: "var(--color-input-fg)",
|
|
30
|
+
borderColor: "var(--color-input-border)",
|
|
31
|
+
hoverStyle: { borderColor: "var(--color-input-border-hover)" },
|
|
32
|
+
focusStyle: { borderColor: "var(--color-input-border-focus)" },
|
|
33
|
+
disabledStyle: { opacity: 0.4, cursor: "not-allowed" }
|
|
34
|
+
};
|
|
35
|
+
var Input = React__default.default.forwardRef(
|
|
36
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
37
|
+
const handleChange = React__default.default.useCallback(
|
|
38
|
+
(event) => {
|
|
39
|
+
onChange?.(event);
|
|
40
|
+
onChangeText?.(event.target.value);
|
|
41
|
+
},
|
|
42
|
+
[onChange, onChangeText]
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
gui.Input,
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
unstyled: true,
|
|
49
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
50
|
+
...CONTROL,
|
|
51
|
+
...SIZE[size],
|
|
52
|
+
...VARIANT[variant],
|
|
53
|
+
...rest,
|
|
54
|
+
onChange: handleChange
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
Input.displayName = "Input";
|
|
60
|
+
var SIZE2 = {
|
|
61
|
+
xs: { paddingHorizontal: 8, paddingVertical: 4, fontSize: 12, borderRadius: 4 },
|
|
62
|
+
sm: { paddingHorizontal: 12, paddingVertical: 8, fontSize: 14, borderRadius: 6 },
|
|
63
|
+
md: { paddingHorizontal: 16, paddingVertical: 8, fontSize: 16, borderRadius: 6 },
|
|
64
|
+
lg: { paddingHorizontal: 16, paddingVertical: 12, fontSize: 18, borderRadius: 8 },
|
|
65
|
+
"2xl": { paddingHorizontal: 16, paddingVertical: 12, fontSize: 20, borderRadius: 8 }
|
|
40
66
|
};
|
|
41
67
|
var Textarea = React__default.default.forwardRef(
|
|
42
68
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -52,7 +78,10 @@ var Textarea = React__default.default.forwardRef(
|
|
|
52
78
|
{
|
|
53
79
|
ref,
|
|
54
80
|
unstyled: true,
|
|
55
|
-
className:
|
|
81
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
82
|
+
...CONTROL,
|
|
83
|
+
...SIZE2[size],
|
|
84
|
+
...VARIANT[variant],
|
|
56
85
|
...rest,
|
|
57
86
|
onChange: handleChange
|
|
58
87
|
}
|
package/dist/textarea.js
CHANGED
|
@@ -1,36 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TextArea } from '@hanzo/gui';
|
|
2
|
+
import { Input as Input$1, TextArea } from '@hanzo/gui';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
4
|
import { jsx } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
6
|
// src/textarea.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
16
|
-
"hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]",
|
|
17
|
-
"focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]",
|
|
18
|
-
"focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]",
|
|
19
|
-
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
20
|
-
"read-only:opacity-70",
|
|
21
|
-
"data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]"
|
|
22
|
-
].join(" ");
|
|
23
|
-
var TEXTAREA_SIZE_CLASSES = {
|
|
24
|
-
xs: "px-2 py-1 text-xs rounded",
|
|
25
|
-
sm: "px-3 py-2 text-sm rounded-md",
|
|
26
|
-
md: "px-4 py-2 text-base rounded-md",
|
|
27
|
-
lg: "px-4 py-3 text-lg rounded-lg",
|
|
28
|
-
"2xl": "px-4 py-3 text-xl rounded-lg"
|
|
7
|
+
var SIZE = {
|
|
8
|
+
xs: { height: 24, paddingHorizontal: 8, fontSize: 12, borderRadius: 4 },
|
|
9
|
+
sm: { height: 32, paddingHorizontal: 12, fontSize: 14, borderRadius: 6 },
|
|
10
|
+
md: { height: 40, paddingHorizontal: 16, fontSize: 16, borderRadius: 6 },
|
|
11
|
+
lg: { height: 48, paddingHorizontal: 16, fontSize: 18, borderRadius: 8 },
|
|
12
|
+
"2xl": { height: 56, paddingHorizontal: 16, fontSize: 20, borderRadius: 8 }
|
|
29
13
|
};
|
|
30
|
-
var
|
|
31
|
-
outline: "
|
|
32
|
-
filled:
|
|
33
|
-
unstyled:
|
|
14
|
+
var VARIANT = {
|
|
15
|
+
outline: { borderWidth: 1, borderStyle: "solid" },
|
|
16
|
+
filled: { borderWidth: 0, backgroundColor: "var(--color-input-filled-bg)" },
|
|
17
|
+
unstyled: { borderWidth: 0, backgroundColor: "transparent", padding: 0, height: "auto" }
|
|
18
|
+
};
|
|
19
|
+
var CONTROL = {
|
|
20
|
+
width: "100%",
|
|
21
|
+
outlineWidth: 0,
|
|
22
|
+
backgroundColor: "var(--color-input-bg)",
|
|
23
|
+
color: "var(--color-input-fg)",
|
|
24
|
+
borderColor: "var(--color-input-border)",
|
|
25
|
+
hoverStyle: { borderColor: "var(--color-input-border-hover)" },
|
|
26
|
+
focusStyle: { borderColor: "var(--color-input-border-focus)" },
|
|
27
|
+
disabledStyle: { opacity: 0.4, cursor: "not-allowed" }
|
|
28
|
+
};
|
|
29
|
+
var Input = React.forwardRef(
|
|
30
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
31
|
+
const handleChange = React.useCallback(
|
|
32
|
+
(event) => {
|
|
33
|
+
onChange?.(event);
|
|
34
|
+
onChangeText?.(event.target.value);
|
|
35
|
+
},
|
|
36
|
+
[onChange, onChangeText]
|
|
37
|
+
);
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
Input$1,
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
unstyled: true,
|
|
43
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
44
|
+
...CONTROL,
|
|
45
|
+
...SIZE[size],
|
|
46
|
+
...VARIANT[variant],
|
|
47
|
+
...rest,
|
|
48
|
+
onChange: handleChange
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
Input.displayName = "Input";
|
|
54
|
+
var SIZE2 = {
|
|
55
|
+
xs: { paddingHorizontal: 8, paddingVertical: 4, fontSize: 12, borderRadius: 4 },
|
|
56
|
+
sm: { paddingHorizontal: 12, paddingVertical: 8, fontSize: 14, borderRadius: 6 },
|
|
57
|
+
md: { paddingHorizontal: 16, paddingVertical: 8, fontSize: 16, borderRadius: 6 },
|
|
58
|
+
lg: { paddingHorizontal: 16, paddingVertical: 12, fontSize: 18, borderRadius: 8 },
|
|
59
|
+
"2xl": { paddingHorizontal: 16, paddingVertical: 12, fontSize: 20, borderRadius: 8 }
|
|
34
60
|
};
|
|
35
61
|
var Textarea = React.forwardRef(
|
|
36
62
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -46,7 +72,10 @@ var Textarea = React.forwardRef(
|
|
|
46
72
|
{
|
|
47
73
|
ref,
|
|
48
74
|
unstyled: true,
|
|
49
|
-
className:
|
|
75
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
76
|
+
...CONTROL,
|
|
77
|
+
...SIZE2[size],
|
|
78
|
+
...VARIANT[variant],
|
|
50
79
|
...rest,
|
|
51
80
|
onChange: handleChange
|
|
52
81
|
}
|