@intent-driven/adapter-apple 0.1.1
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/index.cjs +649 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +128 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.mjs +685 -0
- package/dist/index.mjs.map +1 -0
- package/dist/theme.css +38 -0
- package/package.json +73 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/index.js
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
AppleAdapterProvider: () => AppleAdapterProvider,
|
|
33
|
+
appleAdapter: () => appleAdapter
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// src/adapter.jsx
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var Dialog = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
40
|
+
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
41
|
+
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
42
|
+
var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
43
|
+
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
|
|
44
|
+
var import_lucide_react = require("lucide-react");
|
|
45
|
+
var import_theme = require("./theme.css");
|
|
46
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
+
var EMOJI_TO_LUCIDE = {
|
|
48
|
+
"\u270E": import_lucide_react.Pencil,
|
|
49
|
+
"\u270F\uFE0F": import_lucide_react.Pencil,
|
|
50
|
+
"\u{1F5D1}": import_lucide_react.Trash2,
|
|
51
|
+
"\u{1F5D1}\uFE0F": import_lucide_react.Trash2,
|
|
52
|
+
"\u2795": import_lucide_react.Plus,
|
|
53
|
+
"+": import_lucide_react.Plus,
|
|
54
|
+
"\u2713": import_lucide_react.Check,
|
|
55
|
+
"\u2714": import_lucide_react.Check,
|
|
56
|
+
"\u2714\uFE0F": import_lucide_react.Check,
|
|
57
|
+
"\u2715": import_lucide_react.X,
|
|
58
|
+
"\u2717": import_lucide_react.X,
|
|
59
|
+
"\u274C": import_lucide_react.X,
|
|
60
|
+
"\u22EF": import_lucide_react.MoreHorizontal,
|
|
61
|
+
"\u2026": import_lucide_react.MoreHorizontal,
|
|
62
|
+
"\u{1F50D}": import_lucide_react.Search,
|
|
63
|
+
"\u{1F4CC}": import_lucide_react.Pin,
|
|
64
|
+
"\u{1F4CD}": import_lucide_react.Pin,
|
|
65
|
+
"\u21A9": import_lucide_react.Reply,
|
|
66
|
+
"\u21A9\uFE0F": import_lucide_react.Reply,
|
|
67
|
+
"\u{1F4E4}": import_lucide_react.Send,
|
|
68
|
+
"\u2B50": import_lucide_react.Star,
|
|
69
|
+
"\u{1F514}": import_lucide_react.Bell,
|
|
70
|
+
"\u{1F515}": import_lucide_react.BellOff,
|
|
71
|
+
"\u{1F4E6}": import_lucide_react.Archive,
|
|
72
|
+
"\u{1F4CB}": import_lucide_react.Copy,
|
|
73
|
+
"\u{1F441}": import_lucide_react.Eye,
|
|
74
|
+
"\u{1F512}": import_lucide_react.Lock,
|
|
75
|
+
"\u{1F513}": import_lucide_react.Unlock,
|
|
76
|
+
"\u2699": import_lucide_react.Settings,
|
|
77
|
+
"\u2699\uFE0F": import_lucide_react.Settings,
|
|
78
|
+
"\u{1F464}": import_lucide_react.User,
|
|
79
|
+
"\u{1F6AA}": import_lucide_react.LogOut,
|
|
80
|
+
"\u25B6": import_lucide_react.Play,
|
|
81
|
+
"\u23F9": import_lucide_react.Square,
|
|
82
|
+
"\u{1F4BE}": import_lucide_react.Save,
|
|
83
|
+
"\u{1F4E5}": import_lucide_react.Download,
|
|
84
|
+
"\u{1F4E4}": import_lucide_react.Upload,
|
|
85
|
+
"\u{1F504}": import_lucide_react.RefreshCw,
|
|
86
|
+
"\u{1F503}": import_lucide_react.RefreshCw,
|
|
87
|
+
"\u{1F5C2}": import_lucide_react.Filter,
|
|
88
|
+
"\u{1F4C5}": import_lucide_react.Calendar,
|
|
89
|
+
"\u{1F550}": import_lucide_react.Clock,
|
|
90
|
+
"\u2764\uFE0F": import_lucide_react.Heart,
|
|
91
|
+
"\u{1F44D}": import_lucide_react.ThumbsUp,
|
|
92
|
+
"\u{1F44E}": import_lucide_react.ThumbsDown,
|
|
93
|
+
"\u{1F6A9}": import_lucide_react.Flag,
|
|
94
|
+
"\u{1F4AC}": import_lucide_react.MessageSquare,
|
|
95
|
+
"\u{1F4DE}": import_lucide_react.Phone,
|
|
96
|
+
"\u{1F4F9}": import_lucide_react.Video,
|
|
97
|
+
"\u{1F3A4}": import_lucide_react.Mic,
|
|
98
|
+
"\u{1F507}": import_lucide_react.MicOff,
|
|
99
|
+
"\u{1F50A}": import_lucide_react.Volume2,
|
|
100
|
+
"\u{1F508}": import_lucide_react.VolumeX,
|
|
101
|
+
"\u{1F517}": import_lucide_react.Link,
|
|
102
|
+
"\u2702": import_lucide_react.Unlink,
|
|
103
|
+
"\u2194": import_lucide_react.Move,
|
|
104
|
+
"\u2922": import_lucide_react.Maximize2,
|
|
105
|
+
"\u26A0": import_lucide_react.AlertTriangle,
|
|
106
|
+
"\u26A0\uFE0F": import_lucide_react.AlertTriangle,
|
|
107
|
+
"\u2139": import_lucide_react.Info,
|
|
108
|
+
"\u2139\uFE0F": import_lucide_react.Info,
|
|
109
|
+
"\u2753": import_lucide_react.HelpCircle,
|
|
110
|
+
"\u2192": import_lucide_react.ArrowRight,
|
|
111
|
+
"\u2190": import_lucide_react.ArrowLeft,
|
|
112
|
+
"\u{1F3E0}": import_lucide_react.Home,
|
|
113
|
+
"\u{1F3AF}": import_lucide_react.Target,
|
|
114
|
+
"\u{1F3C6}": import_lucide_react.Award,
|
|
115
|
+
"\u{1F4C8}": import_lucide_react.TrendingUp,
|
|
116
|
+
"\u{1F525}": import_lucide_react.Flame,
|
|
117
|
+
"\u26A1": import_lucide_react.Zap,
|
|
118
|
+
"\u{1F4DA}": import_lucide_react.BookOpen,
|
|
119
|
+
"\u{1F4AA}": import_lucide_react.Dumbbell,
|
|
120
|
+
"\u{1F4B0}": import_lucide_react.DollarSign,
|
|
121
|
+
"\u{1F4BC}": import_lucide_react.Briefcase,
|
|
122
|
+
"\u{1F91D}": import_lucide_react.Users,
|
|
123
|
+
"\u{1F9D8}": import_lucide_react.Smile,
|
|
124
|
+
"\u{1F3A8}": import_lucide_react.Palette,
|
|
125
|
+
"\u{1F3D6}\uFE0F": import_lucide_react.Umbrella,
|
|
126
|
+
"\u{1F30D}": import_lucide_react.Globe,
|
|
127
|
+
"\u{1F9ED}": import_lucide_react.Compass,
|
|
128
|
+
"\u2705": import_lucide_react.CheckSquare,
|
|
129
|
+
"\u2610": import_lucide_react.CheckSquare,
|
|
130
|
+
"\u{1F4CA}": import_lucide_react.BarChart3,
|
|
131
|
+
"\u{1F4C9}": import_lucide_react.LineChart,
|
|
132
|
+
"\u{1F52C}": import_lucide_react.PieChart,
|
|
133
|
+
"\u{1F4A1}": import_lucide_react.Lightbulb
|
|
134
|
+
};
|
|
135
|
+
function resolveLucide(emoji) {
|
|
136
|
+
if (!emoji) return null;
|
|
137
|
+
return EMOJI_TO_LUCIDE[emoji] || null;
|
|
138
|
+
}
|
|
139
|
+
var inputStyle = {
|
|
140
|
+
width: "100%",
|
|
141
|
+
borderRadius: "var(--radius-apple-input)",
|
|
142
|
+
border: "0.5px solid var(--color-apple-divider)",
|
|
143
|
+
background: "rgba(255, 255, 255, 0.6)",
|
|
144
|
+
padding: "10px 14px",
|
|
145
|
+
fontFamily: "var(--font-apple)",
|
|
146
|
+
fontSize: 15,
|
|
147
|
+
color: "var(--color-apple-text)",
|
|
148
|
+
outline: "none",
|
|
149
|
+
transition: "all 0.2s"
|
|
150
|
+
};
|
|
151
|
+
var labelStyle = {
|
|
152
|
+
fontSize: 13,
|
|
153
|
+
fontWeight: 500,
|
|
154
|
+
color: "var(--color-apple-text-secondary)",
|
|
155
|
+
fontFamily: "var(--font-apple)",
|
|
156
|
+
marginBottom: 4
|
|
157
|
+
};
|
|
158
|
+
function AppleTextInput({ spec, value, onChange }) {
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
160
|
+
spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: labelStyle, children: spec.label }),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
"input",
|
|
163
|
+
{
|
|
164
|
+
type: spec.type === "email" ? "email" : spec.type === "url" ? "url" : spec.type === "tel" ? "tel" : "text",
|
|
165
|
+
style: inputStyle,
|
|
166
|
+
placeholder: spec.placeholder || "",
|
|
167
|
+
value: value || "",
|
|
168
|
+
onChange: (e) => onChange(e.target.value),
|
|
169
|
+
required: spec.required
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
function AppleTextarea({ spec, value, onChange }) {
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
176
|
+
spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: labelStyle, children: spec.label }),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
"textarea",
|
|
179
|
+
{
|
|
180
|
+
style: { ...inputStyle, minHeight: 80, resize: "vertical" },
|
|
181
|
+
placeholder: spec.placeholder || "",
|
|
182
|
+
value: value || "",
|
|
183
|
+
onChange: (e) => onChange(e.target.value),
|
|
184
|
+
rows: 3
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
function AppleNumber({ spec, value, onChange }) {
|
|
190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
191
|
+
spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: labelStyle, children: spec.label }),
|
|
192
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
"input",
|
|
194
|
+
{
|
|
195
|
+
type: "number",
|
|
196
|
+
style: inputStyle,
|
|
197
|
+
value: value ?? "",
|
|
198
|
+
onChange: (e) => onChange(e.target.value === "" ? null : Number(e.target.value)),
|
|
199
|
+
min: spec.min,
|
|
200
|
+
max: spec.max
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] });
|
|
204
|
+
}
|
|
205
|
+
function AppleDateTime({ spec, value, onChange }) {
|
|
206
|
+
const isTimeOnly = spec.name && /time/i.test(spec.name) && !/date/i.test(spec.name);
|
|
207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
208
|
+
spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: labelStyle, children: spec.label }),
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
|
+
"input",
|
|
211
|
+
{
|
|
212
|
+
type: isTimeOnly ? "time" : "date",
|
|
213
|
+
style: inputStyle,
|
|
214
|
+
value: value || "",
|
|
215
|
+
onChange: (e) => onChange(e.target.value)
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] });
|
|
219
|
+
}
|
|
220
|
+
function AppleSelect({ spec, value, onChange }) {
|
|
221
|
+
const options = spec.options || [];
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
223
|
+
spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: labelStyle, children: spec.label }),
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectPrimitive.Root, { value: value || "", onValueChange: onChange, children: [
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
226
|
+
SelectPrimitive.Trigger,
|
|
227
|
+
{
|
|
228
|
+
style: {
|
|
229
|
+
...inputStyle,
|
|
230
|
+
display: "flex",
|
|
231
|
+
alignItems: "center",
|
|
232
|
+
justifyContent: "space-between",
|
|
233
|
+
cursor: "pointer"
|
|
234
|
+
},
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Value, { placeholder: spec.placeholder || "\u0412\u044B\u0431\u0440\u0430\u0442\u044C..." }),
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { size: 16, color: "var(--color-apple-text-secondary)" }) })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
|
+
SelectPrimitive.Content,
|
|
243
|
+
{
|
|
244
|
+
style: {
|
|
245
|
+
background: "rgba(255,255,255,0.95)",
|
|
246
|
+
backdropFilter: "blur(40px) saturate(180%)",
|
|
247
|
+
WebkitBackdropFilter: "blur(40px) saturate(180%)",
|
|
248
|
+
border: "0.5px solid var(--color-apple-divider)",
|
|
249
|
+
borderRadius: "var(--radius-apple-input)",
|
|
250
|
+
boxShadow: "var(--shadow-apple-glass)",
|
|
251
|
+
zIndex: 9999,
|
|
252
|
+
fontFamily: "var(--font-apple)",
|
|
253
|
+
minWidth: 200
|
|
254
|
+
},
|
|
255
|
+
position: "popper",
|
|
256
|
+
sideOffset: 4,
|
|
257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Viewport, { style: { padding: 4 }, children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
+
SelectPrimitive.Item,
|
|
259
|
+
{
|
|
260
|
+
value: opt.value || opt,
|
|
261
|
+
style: {
|
|
262
|
+
padding: "8px 14px",
|
|
263
|
+
borderRadius: 8,
|
|
264
|
+
cursor: "pointer",
|
|
265
|
+
color: "var(--color-apple-text)",
|
|
266
|
+
outline: "none",
|
|
267
|
+
fontSize: 15
|
|
268
|
+
},
|
|
269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.ItemText, { children: opt.label || opt })
|
|
270
|
+
},
|
|
271
|
+
opt.value || opt
|
|
272
|
+
)) })
|
|
273
|
+
}
|
|
274
|
+
) })
|
|
275
|
+
] })
|
|
276
|
+
] });
|
|
277
|
+
}
|
|
278
|
+
var btnBase = {
|
|
279
|
+
borderRadius: "var(--radius-apple-input)",
|
|
280
|
+
fontFamily: "var(--font-apple)",
|
|
281
|
+
cursor: "pointer",
|
|
282
|
+
transition: "all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1)",
|
|
283
|
+
fontSize: 15,
|
|
284
|
+
fontWeight: 600,
|
|
285
|
+
border: "none"
|
|
286
|
+
};
|
|
287
|
+
function ApplePrimaryButton({ children, onClick, disabled, ...props }) {
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
onClick,
|
|
292
|
+
disabled,
|
|
293
|
+
style: {
|
|
294
|
+
...btnBase,
|
|
295
|
+
padding: "10px 20px",
|
|
296
|
+
background: "var(--color-apple-accent)",
|
|
297
|
+
color: "white",
|
|
298
|
+
boxShadow: "0 1px 3px rgba(0, 122, 255, 0.3)",
|
|
299
|
+
opacity: disabled ? 0.4 : 1
|
|
300
|
+
},
|
|
301
|
+
...props,
|
|
302
|
+
children
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
function AppleSecondaryButton({ children, onClick, disabled, ...props }) {
|
|
307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
308
|
+
"button",
|
|
309
|
+
{
|
|
310
|
+
onClick,
|
|
311
|
+
disabled,
|
|
312
|
+
style: {
|
|
313
|
+
...btnBase,
|
|
314
|
+
padding: "10px 20px",
|
|
315
|
+
background: "rgba(0, 122, 255, 0.1)",
|
|
316
|
+
color: "var(--color-apple-accent)",
|
|
317
|
+
opacity: disabled ? 0.4 : 1
|
|
318
|
+
},
|
|
319
|
+
...props,
|
|
320
|
+
children
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
function AppleDangerButton({ children, onClick, disabled, ...props }) {
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
326
|
+
"button",
|
|
327
|
+
{
|
|
328
|
+
onClick,
|
|
329
|
+
disabled,
|
|
330
|
+
style: {
|
|
331
|
+
...btnBase,
|
|
332
|
+
padding: "10px 20px",
|
|
333
|
+
background: "var(--color-apple-danger)",
|
|
334
|
+
color: "white",
|
|
335
|
+
boxShadow: "0 1px 3px rgba(255, 59, 48, 0.3)",
|
|
336
|
+
opacity: disabled ? 0.4 : 1
|
|
337
|
+
},
|
|
338
|
+
...props,
|
|
339
|
+
children
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
function AppleIntentButton({ spec, onClick, disabled }) {
|
|
344
|
+
const Icon2 = spec.icon ? resolveLucide(spec.icon) : null;
|
|
345
|
+
const label = spec.label || spec.intentId;
|
|
346
|
+
const isDanger = spec.irreversibility === "high" || spec.variant === "danger";
|
|
347
|
+
const isPrimary = spec.variant === "primary";
|
|
348
|
+
const bg = isDanger ? "rgba(255, 59, 48, 0.1)" : isPrimary ? "var(--color-apple-accent)" : "rgba(0, 122, 255, 0.08)";
|
|
349
|
+
const color = isDanger ? "var(--color-apple-danger)" : isPrimary ? "white" : "var(--color-apple-accent)";
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
351
|
+
"button",
|
|
352
|
+
{
|
|
353
|
+
onClick,
|
|
354
|
+
disabled,
|
|
355
|
+
style: {
|
|
356
|
+
...btnBase,
|
|
357
|
+
display: "inline-flex",
|
|
358
|
+
alignItems: "center",
|
|
359
|
+
gap: 6,
|
|
360
|
+
padding: "8px 14px",
|
|
361
|
+
fontSize: 14,
|
|
362
|
+
background: bg,
|
|
363
|
+
color,
|
|
364
|
+
opacity: disabled ? 0.4 : 1
|
|
365
|
+
},
|
|
366
|
+
title: label,
|
|
367
|
+
children: [
|
|
368
|
+
Icon2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon2, { size: 16 }),
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label })
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
function AppleOverflowMenu({ items }) {
|
|
375
|
+
if (!items || items.length === 0) return null;
|
|
376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu.Root, { children: [
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { style: {
|
|
378
|
+
...btnBase,
|
|
379
|
+
padding: 8,
|
|
380
|
+
background: "rgba(0, 0, 0, 0.04)",
|
|
381
|
+
color: "var(--color-apple-text-secondary)",
|
|
382
|
+
width: 32,
|
|
383
|
+
height: 32,
|
|
384
|
+
display: "flex",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
justifyContent: "center"
|
|
387
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MoreHorizontal, { size: 16 }) }) }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
389
|
+
DropdownMenu.Content,
|
|
390
|
+
{
|
|
391
|
+
align: "end",
|
|
392
|
+
collisionPadding: 16,
|
|
393
|
+
style: {
|
|
394
|
+
background: "rgba(255,255,255,0.95)",
|
|
395
|
+
backdropFilter: "blur(40px) saturate(180%)",
|
|
396
|
+
WebkitBackdropFilter: "blur(40px) saturate(180%)",
|
|
397
|
+
border: "0.5px solid var(--color-apple-divider)",
|
|
398
|
+
borderRadius: "var(--radius-apple-input)",
|
|
399
|
+
boxShadow: "var(--shadow-apple-glass)",
|
|
400
|
+
padding: 4,
|
|
401
|
+
zIndex: 9999,
|
|
402
|
+
fontFamily: "var(--font-apple)",
|
|
403
|
+
minWidth: 180,
|
|
404
|
+
maxWidth: "90vw"
|
|
405
|
+
},
|
|
406
|
+
sideOffset: 6,
|
|
407
|
+
children: items.map((item, i) => {
|
|
408
|
+
if (item.divider) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Separator, { style: { height: 0.5, background: "var(--color-apple-divider)", margin: "4px 0" } }, item.key);
|
|
409
|
+
const IconCmp = item.icon ? resolveLucide(item.icon) : null;
|
|
410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
411
|
+
DropdownMenu.Item,
|
|
412
|
+
{
|
|
413
|
+
style: {
|
|
414
|
+
display: "flex",
|
|
415
|
+
alignItems: "center",
|
|
416
|
+
gap: 10,
|
|
417
|
+
padding: "10px 14px",
|
|
418
|
+
borderRadius: 8,
|
|
419
|
+
fontSize: 15,
|
|
420
|
+
color: "var(--color-apple-text)",
|
|
421
|
+
outline: "none",
|
|
422
|
+
cursor: "pointer"
|
|
423
|
+
},
|
|
424
|
+
onSelect: () => item.onClick?.(),
|
|
425
|
+
children: [
|
|
426
|
+
IconCmp && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconCmp, { size: 16 }),
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label })
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
item.key || i
|
|
431
|
+
);
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
) })
|
|
435
|
+
] });
|
|
436
|
+
}
|
|
437
|
+
function AppleModalShell({ opened, onClose, title, children }) {
|
|
438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Root, { open: opened, onOpenChange: (v) => {
|
|
439
|
+
if (!v) onClose();
|
|
440
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dialog.Portal, { children: [
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Overlay, { style: {
|
|
442
|
+
position: "fixed",
|
|
443
|
+
inset: 0,
|
|
444
|
+
background: "rgba(0,0,0,0.4)",
|
|
445
|
+
backdropFilter: "blur(8px)",
|
|
446
|
+
zIndex: 9999
|
|
447
|
+
} }),
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dialog.Content, { style: {
|
|
449
|
+
position: "fixed",
|
|
450
|
+
left: "50%",
|
|
451
|
+
top: "50%",
|
|
452
|
+
transform: "translate(-50%, -50%)",
|
|
453
|
+
zIndex: 9999,
|
|
454
|
+
width: "calc(100% - 32px)",
|
|
455
|
+
maxWidth: 480,
|
|
456
|
+
maxHeight: "85vh",
|
|
457
|
+
overflowY: "auto",
|
|
458
|
+
background: "rgba(255,255,255,0.85)",
|
|
459
|
+
backdropFilter: "blur(40px) saturate(180%)",
|
|
460
|
+
WebkitBackdropFilter: "blur(40px) saturate(180%)",
|
|
461
|
+
border: "1px solid var(--color-apple-glass-border)",
|
|
462
|
+
borderRadius: "var(--radius-apple)",
|
|
463
|
+
padding: 24,
|
|
464
|
+
fontFamily: "var(--font-apple)",
|
|
465
|
+
boxShadow: "var(--shadow-apple-glass)"
|
|
466
|
+
}, children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Title, { style: {
|
|
468
|
+
fontSize: 22,
|
|
469
|
+
fontWeight: 700,
|
|
470
|
+
color: "var(--color-apple-text)",
|
|
471
|
+
marginBottom: 16,
|
|
472
|
+
marginTop: 0
|
|
473
|
+
}, children: title }),
|
|
474
|
+
children,
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { style: {
|
|
476
|
+
position: "absolute",
|
|
477
|
+
top: 16,
|
|
478
|
+
right: 16,
|
|
479
|
+
background: "rgba(0,0,0,0.04)",
|
|
480
|
+
border: "none",
|
|
481
|
+
color: "var(--color-apple-text-secondary)",
|
|
482
|
+
cursor: "pointer",
|
|
483
|
+
padding: 6,
|
|
484
|
+
borderRadius: 12,
|
|
485
|
+
width: 28,
|
|
486
|
+
height: 28,
|
|
487
|
+
display: "flex",
|
|
488
|
+
alignItems: "center",
|
|
489
|
+
justifyContent: "center"
|
|
490
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 16 }) }) })
|
|
491
|
+
] })
|
|
492
|
+
] }) });
|
|
493
|
+
}
|
|
494
|
+
function AppleTabs({ tabs, value, onChange }) {
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsPrimitive.Root, { value, onValueChange: onChange, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsPrimitive.List, { style: {
|
|
496
|
+
display: "inline-flex",
|
|
497
|
+
background: "rgba(0,0,0,0.05)",
|
|
498
|
+
borderRadius: 10,
|
|
499
|
+
padding: 2,
|
|
500
|
+
fontFamily: "var(--font-apple)",
|
|
501
|
+
gap: 0
|
|
502
|
+
}, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
503
|
+
TabsPrimitive.Trigger,
|
|
504
|
+
{
|
|
505
|
+
value: tab.value,
|
|
506
|
+
style: {
|
|
507
|
+
padding: "6px 14px",
|
|
508
|
+
fontSize: 13,
|
|
509
|
+
whiteSpace: "nowrap",
|
|
510
|
+
background: "transparent",
|
|
511
|
+
border: "none",
|
|
512
|
+
cursor: "pointer",
|
|
513
|
+
fontFamily: "inherit",
|
|
514
|
+
borderRadius: 8,
|
|
515
|
+
color: "var(--color-apple-text-secondary)",
|
|
516
|
+
fontWeight: 500,
|
|
517
|
+
transition: "all 0.2s"
|
|
518
|
+
},
|
|
519
|
+
"data-state-active-style": "background: white; color: var(--color-apple-text); box-shadow: 0 1px 3px rgba(0,0,0,0.08);",
|
|
520
|
+
children: tab.label
|
|
521
|
+
},
|
|
522
|
+
tab.value
|
|
523
|
+
)) }) });
|
|
524
|
+
}
|
|
525
|
+
function AppleHeading({ children, level = 2, ...props }) {
|
|
526
|
+
const Tag = `h${Math.min(level, 6)}`;
|
|
527
|
+
const sizes = { 1: 34, 2: 28, 3: 22, 4: 17, 5: 15, 6: 13 };
|
|
528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, { style: {
|
|
529
|
+
fontSize: sizes[level] || 22,
|
|
530
|
+
fontWeight: 700,
|
|
531
|
+
fontFamily: "var(--font-apple)",
|
|
532
|
+
color: "var(--color-apple-text)",
|
|
533
|
+
letterSpacing: "-0.02em",
|
|
534
|
+
lineHeight: 1.2,
|
|
535
|
+
margin: 0
|
|
536
|
+
}, ...props, children });
|
|
537
|
+
}
|
|
538
|
+
function AppleText({ children, preset, ...props }) {
|
|
539
|
+
const colors = {
|
|
540
|
+
dimmed: "var(--color-apple-text-secondary)",
|
|
541
|
+
accent: "var(--color-apple-accent)",
|
|
542
|
+
danger: "var(--color-apple-danger)",
|
|
543
|
+
success: "var(--color-apple-success)"
|
|
544
|
+
};
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: {
|
|
546
|
+
fontFamily: "var(--font-apple)",
|
|
547
|
+
color: colors[preset] || "var(--color-apple-text)",
|
|
548
|
+
fontSize: 15
|
|
549
|
+
}, ...props, children });
|
|
550
|
+
}
|
|
551
|
+
function AppleBadge({ children, color, ...props }) {
|
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: {
|
|
553
|
+
display: "inline-flex",
|
|
554
|
+
alignItems: "center",
|
|
555
|
+
padding: "3px 10px",
|
|
556
|
+
borderRadius: 999,
|
|
557
|
+
fontSize: 12,
|
|
558
|
+
fontWeight: 600,
|
|
559
|
+
fontFamily: "var(--font-apple)",
|
|
560
|
+
background: color ? `${color}22` : "rgba(0, 122, 255, 0.1)",
|
|
561
|
+
color: color || "var(--color-apple-accent)"
|
|
562
|
+
}, ...props, children });
|
|
563
|
+
}
|
|
564
|
+
function AppleAvatar({ src, name, size = 32, ...props }) {
|
|
565
|
+
const initials = (name || "?").split(" ").map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AvatarPrimitive.Root, { style: {
|
|
567
|
+
display: "inline-flex",
|
|
568
|
+
alignItems: "center",
|
|
569
|
+
justifyContent: "center",
|
|
570
|
+
borderRadius: "50%",
|
|
571
|
+
overflow: "hidden",
|
|
572
|
+
background: "linear-gradient(135deg, var(--color-apple-accent), var(--color-apple-violet))",
|
|
573
|
+
fontFamily: "var(--font-apple)",
|
|
574
|
+
width: size,
|
|
575
|
+
height: size
|
|
576
|
+
}, ...props, children: [
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Image, { src, alt: name, style: { width: "100%", height: "100%", objectFit: "cover" } }),
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Fallback, { style: {
|
|
579
|
+
display: "flex",
|
|
580
|
+
alignItems: "center",
|
|
581
|
+
justifyContent: "center",
|
|
582
|
+
width: "100%",
|
|
583
|
+
height: "100%",
|
|
584
|
+
color: "white",
|
|
585
|
+
fontSize: Math.round(size * 0.4),
|
|
586
|
+
fontWeight: 600
|
|
587
|
+
}, children: initials })
|
|
588
|
+
] });
|
|
589
|
+
}
|
|
590
|
+
function ApplePaper({ children, ...props }) {
|
|
591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
|
|
592
|
+
borderRadius: "var(--radius-apple)",
|
|
593
|
+
border: "1px solid var(--color-apple-glass-border)",
|
|
594
|
+
background: "var(--color-apple-glass-bg)",
|
|
595
|
+
backdropFilter: "blur(40px) saturate(180%)",
|
|
596
|
+
WebkitBackdropFilter: "blur(40px) saturate(180%)",
|
|
597
|
+
padding: 20,
|
|
598
|
+
boxShadow: "var(--shadow-apple-glass)"
|
|
599
|
+
}, ...props, children });
|
|
600
|
+
}
|
|
601
|
+
var appleAdapter = {
|
|
602
|
+
name: "apple",
|
|
603
|
+
parameter: {
|
|
604
|
+
text: AppleTextInput,
|
|
605
|
+
textarea: AppleTextarea,
|
|
606
|
+
email: AppleTextInput,
|
|
607
|
+
url: AppleTextInput,
|
|
608
|
+
tel: AppleTextInput,
|
|
609
|
+
number: AppleNumber,
|
|
610
|
+
datetime: AppleDateTime,
|
|
611
|
+
select: AppleSelect
|
|
612
|
+
},
|
|
613
|
+
button: {
|
|
614
|
+
primary: ApplePrimaryButton,
|
|
615
|
+
secondary: AppleSecondaryButton,
|
|
616
|
+
danger: AppleDangerButton,
|
|
617
|
+
intent: AppleIntentButton,
|
|
618
|
+
overflow: AppleOverflowMenu
|
|
619
|
+
},
|
|
620
|
+
shell: {
|
|
621
|
+
modal: AppleModalShell,
|
|
622
|
+
tabs: AppleTabs
|
|
623
|
+
},
|
|
624
|
+
primitive: {
|
|
625
|
+
heading: AppleHeading,
|
|
626
|
+
text: AppleText,
|
|
627
|
+
badge: AppleBadge,
|
|
628
|
+
avatar: AppleAvatar,
|
|
629
|
+
paper: ApplePaper
|
|
630
|
+
},
|
|
631
|
+
icon: {
|
|
632
|
+
resolve: resolveLucide
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// src/provider.jsx
|
|
637
|
+
var import_react = __toESM(require("react"), 1);
|
|
638
|
+
var import_renderer = require("@intent-driven/renderer");
|
|
639
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
640
|
+
function AppleAdapterProvider({ children }) {
|
|
641
|
+
import_react.default.useEffect(() => (0, import_renderer.registerUIAdapter)(appleAdapter), []);
|
|
642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
|
|
643
|
+
}
|
|
644
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
645
|
+
0 && (module.exports = {
|
|
646
|
+
AppleAdapterProvider,
|
|
647
|
+
appleAdapter
|
|
648
|
+
});
|
|
649
|
+
//# sourceMappingURL=index.cjs.map
|