@streamplace/components 0.7.18 → 0.7.21
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/assets/emoji-data.json +19371 -0
- package/dist/components/chat/chat-box.js +319 -0
- package/dist/components/chat/chat-message.js +87 -0
- package/dist/components/chat/chat.js +150 -0
- package/dist/components/chat/emoji-suggestions.js +35 -0
- package/dist/components/chat/mention-suggestions.js +42 -0
- package/dist/components/chat/mod-view.js +112 -0
- package/dist/components/chat/system-message.js +19 -0
- package/dist/components/dashboard/chat-panel.js +38 -0
- package/dist/components/dashboard/header.js +80 -0
- package/dist/components/dashboard/index.js +14 -0
- package/dist/components/dashboard/information-widget.js +234 -0
- package/dist/components/dashboard/mod-actions.js +71 -0
- package/dist/components/dashboard/problems.js +74 -0
- package/dist/components/icons/bluesky-icon.js +9 -0
- package/dist/components/keep-awake.js +7 -0
- package/dist/components/keep-awake.native.js +16 -0
- package/dist/components/mobile-player/fullscreen.js +76 -0
- package/dist/components/mobile-player/fullscreen.native.js +141 -0
- package/dist/components/mobile-player/player.js +94 -0
- package/dist/components/mobile-player/props.js +2 -0
- package/dist/components/mobile-player/shared.js +54 -0
- package/dist/components/mobile-player/ui/autoplay-button.js +68 -0
- package/dist/components/mobile-player/ui/countdown.js +83 -0
- package/dist/components/mobile-player/ui/index.js +12 -0
- package/dist/components/mobile-player/ui/input.js +42 -0
- package/dist/components/mobile-player/ui/metrics.js +44 -0
- package/dist/components/mobile-player/ui/report-modal.js +90 -0
- package/dist/components/mobile-player/ui/streamer-context-menu.js +7 -0
- package/dist/components/mobile-player/ui/streamer-loading-overlay.js +104 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +51 -0
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +49 -0
- package/dist/components/mobile-player/ui/viewers.js +23 -0
- package/dist/components/mobile-player/use-webrtc.js +243 -0
- package/dist/components/mobile-player/video-async.native.js +276 -0
- package/dist/components/mobile-player/video-retry.js +29 -0
- package/dist/components/mobile-player/video.js +475 -0
- package/dist/components/mobile-player/video.native.js +56 -0
- package/dist/components/mobile-player/webrtc-diagnostics.js +110 -0
- package/dist/components/mobile-player/webrtc-primitives.js +27 -0
- package/dist/components/mobile-player/webrtc-primitives.native.js +8 -0
- package/dist/components/share/sharesheet.js +91 -0
- package/dist/components/ui/button.js +223 -0
- package/dist/components/ui/dialog.js +206 -0
- package/dist/components/ui/dropdown.js +172 -0
- package/dist/components/ui/icons.js +25 -0
- package/dist/components/ui/index.js +34 -0
- package/dist/components/ui/info-box.js +31 -0
- package/dist/components/ui/info-row.js +23 -0
- package/dist/components/ui/input.js +205 -0
- package/dist/components/ui/loader.js +10 -0
- package/dist/components/ui/primitives/button.js +125 -0
- package/dist/components/ui/primitives/input.js +206 -0
- package/dist/components/ui/primitives/modal.js +206 -0
- package/dist/components/ui/primitives/text.js +292 -0
- package/dist/components/ui/resizeable.js +121 -0
- package/dist/components/ui/slider.js +5 -0
- package/dist/components/ui/text.js +177 -0
- package/dist/components/ui/textarea.js +19 -0
- package/dist/components/ui/toast.js +175 -0
- package/dist/components/ui/view.js +252 -0
- package/dist/hooks/index.js +14 -0
- package/dist/hooks/useAvatars.js +35 -0
- package/dist/hooks/useCameraToggle.js +12 -0
- package/dist/hooks/useKeyboard.js +36 -0
- package/dist/hooks/useKeyboardSlide.js +14 -0
- package/dist/hooks/useLivestreamInfo.js +69 -0
- package/dist/hooks/useOuterAndInnerDimensions.js +30 -0
- package/dist/hooks/usePlayerDimensions.js +22 -0
- package/dist/hooks/usePointerDevice.js +71 -0
- package/dist/hooks/useSegmentDimensions.js +17 -0
- package/dist/hooks/useSegmentTiming.js +65 -0
- package/dist/index.js +34 -0
- package/dist/lib/browser.js +35 -0
- package/dist/lib/facet.js +92 -0
- package/dist/lib/system-messages.js +101 -0
- package/dist/lib/theme/atoms.js +646 -0
- package/dist/lib/theme/atoms.types.js +6 -0
- package/dist/lib/theme/index.js +35 -0
- package/dist/lib/theme/theme.js +256 -0
- package/dist/lib/theme/tokens.js +659 -0
- package/dist/lib/utils.js +105 -0
- package/dist/livestream-provider/index.js +30 -0
- package/dist/livestream-provider/websocket.js +45 -0
- package/dist/livestream-store/chat.js +308 -0
- package/dist/livestream-store/context.js +5 -0
- package/dist/livestream-store/index.js +7 -0
- package/dist/livestream-store/livestream-state.js +2 -0
- package/dist/livestream-store/livestream-store.js +58 -0
- package/dist/livestream-store/problems.js +76 -0
- package/dist/livestream-store/stream-key.js +88 -0
- package/dist/livestream-store/websocket-consumer.js +94 -0
- package/dist/player-store/context.js +5 -0
- package/dist/player-store/index.js +9 -0
- package/dist/player-store/player-provider.js +58 -0
- package/dist/player-store/player-state.js +25 -0
- package/dist/player-store/player-store.js +201 -0
- package/dist/player-store/single-player-provider.js +121 -0
- package/dist/streamplace-provider/context.js +5 -0
- package/dist/streamplace-provider/index.js +20 -0
- package/dist/streamplace-provider/poller.js +49 -0
- package/dist/streamplace-provider/xrpc.js +0 -0
- package/dist/streamplace-store/block.js +65 -0
- package/dist/streamplace-store/index.js +6 -0
- package/dist/streamplace-store/stream.js +247 -0
- package/dist/streamplace-store/streamplace-store.js +47 -0
- package/dist/streamplace-store/user.js +52 -0
- package/dist/streamplace-store/xrpc.js +15 -0
- package/dist/ui/index.js +79 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +5 -4
- package/src/components/chat/chat-box.tsx +3 -0
- package/src/components/chat/mod-view.tsx +39 -5
- package/src/components/mobile-player/fullscreen.tsx +2 -0
- package/src/components/mobile-player/ui/autoplay-button.tsx +86 -0
- package/src/components/mobile-player/ui/index.ts +1 -0
- package/src/components/mobile-player/video.tsx +11 -1
- package/src/livestream-store/chat.tsx +22 -0
- package/src/player-store/player-provider.tsx +2 -1
- package/src/player-store/player-state.tsx +6 -0
- package/src/player-store/player-store.tsx +4 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropdownMenuInfo = exports.DropdownMenuGroup = exports.DropdownMenuSeparator = exports.DropdownMenuLabel = exports.DropdownMenuRadioItem = exports.DropdownMenuCheckboxItem = exports.DropdownMenuItem = exports.ResponsiveDropdownMenuContent = exports.DropdownMenuContentWithoutPortal = exports.DropdownMenuContent = exports.DropdownMenuSubContent = exports.DropdownMenuSubTrigger = exports.DropdownMenuBottomSheet = exports.DropdownMenuRadioGroup = exports.DropdownMenuSub = exports.DropdownMenuPortal = exports.DropdownMenuTrigger = exports.DropdownMenu = void 0;
|
|
4
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const bottom_sheet_1 = tslib_1.__importStar(require("@gorhom/bottom-sheet"));
|
|
8
|
+
const DropdownMenuPrimitive = tslib_1.__importStar(require("@rn-primitives/dropdown-menu"));
|
|
9
|
+
const lucide_react_native_1 = require("lucide-react-native");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const react_native_1 = require("react-native");
|
|
12
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
13
|
+
const text_1 = require("./primitives/text");
|
|
14
|
+
exports.DropdownMenu = DropdownMenuPrimitive.Root;
|
|
15
|
+
exports.DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
16
|
+
exports.DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
17
|
+
exports.DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
18
|
+
exports.DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
19
|
+
exports.DropdownMenuBottomSheet = (0, react_1.forwardRef)(function DropdownMenuBottomSheet({ overlayStyle, portalHost, children }, _ref) {
|
|
20
|
+
// Use the primitives' context to know if open
|
|
21
|
+
const { open, onOpenChange } = DropdownMenuPrimitive.useRootContext();
|
|
22
|
+
const snapPoints = (0, react_1.useMemo)(() => ["25%", "50%", "80%"], []);
|
|
23
|
+
const sheetRef = (0, react_1.useRef)(null);
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { hostName: portalHost, children: (0, jsx_runtime_1.jsx)(bottom_sheet_1.default, { ref: sheetRef,
|
|
25
|
+
// why the heck is this 1-indexed
|
|
26
|
+
index: open ? 3 : -1, snapPoints: snapPoints, enablePanDownToClose: true, enableDynamicSizing: true, enableContentPanningGesture: false, backdropComponent: ({ style }) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [style, react_native_1.StyleSheet.absoluteFill], onPress: () => onOpenChange?.(false) })), onClose: () => onOpenChange?.(false), style: [overlayStyle], backgroundStyle: [atoms_1.bg.black, atoms_1.a.radius.all.md, atoms_1.a.shadows.md, atoms_1.p[1]], handleIndicatorStyle: [
|
|
27
|
+
atoms_1.a.sizes.width[12],
|
|
28
|
+
atoms_1.a.sizes.height[1],
|
|
29
|
+
atoms_1.bg.gray[500],
|
|
30
|
+
], children: (0, jsx_runtime_1.jsx)(bottom_sheet_1.BottomSheetView, { style: [atoms_1.px[2]], children: typeof children === "function"
|
|
31
|
+
? children({ pressed: true })
|
|
32
|
+
: children }) }) }));
|
|
33
|
+
});
|
|
34
|
+
exports.DropdownMenuSubTrigger = (0, react_1.forwardRef)(({ inset, children, ...props }, ref) => {
|
|
35
|
+
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
36
|
+
const Icon = react_native_1.Platform.OS === "web" ? lucide_react_native_1.ChevronRight : open ? lucide_react_native_1.ChevronUp : lucide_react_native_1.ChevronDown;
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(text_1.TextContext.Provider, { value: (0, text_1.objectFromObjects)([
|
|
38
|
+
atoms_1.a.textColors.primary[500],
|
|
39
|
+
atoms_1.a.fontSize.base,
|
|
40
|
+
open && atoms_1.a.textColors.primary[700],
|
|
41
|
+
]), children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.SubTrigger, { ref: ref, ...props, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
42
|
+
inset && atoms_1.gap[2],
|
|
43
|
+
atoms_1.layout.flex.row,
|
|
44
|
+
atoms_1.layout.flex.alignCenter,
|
|
45
|
+
atoms_1.p[2],
|
|
46
|
+
atoms_1.pr[8],
|
|
47
|
+
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.a.layout.position.absolute, atoms_1.a.position.right[1]], children: (0, jsx_runtime_1.jsx)(Icon, { size: 18, color: atoms_1.colors.gray[200] }) })] }) }) }));
|
|
48
|
+
});
|
|
49
|
+
exports.DropdownMenuSubContent = (0, react_1.forwardRef)((props, ref) => {
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.SubContent, { ref: ref, style: [
|
|
51
|
+
atoms_1.a.zIndex[50],
|
|
52
|
+
atoms_1.a.sizes.minWidth[32],
|
|
53
|
+
atoms_1.a.overflow.hidden,
|
|
54
|
+
atoms_1.a.radius.all.md,
|
|
55
|
+
atoms_1.a.borders.width.thin,
|
|
56
|
+
atoms_1.a.borders.color.gray[600],
|
|
57
|
+
atoms_1.mt[1],
|
|
58
|
+
atoms_1.bg.black,
|
|
59
|
+
atoms_1.p[1],
|
|
60
|
+
atoms_1.a.shadows.md,
|
|
61
|
+
], ...props }));
|
|
62
|
+
});
|
|
63
|
+
exports.DropdownMenuContent = (0, react_1.forwardRef)(({ overlayStyle, portalHost, ...props }, ref) => {
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { hostName: portalHost, children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Overlay, { style: [
|
|
65
|
+
react_native_1.Platform.OS !== "web" ? react_native_1.StyleSheet.absoluteFill : undefined,
|
|
66
|
+
overlayStyle,
|
|
67
|
+
], children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Content, { ref: ref, style: [
|
|
68
|
+
atoms_1.a.zIndex[50],
|
|
69
|
+
atoms_1.a.sizes.minWidth[32],
|
|
70
|
+
atoms_1.a.sizes.maxWidth[64],
|
|
71
|
+
atoms_1.a.overflow.hidden,
|
|
72
|
+
atoms_1.a.radius.all.md,
|
|
73
|
+
atoms_1.a.borders.width.thin,
|
|
74
|
+
atoms_1.a.borders.color.gray[800],
|
|
75
|
+
atoms_1.bg.gray[950],
|
|
76
|
+
atoms_1.p[2],
|
|
77
|
+
atoms_1.a.shadows.md,
|
|
78
|
+
], ...props }) }) }));
|
|
79
|
+
});
|
|
80
|
+
exports.DropdownMenuContentWithoutPortal = (0, react_1.forwardRef)(({ overlayStyle, ...props }, ref) => {
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Overlay, { style: [
|
|
82
|
+
react_native_1.Platform.OS !== "web" ? react_native_1.StyleSheet.absoluteFill : undefined,
|
|
83
|
+
overlayStyle,
|
|
84
|
+
], children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Content, { ref: ref, style: [
|
|
85
|
+
{ zIndex: 999999 },
|
|
86
|
+
atoms_1.a.sizes.minWidth[32],
|
|
87
|
+
atoms_1.a.sizes.maxWidth[64],
|
|
88
|
+
atoms_1.a.overflow.hidden,
|
|
89
|
+
atoms_1.a.radius.all.md,
|
|
90
|
+
atoms_1.a.borders.width.thin,
|
|
91
|
+
atoms_1.a.borders.color.gray[800],
|
|
92
|
+
atoms_1.bg.gray[950],
|
|
93
|
+
atoms_1.p[2],
|
|
94
|
+
atoms_1.a.shadows.md,
|
|
95
|
+
], ...props }) }));
|
|
96
|
+
});
|
|
97
|
+
/// Responsive Dropdown Menu Content. On mobile this will render a *bottom sheet* that is **portaled to the root of the app**.
|
|
98
|
+
/// Prefer passing scoped content in as **otherwise it may crash the app**.
|
|
99
|
+
exports.ResponsiveDropdownMenuContent = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
|
|
100
|
+
const { width } = (0, react_native_1.useWindowDimensions)();
|
|
101
|
+
// On web, you might want to always use the normal dropdown
|
|
102
|
+
const isBottomSheet = react_native_1.Platform.OS !== "web" && width < 800;
|
|
103
|
+
if (isBottomSheet) {
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(exports.DropdownMenuBottomSheet, { ref: ref, ...props, children: children }));
|
|
105
|
+
}
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(exports.DropdownMenuContent, { ref: ref, ...props, children: children }));
|
|
107
|
+
});
|
|
108
|
+
exports.DropdownMenuItem = (0, react_1.forwardRef)(({ inset, disabled, style, children, ...props }, ref) => {
|
|
109
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { ...props, children: (0, jsx_runtime_1.jsx)(text_1.TextContext.Provider, { value: (0, text_1.objectFromObjects)([atoms_1.a.textColors.gray[900], atoms_1.a.fontSize.base]), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
110
|
+
atoms_1.a.layout.flex.row,
|
|
111
|
+
atoms_1.a.layout.flex.alignCenter,
|
|
112
|
+
atoms_1.a.radius.all.sm,
|
|
113
|
+
atoms_1.py[1],
|
|
114
|
+
atoms_1.pl[2],
|
|
115
|
+
atoms_1.pr[2],
|
|
116
|
+
], children: typeof children === "function"
|
|
117
|
+
? children({ pressed: true })
|
|
118
|
+
: children }) }) }));
|
|
119
|
+
});
|
|
120
|
+
exports.DropdownMenuCheckboxItem = (0, react_1.forwardRef)(({ children, checked, ...props }, ref) => {
|
|
121
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.CheckboxItem, { ref: ref, checked: checked, closeOnPress: props.closeOnPress || false, ...props, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
122
|
+
atoms_1.a.layout.flex.row,
|
|
123
|
+
atoms_1.a.layout.flex.alignCenter,
|
|
124
|
+
atoms_1.a.radius.all.sm,
|
|
125
|
+
atoms_1.py[1],
|
|
126
|
+
atoms_1.pl[2],
|
|
127
|
+
atoms_1.pr[2],
|
|
128
|
+
atoms_1.pr[8],
|
|
129
|
+
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: checked ? ((0, jsx_runtime_1.jsx)(lucide_react_native_1.CheckCircle, { size: 14, strokeWidth: 3, color: "white" })) : ((0, jsx_runtime_1.jsx)(lucide_react_native_1.Circle, { size: 14, strokeWidth: 3, color: atoms_1.a.colors.gray[400] })) })] }) }));
|
|
130
|
+
});
|
|
131
|
+
exports.DropdownMenuRadioItem = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.RadioItem, { ref: ref, closeOnPress: props.closeOnPress || false, ...props, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
133
|
+
atoms_1.a.layout.flex.row,
|
|
134
|
+
atoms_1.a.layout.flex.alignCenter,
|
|
135
|
+
atoms_1.a.radius.all.sm,
|
|
136
|
+
atoms_1.py[1],
|
|
137
|
+
atoms_1.pl[2],
|
|
138
|
+
atoms_1.pr[1],
|
|
139
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Check, { size: 14, strokeWidth: 3, color: "white" }) }) }), children] }) }));
|
|
140
|
+
});
|
|
141
|
+
exports.DropdownMenuLabel = (0, react_1.forwardRef)(({ inset, ...props }, ref) => {
|
|
142
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
|
|
143
|
+
atoms_1.px[2],
|
|
144
|
+
atoms_1.py[2],
|
|
145
|
+
atoms_1.a.textColors.gray[200],
|
|
146
|
+
atoms_1.a.fontSize.base,
|
|
147
|
+
inset && atoms_1.gap[2],
|
|
148
|
+
], ...props }));
|
|
149
|
+
});
|
|
150
|
+
exports.DropdownMenuSeparator = (0, react_1.forwardRef)((props, ref) => {
|
|
151
|
+
return (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [{ height: 0.5 }, atoms_1.bg.gray[800]], ...props });
|
|
152
|
+
});
|
|
153
|
+
function DropdownMenuShortcut(props) {
|
|
154
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
155
|
+
atoms_1.ml.auto,
|
|
156
|
+
atoms_1.a.textColors.gray[500],
|
|
157
|
+
atoms_1.a.fontSize.sm,
|
|
158
|
+
atoms_1.a.letterSpacing.widest,
|
|
159
|
+
], ...props }));
|
|
160
|
+
}
|
|
161
|
+
exports.DropdownMenuGroup = (0, react_1.forwardRef)((props, ref) => {
|
|
162
|
+
const { inset, title, children, ...rest } = props;
|
|
163
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [atoms_1.pt[2], inset && atoms_1.gap[2]], ref: ref, ...rest, children: [title && ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [atoms_1.textColors.gray[400], atoms_1.pb[1], atoms_1.pl[2]], children: title })), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
164
|
+
atoms_1.bg.gray[900],
|
|
165
|
+
react_native_1.Platform.OS === "web" ? [atoms_1.px[2], atoms_1.py[1]] : atoms_1.p[2],
|
|
166
|
+
atoms_1.gap.all[1],
|
|
167
|
+
{ borderRadius: atoms_1.borderRadius.lg },
|
|
168
|
+
], children: children })] }));
|
|
169
|
+
});
|
|
170
|
+
exports.DropdownMenuInfo = (0, react_1.forwardRef)(({ description, ...props }, ref) => {
|
|
171
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [atoms_1.textColors.gray[400], atoms_1.pt[1], atoms_1.pl[2], atoms_1.pb[2], atoms_1.fontSize.sm], children: description }));
|
|
172
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createThemedIcon = createThemedIcon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const theme_1 = require("../../lib/theme");
|
|
6
|
+
// Size mapping
|
|
7
|
+
const sizeMap = {
|
|
8
|
+
sm: 16,
|
|
9
|
+
md: 20,
|
|
10
|
+
lg: 24,
|
|
11
|
+
xl: 32,
|
|
12
|
+
};
|
|
13
|
+
// HOC to create themed icons
|
|
14
|
+
function createThemedIcon(IconComponent) {
|
|
15
|
+
return ({ variant = "default", size = "md", color, ...restProps }) => {
|
|
16
|
+
let theme = (0, theme_1.useTheme)(); // Ensure theme is available
|
|
17
|
+
// Calculate size
|
|
18
|
+
const iconSize = typeof size === "number" ? size : sizeMap[size];
|
|
19
|
+
// Calculate color if not provided using atoms
|
|
20
|
+
const iconColor = color ||
|
|
21
|
+
theme.theme.colors[variant] ||
|
|
22
|
+
theme.theme.colors.secondaryForeground;
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(IconComponent, { size: iconSize, color: iconColor, ...restProps }));
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextPrimitive = exports.ModalPrimitive = exports.InputPrimitive = exports.ButtonPrimitive = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Export primitive components
|
|
6
|
+
tslib_1.__exportStar(require("./primitives/button"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./primitives/input"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./primitives/modal"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./primitives/text"), exports);
|
|
10
|
+
// Export styled components
|
|
11
|
+
tslib_1.__exportStar(require("./button"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./dialog"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./dropdown"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./icons"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./info-box"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./info-row"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./input"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./loader"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./resizeable"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./slider"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./text"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./textarea"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./toast"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./view"), exports);
|
|
25
|
+
// Component collections for easy importing
|
|
26
|
+
var button_1 = require("./primitives/button");
|
|
27
|
+
Object.defineProperty(exports, "ButtonPrimitive", { enumerable: true, get: function () { return button_1.ButtonPrimitive; } });
|
|
28
|
+
var input_1 = require("./primitives/input");
|
|
29
|
+
Object.defineProperty(exports, "InputPrimitive", { enumerable: true, get: function () { return input_1.InputPrimitive; } });
|
|
30
|
+
var modal_1 = require("./primitives/modal");
|
|
31
|
+
Object.defineProperty(exports, "ModalPrimitive", { enumerable: true, get: function () { return modal_1.ModalPrimitive; } });
|
|
32
|
+
var text_1 = require("./primitives/text");
|
|
33
|
+
Object.defineProperty(exports, "TextPrimitive", { enumerable: true, get: function () { return text_1.TextPrimitive; } });
|
|
34
|
+
tslib_1.__exportStar(require("../../lib/theme"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfoBox = InfoBox;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
8
|
+
const { bg, r, p, text, layout, gap, flex } = zero;
|
|
9
|
+
function InfoBox({ icon: Icon, label, value, status = "neutral", }) {
|
|
10
|
+
const statusColors = {
|
|
11
|
+
good: text.green[400],
|
|
12
|
+
warning: text.yellow[400],
|
|
13
|
+
error: text.red[400],
|
|
14
|
+
neutral: text.white,
|
|
15
|
+
};
|
|
16
|
+
const statusColor = statusColors[status];
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
18
|
+
flex.values[1],
|
|
19
|
+
layout.flex.column,
|
|
20
|
+
layout.flex.spaceBetween,
|
|
21
|
+
layout.flex.alignCenter,
|
|
22
|
+
bg.neutral[700],
|
|
23
|
+
r.sm,
|
|
24
|
+
p[2],
|
|
25
|
+
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
26
|
+
layout.flex.row,
|
|
27
|
+
layout.flex.spaceBetween,
|
|
28
|
+
gap.all[3],
|
|
29
|
+
zero.w.percent[100],
|
|
30
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[100], { fontSize: 13, fontWeight: "500" }], children: label }), (0, jsx_runtime_1.jsx)(Icon, { size: 16, color: "#9ca3af" })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [layout.flex.align.end, zero.w.percent[100]], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [statusColor, { fontSize: 26, fontWeight: "600" }], children: value }) })] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfoRow = InfoRow;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
8
|
+
const { text, layout, py, gap } = zero;
|
|
9
|
+
function InfoRow({ icon: Icon, label, value, status = "neutral", }) {
|
|
10
|
+
const statusColors = {
|
|
11
|
+
good: text.green[400],
|
|
12
|
+
warning: text.yellow[400],
|
|
13
|
+
error: text.red[400],
|
|
14
|
+
neutral: text.white,
|
|
15
|
+
};
|
|
16
|
+
const statusColor = statusColors[status];
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
18
|
+
layout.flex.row,
|
|
19
|
+
layout.flex.spaceBetween,
|
|
20
|
+
layout.flex.alignCenter,
|
|
21
|
+
py[2],
|
|
22
|
+
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[3]], children: [(0, jsx_runtime_1.jsx)(Icon, { size: 16, color: "#9ca3af" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[300], { fontSize: 13, fontWeight: "500" }], children: label })] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [statusColor, { fontSize: 13, fontWeight: "600" }], children: value })] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inputVariants = exports.Input = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
7
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const theme_1 = require("../../lib/theme/theme");
|
|
10
|
+
const input_1 = require("./primitives/input");
|
|
11
|
+
const inputVariants = (0, class_variance_authority_1.cva)("", {
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: "default",
|
|
15
|
+
filled: "filled",
|
|
16
|
+
underlined: "underlined",
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
sm: "sm",
|
|
20
|
+
md: "md",
|
|
21
|
+
lg: "lg",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "default",
|
|
26
|
+
size: "md",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
exports.inputVariants = inputVariants;
|
|
30
|
+
exports.Input = (0, react_1.forwardRef)(({ variant = "default", size = "md", label, description, error, required = false, leftAddon, rightAddon, disabled = false, containerStyle, inputStyle, ...props }, ref) => {
|
|
31
|
+
const { theme } = (0, theme_1.useTheme)();
|
|
32
|
+
const [isFocused, setIsFocused] = react_1.default.useState(false);
|
|
33
|
+
const inputRef = react_1.default.useRef(null);
|
|
34
|
+
// Create dynamic styles based on theme
|
|
35
|
+
const styles = react_1.default.useMemo(() => createStyles(theme), [theme]);
|
|
36
|
+
// Get variant and size styles
|
|
37
|
+
const containerStyles = react_1.default.useMemo(() => {
|
|
38
|
+
const variantStyle = styles[`${variant}Container`];
|
|
39
|
+
const sizeStyle = styles[`${size}Container`];
|
|
40
|
+
const focusStyle = isFocused ? styles.focusedContainer : null;
|
|
41
|
+
return [variantStyle, sizeStyle, focusStyle];
|
|
42
|
+
}, [variant, size, styles, isFocused]);
|
|
43
|
+
const textStyles = react_1.default.useMemo(() => {
|
|
44
|
+
const variantTextStyle = styles[`${variant}Input`];
|
|
45
|
+
const sizeTextStyle = styles[`${size}Input`];
|
|
46
|
+
return [variantTextStyle, sizeTextStyle];
|
|
47
|
+
}, [variant, size, styles]);
|
|
48
|
+
const handleFocus = react_1.default.useCallback((event) => {
|
|
49
|
+
setIsFocused(true);
|
|
50
|
+
if (props.onFocus) {
|
|
51
|
+
props.onFocus(event);
|
|
52
|
+
}
|
|
53
|
+
}, [props.onFocus]);
|
|
54
|
+
const handleBlur = react_1.default.useCallback((event) => {
|
|
55
|
+
setIsFocused(false);
|
|
56
|
+
if (props.onBlur) {
|
|
57
|
+
props.onBlur(event);
|
|
58
|
+
}
|
|
59
|
+
}, [props.onBlur]);
|
|
60
|
+
const handleContainerPress = react_1.default.useCallback(() => {
|
|
61
|
+
if (inputRef.current && !disabled) {
|
|
62
|
+
inputRef.current.focus();
|
|
63
|
+
}
|
|
64
|
+
}, [disabled]);
|
|
65
|
+
const hasAddons = leftAddon || rightAddon;
|
|
66
|
+
if (hasAddons) {
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(input_1.InputPrimitive.Group, { children: [label && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Label, { required: required, disabled: disabled, error: !!error, children: label })), (0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { onPress: handleContainerPress, children: (0, jsx_runtime_1.jsxs)(input_1.InputPrimitive.Container, { focused: isFocused, error: !!error, disabled: disabled, style: [containerStyles, containerStyle, { padding: 0 }], children: [leftAddon && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Addon, { position: "left", children: leftAddon })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Root, { ref: (node) => {
|
|
68
|
+
inputRef.current = node;
|
|
69
|
+
if (ref) {
|
|
70
|
+
if (typeof ref === "function") {
|
|
71
|
+
ref(node);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
ref.current = node;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, disabled: disabled, error: !!error, onFocus: handleFocus, onBlur: handleBlur, style: [
|
|
78
|
+
textStyles,
|
|
79
|
+
styles.inputInContainer,
|
|
80
|
+
inputStyle,
|
|
81
|
+
{ outline: "none" },
|
|
82
|
+
], placeholderTextColor: disabled ? theme.colors.textDisabled : theme.colors.textMuted, ...props }), rightAddon && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Addon, { position: "right", children: rightAddon }))] }) }), description && !error && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Description, { disabled: disabled, children: description })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Error, { visible: !!error, children: error })] }));
|
|
83
|
+
}
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(input_1.InputPrimitive.Group, { children: [label && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Label, { required: required, disabled: disabled, error: !!error, children: label })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Root, { ref: (node) => {
|
|
85
|
+
inputRef.current = node;
|
|
86
|
+
if (ref) {
|
|
87
|
+
if (typeof ref === "function") {
|
|
88
|
+
ref(node);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
ref.current = node;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, disabled: disabled, error: !!error, onFocus: handleFocus, onBlur: handleBlur, style: [containerStyles, textStyles, containerStyle, inputStyle], placeholderTextColor: disabled ? theme.colors.textDisabled : theme.colors.textMuted, ...props }), description && !error && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Description, { disabled: disabled, children: description })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Error, { visible: !!error, children: error })] }));
|
|
95
|
+
});
|
|
96
|
+
exports.Input.displayName = "Input";
|
|
97
|
+
// Create theme-aware styles
|
|
98
|
+
function createStyles(theme) {
|
|
99
|
+
return react_native_1.StyleSheet.create({
|
|
100
|
+
// Variant styles for containers
|
|
101
|
+
defaultContainer: {
|
|
102
|
+
backgroundColor: theme.colors.background,
|
|
103
|
+
borderWidth: 1,
|
|
104
|
+
borderColor: theme.colors.border,
|
|
105
|
+
borderRadius: theme.borderRadius.md,
|
|
106
|
+
},
|
|
107
|
+
filledContainer: {
|
|
108
|
+
backgroundColor: theme.colors.muted,
|
|
109
|
+
borderWidth: 0,
|
|
110
|
+
borderRadius: theme.borderRadius.md,
|
|
111
|
+
},
|
|
112
|
+
underlinedContainer: {
|
|
113
|
+
backgroundColor: "transparent",
|
|
114
|
+
borderWidth: 0,
|
|
115
|
+
borderBottomWidth: 1,
|
|
116
|
+
borderBottomColor: theme.colors.border,
|
|
117
|
+
borderRadius: 0,
|
|
118
|
+
paddingHorizontal: 0,
|
|
119
|
+
},
|
|
120
|
+
// Variant styles for inputs
|
|
121
|
+
defaultInput: {
|
|
122
|
+
color: theme.colors.text,
|
|
123
|
+
backgroundColor: "transparent",
|
|
124
|
+
},
|
|
125
|
+
filledInput: {
|
|
126
|
+
color: theme.colors.text,
|
|
127
|
+
backgroundColor: "transparent",
|
|
128
|
+
},
|
|
129
|
+
underlinedInput: {
|
|
130
|
+
color: theme.colors.text,
|
|
131
|
+
backgroundColor: "transparent",
|
|
132
|
+
},
|
|
133
|
+
// Size styles for containers
|
|
134
|
+
smContainer: {
|
|
135
|
+
paddingHorizontal: theme.spacing[3],
|
|
136
|
+
paddingVertical: theme.spacing[2],
|
|
137
|
+
minHeight: theme.touchTargets.minimum - 8,
|
|
138
|
+
},
|
|
139
|
+
mdContainer: {
|
|
140
|
+
paddingHorizontal: theme.spacing[3],
|
|
141
|
+
paddingVertical: theme.spacing[3],
|
|
142
|
+
minHeight: theme.touchTargets.minimum,
|
|
143
|
+
},
|
|
144
|
+
lgContainer: {
|
|
145
|
+
paddingHorizontal: theme.spacing[4],
|
|
146
|
+
paddingVertical: theme.spacing[4],
|
|
147
|
+
minHeight: theme.touchTargets.comfortable,
|
|
148
|
+
},
|
|
149
|
+
// Size styles for inputs
|
|
150
|
+
smInput: {
|
|
151
|
+
fontSize: 14,
|
|
152
|
+
lineHeight: 18,
|
|
153
|
+
...react_native_1.Platform.select({
|
|
154
|
+
ios: {
|
|
155
|
+
paddingVertical: 0,
|
|
156
|
+
},
|
|
157
|
+
android: {
|
|
158
|
+
paddingVertical: 0,
|
|
159
|
+
textAlignVertical: "center",
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
mdInput: {
|
|
164
|
+
fontSize: 16,
|
|
165
|
+
lineHeight: 20,
|
|
166
|
+
...react_native_1.Platform.select({
|
|
167
|
+
ios: {
|
|
168
|
+
paddingVertical: 0,
|
|
169
|
+
},
|
|
170
|
+
android: {
|
|
171
|
+
paddingVertical: 0,
|
|
172
|
+
textAlignVertical: "center",
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
176
|
+
lgInput: {
|
|
177
|
+
fontSize: 18,
|
|
178
|
+
lineHeight: 22,
|
|
179
|
+
...react_native_1.Platform.select({
|
|
180
|
+
ios: {
|
|
181
|
+
paddingVertical: 0,
|
|
182
|
+
},
|
|
183
|
+
android: {
|
|
184
|
+
paddingVertical: 0,
|
|
185
|
+
textAlignVertical: "center",
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
// Special style for inputs inside containers
|
|
190
|
+
inputInContainer: {
|
|
191
|
+
flex: 1,
|
|
192
|
+
paddingHorizontal: 0,
|
|
193
|
+
paddingVertical: 0,
|
|
194
|
+
borderWidth: 0,
|
|
195
|
+
backgroundColor: "transparent",
|
|
196
|
+
minHeight: "auto",
|
|
197
|
+
borderRadius: 0,
|
|
198
|
+
},
|
|
199
|
+
// Focus styles
|
|
200
|
+
focusedContainer: {
|
|
201
|
+
borderColor: theme.colors.primary,
|
|
202
|
+
borderWidth: 1,
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Loader = Loader;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../../lib/theme");
|
|
7
|
+
function Loader(props) {
|
|
8
|
+
const { theme } = (0, theme_1.useTheme)();
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: theme.colors.primary, ...props });
|
|
10
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonPrimitive = exports.ButtonContent = exports.ButtonLoading = exports.ButtonIcon = exports.ButtonText = exports.ButtonRoot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
// Button root primitive - handles all touch interactions
|
|
9
|
+
exports.ButtonRoot = (0, react_1.forwardRef)(({ children, disabled = false, loading = false, onPress, onPressIn, onPressOut, onLongPress, accessibilityRole = "button", accessibilityLabel, accessibilityHint, accessibilityState, testID, style, activeOpacity = 0.7, ...props }, ref) => {
|
|
10
|
+
const handlePress = react_1.default.useCallback((event) => {
|
|
11
|
+
if (!disabled && !loading && onPress) {
|
|
12
|
+
onPress(event);
|
|
13
|
+
}
|
|
14
|
+
}, [disabled, loading, onPress]);
|
|
15
|
+
const handlePressIn = react_1.default.useCallback((event) => {
|
|
16
|
+
if (!disabled && !loading && onPressIn) {
|
|
17
|
+
onPressIn(event);
|
|
18
|
+
}
|
|
19
|
+
}, [disabled, loading, onPressIn]);
|
|
20
|
+
const handlePressOut = react_1.default.useCallback((event) => {
|
|
21
|
+
if (!disabled && !loading && onPressOut) {
|
|
22
|
+
onPressOut(event);
|
|
23
|
+
}
|
|
24
|
+
}, [disabled, loading, onPressOut]);
|
|
25
|
+
const handleLongPress = react_1.default.useCallback((event) => {
|
|
26
|
+
if (!disabled && !loading && onLongPress) {
|
|
27
|
+
onLongPress(event);
|
|
28
|
+
}
|
|
29
|
+
}, [disabled, loading, onLongPress]);
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, onPress: handlePress, onPressIn: handlePressIn, onPressOut: handlePressOut, onLongPress: handleLongPress, disabled: disabled || loading, activeOpacity: disabled || loading ? 1 : activeOpacity, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, accessibilityState: {
|
|
31
|
+
disabled: disabled || loading,
|
|
32
|
+
busy: loading,
|
|
33
|
+
...accessibilityState,
|
|
34
|
+
}, testID: testID, style: [
|
|
35
|
+
primitiveStyles.button,
|
|
36
|
+
(disabled || loading) && primitiveStyles.disabled,
|
|
37
|
+
style,
|
|
38
|
+
], ...props, children: children }));
|
|
39
|
+
});
|
|
40
|
+
exports.ButtonRoot.displayName = "ButtonRoot";
|
|
41
|
+
exports.ButtonText = (0, react_1.forwardRef)(({ children, disabled, loading, style, ...props }, ref) => {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
|
|
43
|
+
primitiveStyles.text,
|
|
44
|
+
(disabled || loading) && primitiveStyles.textDisabled,
|
|
45
|
+
style,
|
|
46
|
+
], ...props, children: children }));
|
|
47
|
+
});
|
|
48
|
+
exports.ButtonText.displayName = "ButtonText";
|
|
49
|
+
exports.ButtonIcon = (0, react_1.forwardRef)(({ children, position = "left", disabled, loading, style, ...props }, ref) => {
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
|
|
51
|
+
primitiveStyles.icon,
|
|
52
|
+
(disabled || loading) && primitiveStyles.iconDisabled,
|
|
53
|
+
style,
|
|
54
|
+
], ...props, children: children }));
|
|
55
|
+
});
|
|
56
|
+
exports.ButtonIcon.displayName = "ButtonIcon";
|
|
57
|
+
exports.ButtonLoading = (0, react_1.forwardRef)(({ children, visible = false, style, ...props }, ref) => {
|
|
58
|
+
if (!visible)
|
|
59
|
+
return null;
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.loading, style], ...props, children: children }));
|
|
61
|
+
});
|
|
62
|
+
exports.ButtonLoading.displayName = "ButtonLoading";
|
|
63
|
+
exports.ButtonContent = (0, react_1.forwardRef)(({ children, direction = "row", align = "center", justify = "center", style, ...props }, ref) => {
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
|
|
65
|
+
primitiveStyles.content,
|
|
66
|
+
{
|
|
67
|
+
flexDirection: direction,
|
|
68
|
+
alignItems: align,
|
|
69
|
+
justifyContent: justify,
|
|
70
|
+
},
|
|
71
|
+
style,
|
|
72
|
+
], ...props, children: children }));
|
|
73
|
+
});
|
|
74
|
+
exports.ButtonContent.displayName = "ButtonContent";
|
|
75
|
+
// Primitive styles (minimal, unstyled)
|
|
76
|
+
const primitiveStyles = react_native_1.StyleSheet.create({
|
|
77
|
+
button: {
|
|
78
|
+
flexDirection: "row",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
justifyContent: "center",
|
|
81
|
+
minHeight: 44, // iOS minimum touch target
|
|
82
|
+
minWidth: 44,
|
|
83
|
+
},
|
|
84
|
+
disabled: {
|
|
85
|
+
opacity: 0.5,
|
|
86
|
+
},
|
|
87
|
+
content: {
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
justifyContent: "center",
|
|
91
|
+
flex: 1,
|
|
92
|
+
},
|
|
93
|
+
text: {
|
|
94
|
+
textAlign: "center",
|
|
95
|
+
},
|
|
96
|
+
textDisabled: {
|
|
97
|
+
opacity: 0.5,
|
|
98
|
+
},
|
|
99
|
+
icon: {
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
},
|
|
103
|
+
iconLeft: {
|
|
104
|
+
marginRight: 8,
|
|
105
|
+
},
|
|
106
|
+
iconRight: {
|
|
107
|
+
marginLeft: 8,
|
|
108
|
+
},
|
|
109
|
+
iconDisabled: {
|
|
110
|
+
opacity: 0.5,
|
|
111
|
+
},
|
|
112
|
+
loading: {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
justifyContent: "center",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
// Export primitive collection
|
|
119
|
+
exports.ButtonPrimitive = {
|
|
120
|
+
Root: exports.ButtonRoot,
|
|
121
|
+
Text: exports.ButtonText,
|
|
122
|
+
Icon: exports.ButtonIcon,
|
|
123
|
+
Loading: exports.ButtonLoading,
|
|
124
|
+
Content: exports.ButtonContent,
|
|
125
|
+
};
|