@luxfi/ui 8.2.7 → 8.2.8
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/3d-model-viewer.cjs +25 -421
- package/dist/3d-model-viewer.js +20 -416
- package/dist/accordion.cjs +3 -10
- package/dist/accordion.js +2 -10
- package/dist/advanced-navigation-bar.cjs +5 -401
- package/dist/advanced-navigation-bar.js +5 -401
- package/dist/ai-agents.cjs +45 -890
- package/dist/ai-agents.js +8 -834
- package/dist/ai-assistant.cjs +13 -740
- package/dist/ai-assistant.js +10 -738
- package/dist/ai-chat.cjs +24 -770
- package/dist/ai-chat.js +18 -765
- package/dist/ai-code.cjs +67 -923
- package/dist/ai-code.js +49 -905
- package/dist/ai-playground.cjs +25 -801
- package/dist/ai-playground.js +18 -795
- package/dist/ai-tools.cjs +22 -767
- package/dist/ai-tools.js +15 -761
- package/dist/ai-vision.cjs +41 -993
- package/dist/ai-vision.js +30 -983
- package/dist/ai-voice-settings.cjs +35 -1006
- package/dist/ai-voice-settings.js +32 -1004
- package/dist/ai-voice.cjs +51 -1024
- package/dist/ai-voice.js +9 -963
- package/dist/alert.cjs +11 -129
- package/dist/alert.js +8 -127
- package/dist/announcement.cjs +6 -402
- package/dist/announcement.js +6 -402
- package/dist/app-switcher-navigation-bar.cjs +5 -401
- package/dist/app-switcher-navigation-bar.js +5 -401
- package/dist/apple-cards-carousel.cjs +84 -480
- package/dist/apple-cards-carousel.js +19 -415
- package/dist/auth.cjs +10 -387
- package/dist/auth.js +7 -385
- package/dist/avatar.cjs +2 -9
- package/dist/avatar.js +2 -10
- package/dist/badge.cjs +8 -228
- package/dist/badge.js +5 -210
- package/dist/button.cjs +14 -67
- package/dist/button.js +12 -65
- package/dist/chrome.cjs +29 -493
- package/dist/chrome.js +9 -474
- package/dist/code-block.cjs +16 -664
- package/dist/code-block.js +13 -662
- package/dist/code-compare.cjs +28 -1302
- package/dist/code-compare.js +18 -1293
- package/dist/code-diff.cjs +21 -669
- package/dist/code-diff.js +17 -666
- package/dist/code-editor.cjs +13 -409
- package/dist/code-editor.js +12 -408
- package/dist/code-explorer.cjs +14 -456
- package/dist/code-explorer.js +13 -456
- package/dist/code-preview.cjs +31 -983
- package/dist/code-preview.js +23 -976
- package/dist/code-snippet.cjs +19 -667
- package/dist/code-snippet.js +14 -663
- package/dist/code-terminal.cjs +24 -485
- package/dist/code-terminal.js +19 -481
- package/dist/collapsible.cjs +13 -347
- package/dist/collapsible.js +11 -330
- package/dist/color-picker.cjs +8 -450
- package/dist/color-picker.js +7 -450
- package/dist/combobox.cjs +6 -402
- package/dist/combobox.js +6 -402
- package/dist/communication-navigation-bar.cjs +7 -403
- package/dist/communication-navigation-bar.js +5 -401
- package/dist/dashboard-navigation-bar.cjs +6 -402
- package/dist/dashboard-navigation-bar.js +5 -401
- package/dist/dialog-stack.cjs +5 -401
- package/dist/dialog-stack.js +5 -401
- package/dist/dialog.cjs +13 -70
- package/dist/dialog.js +13 -70
- package/dist/drawer.cjs +23 -99
- package/dist/drawer.js +19 -96
- package/dist/e-commerce-navigation-bar.cjs +7 -403
- package/dist/e-commerce-navigation-bar.js +5 -401
- package/dist/editor.cjs +9 -405
- package/dist/editor.js +6 -402
- package/dist/iam.cjs +2 -123
- package/dist/iam.js +1 -122
- package/dist/icon-button.cjs +2 -56
- package/dist/icon-button.js +1 -55
- package/dist/identity.cjs +28 -242
- package/dist/identity.js +20 -235
- package/dist/image-crop.cjs +10 -406
- package/dist/image-crop.js +7 -403
- package/dist/image.cjs +14 -83
- package/dist/image.js +13 -67
- package/dist/index.cjs +1868 -38770
- package/dist/index.js +174 -38320
- package/dist/input-group.cjs +3 -10
- package/dist/input-group.js +2 -10
- package/dist/item.cjs +2 -27
- package/dist/item.js +1 -22
- package/dist/kanban.cjs +25 -751
- package/dist/kanban.js +15 -742
- package/dist/limelight-nav.cjs +10 -452
- package/dist/limelight-nav.js +9 -452
- package/dist/link.cjs +11 -80
- package/dist/link.js +6 -60
- package/dist/lux.config.cjs +14 -32
- package/dist/lux.config.js +3 -26
- package/dist/menu.cjs +5 -13
- package/dist/menu.js +1 -9
- package/dist/message-dock.cjs +5 -401
- package/dist/message-dock.js +5 -401
- package/dist/mini-calendar.cjs +7 -403
- package/dist/mini-calendar.js +6 -402
- package/dist/music-player.cjs +30 -528
- package/dist/music-player.js +22 -520
- package/dist/next.cjs +8 -89
- package/dist/next.js +3 -86
- package/dist/popover.cjs +17 -74
- package/dist/popover.js +16 -73
- package/dist/progress-circle.cjs +3 -10
- package/dist/progress-circle.js +2 -10
- package/dist/provider.cjs +7 -176
- package/dist/provider.js +4 -174
- package/dist/select.cjs +36 -89
- package/dist/select.js +35 -88
- package/dist/sidebar.cjs +22 -493
- package/dist/sidebar.js +17 -489
- package/dist/site/commerce/ui/context.cjs +9 -214
- package/dist/site/commerce/ui/context.js +6 -215
- package/dist/site/components/analytics.cjs +2 -42
- package/dist/site/components/analytics.js +1 -37
- package/dist/site/components/auth/callback.cjs +2 -8
- package/dist/site/components/auth/callback.js +1 -7
- package/dist/site/components/auth/login-panel.cjs +15 -74
- package/dist/site/components/auth/login-panel.js +12 -73
- package/dist/site/components/auth/login.cjs +2 -6
- package/dist/site/components/auth/login.js +1 -5
- package/dist/site/components/auth/widget.cjs +2 -6
- package/dist/site/components/auth/widget.js +1 -5
- package/dist/site/components/commerce/bag-button.cjs +2 -3
- package/dist/site/components/commerce/bag-button.js +2 -3
- package/dist/site/components/commerce/buy-button.cjs +2 -11
- package/dist/site/components/commerce/buy-button.js +1 -10
- package/dist/site/components/commerce/checkout-button.cjs +2 -3
- package/dist/site/components/commerce/checkout-button.js +2 -3
- package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
- package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
- package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
- package/dist/site/components/commerce/checkout-panel/index.js +10 -403
- package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
- package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
- package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
- package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
- package/dist/site/components/commerce/drawer/index.cjs +15 -289
- package/dist/site/components/commerce/drawer/index.js +10 -290
- package/dist/site/components/commerce/drawer/micro.cjs +8 -115
- package/dist/site/components/commerce/drawer/micro.js +4 -115
- package/dist/site/components/commerce/drawer/shell.cjs +2 -10
- package/dist/site/components/commerce/drawer/shell.js +2 -10
- package/dist/site/components/contact-dialog/index.cjs +6 -69
- package/dist/site/components/contact-dialog/index.js +7 -71
- package/dist/site/components/drawer-margin.cjs +2 -10
- package/dist/site/components/drawer-margin.js +2 -10
- package/dist/site/components/footer.cjs +11 -81
- package/dist/site/components/footer.js +8 -80
- package/dist/site/components/header/desktop.cjs +18 -374
- package/dist/site/components/header/desktop.js +12 -355
- package/dist/site/components/header/index.cjs +9 -674
- package/dist/site/components/header/index.js +8 -657
- package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
- package/dist/site/components/header/mobile-bag-drawer.js +5 -74
- package/dist/site/components/header/mobile-nav-menu-ai.cjs +25 -28
- package/dist/site/components/header/mobile-nav-menu-ai.js +24 -27
- package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
- package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
- package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
- package/dist/site/components/header/mobile-nav-menu.js +7 -112
- package/dist/site/components/header/mobile.cjs +48 -330
- package/dist/site/components/header/mobile.js +42 -330
- package/dist/site/components/icons/index.cjs +34 -35
- package/dist/site/components/icons/index.js +5 -33
- package/dist/site/components/index.cjs +118 -1961
- package/dist/site/components/index.js +23 -1951
- package/dist/site/components/mini-chart/index.cjs +7 -90
- package/dist/site/components/mini-chart/index.js +1 -92
- package/dist/site/components/mini-chart/wrapper.cjs +7 -76
- package/dist/site/components/mini-chart/wrapper.js +4 -77
- package/dist/site/components/not-found/index.cjs +9 -819
- package/dist/site/components/not-found/index.js +8 -802
- package/dist/site/components/security/index.cjs +9 -819
- package/dist/site/components/security/index.js +8 -802
- package/dist/site/next/analytics/index.cjs +16 -49
- package/dist/site/next/analytics/index.js +3 -49
- package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
- package/dist/site/next/analytics/pixel-analytics.js +4 -8
- package/dist/site/next/index.cjs +13 -140
- package/dist/site/next/index.js +2 -140
- package/dist/site/root-layout/index.cjs +12 -1435
- package/dist/site/root-layout/index.css +0 -133
- package/dist/site/root-layout/index.js +12 -1416
- package/dist/site/site-def/footer/community.cjs +11 -27
- package/dist/site/site-def/footer/community.js +2 -18
- package/dist/site/site-def/footer/index.cjs +38 -218
- package/dist/site/site-def/footer/index.js +14 -215
- package/dist/site/site-def/index.cjs +28 -620
- package/dist/site/site-def/index.js +3 -624
- package/dist/table.cjs +20 -338
- package/dist/table.js +19 -338
- package/dist/tabs.cjs +3 -10
- package/dist/tabs.js +1 -9
- package/dist/tag.cjs +9 -270
- package/dist/tag.js +6 -268
- package/dist/tags.cjs +6 -314
- package/dist/tags.js +5 -314
- package/dist/textarea.cjs +4 -50
- package/dist/textarea.js +3 -49
- package/dist/tooltip.cjs +15 -34
- package/dist/tooltip.js +13 -33
- package/dist/vite.cjs +3 -82
- package/dist/vite.js +1 -80
- package/package.json +1 -1
- package/dist/index.css +0 -132
- package/dist/site/components/auth/login-panel.css +0 -4
- package/dist/site/components/commerce/bag-button.css +0 -4
- package/dist/site/components/commerce/checkout-button.css +0 -4
- package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
- package/dist/site/components/commerce/checkout-panel/index.css +0 -132
- package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
- package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
- package/dist/site/components/commerce/drawer/index.css +0 -132
- package/dist/site/components/commerce/drawer/micro.css +0 -4
- package/dist/site/components/header/desktop.css +0 -4
- package/dist/site/components/header/index.css +0 -132
- package/dist/site/components/header/mobile-bag-drawer.css +0 -4
- package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
- package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
- package/dist/site/components/header/mobile-nav-menu.css +0 -132
- package/dist/site/components/header/mobile.css +0 -132
- package/dist/site/components/icons/index.css +0 -4
- package/dist/site/components/index.css +0 -132
- package/dist/site/components/not-found/index.css +0 -132
- package/dist/site/components/security/index.css +0 -132
- package/dist/site/site-def/footer/community.css +0 -4
- package/dist/site/site-def/footer/index.css +0 -4
- package/dist/site/site-def/index.css +0 -4
package/dist/dialog.js
CHANGED
|
@@ -1,67 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Dialog } from '@hanzo/gui';
|
|
3
3
|
import { sx, Box, cn, css } from '@hanzo/ui';
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { CloseButton } from './close-button.js';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
|
-
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";
|
|
8
|
-
var CloseButtonFrame = styled(View, {
|
|
9
|
-
name: "LuxCloseButton",
|
|
10
|
-
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
11
|
-
role: "button",
|
|
12
|
-
cursor: "pointer",
|
|
13
|
-
display: "inline-flex",
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "center",
|
|
16
|
-
width: 20,
|
|
17
|
-
height: 20,
|
|
18
|
-
minWidth: 0,
|
|
19
|
-
flexShrink: 1,
|
|
20
|
-
padding: 0,
|
|
21
|
-
borderRadius: 4,
|
|
22
|
-
borderWidth: 0,
|
|
23
|
-
overflow: "hidden",
|
|
24
|
-
backgroundColor: "transparent",
|
|
25
|
-
hoverStyle: {
|
|
26
|
-
backgroundColor: "transparent"
|
|
27
|
-
},
|
|
28
|
-
variants: {
|
|
29
|
-
disabled: {
|
|
30
|
-
true: {
|
|
31
|
-
opacity: 0.4,
|
|
32
|
-
pointerEvents: "none"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
|
|
38
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
39
|
-
return /* @__PURE__ */ jsx(
|
|
40
|
-
CloseButtonFrame,
|
|
41
|
-
{
|
|
42
|
-
ref,
|
|
43
|
-
className,
|
|
44
|
-
...rest,
|
|
45
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
46
|
-
"svg",
|
|
47
|
-
{
|
|
48
|
-
width: 20,
|
|
49
|
-
height: 20,
|
|
50
|
-
viewBox: "0 0 20 20",
|
|
51
|
-
fill: "none",
|
|
52
|
-
"aria-hidden": "true",
|
|
53
|
-
children: /* @__PURE__ */ jsx(
|
|
54
|
-
"path",
|
|
55
|
-
{
|
|
56
|
-
d: CLOSE_ICON_PATH,
|
|
57
|
-
fill: "currentColor"
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
8
|
function BackToButton({ onClick }) {
|
|
66
9
|
return /* @__PURE__ */ jsx(
|
|
67
10
|
Box,
|
|
@@ -75,9 +18,9 @@ function BackToButton({ onClick }) {
|
|
|
75
18
|
}
|
|
76
19
|
);
|
|
77
20
|
}
|
|
78
|
-
var DialogSizeContext =
|
|
21
|
+
var DialogSizeContext = React.createContext({ size: "md" });
|
|
79
22
|
function useDialogSizeContext() {
|
|
80
|
-
return
|
|
23
|
+
return React.useContext(DialogSizeContext);
|
|
81
24
|
}
|
|
82
25
|
var CONTENT_SIZE_MAP = {
|
|
83
26
|
sm: "max-w-[400px]",
|
|
@@ -109,13 +52,13 @@ var DialogRoot = ({
|
|
|
109
52
|
modal = true
|
|
110
53
|
// motionPreset is intentionally unused -- kept for API compat
|
|
111
54
|
}) => {
|
|
112
|
-
const handleOpenChange =
|
|
55
|
+
const handleOpenChange = React.useCallback(
|
|
113
56
|
(nextOpen) => {
|
|
114
57
|
onOpenChange?.({ open: nextOpen });
|
|
115
58
|
},
|
|
116
59
|
[onOpenChange]
|
|
117
60
|
);
|
|
118
|
-
const ctx =
|
|
61
|
+
const ctx = React.useMemo(() => ({ size }), [size]);
|
|
119
62
|
return /* @__PURE__ */ jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
120
63
|
Dialog,
|
|
121
64
|
{
|
|
@@ -127,7 +70,7 @@ var DialogRoot = ({
|
|
|
127
70
|
}
|
|
128
71
|
) });
|
|
129
72
|
};
|
|
130
|
-
var DialogContent =
|
|
73
|
+
var DialogContent = React.forwardRef(function DialogContent2(props, ref) {
|
|
131
74
|
const {
|
|
132
75
|
children,
|
|
133
76
|
portalled: _portalled = true,
|
|
@@ -184,11 +127,11 @@ var DialogContent = React2.forwardRef(function DialogContent2(props, ref) {
|
|
|
184
127
|
)
|
|
185
128
|
] });
|
|
186
129
|
});
|
|
187
|
-
var DialogCloseTrigger =
|
|
130
|
+
var DialogCloseTrigger = React.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
188
131
|
const { className, ...rest } = props;
|
|
189
132
|
return /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
190
133
|
});
|
|
191
|
-
var DialogHeader =
|
|
134
|
+
var DialogHeader = React.forwardRef(function DialogHeader2(props, ref) {
|
|
192
135
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
193
136
|
const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
|
|
194
137
|
return /* @__PURE__ */ jsxs(
|
|
@@ -218,7 +161,7 @@ var DialogHeader = React2.forwardRef(function DialogHeader2(props, ref) {
|
|
|
218
161
|
}
|
|
219
162
|
);
|
|
220
163
|
});
|
|
221
|
-
var DialogBody =
|
|
164
|
+
var DialogBody = React.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
|
|
222
165
|
const bodyStyle = {
|
|
223
166
|
...styleProp,
|
|
224
167
|
...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
|
|
@@ -235,7 +178,7 @@ var DialogBody = React2.forwardRef(function DialogBody2({ className, pt, display
|
|
|
235
178
|
}
|
|
236
179
|
);
|
|
237
180
|
});
|
|
238
|
-
var DialogFooter =
|
|
181
|
+
var DialogFooter = React.forwardRef(function DialogFooter2({ className, ...props }, ref) {
|
|
239
182
|
return /* @__PURE__ */ jsx(
|
|
240
183
|
Box,
|
|
241
184
|
{
|
package/dist/drawer.cjs
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var closeButton_js = require('./close-button.js');
|
|
7
|
+
var ink_js = require('./ink.js');
|
|
8
|
+
var useNarrow_js = require('./use-narrow.js');
|
|
6
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
10
|
|
|
8
11
|
function _interopNamespace(e) {
|
|
@@ -23,90 +26,11 @@ function _interopNamespace(e) {
|
|
|
23
26
|
return Object.freeze(n);
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
var
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
30
|
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
|
|
32
|
-
role: "button",
|
|
33
|
-
cursor: "pointer",
|
|
34
|
-
display: "inline-flex",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
justifyContent: "center",
|
|
37
|
-
width: 20,
|
|
38
|
-
height: 20,
|
|
39
|
-
minWidth: 0,
|
|
40
|
-
flexShrink: 1,
|
|
41
|
-
padding: 0,
|
|
42
|
-
borderRadius: 4,
|
|
43
|
-
borderWidth: 0,
|
|
44
|
-
overflow: "hidden",
|
|
45
|
-
backgroundColor: "transparent",
|
|
46
|
-
hoverStyle: {
|
|
47
|
-
backgroundColor: "transparent"
|
|
48
|
-
},
|
|
49
|
-
variants: {
|
|
50
|
-
disabled: {
|
|
51
|
-
true: {
|
|
52
|
-
opacity: 0.4,
|
|
53
|
-
pointerEvents: "none"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
var CloseButton = React3__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
59
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
60
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
-
CloseButtonFrame,
|
|
62
|
-
{
|
|
63
|
-
ref,
|
|
64
|
-
className,
|
|
65
|
-
...rest,
|
|
66
|
-
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
-
"svg",
|
|
68
|
-
{
|
|
69
|
-
width: 20,
|
|
70
|
-
height: 20,
|
|
71
|
-
viewBox: "0 0 20 20",
|
|
72
|
-
fill: "none",
|
|
73
|
-
"aria-hidden": "true",
|
|
74
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
-
"path",
|
|
76
|
-
{
|
|
77
|
-
d: CLOSE_ICON_PATH,
|
|
78
|
-
fill: "currentColor"
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
87
|
-
let hasText = false;
|
|
88
|
-
React3.Children.forEach(children, (child) => {
|
|
89
|
-
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
90
|
-
});
|
|
91
|
-
if (!hasText) return children;
|
|
92
|
-
return React3.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React3.createElement(Wrap, props, child) : child);
|
|
93
|
-
};
|
|
94
|
-
var NARROW_PX = 640;
|
|
95
|
-
function useBelow(px) {
|
|
96
|
-
const [below, setBelow] = React3__namespace.useState(false);
|
|
97
|
-
React3__namespace.useEffect(() => {
|
|
98
|
-
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
99
|
-
const apply = () => setBelow(mql.matches);
|
|
100
|
-
apply();
|
|
101
|
-
mql.addEventListener("change", apply);
|
|
102
|
-
return () => mql.removeEventListener("change", apply);
|
|
103
|
-
}, [px]);
|
|
104
|
-
return below;
|
|
105
|
-
}
|
|
106
|
-
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
107
|
-
var DrawerPlacementContext = React3__namespace.createContext("right");
|
|
108
|
-
var DrawerSizeContext = React3__namespace.createContext("md");
|
|
109
|
-
var DrawerStateContext = React3__namespace.createContext({
|
|
31
|
+
var DrawerPlacementContext = React__namespace.createContext("right");
|
|
32
|
+
var DrawerSizeContext = React__namespace.createContext("md");
|
|
33
|
+
var DrawerStateContext = React__namespace.createContext({
|
|
110
34
|
open: false,
|
|
111
35
|
setOpen: () => {
|
|
112
36
|
},
|
|
@@ -123,15 +47,15 @@ var DrawerRoot = (props) => {
|
|
|
123
47
|
modal = true,
|
|
124
48
|
size = "md"
|
|
125
49
|
} = props;
|
|
126
|
-
const [uncontrolled, setUncontrolled] =
|
|
50
|
+
const [uncontrolled, setUncontrolled] = React__namespace.useState(defaultOpen ?? false);
|
|
127
51
|
const isControlled = open !== void 0;
|
|
128
52
|
const isOpen = isControlled ? open : uncontrolled;
|
|
129
|
-
const narrow = useIsNarrow();
|
|
130
|
-
const setOpen =
|
|
53
|
+
const narrow = useNarrow_js.useIsNarrow();
|
|
54
|
+
const setOpen = React__namespace.useCallback((nextOpen) => {
|
|
131
55
|
if (!isControlled) setUncontrolled(nextOpen);
|
|
132
56
|
onOpenChange?.({ open: nextOpen });
|
|
133
57
|
}, [isControlled, onOpenChange]);
|
|
134
|
-
const state =
|
|
58
|
+
const state = React__namespace.useMemo(
|
|
135
59
|
() => ({ open: isOpen, setOpen, modal, narrow }),
|
|
136
60
|
[isOpen, setOpen, modal, narrow]
|
|
137
61
|
);
|
|
@@ -153,12 +77,12 @@ var ACROSS = {
|
|
|
153
77
|
};
|
|
154
78
|
var extent = (placement, size) => placement === "left" || placement === "right" ? { width: ACROSS[size], maxWidth: "100%" } : { height: ACROSS[size], maxHeight: "100%" };
|
|
155
79
|
var SCRIM = "rgba(0,0,0,0.5)";
|
|
156
|
-
var DrawerContent =
|
|
80
|
+
var DrawerContent = React__namespace.forwardRef(
|
|
157
81
|
function DrawerContent2(props, ref) {
|
|
158
82
|
const { children, portalled = true, portalRef: _portalRef, offset: _offset, backdrop = true, ...rest } = props;
|
|
159
|
-
const placement =
|
|
160
|
-
const size =
|
|
161
|
-
const { open, setOpen, modal, narrow } =
|
|
83
|
+
const placement = React__namespace.useContext(DrawerPlacementContext);
|
|
84
|
+
const size = React__namespace.useContext(DrawerSizeContext);
|
|
85
|
+
const { open, setOpen, modal, narrow } = React__namespace.useContext(DrawerStateContext);
|
|
162
86
|
if (narrow) {
|
|
163
87
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
164
88
|
gui.Sheet,
|
|
@@ -236,23 +160,23 @@ var DrawerContent = React3__namespace.forwardRef(
|
|
|
236
160
|
return portalled ? /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Portal, { children: content }) : content;
|
|
237
161
|
}
|
|
238
162
|
);
|
|
239
|
-
var DrawerCloseTrigger =
|
|
163
|
+
var DrawerCloseTrigger = React__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
240
164
|
return (
|
|
241
165
|
// Placement belongs to the surrounding box, not to the button: CloseButton
|
|
242
166
|
// is a fixed 20px control and has no opinion about where it sits.
|
|
243
|
-
/* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "absolute", top: 28, right: 20, zIndex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { ref, ...props }) }) })
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "absolute", top: 28, right: 20, zIndex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(closeButton_js.CloseButton, { ref, ...props }) }) })
|
|
244
168
|
);
|
|
245
169
|
});
|
|
246
170
|
var DrawerTrigger = ({ asChild = true, children, ...rest }) => {
|
|
247
|
-
const { setOpen, narrow } =
|
|
171
|
+
const { setOpen, narrow } = React__namespace.useContext(DrawerStateContext);
|
|
248
172
|
if (narrow) {
|
|
249
|
-
return
|
|
173
|
+
return React__namespace.isValidElement(children) ? React__namespace.cloneElement(children, { onClick: () => setOpen(true) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
250
174
|
}
|
|
251
175
|
return /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Trigger, { asChild, ...rest, children });
|
|
252
176
|
};
|
|
253
|
-
var DrawerHeader = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: 6, padding: 24, paddingBottom: 0, ...props, children: ink(children) });
|
|
254
|
-
var DrawerBody = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, overflow: "scroll", padding: 24, ...props, children: ink(children) });
|
|
255
|
-
var DrawerFooter = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { alignItems: "center", justifyContent: "flex-end", gap: 8, padding: 24, paddingTop: 0, ...props, children: ink(children) });
|
|
177
|
+
var DrawerHeader = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: 6, padding: 24, paddingBottom: 0, ...props, children: ink_js.ink(children) });
|
|
178
|
+
var DrawerBody = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, overflow: "scroll", padding: 24, ...props, children: ink_js.ink(children) });
|
|
179
|
+
var DrawerFooter = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { alignItems: "center", justifyContent: "flex-end", gap: 8, padding: 24, paddingTop: 0, ...props, children: ink_js.ink(children) });
|
|
256
180
|
var DrawerTitle = gui.Dialog.Title;
|
|
257
181
|
var DrawerDescription = gui.Dialog.Description;
|
|
258
182
|
var DrawerActionTrigger = gui.Dialog.Close;
|
package/dist/drawer.js
CHANGED
|
@@ -1,91 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { Sheet, Dialog, View, YStack, XStack } from '@hanzo/gui';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { CloseButton } from './close-button.js';
|
|
5
|
+
import { ink } from './ink.js';
|
|
6
|
+
import { useIsNarrow } from './use-narrow.js';
|
|
7
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
8
|
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
11
|
-
role: "button",
|
|
12
|
-
cursor: "pointer",
|
|
13
|
-
display: "inline-flex",
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "center",
|
|
16
|
-
width: 20,
|
|
17
|
-
height: 20,
|
|
18
|
-
minWidth: 0,
|
|
19
|
-
flexShrink: 1,
|
|
20
|
-
padding: 0,
|
|
21
|
-
borderRadius: 4,
|
|
22
|
-
borderWidth: 0,
|
|
23
|
-
overflow: "hidden",
|
|
24
|
-
backgroundColor: "transparent",
|
|
25
|
-
hoverStyle: {
|
|
26
|
-
backgroundColor: "transparent"
|
|
27
|
-
},
|
|
28
|
-
variants: {
|
|
29
|
-
disabled: {
|
|
30
|
-
true: {
|
|
31
|
-
opacity: 0.4,
|
|
32
|
-
pointerEvents: "none"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var CloseButton = React3.forwardRef(function CloseButton2(props, ref) {
|
|
38
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
39
|
-
return /* @__PURE__ */ jsx(
|
|
40
|
-
CloseButtonFrame,
|
|
41
|
-
{
|
|
42
|
-
ref,
|
|
43
|
-
className,
|
|
44
|
-
...rest,
|
|
45
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
46
|
-
"svg",
|
|
47
|
-
{
|
|
48
|
-
width: 20,
|
|
49
|
-
height: 20,
|
|
50
|
-
viewBox: "0 0 20 20",
|
|
51
|
-
fill: "none",
|
|
52
|
-
"aria-hidden": "true",
|
|
53
|
-
children: /* @__PURE__ */ jsx(
|
|
54
|
-
"path",
|
|
55
|
-
{
|
|
56
|
-
d: CLOSE_ICON_PATH,
|
|
57
|
-
fill: "currentColor"
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
var ink = (children, Wrap = Text, props = {}) => {
|
|
66
|
-
let hasText = false;
|
|
67
|
-
Children.forEach(children, (child) => {
|
|
68
|
-
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
69
|
-
});
|
|
70
|
-
if (!hasText) return children;
|
|
71
|
-
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
72
|
-
};
|
|
73
|
-
var NARROW_PX = 640;
|
|
74
|
-
function useBelow(px) {
|
|
75
|
-
const [below, setBelow] = React3.useState(false);
|
|
76
|
-
React3.useEffect(() => {
|
|
77
|
-
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
78
|
-
const apply = () => setBelow(mql.matches);
|
|
79
|
-
apply();
|
|
80
|
-
mql.addEventListener("change", apply);
|
|
81
|
-
return () => mql.removeEventListener("change", apply);
|
|
82
|
-
}, [px]);
|
|
83
|
-
return below;
|
|
84
|
-
}
|
|
85
|
-
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
86
|
-
var DrawerPlacementContext = React3.createContext("right");
|
|
87
|
-
var DrawerSizeContext = React3.createContext("md");
|
|
88
|
-
var DrawerStateContext = React3.createContext({
|
|
9
|
+
var DrawerPlacementContext = React.createContext("right");
|
|
10
|
+
var DrawerSizeContext = React.createContext("md");
|
|
11
|
+
var DrawerStateContext = React.createContext({
|
|
89
12
|
open: false,
|
|
90
13
|
setOpen: () => {
|
|
91
14
|
},
|
|
@@ -102,15 +25,15 @@ var DrawerRoot = (props) => {
|
|
|
102
25
|
modal = true,
|
|
103
26
|
size = "md"
|
|
104
27
|
} = props;
|
|
105
|
-
const [uncontrolled, setUncontrolled] =
|
|
28
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultOpen ?? false);
|
|
106
29
|
const isControlled = open !== void 0;
|
|
107
30
|
const isOpen = isControlled ? open : uncontrolled;
|
|
108
31
|
const narrow = useIsNarrow();
|
|
109
|
-
const setOpen =
|
|
32
|
+
const setOpen = React.useCallback((nextOpen) => {
|
|
110
33
|
if (!isControlled) setUncontrolled(nextOpen);
|
|
111
34
|
onOpenChange?.({ open: nextOpen });
|
|
112
35
|
}, [isControlled, onOpenChange]);
|
|
113
|
-
const state =
|
|
36
|
+
const state = React.useMemo(
|
|
114
37
|
() => ({ open: isOpen, setOpen, modal, narrow }),
|
|
115
38
|
[isOpen, setOpen, modal, narrow]
|
|
116
39
|
);
|
|
@@ -132,12 +55,12 @@ var ACROSS = {
|
|
|
132
55
|
};
|
|
133
56
|
var extent = (placement, size) => placement === "left" || placement === "right" ? { width: ACROSS[size], maxWidth: "100%" } : { height: ACROSS[size], maxHeight: "100%" };
|
|
134
57
|
var SCRIM = "rgba(0,0,0,0.5)";
|
|
135
|
-
var DrawerContent =
|
|
58
|
+
var DrawerContent = React.forwardRef(
|
|
136
59
|
function DrawerContent2(props, ref) {
|
|
137
60
|
const { children, portalled = true, portalRef: _portalRef, offset: _offset, backdrop = true, ...rest } = props;
|
|
138
|
-
const placement =
|
|
139
|
-
const size =
|
|
140
|
-
const { open, setOpen, modal, narrow } =
|
|
61
|
+
const placement = React.useContext(DrawerPlacementContext);
|
|
62
|
+
const size = React.useContext(DrawerSizeContext);
|
|
63
|
+
const { open, setOpen, modal, narrow } = React.useContext(DrawerStateContext);
|
|
141
64
|
if (narrow) {
|
|
142
65
|
return /* @__PURE__ */ jsxs(
|
|
143
66
|
Sheet,
|
|
@@ -215,7 +138,7 @@ var DrawerContent = React3.forwardRef(
|
|
|
215
138
|
return portalled ? /* @__PURE__ */ jsx(Dialog.Portal, { children: content }) : content;
|
|
216
139
|
}
|
|
217
140
|
);
|
|
218
|
-
var DrawerCloseTrigger =
|
|
141
|
+
var DrawerCloseTrigger = React.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
219
142
|
return (
|
|
220
143
|
// Placement belongs to the surrounding box, not to the button: CloseButton
|
|
221
144
|
// is a fixed 20px control and has no opinion about where it sits.
|
|
@@ -223,9 +146,9 @@ var DrawerCloseTrigger = React3.forwardRef(function DrawerCloseTrigger2(props, r
|
|
|
223
146
|
);
|
|
224
147
|
});
|
|
225
148
|
var DrawerTrigger = ({ asChild = true, children, ...rest }) => {
|
|
226
|
-
const { setOpen, narrow } =
|
|
149
|
+
const { setOpen, narrow } = React.useContext(DrawerStateContext);
|
|
227
150
|
if (narrow) {
|
|
228
|
-
return
|
|
151
|
+
return React.isValidElement(children) ? React.cloneElement(children, { onClick: () => setOpen(true) }) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
229
152
|
}
|
|
230
153
|
return /* @__PURE__ */ jsx(Dialog.Trigger, { asChild, ...rest, children });
|
|
231
154
|
};
|