@luxfi/ui 7.4.10 → 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/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/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/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/input-group.cjs
CHANGED
|
@@ -31,11 +31,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
31
31
|
function cn(...inputs) {
|
|
32
32
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
if (typeof type === "string") return void 0;
|
|
36
|
-
if ("displayName" in type) return type.displayName;
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
34
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
39
35
|
var InputGroup = React__namespace.forwardRef(
|
|
40
36
|
function InputGroup2(props, ref) {
|
|
41
37
|
const {
|
|
@@ -81,7 +77,7 @@ var InputGroup = React__namespace.forwardRef(
|
|
|
81
77
|
}
|
|
82
78
|
};
|
|
83
79
|
}, [calculateInlinePaddings]);
|
|
84
|
-
|
|
80
|
+
useIsomorphicLayoutEffect(() => {
|
|
85
81
|
calculateInlinePaddings();
|
|
86
82
|
const resizeHandler = esToolkit.debounce(calculateInlinePaddings, 300);
|
|
87
83
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -122,15 +118,18 @@ var InputGroup = React__namespace.forwardRef(
|
|
|
122
118
|
}
|
|
123
119
|
),
|
|
124
120
|
React__namespace.Children.map(children, (child) => {
|
|
125
|
-
if (
|
|
121
|
+
if (!React__namespace.isValidElement(child)) {
|
|
126
122
|
return child;
|
|
127
123
|
}
|
|
124
|
+
const start = startElement ? startOffset ?? inlinePaddings?.start : void 0;
|
|
125
|
+
const end = endElement ? endOffset ?? inlinePaddings?.end : void 0;
|
|
126
|
+
const px = (v) => typeof v === "number" ? `${v}px` : v;
|
|
128
127
|
return React__namespace.cloneElement(child, {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
style: {
|
|
129
|
+
...child.props.style,
|
|
130
|
+
...start !== void 0 && { paddingInlineStart: px(start) },
|
|
131
|
+
...end !== void 0 && { paddingInlineEnd: px(end) }
|
|
132
|
+
}
|
|
134
133
|
});
|
|
135
134
|
}),
|
|
136
135
|
endElement && /* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/input-group.js
CHANGED
|
@@ -9,11 +9,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
function cn(...inputs) {
|
|
10
10
|
return twMerge(clsx(inputs));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
if (typeof type === "string") return void 0;
|
|
14
|
-
if ("displayName" in type) return type.displayName;
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
12
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
17
13
|
var InputGroup = React.forwardRef(
|
|
18
14
|
function InputGroup2(props, ref) {
|
|
19
15
|
const {
|
|
@@ -59,7 +55,7 @@ var InputGroup = React.forwardRef(
|
|
|
59
55
|
}
|
|
60
56
|
};
|
|
61
57
|
}, [calculateInlinePaddings]);
|
|
62
|
-
|
|
58
|
+
useIsomorphicLayoutEffect(() => {
|
|
63
59
|
calculateInlinePaddings();
|
|
64
60
|
const resizeHandler = debounce(calculateInlinePaddings, 300);
|
|
65
61
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -100,15 +96,18 @@ var InputGroup = React.forwardRef(
|
|
|
100
96
|
}
|
|
101
97
|
),
|
|
102
98
|
React.Children.map(children, (child) => {
|
|
103
|
-
if (
|
|
99
|
+
if (!React.isValidElement(child)) {
|
|
104
100
|
return child;
|
|
105
101
|
}
|
|
102
|
+
const start = startElement ? startOffset ?? inlinePaddings?.start : void 0;
|
|
103
|
+
const end = endElement ? endOffset ?? inlinePaddings?.end : void 0;
|
|
104
|
+
const px = (v) => typeof v === "number" ? `${v}px` : v;
|
|
106
105
|
return React.cloneElement(child, {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
style: {
|
|
107
|
+
...child.props.style,
|
|
108
|
+
...start !== void 0 && { paddingInlineStart: px(start) },
|
|
109
|
+
...end !== void 0 && { paddingInlineEnd: px(end) }
|
|
110
|
+
}
|
|
112
111
|
});
|
|
113
112
|
}),
|
|
114
113
|
endElement && /* @__PURE__ */ jsx(
|
package/dist/input.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,27 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
|
|
14
12
|
// src/input.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 INPUT_SIZE_CLASSES = {
|
|
30
|
-
xs: "h-6 px-2 text-xs rounded",
|
|
31
|
-
sm: "h-8 px-3 text-sm rounded-md",
|
|
32
|
-
md: "h-10 px-4 text-base rounded-md",
|
|
33
|
-
lg: "h-12 px-4 text-lg rounded-lg",
|
|
34
|
-
"2xl": "h-14 px-4 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" }
|
|
40
34
|
};
|
|
41
35
|
var Input = React__default.default.forwardRef(
|
|
42
36
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -52,7 +46,10 @@ var Input = React__default.default.forwardRef(
|
|
|
52
46
|
{
|
|
53
47
|
ref,
|
|
54
48
|
unstyled: true,
|
|
55
|
-
className:
|
|
49
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
50
|
+
...CONTROL,
|
|
51
|
+
...SIZE[size],
|
|
52
|
+
...VARIANT[variant],
|
|
56
53
|
...rest,
|
|
57
54
|
onChange: handleChange
|
|
58
55
|
}
|
|
@@ -61,4 +58,7 @@ var Input = React__default.default.forwardRef(
|
|
|
61
58
|
);
|
|
62
59
|
Input.displayName = "Input";
|
|
63
60
|
|
|
61
|
+
exports.CONTROL = CONTROL;
|
|
64
62
|
exports.Input = Input;
|
|
63
|
+
exports.SIZE = SIZE;
|
|
64
|
+
exports.VARIANT = VARIANT;
|
package/dist/input.d.cts
CHANGED
|
@@ -12,6 +12,26 @@ interface InputProps extends Omit<React__default.ComponentPropsWithRef<'input'>,
|
|
|
12
12
|
*/
|
|
13
13
|
readonly onChangeText?: (text: string) => void;
|
|
14
14
|
}
|
|
15
|
+
declare const SIZE: Record<InputSize, Record<string, number>>;
|
|
16
|
+
declare const VARIANT: Record<InputVariant, Record<string, unknown>>;
|
|
17
|
+
/** The frame every text control shares. */
|
|
18
|
+
declare const CONTROL: {
|
|
19
|
+
readonly width: "100%";
|
|
20
|
+
readonly outlineWidth: 0;
|
|
21
|
+
readonly backgroundColor: "var(--color-input-bg)";
|
|
22
|
+
readonly color: "var(--color-input-fg)";
|
|
23
|
+
readonly borderColor: "var(--color-input-border)";
|
|
24
|
+
readonly hoverStyle: {
|
|
25
|
+
readonly borderColor: "var(--color-input-border-hover)";
|
|
26
|
+
};
|
|
27
|
+
readonly focusStyle: {
|
|
28
|
+
readonly borderColor: "var(--color-input-border-focus)";
|
|
29
|
+
};
|
|
30
|
+
readonly disabledStyle: {
|
|
31
|
+
readonly opacity: 0.4;
|
|
32
|
+
readonly cursor: "not-allowed";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
15
35
|
declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
16
36
|
|
|
17
|
-
export { Input, type InputProps };
|
|
37
|
+
export { CONTROL, Input, type InputProps, SIZE, VARIANT };
|
package/dist/input.d.ts
CHANGED
|
@@ -12,6 +12,26 @@ interface InputProps extends Omit<React__default.ComponentPropsWithRef<'input'>,
|
|
|
12
12
|
*/
|
|
13
13
|
readonly onChangeText?: (text: string) => void;
|
|
14
14
|
}
|
|
15
|
+
declare const SIZE: Record<InputSize, Record<string, number>>;
|
|
16
|
+
declare const VARIANT: Record<InputVariant, Record<string, unknown>>;
|
|
17
|
+
/** The frame every text control shares. */
|
|
18
|
+
declare const CONTROL: {
|
|
19
|
+
readonly width: "100%";
|
|
20
|
+
readonly outlineWidth: 0;
|
|
21
|
+
readonly backgroundColor: "var(--color-input-bg)";
|
|
22
|
+
readonly color: "var(--color-input-fg)";
|
|
23
|
+
readonly borderColor: "var(--color-input-border)";
|
|
24
|
+
readonly hoverStyle: {
|
|
25
|
+
readonly borderColor: "var(--color-input-border-hover)";
|
|
26
|
+
};
|
|
27
|
+
readonly focusStyle: {
|
|
28
|
+
readonly borderColor: "var(--color-input-border-focus)";
|
|
29
|
+
};
|
|
30
|
+
readonly disabledStyle: {
|
|
31
|
+
readonly opacity: 0.4;
|
|
32
|
+
readonly cursor: "not-allowed";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
15
35
|
declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
16
36
|
|
|
17
|
-
export { Input, type InputProps };
|
|
37
|
+
export { CONTROL, Input, type InputProps, SIZE, VARIANT };
|
package/dist/input.js
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Input as Input$1 } 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/input.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 INPUT_SIZE_CLASSES = {
|
|
24
|
-
xs: "h-6 px-2 text-xs rounded",
|
|
25
|
-
sm: "h-8 px-3 text-sm rounded-md",
|
|
26
|
-
md: "h-10 px-4 text-base rounded-md",
|
|
27
|
-
lg: "h-12 px-4 text-lg rounded-lg",
|
|
28
|
-
"2xl": "h-14 px-4 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" }
|
|
34
28
|
};
|
|
35
29
|
var Input = React.forwardRef(
|
|
36
30
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -46,7 +40,10 @@ var Input = React.forwardRef(
|
|
|
46
40
|
{
|
|
47
41
|
ref,
|
|
48
42
|
unstyled: true,
|
|
49
|
-
className:
|
|
43
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
44
|
+
...CONTROL,
|
|
45
|
+
...SIZE[size],
|
|
46
|
+
...VARIANT[variant],
|
|
50
47
|
...rest,
|
|
51
48
|
onChange: handleChange
|
|
52
49
|
}
|
|
@@ -55,4 +52,4 @@ var Input = React.forwardRef(
|
|
|
55
52
|
);
|
|
56
53
|
Input.displayName = "Input";
|
|
57
54
|
|
|
58
|
-
export { Input };
|
|
55
|
+
export { CONTROL, Input, SIZE, VARIANT };
|