@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/drawer.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as _hanzogui_core from '@hanzogui/core';
|
|
2
|
+
import * as _hanzo_gui from '@hanzo/gui';
|
|
3
|
+
import { Dialog, YStack, XStack } from '@hanzo/gui';
|
|
4
|
+
import * as _hanzogui_web from '@hanzogui/web';
|
|
1
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
6
|
import * as React from 'react';
|
|
4
7
|
|
|
5
8
|
interface DrawerRootProps {
|
|
@@ -9,13 +12,15 @@ interface DrawerRootProps {
|
|
|
9
12
|
onOpenChange?: (details: {
|
|
10
13
|
open: boolean;
|
|
11
14
|
}) => void;
|
|
12
|
-
placement?:
|
|
15
|
+
placement?: Placement;
|
|
13
16
|
initialFocusEl?: (() => HTMLElement | null) | React.RefObject<HTMLElement>;
|
|
14
17
|
lazyMount?: boolean;
|
|
15
18
|
unmountOnExit?: boolean;
|
|
16
19
|
modal?: boolean;
|
|
17
|
-
size?:
|
|
20
|
+
size?: Size;
|
|
18
21
|
}
|
|
22
|
+
type Placement = 'left' | 'right' | 'top' | 'bottom';
|
|
23
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
19
24
|
declare const DrawerRoot: (props: DrawerRootProps) => react_jsx_runtime.JSX.Element;
|
|
20
25
|
interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
21
26
|
portalled?: boolean;
|
|
@@ -25,12 +30,40 @@ interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
25
30
|
}
|
|
26
31
|
declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
32
|
declare const DrawerCloseTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
28
|
-
declare const DrawerTrigger: (
|
|
29
|
-
declare const DrawerHeader: React.
|
|
30
|
-
declare const DrawerBody: React.
|
|
31
|
-
declare const DrawerFooter: React.
|
|
32
|
-
declare const DrawerTitle:
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
declare const DrawerTrigger: ({ asChild, children, ...rest }: React.ComponentProps<typeof Dialog.Trigger>) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare const DrawerHeader: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare const DrawerBody: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const DrawerFooter: ({ children, ...props }: React.ComponentProps<typeof XStack>) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const DrawerTitle: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
|
|
38
|
+
unstyled?: boolean | undefined;
|
|
39
|
+
size?: _hanzogui_web.FontSizeTokens | undefined;
|
|
40
|
+
}>, "scope"> & {
|
|
41
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
42
|
+
}, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
|
|
43
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
44
|
+
}, _hanzogui_web.TextStylePropsBase, {
|
|
45
|
+
unstyled?: boolean | undefined;
|
|
46
|
+
size?: _hanzogui_web.FontSizeTokens | undefined;
|
|
47
|
+
}, _hanzogui_web.StaticConfigPublic>;
|
|
48
|
+
declare const DrawerDescription: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
|
|
49
|
+
unstyled?: boolean | undefined;
|
|
50
|
+
size?: _hanzogui_web.FontSizeTokens | undefined;
|
|
51
|
+
}>, "scope"> & {
|
|
52
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
53
|
+
}, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
|
|
54
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
55
|
+
}, _hanzogui_web.TextStylePropsBase, {
|
|
56
|
+
unstyled?: boolean | undefined;
|
|
57
|
+
size?: _hanzogui_web.FontSizeTokens | undefined;
|
|
58
|
+
}, _hanzogui_web.StaticConfigPublic>;
|
|
59
|
+
declare const DrawerActionTrigger: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_core.RNViewNonStyleProps, _hanzogui_web.StackStyleBase, {}>, "scope" | "displayWhenAdapted"> & {
|
|
60
|
+
displayWhenAdapted?: boolean;
|
|
61
|
+
} & {
|
|
62
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
63
|
+
}, _hanzogui_web.GuiElement, _hanzogui_core.RNViewNonStyleProps & {
|
|
64
|
+
displayWhenAdapted?: boolean;
|
|
65
|
+
} & {
|
|
66
|
+
scope?: _hanzo_gui.DialogScopes;
|
|
67
|
+
}, _hanzogui_web.StackStyleBase, {}, _hanzogui_web.StaticConfigPublic>;
|
|
35
68
|
|
|
36
69
|
export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, type DrawerRootProps, DrawerTitle, DrawerTrigger };
|
package/dist/drawer.js
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { styled, View, Sheet } from '@hanzo/gui';
|
|
3
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
2
|
+
import { styled, View, Sheet, Dialog, YStack, Text, XStack } from '@hanzo/gui';
|
|
4
3
|
import * as React3 from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { Children, createElement } from 'react';
|
|
7
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
6
|
|
|
9
7
|
// src/drawer.tsx
|
|
10
|
-
var NARROW_PX = 640;
|
|
11
|
-
function useBelow(px) {
|
|
12
|
-
const [below, setBelow] = React3.useState(false);
|
|
13
|
-
React3.useEffect(() => {
|
|
14
|
-
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
15
|
-
const apply = () => setBelow(mql.matches);
|
|
16
|
-
apply();
|
|
17
|
-
mql.addEventListener("change", apply);
|
|
18
|
-
return () => mql.removeEventListener("change", apply);
|
|
19
|
-
}, [px]);
|
|
20
|
-
return below;
|
|
21
|
-
}
|
|
22
|
-
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
23
|
-
function cn(...inputs) {
|
|
24
|
-
return twMerge(clsx(inputs));
|
|
25
|
-
}
|
|
26
8
|
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
27
9
|
var CloseButtonFrame = styled(View, {
|
|
28
10
|
name: "LuxCloseButton",
|
|
@@ -85,13 +67,35 @@ var CloseButton = React3.forwardRef(function CloseButton2(props, ref) {
|
|
|
85
67
|
}
|
|
86
68
|
);
|
|
87
69
|
});
|
|
70
|
+
var ink = (children, Wrap = Text, props = {}) => {
|
|
71
|
+
let hasText = false;
|
|
72
|
+
Children.forEach(children, (child) => {
|
|
73
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
74
|
+
});
|
|
75
|
+
if (!hasText) return children;
|
|
76
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
77
|
+
};
|
|
78
|
+
var NARROW_PX = 640;
|
|
79
|
+
function useBelow(px) {
|
|
80
|
+
const [below, setBelow] = React3.useState(false);
|
|
81
|
+
React3.useEffect(() => {
|
|
82
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
83
|
+
const apply = () => setBelow(mql.matches);
|
|
84
|
+
apply();
|
|
85
|
+
mql.addEventListener("change", apply);
|
|
86
|
+
return () => mql.removeEventListener("change", apply);
|
|
87
|
+
}, [px]);
|
|
88
|
+
return below;
|
|
89
|
+
}
|
|
90
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
88
91
|
var DrawerPlacementContext = React3.createContext("right");
|
|
89
92
|
var DrawerSizeContext = React3.createContext("md");
|
|
90
93
|
var DrawerStateContext = React3.createContext({
|
|
91
94
|
open: false,
|
|
92
95
|
setOpen: () => {
|
|
93
96
|
},
|
|
94
|
-
modal: true
|
|
97
|
+
modal: true,
|
|
98
|
+
narrow: false
|
|
95
99
|
});
|
|
96
100
|
var DrawerRoot = (props) => {
|
|
97
101
|
const {
|
|
@@ -106,60 +110,40 @@ var DrawerRoot = (props) => {
|
|
|
106
110
|
const [uncontrolled, setUncontrolled] = React3.useState(defaultOpen ?? false);
|
|
107
111
|
const isControlled = open !== void 0;
|
|
108
112
|
const isOpen = isControlled ? open : uncontrolled;
|
|
113
|
+
const narrow = useIsNarrow();
|
|
109
114
|
const setOpen = React3.useCallback((nextOpen) => {
|
|
110
115
|
if (!isControlled) setUncontrolled(nextOpen);
|
|
111
116
|
onOpenChange?.({ open: nextOpen });
|
|
112
117
|
}, [isControlled, onOpenChange]);
|
|
113
118
|
const state = React3.useMemo(
|
|
114
|
-
() => ({ open: isOpen, setOpen, modal }),
|
|
115
|
-
[isOpen, setOpen, modal]
|
|
119
|
+
() => ({ open: isOpen, setOpen, modal, narrow }),
|
|
120
|
+
[isOpen, setOpen, modal, narrow]
|
|
116
121
|
);
|
|
117
|
-
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(
|
|
118
|
-
RadixDialog.Root,
|
|
119
|
-
{
|
|
120
|
-
open: isOpen,
|
|
121
|
-
onOpenChange: setOpen,
|
|
122
|
-
modal,
|
|
123
|
-
children
|
|
124
|
-
}
|
|
125
|
-
) }) }) });
|
|
122
|
+
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: narrow ? children : /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: setOpen, modal, children }) }) }) });
|
|
126
123
|
};
|
|
127
|
-
var
|
|
128
|
-
right:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
].join(" "),
|
|
133
|
-
left: [
|
|
134
|
-
"inset-y-0 left-0",
|
|
135
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
136
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
137
|
-
].join(" "),
|
|
138
|
-
top: [
|
|
139
|
-
"inset-x-0 top-0",
|
|
140
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
141
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
142
|
-
].join(" "),
|
|
143
|
-
bottom: [
|
|
144
|
-
"inset-x-0 bottom-0",
|
|
145
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
146
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
147
|
-
].join(" ")
|
|
124
|
+
var ANCHOR = {
|
|
125
|
+
right: { top: 0, bottom: 0, right: 0, enterStyle: { x: 24, opacity: 0 }, exitStyle: { x: 24, opacity: 0 } },
|
|
126
|
+
left: { top: 0, bottom: 0, left: 0, enterStyle: { x: -24, opacity: 0 }, exitStyle: { x: -24, opacity: 0 } },
|
|
127
|
+
top: { left: 0, right: 0, top: 0, enterStyle: { y: -24, opacity: 0 }, exitStyle: { y: -24, opacity: 0 } },
|
|
128
|
+
bottom: { left: 0, right: 0, bottom: 0, enterStyle: { y: 24, opacity: 0 }, exitStyle: { y: 24, opacity: 0 } }
|
|
148
129
|
};
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
var ACROSS = {
|
|
131
|
+
xs: 240,
|
|
132
|
+
sm: 320,
|
|
133
|
+
md: 384,
|
|
134
|
+
lg: 480,
|
|
135
|
+
xl: 640,
|
|
136
|
+
full: "100%"
|
|
154
137
|
};
|
|
138
|
+
var extent = (placement, size) => placement === "left" || placement === "right" ? { width: ACROSS[size], maxWidth: "100%" } : { height: ACROSS[size], maxHeight: "100%" };
|
|
139
|
+
var SCRIM = "rgba(0,0,0,0.5)";
|
|
155
140
|
var DrawerContent = React3.forwardRef(
|
|
156
141
|
function DrawerContent2(props, ref) {
|
|
157
|
-
const { children, portalled = true, portalRef, offset: _offset, backdrop = true,
|
|
142
|
+
const { children, portalled = true, portalRef: _portalRef, offset: _offset, backdrop = true, ...rest } = props;
|
|
158
143
|
const placement = React3.useContext(DrawerPlacementContext);
|
|
159
144
|
const size = React3.useContext(DrawerSizeContext);
|
|
160
|
-
const { open, setOpen, modal } = React3.useContext(DrawerStateContext);
|
|
161
|
-
|
|
162
|
-
if (isNarrow) {
|
|
145
|
+
const { open, setOpen, modal, narrow } = React3.useContext(DrawerStateContext);
|
|
146
|
+
if (narrow) {
|
|
163
147
|
return /* @__PURE__ */ jsxs(
|
|
164
148
|
Sheet,
|
|
165
149
|
{
|
|
@@ -177,7 +161,7 @@ var DrawerContent = React3.forwardRef(
|
|
|
177
161
|
transition: "lazy",
|
|
178
162
|
enterStyle: { opacity: 0 },
|
|
179
163
|
exitStyle: { opacity: 0 },
|
|
180
|
-
|
|
164
|
+
backgroundColor: SCRIM
|
|
181
165
|
}
|
|
182
166
|
),
|
|
183
167
|
/* @__PURE__ */ jsx(Sheet.Handle, {}),
|
|
@@ -185,10 +169,11 @@ var DrawerContent = React3.forwardRef(
|
|
|
185
169
|
Sheet.Frame,
|
|
186
170
|
{
|
|
187
171
|
unstyled: true,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
),
|
|
172
|
+
flexDirection: "column",
|
|
173
|
+
borderTopLeftRadius: 16,
|
|
174
|
+
borderTopRightRadius: 16,
|
|
175
|
+
backgroundColor: "var(--color-drawer-bg)",
|
|
176
|
+
shadowColor: "var(--shadow-drawer)",
|
|
192
177
|
...rest,
|
|
193
178
|
children
|
|
194
179
|
}
|
|
@@ -199,67 +184,61 @@ var DrawerContent = React3.forwardRef(
|
|
|
199
184
|
}
|
|
200
185
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
186
|
backdrop && /* @__PURE__ */ jsx(
|
|
202
|
-
|
|
187
|
+
Dialog.Overlay,
|
|
203
188
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
189
|
+
position: "fixed",
|
|
190
|
+
top: 0,
|
|
191
|
+
right: 0,
|
|
192
|
+
bottom: 0,
|
|
193
|
+
left: 0,
|
|
194
|
+
zIndex: 50,
|
|
195
|
+
backgroundColor: SCRIM,
|
|
196
|
+
transition: "lazy",
|
|
197
|
+
enterStyle: { opacity: 0 },
|
|
198
|
+
exitStyle: { opacity: 0 }
|
|
199
|
+
},
|
|
200
|
+
"overlay"
|
|
210
201
|
),
|
|
211
202
|
/* @__PURE__ */ jsx(
|
|
212
|
-
|
|
203
|
+
Dialog.Content,
|
|
213
204
|
{
|
|
214
205
|
ref,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
206
|
+
unstyled: true,
|
|
207
|
+
position: "fixed",
|
|
208
|
+
zIndex: 50,
|
|
209
|
+
flexDirection: "column",
|
|
210
|
+
backgroundColor: "var(--color-drawer-bg)",
|
|
211
|
+
transition: "medium",
|
|
212
|
+
...ANCHOR[placement],
|
|
213
|
+
...extent(placement, size),
|
|
221
214
|
...rest,
|
|
222
215
|
children
|
|
223
|
-
}
|
|
216
|
+
},
|
|
217
|
+
"content"
|
|
224
218
|
)
|
|
225
219
|
] });
|
|
226
|
-
|
|
227
|
-
return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
228
|
-
}
|
|
229
|
-
return content;
|
|
220
|
+
return portalled ? /* @__PURE__ */ jsx(Dialog.Portal, { children: content }) : content;
|
|
230
221
|
}
|
|
231
222
|
);
|
|
232
223
|
var DrawerCloseTrigger = React3.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
233
|
-
return
|
|
234
|
-
CloseButton
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
...props
|
|
239
|
-
}
|
|
240
|
-
) });
|
|
224
|
+
return (
|
|
225
|
+
// Placement belongs to the surrounding box, not to the button: CloseButton
|
|
226
|
+
// is a fixed 20px control and has no opinion about where it sits.
|
|
227
|
+
/* @__PURE__ */ jsx(View, { position: "absolute", top: 28, right: 20, zIndex: 1, children: /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, ...props }) }) })
|
|
228
|
+
);
|
|
241
229
|
});
|
|
242
|
-
var DrawerTrigger = (
|
|
243
|
-
const {
|
|
244
|
-
|
|
245
|
-
};
|
|
246
|
-
var DrawerHeader = React3.forwardRef(
|
|
247
|
-
function DrawerHeader2({ className, ...props }, ref) {
|
|
248
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
230
|
+
var DrawerTrigger = ({ asChild = true, children, ...rest }) => {
|
|
231
|
+
const { setOpen, narrow } = React3.useContext(DrawerStateContext);
|
|
232
|
+
if (narrow) {
|
|
233
|
+
return React3.isValidElement(children) ? React3.cloneElement(children, { onClick: () => setOpen(true) }) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
249
234
|
}
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
var DrawerTitle = RadixDialog.Title;
|
|
262
|
-
var DrawerDescription = RadixDialog.Description;
|
|
263
|
-
var DrawerActionTrigger = RadixDialog.Close;
|
|
235
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, { asChild, ...rest, children });
|
|
236
|
+
};
|
|
237
|
+
var DrawerHeader = ({ children, ...props }) => /* @__PURE__ */ jsx(YStack, { gap: 6, padding: 24, paddingBottom: 0, ...props, children: ink(children) });
|
|
238
|
+
var DrawerBody = ({ children, ...props }) => /* @__PURE__ */ jsx(YStack, { flex: 1, overflow: "scroll", padding: 24, ...props, children: ink(children) });
|
|
239
|
+
var DrawerFooter = ({ children, ...props }) => /* @__PURE__ */ jsx(XStack, { alignItems: "center", justifyContent: "flex-end", gap: 8, padding: 24, paddingTop: 0, ...props, children: ink(children) });
|
|
240
|
+
var DrawerTitle = Dialog.Title;
|
|
241
|
+
var DrawerDescription = Dialog.Description;
|
|
242
|
+
var DrawerActionTrigger = Dialog.Close;
|
|
264
243
|
|
|
265
244
|
export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, DrawerTitle, DrawerTrigger };
|
package/dist/field.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
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 _interopNamespace(e) {
|
|
@@ -25,19 +23,26 @@ function _interopNamespace(e) {
|
|
|
25
23
|
return Object.freeze(n);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
29
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
27
|
|
|
31
28
|
// src/field.tsx
|
|
32
|
-
function cn(...inputs) {
|
|
33
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
|
-
}
|
|
35
29
|
var space = String.fromCharCode(32);
|
|
36
30
|
function getComponentDisplayName(type) {
|
|
37
31
|
if (typeof type === "string") return void 0;
|
|
38
32
|
if ("displayName" in type) return type.displayName;
|
|
39
33
|
return void 0;
|
|
40
34
|
}
|
|
35
|
+
var ERROR = "var(--color-text-error)";
|
|
36
|
+
var MUTED = "var(--color-text-secondary)";
|
|
37
|
+
var Marks = ({ required, optionalText, errorText }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
38
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { color: ERROR, "aria-hidden": true, children: "*" }),
|
|
39
|
+
!required && optionalText && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 14, color: MUTED, children: optionalText }),
|
|
40
|
+
errorText && /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 14, color: ERROR, children: [
|
|
41
|
+
"-",
|
|
42
|
+
space,
|
|
43
|
+
errorText
|
|
44
|
+
] })
|
|
45
|
+
] });
|
|
41
46
|
var Field = React__namespace.forwardRef(
|
|
42
47
|
function Field2(props, ref) {
|
|
43
48
|
const {
|
|
@@ -56,127 +61,73 @@ var Field = React__namespace.forwardRef(
|
|
|
56
61
|
className,
|
|
57
62
|
style
|
|
58
63
|
} = props;
|
|
64
|
+
const flags = {
|
|
65
|
+
"data-disabled": disabled || void 0,
|
|
66
|
+
"data-readonly": readOnly || void 0,
|
|
67
|
+
"data-invalid": invalid || void 0
|
|
68
|
+
};
|
|
59
69
|
if (floating && label) {
|
|
60
|
-
const
|
|
61
|
-
className: "peer",
|
|
62
|
-
placeholder: " ",
|
|
63
|
-
size,
|
|
64
|
-
floating,
|
|
65
|
-
disabled,
|
|
66
|
-
readOnly
|
|
67
|
-
};
|
|
70
|
+
const injectedProps = { className: "lux-field-control", placeholder: " ", size, floating, disabled, readOnly };
|
|
68
71
|
const labelElement = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
69
|
-
|
|
72
|
+
gui.Label,
|
|
70
73
|
{
|
|
71
|
-
className: cn(
|
|
72
|
-
"absolute left-3 top-1/2 -translate-y-1/2",
|
|
73
|
-
"text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
74
|
-
"pointer-events-none select-none",
|
|
75
|
-
"origin-top-left transition-all duration-150",
|
|
76
|
-
"peer-focus:top-1 peer-focus:translate-y-0 peer-focus:scale-75",
|
|
77
|
-
"peer-[:not(:placeholder-shown)]:top-1 peer-[:not(:placeholder-shown)]:translate-y-0 peer-[:not(:placeholder-shown)]:scale-75"
|
|
78
|
-
),
|
|
79
74
|
htmlFor: id,
|
|
75
|
+
position: "absolute",
|
|
76
|
+
left: 12,
|
|
77
|
+
top: "50%",
|
|
78
|
+
pointerEvents: "none",
|
|
79
|
+
userSelect: "none",
|
|
80
|
+
flexDirection: "row",
|
|
81
|
+
gap: 4,
|
|
82
|
+
color: "var(--color-input-placeholder)",
|
|
83
|
+
className: "lux-field-float",
|
|
80
84
|
children: [
|
|
81
85
|
label,
|
|
82
|
-
|
|
83
|
-
!required && optionalText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 text-[var(--color-text-secondary,theme(colors.gray.400))] text-sm", children: optionalText }),
|
|
84
|
-
errorText && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-0.5 text-[var(--color-fg-error,theme(colors.red.500))] text-sm", children: [
|
|
85
|
-
"-",
|
|
86
|
-
space,
|
|
87
|
-
errorText
|
|
88
|
-
] })
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(Marks, { required, optionalText, errorText })
|
|
89
87
|
]
|
|
90
88
|
}
|
|
91
89
|
);
|
|
92
|
-
const helperTextElement = helperText ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
const helperTextElement = helperText ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { marginTop: 6, fontSize: 12, color: MUTED, children: helperText }) : null;
|
|
93
91
|
const child2 = React__namespace.Children.only(children);
|
|
94
92
|
const isInputGroup = getComponentDisplayName(child2.type) === "InputGroup";
|
|
95
93
|
if (isInputGroup) {
|
|
96
|
-
const
|
|
94
|
+
const inputElement = React__namespace.cloneElement(
|
|
97
95
|
React__namespace.Children.only(child2.props.children),
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
const groupInputElement = React__namespace.cloneElement(
|
|
101
|
-
child2,
|
|
102
|
-
{},
|
|
103
|
-
inputElement2,
|
|
104
|
-
labelElement
|
|
105
|
-
);
|
|
106
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
ref,
|
|
110
|
-
id,
|
|
111
|
-
className: cn("relative w-full", className),
|
|
112
|
-
style,
|
|
113
|
-
"data-disabled": disabled || void 0,
|
|
114
|
-
"data-readonly": readOnly || void 0,
|
|
115
|
-
"data-invalid": invalid || void 0,
|
|
116
|
-
children: [
|
|
117
|
-
groupInputElement,
|
|
118
|
-
helperTextElement
|
|
119
|
-
]
|
|
120
|
-
}
|
|
96
|
+
injectedProps
|
|
121
97
|
);
|
|
98
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { ref, id, position: "relative", width: "100%", className, style, ...flags, children: [
|
|
99
|
+
React__namespace.cloneElement(child2, {}, inputElement, labelElement),
|
|
100
|
+
helperTextElement
|
|
101
|
+
] });
|
|
122
102
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
103
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { ref, id, position: "relative", width: "100%", className, style, ...flags, children: [
|
|
104
|
+
React__namespace.cloneElement(child2, injectedProps),
|
|
105
|
+
labelElement,
|
|
106
|
+
helperTextElement
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
const child = React__namespace.Children.only(children);
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { ref, id, gap: 4, className, style, ...flags, children: [
|
|
111
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
112
|
+
gui.Label,
|
|
126
113
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
|
|
114
|
+
htmlFor: id,
|
|
115
|
+
flexDirection: "row",
|
|
116
|
+
gap: 4,
|
|
117
|
+
fontSize: 14,
|
|
118
|
+
fontWeight: "500",
|
|
119
|
+
color: "var(--color-text-primary)",
|
|
120
|
+
opacity: disabled ? 0.4 : 1,
|
|
134
121
|
children: [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
helperTextElement
|
|
122
|
+
label,
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsx(Marks, { required, optionalText })
|
|
138
124
|
]
|
|
139
125
|
}
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
const child = React__namespace.Children.only(children);
|
|
146
|
-
const clonedChild = React__namespace.cloneElement(child, injectedProps);
|
|
147
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
148
|
-
"div",
|
|
149
|
-
{
|
|
150
|
-
ref,
|
|
151
|
-
id,
|
|
152
|
-
className: cn("flex flex-col gap-1", className),
|
|
153
|
-
style,
|
|
154
|
-
"data-disabled": disabled || void 0,
|
|
155
|
-
"data-readonly": readOnly || void 0,
|
|
156
|
-
"data-invalid": invalid || void 0,
|
|
157
|
-
children: [
|
|
158
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
159
|
-
LabelPrimitive__namespace.Root,
|
|
160
|
-
{
|
|
161
|
-
className: cn(
|
|
162
|
-
"text-sm font-medium text-[var(--color-field-label,theme(colors.gray.700))]",
|
|
163
|
-
"dark:text-[var(--color-field-label,theme(colors.gray.300))]",
|
|
164
|
-
disabled && "opacity-40"
|
|
165
|
-
),
|
|
166
|
-
htmlFor: id,
|
|
167
|
-
children: [
|
|
168
|
-
label,
|
|
169
|
-
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-0.5 text-[var(--color-fg-error,theme(colors.red.500))]", "aria-hidden": "true", children: "*" }),
|
|
170
|
-
!required && optionalText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 text-[var(--color-text-secondary,theme(colors.gray.400))] text-sm font-normal", children: optionalText })
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
),
|
|
174
|
-
clonedChild,
|
|
175
|
-
helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-[var(--color-text-secondary,theme(colors.gray.400))]", children: helperText }),
|
|
176
|
-
errorText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-[var(--color-fg-error,theme(colors.red.500))]", children: errorText })
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
);
|
|
126
|
+
),
|
|
127
|
+
React__namespace.cloneElement(child, { size }),
|
|
128
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: MUTED, children: helperText }),
|
|
129
|
+
errorText && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: ERROR, children: errorText })
|
|
130
|
+
] });
|
|
180
131
|
}
|
|
181
132
|
);
|
|
182
133
|
|
package/dist/field.d.cts
CHANGED
|
@@ -14,7 +14,6 @@ interface FieldProps {
|
|
|
14
14
|
readonly readOnly?: boolean;
|
|
15
15
|
readonly invalid?: boolean;
|
|
16
16
|
readonly floating?: boolean;
|
|
17
|
-
readonly bgColor?: string | Record<string, string>;
|
|
18
17
|
readonly id?: string;
|
|
19
18
|
readonly className?: string;
|
|
20
19
|
readonly style?: React.CSSProperties;
|
package/dist/field.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ interface FieldProps {
|
|
|
14
14
|
readonly readOnly?: boolean;
|
|
15
15
|
readonly invalid?: boolean;
|
|
16
16
|
readonly floating?: boolean;
|
|
17
|
-
readonly bgColor?: string | Record<string, string>;
|
|
18
17
|
readonly id?: string;
|
|
19
18
|
readonly className?: string;
|
|
20
19
|
readonly style?: React.CSSProperties;
|