panelui-native 0.7.0 → 0.12.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 +5 -3
- package/lib/module/components/attachment/index.js +219 -0
- package/lib/module/components/attachment/index.js.map +1 -0
- package/lib/module/components/bottom-sheet/index.js +53 -3
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/button/index.js +19 -1
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/dialog/index.js +6 -2
- package/lib/module/components/dialog/index.js.map +1 -1
- package/lib/module/components/empty-state/index.js +94 -17
- package/lib/module/components/empty-state/index.js.map +1 -1
- package/lib/module/components/frame/index.js +128 -15
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/input/index.js +107 -15
- package/lib/module/components/input/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +1024 -0
- package/lib/module/components/line-chart/index.js.map +1 -0
- package/lib/module/components/marker/index.js +190 -0
- package/lib/module/components/marker/index.js.map +1 -0
- package/lib/module/components/message/index.js +24 -8
- package/lib/module/components/message/index.js.map +1 -1
- package/lib/module/components/message-scroller/index.js +451 -0
- package/lib/module/components/message-scroller/index.js.map +1 -0
- package/lib/module/components/popover/index.js +511 -0
- package/lib/module/components/popover/index.js.map +1 -0
- package/lib/module/components/progress/index.js +52 -2
- package/lib/module/components/progress/index.js.map +1 -1
- package/lib/module/components/radio-group/index.js +132 -17
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/section-rail/index.js +355 -0
- package/lib/module/components/section-rail/index.js.map +1 -0
- package/lib/module/components/select/index.js +245 -56
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/separator/index.js +91 -0
- package/lib/module/components/separator/index.js.map +1 -0
- package/lib/module/components/slider/index.js +355 -0
- package/lib/module/components/slider/index.js.map +1 -0
- package/lib/module/components/surface/index.js +21 -2
- package/lib/module/components/surface/index.js.map +1 -1
- package/lib/module/components/switch/index.js +10 -1
- package/lib/module/components/switch/index.js.map +1 -1
- package/lib/module/components/tabs/index.js +186 -16
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/toggle-button/index.js +297 -0
- package/lib/module/components/toggle-button/index.js.map +1 -0
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-keyboard-avoidance.js +57 -8
- package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
- package/lib/module/hooks/use-scroll-sections.js +89 -0
- package/lib/module/hooks/use-scroll-sections.js.map +1 -0
- package/lib/module/icons/index.js +69 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +11 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/primitives/keyboard-avoider.js +2 -0
- package/lib/module/primitives/keyboard-avoider.js.map +1 -1
- package/lib/module/primitives/scrim.js +72 -0
- package/lib/module/primitives/scrim.js.map +1 -0
- package/lib/module/utils/haptics.js +57 -0
- package/lib/module/utils/haptics.js.map +1 -0
- package/lib/typescript/src/components/attachment/index.d.ts +93 -0
- package/lib/typescript/src/components/attachment/index.d.ts.map +1 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +6 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +9 -4
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/dialog/index.d.ts +7 -1
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts +152 -2
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
- package/lib/typescript/src/components/frame/index.d.ts +47 -7
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input/index.d.ts +113 -2
- package/lib/typescript/src/components/input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts +247 -0
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/marker/index.d.ts +137 -0
- package/lib/typescript/src/components/marker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/message/index.d.ts +8 -1
- package/lib/typescript/src/components/message/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message-scroller/index.d.ts +150 -0
- package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -0
- package/lib/typescript/src/components/popover/index.d.ts +136 -0
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -0
- package/lib/typescript/src/components/progress/index.d.ts +33 -0
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radio-group/index.d.ts +39 -0
- package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/section-rail/index.d.ts +115 -0
- package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts +46 -7
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/separator/index.d.ts +47 -0
- package/lib/typescript/src/components/separator/index.d.ts.map +1 -0
- package/lib/typescript/src/components/slider/index.d.ts +203 -0
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/surface/index.d.ts +51 -2
- package/lib/typescript/src/components/surface/index.d.ts.map +1 -1
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tabs/index.d.ts +46 -4
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toggle-button/index.d.ts +244 -0
- package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts +10 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-scroll-sections.d.ts +31 -0
- package/lib/typescript/src/hooks/use-scroll-sections.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +6 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +13 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +16 -1
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts +8 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
- package/lib/typescript/src/primitives/scrim.d.ts +21 -0
- package/lib/typescript/src/primitives/scrim.d.ts.map +1 -0
- package/lib/typescript/src/utils/haptics.d.ts +12 -0
- package/lib/typescript/src/utils/haptics.d.ts.map +1 -0
- package/package.json +9 -1
- package/src/components/attachment/index.tsx +279 -0
- package/src/components/bottom-sheet/index.tsx +58 -2
- package/src/components/button/index.tsx +26 -5
- package/src/components/dialog/index.tsx +10 -1
- package/src/components/empty-state/index.tsx +60 -14
- package/src/components/frame/index.tsx +175 -29
- package/src/components/input/index.tsx +122 -16
- package/src/components/line-chart/index.tsx +1224 -0
- package/src/components/marker/index.tsx +194 -0
- package/src/components/message/index.tsx +29 -5
- package/src/components/message-scroller/index.tsx +574 -0
- package/src/components/popover/index.tsx +624 -0
- package/src/components/progress/index.tsx +81 -1
- package/src/components/radio-group/index.tsx +156 -18
- package/src/components/section-rail/index.tsx +459 -0
- package/src/components/select/index.tsx +265 -52
- package/src/components/separator/index.tsx +97 -0
- package/src/components/slider/index.tsx +371 -0
- package/src/components/surface/index.tsx +29 -3
- package/src/components/switch/index.tsx +8 -1
- package/src/components/tabs/index.tsx +208 -28
- package/src/components/toggle-button/index.tsx +374 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-keyboard-avoidance.ts +73 -7
- package/src/hooks/use-scroll-sections.ts +127 -0
- package/src/icons/index.tsx +48 -0
- package/src/index.ts +97 -6
- package/src/native/index.ts +13 -1
- package/src/primitives/keyboard-avoider.tsx +9 -1
- package/src/primitives/scrim.tsx +95 -0
- package/src/utils/haptics.ts +63 -0
- package/theme.css +64 -2
- package/lib/module/components/inline-select/index.js +0 -284
- package/lib/module/components/inline-select/index.js.map +0 -1
- package/lib/typescript/src/components/inline-select/index.d.ts +0 -48
- package/lib/typescript/src/components/inline-select/index.d.ts.map +0 -1
- package/src/components/inline-select/index.tsx +0 -332
package/README.md
CHANGED
|
@@ -101,20 +101,22 @@ overlays, and the toast viewport.
|
|
|
101
101
|
| `Dialog` | Modal dialog with backdrop, title, description and footer actions |
|
|
102
102
|
| `EmptyState` | Placeholder for an empty list or screen, with a stacked-icon media slot |
|
|
103
103
|
| `Frame` | Widget shell — header row with action, inset panel of rows, caption footer |
|
|
104
|
-
| `InlineSelect` | Picker that expands its options in place |
|
|
105
104
|
| `Input` | Text field with label, description and error message |
|
|
106
105
|
| `InputGroup` | Input with leading and trailing decorators, auto-measured |
|
|
107
106
|
| `Label` | Form field label with required, invalid and disabled states |
|
|
108
|
-
| `Progress` | Determinate and indeterminate progress bar |
|
|
107
|
+
| `Progress` | Determinate and indeterminate progress bar, optionally captioned |
|
|
109
108
|
| `RadioGroup` | Single-select list of options |
|
|
110
109
|
| `ScrollFade` | Fades the edges of a scroll container |
|
|
111
|
-
| `
|
|
110
|
+
| `SectionRail` | Floating section navigator — bars that expand into a jump list |
|
|
111
|
+
| `Select` | Picker shown in a bottom sheet, in place, or floating over the page |
|
|
112
112
|
| `Shimmer` | Animated highlight sweeping across content |
|
|
113
113
|
| `Skeleton` | Shimmer placeholder for loading content |
|
|
114
|
+
| `Slider` | Pick a value by dragging a thumb along a track |
|
|
114
115
|
| `Spinner` | Indeterminate loading indicator |
|
|
115
116
|
| `Steps` | Stepper for multi-step flows, horizontal or vertical |
|
|
116
117
|
| `Switch` | Animated on/off toggle |
|
|
117
118
|
| `Tabs` | Segmented navigation with animated indicator |
|
|
119
|
+
| `ToggleButton` | A button that stays down, on its own or in a group |
|
|
118
120
|
| `Timeline` | Vertical sequence of events — dot, icon, numbered, card or compact, with per-item tones |
|
|
119
121
|
| `Toast` | Transient notification queue with swipe-to-dismiss |
|
|
120
122
|
| `Typography` | Semantic text presets — `h1`–`h6`, body sizes, inline code |
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attachment — a file, with its upload life.
|
|
5
|
+
*
|
|
6
|
+
* A file in a chat composer or an upload list is the same row shape `Item`
|
|
7
|
+
* already draws — media, a name, a size, a remove button — so this is that row,
|
|
8
|
+
* not a second one. What it adds is the part `Item` has no opinion on: the
|
|
9
|
+
* file's *state*. A file is picked, then uploading, then processing, then done
|
|
10
|
+
* (or failed), and each of those has to look different or the user cannot tell
|
|
11
|
+
* a stuck upload from a finished one.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Attachment state="uploading">
|
|
15
|
+
* <Attachment.Media><FileIcon /></Attachment.Media>
|
|
16
|
+
* <Attachment.Content>
|
|
17
|
+
* <Attachment.Title>report.pdf</Attachment.Title>
|
|
18
|
+
* <Attachment.Description>PDF · 2.4 MB</Attachment.Description>
|
|
19
|
+
* </Attachment.Content>
|
|
20
|
+
* <Attachment.Actions>
|
|
21
|
+
* <Attachment.Action aria-label="Cancel"><XIcon size={14} /></Attachment.Action>
|
|
22
|
+
* </Attachment.Actions>
|
|
23
|
+
* </Attachment>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* While uploading or processing the title shimmers — the same sweep the rest of
|
|
27
|
+
* the library uses for "in progress" — and an optional bar tracks `progress`.
|
|
28
|
+
* A failed file tints its name and description in the destructive colour, which
|
|
29
|
+
* carries the state without relying on an icon nobody reads.
|
|
30
|
+
*/
|
|
31
|
+
import { createContext, forwardRef, useContext } from 'react';
|
|
32
|
+
import { View } from 'react-native';
|
|
33
|
+
import { tv } from 'tailwind-variants';
|
|
34
|
+
import { useCSSVariable } from 'uniwind';
|
|
35
|
+
import { AnimatedPressable } from "../../primitives/animated-pressable.js";
|
|
36
|
+
import { cn } from "../../utils/cn.js";
|
|
37
|
+
import { Item } from "../item/index.js";
|
|
38
|
+
import { Shimmer } from "../shimmer/index.js";
|
|
39
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
40
|
+
const AttachmentContext = /*#__PURE__*/createContext({
|
|
41
|
+
state: 'done',
|
|
42
|
+
size: 'default'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/** True while the file is still moving — the two states that shimmer. */
|
|
46
|
+
function isBusy(state) {
|
|
47
|
+
return state === 'uploading' || state === 'processing';
|
|
48
|
+
}
|
|
49
|
+
const rootVariants = tv({
|
|
50
|
+
base: '',
|
|
51
|
+
variants: {
|
|
52
|
+
state: {
|
|
53
|
+
idle: '',
|
|
54
|
+
uploading: '',
|
|
55
|
+
processing: '',
|
|
56
|
+
// The border carries the failure, so it reads at a glance in a list.
|
|
57
|
+
error: 'border border-destructive',
|
|
58
|
+
done: ''
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const AttachmentRoot = /*#__PURE__*/forwardRef(({
|
|
63
|
+
className,
|
|
64
|
+
state = 'done',
|
|
65
|
+
size = 'default',
|
|
66
|
+
orientation,
|
|
67
|
+
progress,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}, ref) => {
|
|
71
|
+
const track = useCSSVariable('--color-primary');
|
|
72
|
+
return /*#__PURE__*/_jsx(AttachmentContext.Provider, {
|
|
73
|
+
value: {
|
|
74
|
+
state,
|
|
75
|
+
size
|
|
76
|
+
},
|
|
77
|
+
children: /*#__PURE__*/_jsxs(Item, {
|
|
78
|
+
ref: ref,
|
|
79
|
+
size: size,
|
|
80
|
+
orientation: orientation,
|
|
81
|
+
variant: "outline",
|
|
82
|
+
className: cn('overflow-hidden', rootVariants({
|
|
83
|
+
state
|
|
84
|
+
}), className),
|
|
85
|
+
...props,
|
|
86
|
+
children: [children, isBusy(state) && progress !== undefined ? /*#__PURE__*/_jsx(View, {
|
|
87
|
+
className: "absolute bottom-0 left-0 right-0 h-0.5 bg-muted",
|
|
88
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
89
|
+
style: {
|
|
90
|
+
width: `${Math.min(100, Math.max(0, progress * 100))}%`,
|
|
91
|
+
backgroundColor: typeof track === 'string' ? track : undefined
|
|
92
|
+
},
|
|
93
|
+
className: "h-full"
|
|
94
|
+
})
|
|
95
|
+
}) : null]
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
AttachmentRoot.displayName = 'Attachment';
|
|
100
|
+
/** A row (or column) of attachments — the same stack `Item.Group` provides. */
|
|
101
|
+
const AttachmentGroup = /*#__PURE__*/forwardRef(({
|
|
102
|
+
className,
|
|
103
|
+
orientation = 'vertical',
|
|
104
|
+
children,
|
|
105
|
+
...props
|
|
106
|
+
}, ref) => /*#__PURE__*/_jsx(Item.Group, {
|
|
107
|
+
ref: ref,
|
|
108
|
+
orientation: orientation,
|
|
109
|
+
className: className,
|
|
110
|
+
...props,
|
|
111
|
+
children: children
|
|
112
|
+
}));
|
|
113
|
+
AttachmentGroup.displayName = 'Attachment.Group';
|
|
114
|
+
/** Leading slot — a file-type icon tile, or an image thumbnail. */
|
|
115
|
+
const AttachmentMedia = /*#__PURE__*/forwardRef(({
|
|
116
|
+
className,
|
|
117
|
+
variant = 'icon',
|
|
118
|
+
children,
|
|
119
|
+
...props
|
|
120
|
+
}, ref) => /*#__PURE__*/_jsx(Item.Media, {
|
|
121
|
+
ref: ref,
|
|
122
|
+
variant: variant,
|
|
123
|
+
className: className,
|
|
124
|
+
...props,
|
|
125
|
+
children: children
|
|
126
|
+
}));
|
|
127
|
+
AttachmentMedia.displayName = 'Attachment.Media';
|
|
128
|
+
const AttachmentContent = /*#__PURE__*/forwardRef(({
|
|
129
|
+
className,
|
|
130
|
+
children,
|
|
131
|
+
...props
|
|
132
|
+
}, ref) => /*#__PURE__*/_jsx(Item.Content, {
|
|
133
|
+
ref: ref,
|
|
134
|
+
className: className,
|
|
135
|
+
...props,
|
|
136
|
+
children: children
|
|
137
|
+
}));
|
|
138
|
+
AttachmentContent.displayName = 'Attachment.Content';
|
|
139
|
+
/** The file name. Shimmers while the file is uploading or processing. */
|
|
140
|
+
const AttachmentTitle = /*#__PURE__*/forwardRef(({
|
|
141
|
+
className,
|
|
142
|
+
children,
|
|
143
|
+
...props
|
|
144
|
+
}, ref) => {
|
|
145
|
+
const {
|
|
146
|
+
state
|
|
147
|
+
} = useContext(AttachmentContext);
|
|
148
|
+
if (isBusy(state)) {
|
|
149
|
+
// Shimmer owns the text so it can mask the sweep to the glyphs.
|
|
150
|
+
return /*#__PURE__*/_jsx(Shimmer, {
|
|
151
|
+
textClassName: cn('text-base font-medium', className),
|
|
152
|
+
children: children
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return /*#__PURE__*/_jsx(Item.Title, {
|
|
156
|
+
ref: ref,
|
|
157
|
+
className: cn(state === 'error' && 'text-destructive', className),
|
|
158
|
+
...props,
|
|
159
|
+
children: children
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
AttachmentTitle.displayName = 'Attachment.Title';
|
|
163
|
+
/** File type, size or status. Tints destructive on `error`. */
|
|
164
|
+
const AttachmentDescription = /*#__PURE__*/forwardRef(({
|
|
165
|
+
className,
|
|
166
|
+
children,
|
|
167
|
+
...props
|
|
168
|
+
}, ref) => {
|
|
169
|
+
const {
|
|
170
|
+
state
|
|
171
|
+
} = useContext(AttachmentContext);
|
|
172
|
+
return /*#__PURE__*/_jsx(Item.Description, {
|
|
173
|
+
ref: ref,
|
|
174
|
+
className: cn(state === 'error' && 'text-destructive', className),
|
|
175
|
+
...props,
|
|
176
|
+
children: children
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
AttachmentDescription.displayName = 'Attachment.Description';
|
|
180
|
+
const AttachmentActions = /*#__PURE__*/forwardRef(({
|
|
181
|
+
className,
|
|
182
|
+
children,
|
|
183
|
+
...props
|
|
184
|
+
}, ref) => /*#__PURE__*/_jsx(Item.Actions, {
|
|
185
|
+
ref: ref,
|
|
186
|
+
className: className,
|
|
187
|
+
...props,
|
|
188
|
+
children: children
|
|
189
|
+
}));
|
|
190
|
+
AttachmentActions.displayName = 'Attachment.Actions';
|
|
191
|
+
/**
|
|
192
|
+
* A single icon button in the actions slot — remove, retry, download. An icon
|
|
193
|
+
* on its own says nothing to a screen reader, so the label is required.
|
|
194
|
+
*/
|
|
195
|
+
const AttachmentAction = /*#__PURE__*/forwardRef(({
|
|
196
|
+
className,
|
|
197
|
+
accessibilityLabel,
|
|
198
|
+
children,
|
|
199
|
+
...props
|
|
200
|
+
}, ref) => /*#__PURE__*/_jsx(AnimatedPressable, {
|
|
201
|
+
ref: ref,
|
|
202
|
+
accessibilityRole: "button",
|
|
203
|
+
accessibilityLabel: accessibilityLabel,
|
|
204
|
+
hitSlop: 8,
|
|
205
|
+
className: cn('h-8 w-8 items-center justify-center rounded-full active:bg-muted', className),
|
|
206
|
+
...props,
|
|
207
|
+
children: children
|
|
208
|
+
}));
|
|
209
|
+
AttachmentAction.displayName = 'Attachment.Action';
|
|
210
|
+
export const Attachment = Object.assign(AttachmentRoot, {
|
|
211
|
+
Group: AttachmentGroup,
|
|
212
|
+
Media: AttachmentMedia,
|
|
213
|
+
Content: AttachmentContent,
|
|
214
|
+
Title: AttachmentTitle,
|
|
215
|
+
Description: AttachmentDescription,
|
|
216
|
+
Actions: AttachmentActions,
|
|
217
|
+
Action: AttachmentAction
|
|
218
|
+
});
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useContext","View","tv","useCSSVariable","AnimatedPressable","cn","Item","Shimmer","jsx","_jsx","jsxs","_jsxs","AttachmentContext","state","size","isBusy","rootVariants","base","variants","idle","uploading","processing","error","done","AttachmentRoot","className","orientation","progress","children","props","ref","track","Provider","value","variant","undefined","style","width","Math","min","max","backgroundColor","displayName","AttachmentGroup","Group","AttachmentMedia","Media","AttachmentContent","Content","AttachmentTitle","textClassName","Title","AttachmentDescription","Description","AttachmentActions","Actions","AttachmentAction","accessibilityLabel","accessibilityRole","hitSlop","Attachment","Object","assign","Action"],"sourceRoot":"../../../../src","sources":["components/attachment/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAwB,OAAO;AAC7E,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,iBAAiB,QAAqC,wCAAqC;AAEpG,SAASC,EAAE,QAAQ,mBAAgB;AACnC,SAASC,IAAI,QAAQ,kBAAS;AAC9B,SAASC,OAAO,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUrC,MAAMC,iBAAiB,gBAAGd,aAAa,CAAyB;EAC9De,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA,SAASC,MAAMA,CAACF,KAAsB,EAAW;EAC/C,OAAOA,KAAK,KAAK,WAAW,IAAIA,KAAK,KAAK,YAAY;AACxD;AAEA,MAAMG,YAAY,GAAGd,EAAE,CAAC;EACtBe,IAAI,EAAE,EAAE;EACRC,QAAQ,EAAE;IACRL,KAAK,EAAE;MACLM,IAAI,EAAE,EAAE;MACRC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE,EAAE;MACd;MACAC,KAAK,EAAE,2BAA2B;MAClCC,IAAI,EAAE;IACR;EACF;AACF,CAAC,CAAC;AAoBF,MAAMC,cAAc,gBAAGzB,UAAU,CAC/B,CACE;EAAE0B,SAAS;E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;EAAE0B,SAAS;EAAEgC,kBAAkB;EAAE7B,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBACzDrB,IAAA,CAACL,iBAAiB;EAChB0B,GAAG,EAAEA,GAAI;EACT4B,iBAAiB,EAAC,QAAQ;EAC1BD,kBAAkB,EAAEA,kBAAmB;EACvCE,OAAO,EAAE,CAAE;EACXlC,SAAS,EAAEpB,EAAE,CACX,kEAAkE,EAClEoB,SACF,CAAE;EAAA,GACEI,KAAK;EAAAD,QAAA,EAERA;AAAQ,CACQ,CAEvB,CAAC;AACD4B,gBAAgB,CAACd,WAAW,GAAG,mBAAmB;AAElD,OAAO,MAAMkB,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACtC,cAAc,EAAE;EACtDoB,KAAK,EAAED,eAAe;EACtBG,KAAK,EAAED,eAAe;EACtBG,OAAO,EAAED,iBAAiB;EAC1BI,KAAK,EAAEF,eAAe;EACtBI,WAAW,EAAED,qBAAqB;EAClCG,OAAO,EAAED,iBAAiB;EAC1BS,MAAM,EAAEP;AACV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useMemo, useState } from 'react';
|
|
4
4
|
import { Pressable, useWindowDimensions, View } from 'react-native';
|
|
5
|
+
import { useCSSVariable } from 'uniwind';
|
|
5
6
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
6
7
|
import Animated, { FadeIn, FadeOut, SlideInDown, SlideOutDown, runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
7
8
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
8
9
|
import { getNativeUI } from "../../native/index.js";
|
|
10
|
+
import { XIcon } from "../../icons/index.js";
|
|
9
11
|
import { Portal } from "../../primitives/portal.js";
|
|
10
12
|
import { cn } from "../../utils/cn.js";
|
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -24,6 +26,39 @@ function useBottomSheet(component) {
|
|
|
24
26
|
}
|
|
25
27
|
return context;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Roughly how tall the platform will make the sheet at a given detent, as a
|
|
31
|
+
* fraction of the screen. Approximate on purpose — it is used as a floor for
|
|
32
|
+
* the content, not as the sheet's real height, which the platform owns.
|
|
33
|
+
*/
|
|
34
|
+
const DETENT_FRACTION = {
|
|
35
|
+
half: 0.5,
|
|
36
|
+
full: 0.9
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The height the content should at least fill for a given set of detents.
|
|
41
|
+
*
|
|
42
|
+
* Without this the hosted content sizes to itself and the platform centres
|
|
43
|
+
* that smaller box inside the taller sheet, which is why a short sheet shows
|
|
44
|
+
* its content floating in the middle. Filling the detent leaves nothing to
|
|
45
|
+
* centre, so the content sits where it was written: at the top.
|
|
46
|
+
*/
|
|
47
|
+
function detentFloor(snapPoints, screenHeight) {
|
|
48
|
+
if (!snapPoints?.length) return undefined;
|
|
49
|
+
|
|
50
|
+
// The sheet opens at its first detent, so that is the one to fill.
|
|
51
|
+
const first = snapPoints[0];
|
|
52
|
+
if (first === 'half' || first === 'full') {
|
|
53
|
+
return screenHeight * DETENT_FRACTION[first];
|
|
54
|
+
}
|
|
55
|
+
if (typeof first === 'object' && 'fraction' in first) {
|
|
56
|
+
return screenHeight * first.fraction;
|
|
57
|
+
}
|
|
58
|
+
if (typeof first === 'object' && 'height' in first) return first.height;
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
27
62
|
/**
|
|
28
63
|
* Set by the root so Content knows the platform is drawing the sheet, and with
|
|
29
64
|
* which detents. Null means the styled sheet renders.
|
|
@@ -78,6 +113,7 @@ function BottomSheetTrigger({
|
|
|
78
113
|
function BottomSheetContent({
|
|
79
114
|
className,
|
|
80
115
|
dismissible = true,
|
|
116
|
+
showClose = true,
|
|
81
117
|
children,
|
|
82
118
|
...props
|
|
83
119
|
}) {
|
|
@@ -93,6 +129,7 @@ function BottomSheetContent({
|
|
|
93
129
|
} = useWindowDimensions();
|
|
94
130
|
const insets = useSafeAreaInsets();
|
|
95
131
|
const translateY = useSharedValue(0);
|
|
132
|
+
const closeTint = useCSSVariable('--color-muted-foreground');
|
|
96
133
|
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
97
134
|
const pan = Gesture.Pan().onChange(event => {
|
|
98
135
|
// Rubber-band when dragging upward, follow the finger downward.
|
|
@@ -143,14 +180,17 @@ function BottomSheetContent({
|
|
|
143
180
|
...props,
|
|
144
181
|
className: cn(
|
|
145
182
|
// The platform draws the container, but it hands us a bare
|
|
146
|
-
// box — padding and safe-area are still ours.
|
|
147
|
-
|
|
183
|
+
// box — padding and safe-area are still ours. The top
|
|
184
|
+
// padding has to clear the platform's grabber, which sits
|
|
185
|
+
// inside the sheet rather than above the content.
|
|
186
|
+
'justify-start gap-2 px-5 pb-2 pt-5', className),
|
|
148
187
|
style: {
|
|
149
188
|
// An explicit width, not `w-full`. Inside the native host
|
|
150
189
|
// there is no parent width for a percentage to resolve
|
|
151
190
|
// against, so `100%` measures against nothing and the
|
|
152
191
|
// content lays out wider than the sheet it sits in.
|
|
153
192
|
width: screenWidth,
|
|
193
|
+
minHeight: detentFloor(nativeSheet.snapPoints, screenHeight),
|
|
154
194
|
paddingBottom: Math.max(insets.bottom, 16)
|
|
155
195
|
},
|
|
156
196
|
children: children
|
|
@@ -191,7 +231,17 @@ function BottomSheetContent({
|
|
|
191
231
|
children: /*#__PURE__*/_jsx(View, {
|
|
192
232
|
className: "h-1 w-10 rounded-full bg-muted-foreground/30"
|
|
193
233
|
})
|
|
194
|
-
}),
|
|
234
|
+
}), showClose ? /*#__PURE__*/_jsx(Pressable, {
|
|
235
|
+
accessibilityRole: "button",
|
|
236
|
+
accessibilityLabel: "Close",
|
|
237
|
+
onPress: close,
|
|
238
|
+
hitSlop: 8,
|
|
239
|
+
className: "absolute right-4 top-3 h-8 w-8 items-center justify-center rounded-full bg-muted active:opacity-70",
|
|
240
|
+
children: /*#__PURE__*/_jsx(XIcon, {
|
|
241
|
+
size: 16,
|
|
242
|
+
color: typeof closeTint === 'string' ? closeTint : undefined
|
|
243
|
+
})
|
|
244
|
+
}) : null, children]
|
|
195
245
|
})
|
|
196
246
|
})]
|
|
197
247
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useMemo","useState","Pressable","useWindowDimensions","View","Gesture","GestureDetector","Animated","FadeIn","FadeOut","SlideInDown","SlideOutDown","runOnJS","useAnimatedStyle","useSharedValue","withSpring","withTiming","useSafeAreaInsets","getNativeUI","Portal","cn","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","DISMISS_DISTANCE","DISMISS_VELOCITY","BottomSheetContext","useBottomSheet","component","context","Error","NativeSheetContext","BottomSheetRoot","children","open","onOpenChange","defaultOpen","native","
|
|
1
|
+
{"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useMemo","useState","Pressable","useWindowDimensions","View","useCSSVariable","Gesture","GestureDetector","Animated","FadeIn","FadeOut","SlideInDown","SlideOutDown","runOnJS","useAnimatedStyle","useSharedValue","withSpring","withTiming","useSafeAreaInsets","getNativeUI","XIcon","Portal","cn","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","DISMISS_DISTANCE","DISMISS_VELOCITY","BottomSheetContext","useBottomSheet","component","context","Error","DETENT_FRACTION","half","full","detentFloor","snapPoints","screenHeight","length","undefined","first","fraction","height","NativeSheetContext","BottomSheetRoot","children","open","onOpenChange","defaultOpen","native","internalOpen","setInternalOpen","isControlled","resolvedOpen","setOpen","next","nativeUI","nativeSheet","Provider","value","BottomSheetTrigger","onPress","args","props","BottomSheetContent","className","dismissible","showClose","width","screenWidth","insets","translateY","closeTint","close","pan","Pan","onChange","event","changeY","onEnd","velocityY","duration","sheetStyle","transform","Host","BottomSheet","NativeBottomSheet","RNHostView","matchContents","style","position","isPresented","onDismiss","minHeight","paddingBottom","Math","max","bottom","entering","exiting","accessibilityLabel","gesture","springify","accessibilityViewIsModal","accessibilityRole","hitSlop","size","color","Object","assign","Trigger","Content"],"sourceRoot":"../../../../src","sources":["components/bottom-sheet/index.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SAASC,SAAS,EAAEC,mBAAmB,EAAEC,IAAI,QAAwB,cAAc;AACnF,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,WAAW,QAAQ,uBAAc;AAC1C,SAASC,KAAK,QAAQ,sBAAa;AACnC,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpC,MAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE,EAAE;EAAEC,SAAS,EAAE,GAAG;EAAEC,IAAI,EAAE;AAAI,CAAU;AAClE,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,gBAAgB,GAAG,GAAG;AAO5B,MAAMC,kBAAkB,gBAAGrC,aAAa,CAAiC,IAAI,CAAC;AAE9E,SAASsC,cAAcA,CAACC,SAAiB,EAA2B;EAClE,MAAMC,OAAO,GAAGrC,UAAU,CAACkC,kBAAkB,CAAC;EAC9C,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,GAAGF,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ACpB,IAAI;gBAACmE,SAAS,EAAC;cAA8C,CAAE;YAAC,CAC7D,CAAC,EACNE,SAAS,gBACRjD,IAAA,CAACtB,SAAS;cACR4G,iBAAiB,EAAC,QAAQ;cAC1BJ,kBAAkB,EAAC,OAAO;cAC1BvC,OAAO,EAAEY,KAAM;cACfgC,OAAO,EAAE,CAAE;cACXxC,SAAS,EAAC,oGAAoG;cAAApB,QAAA,eAE9G3B,IAAA,CAACJ,KAAK;gBAAC4F,IAAI,EAAE,EAAG;gBAACC,KAAK,EAAE,OAAOnC,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGjC;cAAU,CAAE;YAAC,CACxE,CAAC,GACV,IAAI,EACPM,QAAQ;UAAA,CACI;QAAC,CACD,CAAC;MAAA,CACZ;IAAC,CACoB;EAAC,CACxB,CAAC;AAEb;AAEA,OAAO,MAAMwC,WAAW,GAAGuB,MAAM,CAACC,MAAM,CAACjE,eAAe,EAAE;EACxDkE,OAAO,EAAElD,kBAAkB;EAC3BmD,OAAO,EAAE/C;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -103,6 +103,22 @@ const CONTENT_COLOR_VAR = {
|
|
|
103
103
|
ghost: '--color-foreground',
|
|
104
104
|
social: '--color-foreground'
|
|
105
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* Height given to the native host, matching the styled scale above.
|
|
108
|
+
*
|
|
109
|
+
* The host is told its size rather than asked to work it out. `matchContents`
|
|
110
|
+
* measures the platform's own content a frame late and again when that content
|
|
111
|
+
* changes — so the button renders at nothing, collapses against whatever sits
|
|
112
|
+
* above it, and jolts into place on the first press. Width comes from ordinary
|
|
113
|
+
* layout instead, which is why a native button fills its container.
|
|
114
|
+
*/
|
|
115
|
+
const NATIVE_HEIGHT = {
|
|
116
|
+
sm: 36,
|
|
117
|
+
md: 44,
|
|
118
|
+
lg: 48,
|
|
119
|
+
icon: 44
|
|
120
|
+
};
|
|
121
|
+
|
|
106
122
|
/** PanelUI variants mapped onto the platform button styles. */
|
|
107
123
|
const NATIVE_VARIANT = {
|
|
108
124
|
primary: 'filled',
|
|
@@ -152,7 +168,9 @@ export const Button = /*#__PURE__*/forwardRef(({
|
|
|
152
168
|
} = nativeUI;
|
|
153
169
|
const isStringLabel = typeof children === 'string';
|
|
154
170
|
return /*#__PURE__*/_jsx(Host, {
|
|
155
|
-
|
|
171
|
+
style: {
|
|
172
|
+
height: NATIVE_HEIGHT[size ?? 'md']
|
|
173
|
+
},
|
|
156
174
|
children: /*#__PURE__*/_jsx(NativeButton, {
|
|
157
175
|
label: isStringLabel ? children : undefined,
|
|
158
176
|
variant: NATIVE_VARIANT[variant ?? 'primary'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","tv","useCSSVariable","AnimatedPressable","Text","IconColorProvider","getNativeUI","Spinner","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","buttonVariants","slots","root","label","spinner","variants","variant","primary","secondary","outline","ghost","destructive","social","size","sm","md","lg","icon","fullWidth","true","disabled","defaultVariants","SPINNER_SIZE","CONTENT_COLOR_VAR","NATIVE_VARIANT","Button","children","className","labelClassName","loading","startContent","endContent","native","props","ref","isDisabled","nativeUI","themedColor","contentColor","undefined","Host","NativeButton","RNHostView","isStringLabel","
|
|
1
|
+
{"version":3,"names":["forwardRef","tv","useCSSVariable","AnimatedPressable","Text","IconColorProvider","getNativeUI","Spinner","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","buttonVariants","slots","root","label","spinner","variants","variant","primary","secondary","outline","ghost","destructive","social","size","sm","md","lg","icon","fullWidth","true","disabled","defaultVariants","SPINNER_SIZE","CONTENT_COLOR_VAR","NATIVE_HEIGHT","NATIVE_VARIANT","Button","children","className","labelClassName","loading","startContent","endContent","native","props","ref","isDisabled","nativeUI","themedColor","contentColor","undefined","Host","NativeButton","RNHostView","isStringLabel","style","height","onPress","matchContents","color","accessibilityRole","accessibilityState","busy","displayName"],"sourceRoot":"../../../../src","sources":["components/button/index.tsx"],"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AACa,OAAQ;QAAApB,QAAA,EAKtBiB,aAAa,GAAGJ,SAAS,gBACxB3C,IAAA,CAAC8C,UAAU;UAACK,aAAa;UAAArB,QAAA,eACvB9B,IAAA,CAAAF,SAAA;YAAAgC,QAAA,EAAGA;UAAQ,CAAG;QAAC,CACL;MACb,CACW;IAAC,CACX,CAAC;EAEX;EAEA,oBACE9B,IAAA,CAACN,iBAAiB;IAAC0D,KAAK,EAAEV,YAAa;IAAAZ,QAAA,eACrC5B,KAAA,CAACV,iBAAiB;MAChB8C,GAAG,EAAEA,GAAI;MACTe,iBAAiB,EAAC,QAAQ;MAC1BC,kBAAkB,EAAE;QAAE/B,QAAQ,EAAEgB,UAAU;QAAEgB,IAAI,EAAEtB;MAAQ,CAAE;MAC5DV,QAAQ,EAAEgB,UAAW;MACrBR,SAAS,EAAE1B,IAAI,CAAC;QAAE0B;MAAU,CAAC,CAAE;MAAA,GAC3BM,KAAK;MAAAP,QAAA,GAERG,OAAO,gBACNjC,IAAA,CAACJ,OAAO;QAACoB,IAAI,EAAES,YAAY,CAACT,IAAI,IAAI,IAAI,CAAE;QAACe,SAAS,EAAExB,OAAO,CAAC;MAAE,CAAE,CAAC,GAEnE2B,YACD,EACA,OAAOJ,QAAQ,KAAK,QAAQ,gBAC3B9B,IAAA,CAACP,IAAI;QAACsC,SAAS,EAAEzB,KAAK,CAAC;UAAEyB,SAAS,EAAEC;QAAe,CAAC,CAAE;QAAAF,QAAA,EAAEA;MAAQ,CAAO,CAAC,GAExEA,QACD,EACAK,UAAU;IAAA,CACM;EAAC,CACH,CAAC;AAExB,CACF,CAAC;AAEDN,MAAM,CAAC2B,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { cloneElement, createContext, forwardRef, isValidElement, useCallback, u
|
|
|
4
4
|
import { Pressable, View } from 'react-native';
|
|
5
5
|
import Animated, { FadeIn, FadeOut, ZoomIn } from 'react-native-reanimated';
|
|
6
6
|
import { Portal } from "../../primitives/portal.js";
|
|
7
|
+
import { Scrim } from "../../primitives/scrim.js";
|
|
7
8
|
import { Text } from "../../primitives/text.js";
|
|
8
9
|
import { cn } from "../../utils/cn.js";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -55,6 +56,7 @@ function DialogTrigger({
|
|
|
55
56
|
function DialogContent({
|
|
56
57
|
className,
|
|
57
58
|
dismissible = true,
|
|
59
|
+
blur = false,
|
|
58
60
|
children,
|
|
59
61
|
...props
|
|
60
62
|
}) {
|
|
@@ -71,9 +73,11 @@ function DialogContent({
|
|
|
71
73
|
entering: FadeIn.duration(150),
|
|
72
74
|
exiting: FadeOut.duration(150),
|
|
73
75
|
className: "absolute inset-0 items-center justify-center p-6",
|
|
74
|
-
children: [/*#__PURE__*/_jsx(
|
|
76
|
+
children: [/*#__PURE__*/_jsx(Scrim, {
|
|
77
|
+
blur: blur
|
|
78
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
75
79
|
accessibilityLabel: "Close dialog",
|
|
76
|
-
className: "absolute inset-0
|
|
80
|
+
className: "absolute inset-0",
|
|
77
81
|
onPress: dismissible ? () => setOpen(false) : undefined
|
|
78
82
|
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
79
83
|
entering: ZoomIn.springify().damping(18).stiffness(250).mass(0.6),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cloneElement","createContext","forwardRef","isValidElement","useCallback","useContext","useMemo","useState","Pressable","View","Animated","FadeIn","FadeOut","ZoomIn","Portal","Text","cn","jsx","_jsx","jsxs","_jsxs","DialogContext","useDialog","component","context","Error","DialogRoot","children","open","onOpenChange","defaultOpen","internalOpen","setInternalOpen","isControlled","undefined","resolvedOpen","setOpen","next","Provider","value","DialogTrigger","onPress","args","props","DialogContent","className","dismissible","entering","duration","exiting","accessibilityLabel","springify","damping","stiffness","mass","accessibilityViewIsModal","DialogTitle","ref","size","weight","displayName","DialogDescription","muted","DialogFooter","DialogClose","Dialog","Object","assign","Trigger","Content","Title","Description","Footer","Close"],"sourceRoot":"../../../../src","sources":["components/dialog/index.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SAASC,SAAS,EAAEC,IAAI,QAAwB,cAAc;AAC9D,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,EAAEC,MAAM,QAAQ,yBAAyB;AAC3E,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,IAAI,QAAwB,0BAAuB;AAC5D,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAOpC,MAAMC,aAAa,
|
|
1
|
+
{"version":3,"names":["cloneElement","createContext","forwardRef","isValidElement","useCallback","useContext","useMemo","useState","Pressable","View","Animated","FadeIn","FadeOut","ZoomIn","Portal","Scrim","Text","cn","jsx","_jsx","jsxs","_jsxs","DialogContext","useDialog","component","context","Error","DialogRoot","children","open","onOpenChange","defaultOpen","internalOpen","setInternalOpen","isControlled","undefined","resolvedOpen","setOpen","next","Provider","value","DialogTrigger","onPress","args","props","DialogContent","className","dismissible","blur","entering","duration","exiting","accessibilityLabel","springify","damping","stiffness","mass","accessibilityViewIsModal","DialogTitle","ref","size","weight","displayName","DialogDescription","muted","DialogFooter","DialogClose","Dialog","Object","assign","Trigger","Content","Title","Description","Footer","Close"],"sourceRoot":"../../../../src","sources":["components/dialog/index.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SAASC,SAAS,EAAEC,IAAI,QAAwB,cAAc;AAC9D,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,EAAEC,MAAM,QAAQ,yBAAyB;AAC3E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