react-native-tinyui 0.3.0 → 0.5.0
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/README.md +70 -2
- package/Tinyui.podspec +7 -1
- package/ios/Core/Tinyui.mm +4 -0
- package/ios/Core/TinyuiComponentClasses.mm +35 -9
- package/ios/LiquidGlassText/GlassText-LICENSE +21 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextProvider.swift +250 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextShadowNode.h +46 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextShadowNode.mm +159 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextView.h +12 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextView.mm +63 -0
- package/ios/LiquidGlassText/TinyuiTextOutlineShape.swift +116 -0
- package/ios/Menu/TinyuiMenuProvider.swift +2 -2
- package/ios/Menu/TinyuiMenuView.mm +2 -1
- package/ios/Menu/TinyuiMenuViewSwift.swift +42 -124
- package/lib/module/LiquidGlassText/LiquidGlassTextNativeComponent.ts +16 -0
- package/lib/module/LiquidGlassText/index.js +87 -0
- package/lib/module/LiquidGlassText/index.js.map +1 -0
- package/lib/module/LiquidGlassText/types.js +4 -0
- package/lib/module/LiquidGlassText/types.js.map +1 -0
- package/lib/module/{MenuNativeComponent.ts → Menu/MenuNativeComponent.ts} +6 -2
- package/lib/module/{Menu.js → Menu/index.js} +3 -3
- package/lib/module/Menu/index.js.map +1 -0
- package/lib/module/{MenuOptions.js → Menu/options.js} +3 -3
- package/lib/module/Menu/options.js.map +1 -0
- package/lib/module/Menu/types.js +4 -0
- package/lib/module/Menu/types.js.map +1 -0
- package/lib/module/{PopoverPrimitives.js → Popover/PopoverClose.js} +1 -1
- package/lib/module/Popover/PopoverClose.js.map +1 -0
- package/lib/module/{Popover.js → Popover/index.js} +3 -3
- package/lib/module/Popover/index.js.map +1 -0
- package/lib/module/Popover/types.js +4 -0
- package/lib/module/Popover/types.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/{getNativeTinyui.js → utils/getNativeTinyui.js} +1 -1
- package/lib/module/utils/getNativeTinyui.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/src/LiquidGlassText/LiquidGlassTextNativeComponent.d.ts +8 -0
- package/lib/typescript/src/LiquidGlassText/LiquidGlassTextNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/LiquidGlassText/index.d.ts +4 -0
- package/lib/typescript/src/LiquidGlassText/index.d.ts.map +1 -0
- package/lib/typescript/src/LiquidGlassText/types.d.ts +22 -0
- package/lib/typescript/src/LiquidGlassText/types.d.ts.map +1 -0
- package/lib/typescript/src/{MenuNativeComponent.d.ts → Menu/MenuNativeComponent.d.ts} +2 -2
- package/lib/typescript/src/Menu/MenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/{Menu.d.ts → Menu/index.d.ts} +3 -3
- package/lib/typescript/src/Menu/index.d.ts.map +1 -0
- package/lib/typescript/src/Menu/options.d.ts +47 -0
- package/lib/typescript/src/Menu/options.d.ts.map +1 -0
- package/lib/typescript/src/{Menu.types.d.ts → Menu/types.d.ts} +1 -1
- package/lib/typescript/src/Menu/types.d.ts.map +1 -0
- package/lib/typescript/src/{PopoverPrimitives.d.ts → Popover/PopoverClose.d.ts} +2 -2
- package/lib/typescript/src/Popover/PopoverClose.d.ts.map +1 -0
- package/lib/typescript/src/Popover/PopoverNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/Popover/index.d.ts +8 -0
- package/lib/typescript/src/Popover/index.d.ts.map +1 -0
- package/lib/typescript/src/{Popover.types.d.ts → Popover/types.d.ts} +1 -1
- package/lib/typescript/src/Popover/types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/{getNativeTinyui.d.ts → utils/getNativeTinyui.d.ts} +2 -2
- package/lib/typescript/src/utils/getNativeTinyui.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +3 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +19 -10
- package/src/LiquidGlassText/LiquidGlassTextNativeComponent.ts +16 -0
- package/src/LiquidGlassText/index.tsx +113 -0
- package/src/LiquidGlassText/types.ts +37 -0
- package/src/{MenuNativeComponent.ts → Menu/MenuNativeComponent.ts} +6 -2
- package/src/{Menu.tsx → Menu/index.tsx} +4 -4
- package/src/{MenuOptions.ts → Menu/options.ts} +7 -3
- package/src/{PopoverPrimitives.tsx → Popover/PopoverClose.tsx} +1 -1
- package/src/{Popover.tsx → Popover/index.tsx} +12 -3
- package/src/index.tsx +12 -4
- package/src/react-native.d.ts +1 -0
- package/src/{getNativeTinyui.ts → utils/getNativeTinyui.ts} +2 -2
- package/src/utils/index.ts +2 -0
- package/lib/module/Menu.js.map +0 -1
- package/lib/module/Menu.types.js +0 -4
- package/lib/module/Menu.types.js.map +0 -1
- package/lib/module/MenuOptions.js.map +0 -1
- package/lib/module/Popover.js.map +0 -1
- package/lib/module/Popover.types.js +0 -4
- package/lib/module/Popover.types.js.map +0 -1
- package/lib/module/PopoverPrimitives.js.map +0 -1
- package/lib/module/getNativeTinyui.js.map +0 -1
- package/lib/typescript/src/Menu.d.ts.map +0 -1
- package/lib/typescript/src/Menu.types.d.ts.map +0 -1
- package/lib/typescript/src/MenuNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/MenuOptions.d.ts +0 -7
- package/lib/typescript/src/MenuOptions.d.ts.map +0 -1
- package/lib/typescript/src/Popover.d.ts +0 -7
- package/lib/typescript/src/Popover.d.ts.map +0 -1
- package/lib/typescript/src/Popover.types.d.ts.map +0 -1
- package/lib/typescript/src/PopoverNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/PopoverPrimitives.d.ts.map +0 -1
- package/lib/typescript/src/getNativeTinyui.d.ts.map +0 -1
- /package/lib/module/{PopoverNativeComponent.ts → Popover/PopoverNativeComponent.ts} +0 -0
- /package/lib/typescript/src/{PopoverNativeComponent.d.ts → Popover/PopoverNativeComponent.d.ts} +0 -0
- /package/src/{Menu.types.ts → Menu/types.ts} +0 -0
- /package/src/{PopoverNativeComponent.ts → Popover/PopoverNativeComponent.ts} +0 -0
- /package/src/{Popover.types.ts → Popover/types.ts} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#if TINYUI_FEATURE_LIQUID_GLASS_TEXT
|
|
2
|
+
|
|
3
|
+
#import "TinyuiLiquidGlassTextView.h"
|
|
4
|
+
|
|
5
|
+
#import <React/RCTConversions.h>
|
|
6
|
+
#import <React/UIView+React.h>
|
|
7
|
+
#import <react/utils/FollyConvert.h>
|
|
8
|
+
#import <react/renderer/components/TinyuiSpec/Props.h>
|
|
9
|
+
#import <react/renderer/components/TinyuiSpec/RCTComponentViewHelpers.h>
|
|
10
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
11
|
+
#import "Tinyui-Swift.h"
|
|
12
|
+
#import "TinyuiLiquidGlassTextShadowNode.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
@interface TinyuiLiquidGlassTextView () <RCTTinyuiLiquidGlassTextViewViewProtocol>
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@implementation TinyuiLiquidGlassTextView {
|
|
20
|
+
TinyuiLiquidGlassTextProvider *_provider;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
24
|
+
{
|
|
25
|
+
return concreteComponentDescriptorProvider<TinyuiLiquidGlassTextComponentDescriptor>();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
29
|
+
{
|
|
30
|
+
if (self = [super initWithFrame:frame]) {
|
|
31
|
+
static const auto defaultProps = std::make_shared<const TinyuiLiquidGlassTextViewProps>();
|
|
32
|
+
_props = defaultProps;
|
|
33
|
+
_provider = [[TinyuiLiquidGlassTextProvider alloc] initWithFrame:CGRectZero];
|
|
34
|
+
self.contentView = _provider;
|
|
35
|
+
}
|
|
36
|
+
return self;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (void)didMoveToWindow
|
|
40
|
+
{
|
|
41
|
+
[super didMoveToWindow];
|
|
42
|
+
if (self.window != nil) {
|
|
43
|
+
_provider.parentViewController = [self reactViewController];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
48
|
+
{
|
|
49
|
+
const auto &newProps = *std::static_pointer_cast<TinyuiLiquidGlassTextViewProps const>(props);
|
|
50
|
+
[_provider configure:convertFollyDynamicToId(newProps.configuration)
|
|
51
|
+
tintColor:RCTUIColorFromSharedColor(newProps.tintColor)];
|
|
52
|
+
[super updateProps:props oldProps:oldProps];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)prepareForRecycle
|
|
56
|
+
{
|
|
57
|
+
[_provider reset];
|
|
58
|
+
[super prepareForRecycle];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@end
|
|
62
|
+
|
|
63
|
+
#endif
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Adapted from ailtonvivaz/GlassText (MIT). See GlassText-LICENSE.
|
|
2
|
+
//
|
|
3
|
+
// TextOutlineShape.swift
|
|
4
|
+
// GlassText
|
|
5
|
+
//
|
|
6
|
+
// Created by Ailton Vieira on 17/08/25.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import CoreGraphics
|
|
10
|
+
@preconcurrency import CoreText
|
|
11
|
+
import SwiftUI
|
|
12
|
+
|
|
13
|
+
/// A SwiftUI Shape that creates text outline paths for glass morphism effects
|
|
14
|
+
struct TinyuiTextOutlineShape: Shape {
|
|
15
|
+
var text: String
|
|
16
|
+
var ctFont: CTFont
|
|
17
|
+
var fontSize: CGFloat
|
|
18
|
+
var alignment: TextAlignment = .center
|
|
19
|
+
var letterSpacing: CGFloat = 0
|
|
20
|
+
|
|
21
|
+
func path(in rect: CGRect) -> Path {
|
|
22
|
+
// Split into explicit lines (no wrapping here)
|
|
23
|
+
let rawLines = text.components(separatedBy: CharacterSet.newlines)
|
|
24
|
+
|
|
25
|
+
// Pre-create CTLine objects to leverage CoreText shaping for complex scripts
|
|
26
|
+
var ctLines: [CTLine] = []
|
|
27
|
+
ctLines.reserveCapacity(rawLines.count)
|
|
28
|
+
|
|
29
|
+
for l in rawLines {
|
|
30
|
+
let attr: [NSAttributedString.Key: Any] = [
|
|
31
|
+
kCTFontAttributeName as NSAttributedString.Key: ctFont,
|
|
32
|
+
kCTKernAttributeName as NSAttributedString.Key: letterSpacing,
|
|
33
|
+
]
|
|
34
|
+
let astr = NSAttributedString(string: l, attributes: attr)
|
|
35
|
+
let line = CTLineCreateWithAttributedString(astr)
|
|
36
|
+
ctLines.append(line)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Metrics (we still stack lines with a uniform height derived from base font)
|
|
40
|
+
let ascent = CTFontGetAscent(ctFont)
|
|
41
|
+
let descent = CTFontGetDescent(ctFont)
|
|
42
|
+
let leading = CTFontGetLeading(ctFont)
|
|
43
|
+
let lineHeight = ascent + descent + max(leading, CTFontGetSize(ctFont) * 0.2)
|
|
44
|
+
|
|
45
|
+
// Determine widths using typographic bounds for each CTLine (better for scripts & ligatures)
|
|
46
|
+
var lineWidths: [CGFloat] = []
|
|
47
|
+
var maxWidth: CGFloat = 0
|
|
48
|
+
for line in ctLines {
|
|
49
|
+
let w = CGFloat(CTLineGetTypographicBounds(line, nil, nil, nil))
|
|
50
|
+
lineWidths.append(w)
|
|
51
|
+
maxWidth = max(maxWidth, w)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Build combined path aggregating each run's glyphs & positions
|
|
55
|
+
let combined = CGMutablePath()
|
|
56
|
+
for (idx, line) in ctLines.enumerated() {
|
|
57
|
+
// Position baseline for this line (stack downward later flipped)
|
|
58
|
+
let penY = -CGFloat(idx) * lineHeight
|
|
59
|
+
let lineWidth = lineWidths[idx]
|
|
60
|
+
|
|
61
|
+
// Alignment offset
|
|
62
|
+
let startX: CGFloat
|
|
63
|
+
switch alignment {
|
|
64
|
+
case .leading: startX = 0
|
|
65
|
+
case .center: startX = (maxWidth - lineWidth) / 2
|
|
66
|
+
case .trailing: startX = maxWidth - lineWidth
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Iterate glyph runs (handles complex scripts, clusters & ligatures)
|
|
70
|
+
let runs = CTLineGetGlyphRuns(line) as NSArray
|
|
71
|
+
for runObj in runs {
|
|
72
|
+
let run = runObj as! CTRun // Safe cast (CoreFoundation bridging)
|
|
73
|
+
let glyphCount = CTRunGetGlyphCount(run)
|
|
74
|
+
if glyphCount == 0 { continue }
|
|
75
|
+
|
|
76
|
+
// Extract glyphs & positions
|
|
77
|
+
var glyphs = Array(repeating: CGGlyph(), count: glyphCount)
|
|
78
|
+
var positions = Array(repeating: CGPoint.zero, count: glyphCount)
|
|
79
|
+
CTRunGetGlyphs(run, CFRange(location: 0, length: 0), &glyphs)
|
|
80
|
+
CTRunGetPositions(run, CFRange(location: 0, length: 0), &positions)
|
|
81
|
+
|
|
82
|
+
// Run font (may differ due to fallback)
|
|
83
|
+
let attrs = CTRunGetAttributes(run) as NSDictionary
|
|
84
|
+
let runFont = (attrs[kCTFontAttributeName] as! CTFont)
|
|
85
|
+
|
|
86
|
+
for i in 0 ..< glyphCount {
|
|
87
|
+
let g = glyphs[i]
|
|
88
|
+
guard let gPath = CTFontCreatePathForGlyph(runFont, g, nil) else { continue }
|
|
89
|
+
var t = CGAffineTransform(
|
|
90
|
+
translationX: startX + positions[i].x,
|
|
91
|
+
y: penY + positions[i].y
|
|
92
|
+
)
|
|
93
|
+
if let shifted = gPath.copy(using: &t) {
|
|
94
|
+
combined.addPath(shifted)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if combined.isEmpty { return Path() }
|
|
101
|
+
|
|
102
|
+
// Normalize & center similar to previous approach
|
|
103
|
+
let bbox = combined.boundingBoxOfPath
|
|
104
|
+
var toOrigin = CGAffineTransform(translationX: -bbox.minX, y: -bbox.minY)
|
|
105
|
+
let norm = combined.copy(using: &toOrigin) ?? combined
|
|
106
|
+
var flip = CGAffineTransform(scaleX: 1, y: -1)
|
|
107
|
+
let flipped = norm.copy(using: &flip) ?? norm
|
|
108
|
+
let finalBBox = flipped.boundingBoxOfPath
|
|
109
|
+
var centerT = CGAffineTransform(
|
|
110
|
+
translationX: rect.midX - finalBBox.midX,
|
|
111
|
+
y: rect.midY - finalBBox.midY
|
|
112
|
+
)
|
|
113
|
+
let finalCG = flipped.copy(using: ¢erT) ?? flipped
|
|
114
|
+
return Path(finalCG)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -31,8 +31,8 @@ import UIKit
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
///
|
|
35
|
-
@objc public var menuConfig: String =
|
|
34
|
+
/// Menu configuration passed to the SwiftUI view.
|
|
35
|
+
@objc public var menuConfig: [String: Any] = [:] {
|
|
36
36
|
didSet {
|
|
37
37
|
props.menuConfig = menuConfig
|
|
38
38
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#import <React/RCTConversions.h>
|
|
6
6
|
#import <React/UIView+React.h>
|
|
7
|
+
#import <react/utils/FollyConvert.h>
|
|
7
8
|
|
|
8
9
|
#import <react/renderer/components/TinyuiSpec/ComponentDescriptors.h>
|
|
9
10
|
#import <react/renderer/components/TinyuiSpec/EventEmitters.h>
|
|
@@ -82,7 +83,7 @@ using namespace facebook::react;
|
|
|
82
83
|
const auto &newMenuProps = *std::static_pointer_cast<TinyuiMenuViewProps const>(props);
|
|
83
84
|
|
|
84
85
|
if (oldMenuProps.menuConfig != newMenuProps.menuConfig) {
|
|
85
|
-
_menuProvider.menuConfig =
|
|
86
|
+
_menuProvider.menuConfig = convertFollyDynamicToId(newMenuProps.menuConfig);
|
|
86
87
|
}
|
|
87
88
|
if (oldMenuProps.title != newMenuProps.title) {
|
|
88
89
|
_menuProvider.title = RCTNSStringFromString(newMenuProps.title);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React
|
|
1
2
|
import SwiftUI
|
|
2
3
|
import UIKit
|
|
3
4
|
|
|
@@ -6,7 +7,7 @@ import UIKit
|
|
|
6
7
|
* SwiftUI `Menu` implementation. Mirror of `TinyuiMenuProps` in codegen.
|
|
7
8
|
*/
|
|
8
9
|
class TinyuiMenuProps: ObservableObject {
|
|
9
|
-
@Published var menuConfig: String =
|
|
10
|
+
@Published var menuConfig: [String: Any] = [:]
|
|
10
11
|
@Published var title: String = ""
|
|
11
12
|
@Published var disabled: Bool = false
|
|
12
13
|
@Published var hasPrimaryAction: Bool = false
|
|
@@ -18,7 +19,7 @@ class TinyuiMenuProps: ObservableObject {
|
|
|
18
19
|
*
|
|
19
20
|
* The React Native trigger (a UIView) is embedded as the menu label through
|
|
20
21
|
* `RepresentableView`, so the tap target remains the native RN subtree while
|
|
21
|
-
* the menu content is built natively from the
|
|
22
|
+
* the menu content is built natively from the configuration object.
|
|
22
23
|
*
|
|
23
24
|
* Named distinctly from the Fabric component view `TinyuiMenuView`.
|
|
24
25
|
*/
|
|
@@ -74,13 +75,9 @@ struct TinyuiMenuSwiftUIView: View {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
///
|
|
78
|
-
private func buildElements(from
|
|
79
|
-
guard
|
|
80
|
-
let data = json.data(using: .utf8),
|
|
81
|
-
let root = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
82
|
-
let items = root["items"] as? [[String: Any]]
|
|
83
|
-
else {
|
|
78
|
+
/// Converts the menu config into a list of SwiftUI element builders.
|
|
79
|
+
private func buildElements(from config: [String: Any]) -> [TinyuiMenuElement] {
|
|
80
|
+
guard let items = config["items"] as? [[String: Any]] else {
|
|
84
81
|
return []
|
|
85
82
|
}
|
|
86
83
|
return items.map { TinyuiMenuElement(dictionary: $0) }
|
|
@@ -88,8 +85,8 @@ struct TinyuiMenuSwiftUIView: View {
|
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
/**
|
|
91
|
-
* Lightweight representation of a single UIMenu element
|
|
92
|
-
*
|
|
88
|
+
* Lightweight representation of a single UIMenu element read from the config.
|
|
89
|
+
* Used to build SwiftUI menu content without resolving all elements
|
|
93
90
|
* eagerly. Returns `AnyView` to avoid recursive opaque return type errors.
|
|
94
91
|
*/
|
|
95
92
|
struct TinyuiMenuElement: Identifiable {
|
|
@@ -226,19 +223,41 @@ private struct TinyuiMenuLabel: View {
|
|
|
226
223
|
let destructive: Bool
|
|
227
224
|
let showsState: Bool
|
|
228
225
|
|
|
226
|
+
@ViewBuilder
|
|
229
227
|
var body: some View {
|
|
230
|
-
//
|
|
231
|
-
// the
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if showsState {
|
|
239
|
-
stateIndicator
|
|
228
|
+
// Menu controls interpret the first text as the title and the second as
|
|
229
|
+
// the subtitle. When an icon is present, `Label` replaces the first Text,
|
|
230
|
+
// matching SwiftUI's native menu-item representation.
|
|
231
|
+
if hasIcon {
|
|
232
|
+
Label {
|
|
233
|
+
title
|
|
234
|
+
} icon: {
|
|
235
|
+
menuIcon
|
|
240
236
|
}
|
|
237
|
+
} else {
|
|
238
|
+
title
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if let subtitle {
|
|
242
|
+
Text(subtitle)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if showsState {
|
|
246
|
+
stateIndicator
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
private var subtitle: String? {
|
|
251
|
+
(dictionary["subtitle"] as? String).flatMap {
|
|
252
|
+
$0.isEmpty ? nil : $0
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private var hasIcon: Bool {
|
|
257
|
+
if let icon = dictionary["icon"] as? String, !icon.isEmpty {
|
|
258
|
+
return UIImage(named: icon) != nil
|
|
241
259
|
}
|
|
260
|
+
return !(dictionary["systemImage"] as? String ?? "").isEmpty
|
|
242
261
|
}
|
|
243
262
|
|
|
244
263
|
private var stateIndicator: some View {
|
|
@@ -254,13 +273,7 @@ private struct TinyuiMenuLabel: View {
|
|
|
254
273
|
}
|
|
255
274
|
|
|
256
275
|
private var title: Text {
|
|
257
|
-
let
|
|
258
|
-
let subtitle = (dictionary["subtitle"] as? String).flatMap {
|
|
259
|
-
$0.isEmpty ? nil : $0
|
|
260
|
-
}
|
|
261
|
-
let text = subtitle.map { subtitle in
|
|
262
|
-
Text("\(title)\n\(subtitle)")
|
|
263
|
-
} ?? Text(title)
|
|
276
|
+
let text = Text(dictionary["title"] as? String ?? "")
|
|
264
277
|
|
|
265
278
|
if destructive {
|
|
266
279
|
return text.foregroundColor(.red)
|
|
@@ -303,102 +316,7 @@ private struct TinyuiMenuLabel: View {
|
|
|
303
316
|
/** Converts React Native's processed ColorValue JSON into a dynamic UIColor. */
|
|
304
317
|
private enum TinyuiMenuColor {
|
|
305
318
|
static func uiColor(from value: Any?) -> UIColor? {
|
|
306
|
-
|
|
307
|
-
let argb = number.uint32Value
|
|
308
|
-
return UIColor(
|
|
309
|
-
red: CGFloat((argb >> 16) & 0xff) / 255,
|
|
310
|
-
green: CGFloat((argb >> 8) & 0xff) / 255,
|
|
311
|
-
blue: CGFloat(argb & 0xff) / 255,
|
|
312
|
-
alpha: CGFloat((argb >> 24) & 0xff) / 255
|
|
313
|
-
)
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
guard let object = value as? [String: Any] else {
|
|
317
|
-
return nil
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if let semanticNames = object["semantic"] as? [String] {
|
|
321
|
-
for name in semanticNames {
|
|
322
|
-
if let color = semanticColor(named: name) {
|
|
323
|
-
return color
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if let dynamic = object["dynamic"] as? [String: Any] {
|
|
329
|
-
return UIColor { traits in
|
|
330
|
-
let highContrast = traits.accessibilityContrast == .high
|
|
331
|
-
let dark = traits.userInterfaceStyle == .dark
|
|
332
|
-
let preferredKey: String
|
|
333
|
-
|
|
334
|
-
switch (dark, highContrast) {
|
|
335
|
-
case (true, true):
|
|
336
|
-
preferredKey = "highContrastDark"
|
|
337
|
-
case (false, true):
|
|
338
|
-
preferredKey = "highContrastLight"
|
|
339
|
-
case (true, false):
|
|
340
|
-
preferredKey = "dark"
|
|
341
|
-
case (false, false):
|
|
342
|
-
preferredKey = "light"
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
return uiColor(from: dynamic[preferredKey])
|
|
346
|
-
?? uiColor(from: dynamic[dark ? "dark" : "light"])
|
|
347
|
-
?? UIColor.clear
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return nil
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
private static func semanticColor(named name: String) -> UIColor? {
|
|
355
|
-
if let color = UIColor(named: name) {
|
|
356
|
-
return color
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
let normalizedName = name.hasSuffix("Color")
|
|
360
|
-
? String(name.dropLast("Color".count))
|
|
361
|
-
: name
|
|
362
|
-
|
|
363
|
-
switch normalizedName {
|
|
364
|
-
case "label": return .label
|
|
365
|
-
case "secondaryLabel": return .secondaryLabel
|
|
366
|
-
case "tertiaryLabel": return .tertiaryLabel
|
|
367
|
-
case "quaternaryLabel": return .quaternaryLabel
|
|
368
|
-
case "placeholderText": return .placeholderText
|
|
369
|
-
case "separator": return .separator
|
|
370
|
-
case "opaqueSeparator": return .opaqueSeparator
|
|
371
|
-
case "link": return .link
|
|
372
|
-
case "systemBackground": return .systemBackground
|
|
373
|
-
case "secondarySystemBackground": return .secondarySystemBackground
|
|
374
|
-
case "tertiarySystemBackground": return .tertiarySystemBackground
|
|
375
|
-
case "systemGroupedBackground": return .systemGroupedBackground
|
|
376
|
-
case "secondarySystemGroupedBackground": return .secondarySystemGroupedBackground
|
|
377
|
-
case "tertiarySystemGroupedBackground": return .tertiarySystemGroupedBackground
|
|
378
|
-
case "systemFill": return .systemFill
|
|
379
|
-
case "secondarySystemFill": return .secondarySystemFill
|
|
380
|
-
case "tertiarySystemFill": return .tertiarySystemFill
|
|
381
|
-
case "quaternarySystemFill": return .quaternarySystemFill
|
|
382
|
-
case "systemRed": return .systemRed
|
|
383
|
-
case "systemOrange": return .systemOrange
|
|
384
|
-
case "systemYellow": return .systemYellow
|
|
385
|
-
case "systemGreen": return .systemGreen
|
|
386
|
-
case "systemMint": return .systemMint
|
|
387
|
-
case "systemTeal": return .systemTeal
|
|
388
|
-
case "systemCyan": return .systemCyan
|
|
389
|
-
case "systemBlue": return .systemBlue
|
|
390
|
-
case "systemIndigo": return .systemIndigo
|
|
391
|
-
case "systemPurple": return .systemPurple
|
|
392
|
-
case "systemPink": return .systemPink
|
|
393
|
-
case "systemBrown": return .systemBrown
|
|
394
|
-
case "systemGray": return .systemGray
|
|
395
|
-
case "systemGray2": return .systemGray2
|
|
396
|
-
case "systemGray3": return .systemGray3
|
|
397
|
-
case "systemGray4": return .systemGray4
|
|
398
|
-
case "systemGray5": return .systemGray5
|
|
399
|
-
case "systemGray6": return .systemGray6
|
|
400
|
-
default: return nil
|
|
401
|
-
}
|
|
319
|
+
value.flatMap(RCTConvert.uiColor)
|
|
402
320
|
}
|
|
403
321
|
}
|
|
404
322
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type ColorValue,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
export interface NativeLiquidGlassTextProps extends ViewProps {
|
|
9
|
+
configuration: CodegenTypes.UnsafeMixed;
|
|
10
|
+
tintColor?: ColorValue;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default codegenNativeComponent<NativeLiquidGlassTextProps>(
|
|
14
|
+
'TinyuiLiquidGlassTextView',
|
|
15
|
+
{ excludedPlatforms: ['android'] }
|
|
16
|
+
);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import { assertComponentEnabled } from "../utils/index.js";
|
|
6
|
+
import NativeLiquidGlassTextView from './LiquidGlassTextNativeComponent';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
function normalizeFontWeight(fontWeight) {
|
|
9
|
+
if (fontWeight == null) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const value = String(fontWeight);
|
|
13
|
+
const aliases = {
|
|
14
|
+
'normal': 'regular',
|
|
15
|
+
'ultralight': 'ultraLight',
|
|
16
|
+
'condensed': 'regular',
|
|
17
|
+
'condensedBold': 'bold',
|
|
18
|
+
'100': 'ultraLight',
|
|
19
|
+
'200': 'thin',
|
|
20
|
+
'300': 'light',
|
|
21
|
+
'400': 'regular',
|
|
22
|
+
'500': 'medium',
|
|
23
|
+
'600': 'semibold',
|
|
24
|
+
'700': 'bold',
|
|
25
|
+
'800': 'heavy',
|
|
26
|
+
'900': 'black'
|
|
27
|
+
};
|
|
28
|
+
return aliases[value] ?? value;
|
|
29
|
+
}
|
|
30
|
+
function resolveAlignment(textAlign) {
|
|
31
|
+
switch (textAlign) {
|
|
32
|
+
case 'center':
|
|
33
|
+
return 'center';
|
|
34
|
+
case 'right':
|
|
35
|
+
return 'trailing';
|
|
36
|
+
case 'left':
|
|
37
|
+
return 'leading';
|
|
38
|
+
default:
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const LiquidGlassText = /*#__PURE__*/forwardRef(function LiquidGlassTextRoot({
|
|
43
|
+
text,
|
|
44
|
+
effect = 'clear',
|
|
45
|
+
tint,
|
|
46
|
+
interactive = false,
|
|
47
|
+
fontDesign,
|
|
48
|
+
textStyle,
|
|
49
|
+
multilineTextAlignment,
|
|
50
|
+
style,
|
|
51
|
+
accessibilityLabel,
|
|
52
|
+
accessible = true,
|
|
53
|
+
accessibilityRole = 'text',
|
|
54
|
+
...viewProps
|
|
55
|
+
}, ref) {
|
|
56
|
+
assertComponentEnabled('LiquidGlassText');
|
|
57
|
+
const flattenedTextStyle = StyleSheet.flatten(textStyle);
|
|
58
|
+
const normalizedTextStyle = flattenedTextStyle ? {
|
|
59
|
+
fontSize: flattenedTextStyle.fontSize,
|
|
60
|
+
fontFamily: flattenedTextStyle.fontFamily,
|
|
61
|
+
fontWeight: normalizeFontWeight(flattenedTextStyle.fontWeight),
|
|
62
|
+
fontStyle: flattenedTextStyle.fontStyle,
|
|
63
|
+
letterSpacing: flattenedTextStyle.letterSpacing
|
|
64
|
+
} : undefined;
|
|
65
|
+
const resolvedAlignment = multilineTextAlignment ?? resolveAlignment(flattenedTextStyle?.textAlign) ?? 'leading';
|
|
66
|
+
const configuration = {
|
|
67
|
+
text,
|
|
68
|
+
effect,
|
|
69
|
+
interactive,
|
|
70
|
+
fontDesign,
|
|
71
|
+
...(normalizedTextStyle ? {
|
|
72
|
+
textStyle: normalizedTextStyle
|
|
73
|
+
} : {}),
|
|
74
|
+
multilineTextAlignment: resolvedAlignment
|
|
75
|
+
};
|
|
76
|
+
return /*#__PURE__*/_jsx(NativeLiquidGlassTextView, {
|
|
77
|
+
...viewProps,
|
|
78
|
+
ref: ref,
|
|
79
|
+
accessible: accessible,
|
|
80
|
+
accessibilityRole: accessibilityRole,
|
|
81
|
+
accessibilityLabel: accessibilityLabel ?? text,
|
|
82
|
+
configuration: configuration,
|
|
83
|
+
tintColor: tint ?? flattenedTextStyle?.color,
|
|
84
|
+
style: style
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","StyleSheet","assertComponentEnabled","NativeLiquidGlassTextView","jsx","_jsx","normalizeFontWeight","fontWeight","undefined","value","String","aliases","resolveAlignment","textAlign","LiquidGlassText","LiquidGlassTextRoot","text","effect","tint","interactive","fontDesign","textStyle","multilineTextAlignment","style","accessibilityLabel","accessible","accessibilityRole","viewProps","ref","flattenedTextStyle","flatten","normalizedTextStyle","fontSize","fontFamily","fontStyle","letterSpacing","resolvedAlignment","configuration","tintColor","color"],"sourceRoot":"../../../src","sources":["LiquidGlassText/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,UAAU,QAAmC,cAAc;AAEpE,SAASC,sBAAsB,QAAQ,mBAAU;AAEjD,OAAOC,yBAAyB,MAAM,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEzE,SAASC,mBAAmBA,CAC1BC,UAAmC,EACf;EACpB,IAAIA,UAAU,IAAI,IAAI,EAAE;IACtB,OAAOC,SAAS;EAClB;EAEA,MAAMC,KAAK,GAAGC,MAAM,CAACH,UAAU,CAAC;EAChC,MAAMI,OAAyC,GAAG;IAChD,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,MAAM;IACvB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE;EACT,CAAC;EACD,OAAOA,OAAO,CAACF,KAAK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AC;EACD,oBACE/B,IAAA,CAACF,yBAAyB;IAAA,GACpBwB,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTH,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCF,kBAAkB,EAAEA,kBAAkB,IAAIR,IAAK;IAC/CqB,aAAa,EAAEA,aAAc;IAC7BC,SAAS,EAAEpB,IAAI,IAAIW,kBAAkB,EAAEU,KAAM;IAC7ChB,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["LiquidGlassText/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type ViewProps,
|
|
5
|
+
} from 'react-native';
|
|
2
6
|
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
7
|
|
|
4
8
|
export interface NativeMenuProps extends ViewProps {
|
|
5
|
-
menuConfig:
|
|
9
|
+
menuConfig: CodegenTypes.UnsafeMixed;
|
|
6
10
|
title?: string;
|
|
7
11
|
disabled?: boolean;
|
|
8
12
|
hasPrimaryAction?: boolean;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
import { assertComponentEnabled } from "
|
|
5
|
+
import { assertComponentEnabled } from "../utils/index.js";
|
|
6
6
|
import NativeMenuView from './MenuNativeComponent';
|
|
7
|
-
import { serializeMenuOptions } from "./
|
|
7
|
+
import { serializeMenuOptions } from "./options.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const MenuRoot = /*#__PURE__*/forwardRef(function Menu({
|
|
10
10
|
accessibilityLabel,
|
|
@@ -42,4 +42,4 @@ const MenuRoot = /*#__PURE__*/forwardRef(function Menu({
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
export const Menu = MenuRoot;
|
|
45
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","View","assertComponentEnabled","NativeMenuView","serializeMenuOptions","jsx","_jsx","MenuRoot","Menu","accessibilityLabel","children","disabled","onPrimaryAction","options","title","testID","viewProps","ref","config","callbacks","collapsable","hasPrimaryAction","menuConfig","onItemPress","event","get","nativeEvent","id"],"sourceRoot":"../../../src","sources":["Menu/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,sBAAsB,QAAQ,mBAAU;AAEjD,OAAOC,cAAc,MAAM,uBAAuB;AAClD,SAASC,oBAAoB,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjD,MAAMC,QAAQ,gBAAGP,UAAU,CAAuC,SAASQ,IAAIA,CAC7E;EACEC,kBAAkB;EAClBC,QAAQ;EACRC,QAAQ;EACRC,eAAe;EACfC,OAAO;EACPC,KAAK;EACLC,MAAM;EACN,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACAf,sBAAsB,CAAC,MAAM,CAAC;EAE9B,MAAM;IAAEgB,MAAM;IAAEC;EAAU,CAAC,GAAGf,oBAAoB,CAACS,OAAO,CAAC;EAE3D,oBACEP,IAAA,CAACL,IAAI;IAAA,GAAKe,SAAS;IAAEC,GAAG,EAAEA,GAAI;IAACG,WAAW,EAAE,KAAM;IAAAV,QAAA,eAChDJ,IAAA,CAACH,cAAc;MACbM,kBAAkB,EAAEA,kBAAmB;MACvCE,QAAQ,EAAEA,QAAS;MACnBU,gBAAgB,EAAET,eAAe,IAAI,IAAK;MAC1CU,UAAU,EAAEJ,MAAO;MACnBK,WAAW,EAAGC,KAAK,IAAKL,SAAS,CAACM,GAAG,CAACD,KAAK,CAACE,WAAW,CAACC,EAAE,CAAC,GAAG,CAAE;MAChEf,eAAe,EAAEA,eAAgB;MACjCG,MAAM,EAAEA,MAAO;MACfD,KAAK,EAAEA,KAAM;MAAAJ,QAAA,eAEbJ,IAAA,CAACL,IAAI;QAACmB,WAAW,EAAE,KAAM;QAAAV,QAAA,EAAEA;MAAQ,CAAO;IAAC,CAC7B;EAAC,CACb,CAAC;AAEX,CAAC,CAAC;AAEF,OAAO,MAAMF,IAAI,GAAGD,QAAyB","ignoreList":[]}
|
|
@@ -9,9 +9,9 @@ export function serializeMenuOptions(options) {
|
|
|
9
9
|
const items = serializeOptions(options, callbacks, new Set(), 'root');
|
|
10
10
|
return {
|
|
11
11
|
callbacks,
|
|
12
|
-
config:
|
|
12
|
+
config: {
|
|
13
13
|
items
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function serializeOptions(options, callbacks, usedIds, path) {
|
|
@@ -70,4 +70,4 @@ function serializeOptions(options, callbacks, usedIds, path) {
|
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["processColor","serializeColor","color","undefined","serializeMenuOptions","options","callbacks","Map","items","serializeOptions","Set","config","usedIds","path","map","option","index","optionPath","type","title","subtitle","systemImage","icon","iconColor","titleColor","destructive","disabled","hidden","displayInline","children","id","has","Error","add","onSelect","set","state","keepOpen"],"sourceRoot":"../../../src","sources":["Menu/options.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAyB,cAAc;AA2D5D,SAASC,cAAcA,CAACC,KAA6B,EAAmB;EACtE,OAAOA,KAAK,KAAKC,SAAS,GAAGA,SAAS,GAAGH,YAAY,CAACE,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,oBAAoBA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ACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["Menu/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Pressable","jsx","_jsx","PopoverClose","close","onPress","props","event","displayName"],"sourceRoot":"../../../src","sources":["Popover/PopoverClose.tsx"],"mappings":";;AACA,SAASA,SAAS,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAC;EAC3BC,KAAK;EACLC,OAAO;EACP,GAAGC;AACc,CAAC,EAAa;EAC/B,oBACEJ,IAAA,CAACF,SAAS;IAAA,GACJM,KAAK;IACTD,OAAO,EAAGE,KAAK,IAAK;MAClBF,OAAO,GAAGE,KAAK,CAAC;MAChBH,KAAK,CAAC,CAAC;IACT;EAAE,CACH,CAAC;AAEN;AAEAD,YAAY,CAACK,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useCallback, useState } from 'react';
|
|
4
4
|
import { PlatformColor, Pressable, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { assertComponentEnabled } from "
|
|
6
|
-
import { PopoverClose } from "./
|
|
5
|
+
import { assertComponentEnabled } from "../utils/index.js";
|
|
6
|
+
import { PopoverClose } from "./PopoverClose.js";
|
|
7
7
|
import NativePopoverView from './PopoverNativeComponent';
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
const PopoverRoot = /*#__PURE__*/forwardRef(function Popover({
|
|
@@ -68,4 +68,4 @@ export const Popover = Object.assign(PopoverRoot, {
|
|
|
68
68
|
Close: PopoverClose
|
|
69
69
|
});
|
|
70
70
|
export { PopoverClose };
|
|
71
|
-
//# sourceMappingURL=
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useState","PlatformColor","Pressable","StyleSheet","View","assertComponentEnabled","PopoverClose","NativePopoverView","jsx","_jsx","jsxs","_jsxs","PopoverRoot","Popover","children","content","open","defaultOpen","onOpenChange","attachmentAnchor","arrowEdge","viewProps","ref","uncontrolledOpen","setUncontrolledOpen","isControlled","undefined","isOpen","setOpen","nextOpen","close","renderedContent","renderContent","collapsable","isPresented","onIsPresentedChange","event","nativeEvent","onPress","style","styles","pointerEvents","args","create","position","backgroundColor","overflow","Object","assign","Close"],"sourceRoot":"../../../src","sources":["Popover/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAA2B,OAAO;AAE5E,SAASC,aAAa,EAAEC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzE,SAASC,sBAAsB,QAAQ,mBAAU;AACjD,SAASC,YAAY,QAAQ,mBAAgB;AAO7C,OAAOC,iBAAiB,MAAM,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzD,MAAMC,WAAW,gBAAGd,UAAU,CAC5B,SAASe,OAAOA,CACd;EACEC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,WAAW,GAAG,KAAK;EACnBC,YAAY;EACZC,gBAAgB,GAAG,QAAQ;EAC3BC,SAAS,GAAG,MAAM;EAClB,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACAjB,sBAAsB,CAAC,SAAS,CAAC;EAEjC,MAAM,CAACkB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGxB,QAAQ,CAACiB,WAAW,CAAC;EACrE,MAAMQ,YAAY,GAAGT,IAAI,KAAKU,SAAS;EACvC,MAAMC,MAAM,GAAGF,YAAY,GAAGT,IAAI,GAAGO,gBAAgB;EAErD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