@datatechsolutions/ui 2.11.1 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astrlabe/contracts.d.mts +293 -0
- package/dist/astrlabe/contracts.d.ts +293 -0
- package/dist/astrlabe/contracts.js +5 -0
- package/dist/astrlabe/contracts.js.map +1 -0
- package/dist/astrlabe/contracts.mjs +4 -0
- package/dist/astrlabe/contracts.mjs.map +1 -0
- package/dist/astrlabe/graph-node.d.mts +28 -0
- package/dist/astrlabe/graph-node.d.ts +28 -0
- package/dist/astrlabe/graph-node.js +26 -0
- package/dist/astrlabe/graph-node.js.map +1 -0
- package/dist/astrlabe/graph-node.mjs +5 -0
- package/dist/astrlabe/graph-node.mjs.map +1 -0
- package/dist/astrlabe/index.d.mts +707 -0
- package/dist/astrlabe/index.d.ts +707 -0
- package/dist/astrlabe/index.js +3247 -0
- package/dist/astrlabe/index.js.map +1 -0
- package/dist/astrlabe/index.mjs +2956 -0
- package/dist/astrlabe/index.mjs.map +1 -0
- package/dist/astrlabe/utils.d.mts +71 -0
- package/dist/astrlabe/utils.d.ts +71 -0
- package/dist/astrlabe/utils.js +30 -0
- package/dist/astrlabe/utils.js.map +1 -0
- package/dist/astrlabe/utils.mjs +5 -0
- package/dist/astrlabe/utils.mjs.map +1 -0
- package/dist/astrlabe/workflow-canvas.d.mts +5 -0
- package/dist/astrlabe/workflow-canvas.d.ts +5 -0
- package/dist/astrlabe/workflow-canvas.js +19 -0
- package/dist/astrlabe/workflow-canvas.js.map +1 -0
- package/dist/astrlabe/workflow-canvas.mjs +10 -0
- package/dist/astrlabe/workflow-canvas.mjs.map +1 -0
- package/dist/astrlabe/workflow-preview-canvas.d.mts +10 -0
- package/dist/astrlabe/workflow-preview-canvas.d.ts +10 -0
- package/dist/astrlabe/workflow-preview-canvas.js +28 -0
- package/dist/astrlabe/workflow-preview-canvas.js.map +1 -0
- package/dist/astrlabe/workflow-preview-canvas.mjs +26 -0
- package/dist/astrlabe/workflow-preview-canvas.mjs.map +1 -0
- package/dist/chunk-3GE3MBUZ.js +279 -0
- package/dist/chunk-3GE3MBUZ.js.map +1 -0
- package/dist/chunk-55H6WZQP.js +5 -0
- package/dist/chunk-55H6WZQP.js.map +1 -0
- package/dist/chunk-7VJ7CMMT.mjs +96 -0
- package/dist/chunk-7VJ7CMMT.mjs.map +1 -0
- package/dist/chunk-BLNXRUC4.mjs +276 -0
- package/dist/chunk-BLNXRUC4.mjs.map +1 -0
- package/dist/chunk-D2JF6C3E.mjs +46 -0
- package/dist/chunk-D2JF6C3E.mjs.map +1 -0
- package/dist/chunk-JB6RNAD2.mjs +4 -0
- package/dist/chunk-JB6RNAD2.mjs.map +1 -0
- package/dist/chunk-LJSJMBLO.mjs +7177 -0
- package/dist/chunk-LJSJMBLO.mjs.map +1 -0
- package/dist/chunk-OZNTQROP.mjs +39 -0
- package/dist/chunk-OZNTQROP.mjs.map +1 -0
- package/dist/chunk-P4YYEM4B.js +44 -0
- package/dist/chunk-P4YYEM4B.js.map +1 -0
- package/dist/chunk-PBKTXX4Y.js +20756 -0
- package/dist/chunk-PBKTXX4Y.js.map +1 -0
- package/dist/chunk-PWBWP5FJ.js +197 -0
- package/dist/chunk-PWBWP5FJ.js.map +1 -0
- package/dist/chunk-QWG2FMUN.mjs +60 -0
- package/dist/chunk-QWG2FMUN.mjs.map +1 -0
- package/dist/chunk-S7KHTUHA.js +65 -0
- package/dist/chunk-S7KHTUHA.js.map +1 -0
- package/dist/chunk-TLPPVL3W.mjs +189 -0
- package/dist/chunk-TLPPVL3W.mjs.map +1 -0
- package/dist/chunk-UZ3CMNUJ.js +49 -0
- package/dist/chunk-UZ3CMNUJ.js.map +1 -0
- package/dist/chunk-XAQME7DD.js +7238 -0
- package/dist/chunk-XAQME7DD.js.map +1 -0
- package/dist/chunk-XO7IYJSF.mjs +20022 -0
- package/dist/chunk-XO7IYJSF.mjs.map +1 -0
- package/dist/chunk-YXN2K77G.js +102 -0
- package/dist/chunk-YXN2K77G.js.map +1 -0
- package/dist/dynamic-island-confirm-Cbxh-sta.d.mts +52 -0
- package/dist/dynamic-island-confirm-Cbxh-sta.d.ts +52 -0
- package/dist/index.d.mts +4771 -0
- package/dist/index.d.ts +4771 -0
- package/dist/index.js +2892 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/i18n-context.d.mts +36 -0
- package/dist/lib/i18n-context.d.ts +36 -0
- package/dist/lib/i18n-context.js +29 -0
- package/dist/lib/i18n-context.js.map +1 -0
- package/dist/lib/i18n-context.mjs +4 -0
- package/dist/lib/i18n-context.mjs.map +1 -0
- package/dist/lib/router-context.d.mts +35 -0
- package/dist/lib/router-context.d.ts +35 -0
- package/dist/lib/router-context.js +25 -0
- package/dist/lib/router-context.js.map +1 -0
- package/dist/lib/router-context.mjs +4 -0
- package/dist/lib/router-context.mjs.map +1 -0
- package/dist/use-haptic-RDQNJYBE.js +17 -0
- package/dist/use-haptic-RDQNJYBE.js.map +1 -0
- package/dist/use-haptic-TCMOLPGA.mjs +4 -0
- package/dist/use-haptic-TCMOLPGA.mjs.map +1 -0
- package/dist/workflow-canvas-CJwGehdk.d.mts +241 -0
- package/dist/workflow-canvas-DSm0iyof.d.ts +241 -0
- package/package.json +2 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
// src/lib/i18n-context.tsx
|
|
8
|
+
var I18nContext = react.createContext(null);
|
|
9
|
+
function I18nProvider({ children, value }) {
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsx(I18nContext.Provider, { value, children });
|
|
11
|
+
}
|
|
12
|
+
function useTranslations(namespace) {
|
|
13
|
+
const context = react.useContext(I18nContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
const fallback = ((key, params) => {
|
|
16
|
+
let result = namespace ? `${namespace}.${key}` : key;
|
|
17
|
+
if (params) {
|
|
18
|
+
for (const [paramKey, paramValue] of Object.entries(params)) {
|
|
19
|
+
result = result.replace(`{${paramKey}}`, String(paramValue));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
24
|
+
fallback.raw = (key) => key;
|
|
25
|
+
return fallback;
|
|
26
|
+
}
|
|
27
|
+
const translateFn = context.translate(namespace);
|
|
28
|
+
if (!translateFn.raw) {
|
|
29
|
+
translateFn.raw = (key) => {
|
|
30
|
+
const messages = context.messages;
|
|
31
|
+
if (!messages) return void 0;
|
|
32
|
+
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
33
|
+
return getNestedValue(messages, fullKey);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return translateFn;
|
|
37
|
+
}
|
|
38
|
+
function getNestedValue(object, path) {
|
|
39
|
+
const parts = path.split(".");
|
|
40
|
+
let current = object;
|
|
41
|
+
for (const part of parts) {
|
|
42
|
+
if (current === null || current === void 0 || typeof current !== "object") return void 0;
|
|
43
|
+
current = current[part];
|
|
44
|
+
}
|
|
45
|
+
return current;
|
|
46
|
+
}
|
|
47
|
+
function useLocale() {
|
|
48
|
+
const context = react.useContext(I18nContext);
|
|
49
|
+
return context?.locale ?? "en";
|
|
50
|
+
}
|
|
51
|
+
function useFormatter() {
|
|
52
|
+
const locale = useLocale();
|
|
53
|
+
return {
|
|
54
|
+
dateTime: (date, options) => new Intl.DateTimeFormat(locale, options).format(date),
|
|
55
|
+
relativeTime: (date) => {
|
|
56
|
+
const now = Date.now();
|
|
57
|
+
const diffMs = date.getTime() - now;
|
|
58
|
+
const diffSeconds = Math.round(diffMs / 1e3);
|
|
59
|
+
const diffMinutes = Math.round(diffMs / 6e4);
|
|
60
|
+
const diffHours = Math.round(diffMs / 36e5);
|
|
61
|
+
const diffDays = Math.round(diffMs / 864e5);
|
|
62
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
63
|
+
if (Math.abs(diffSeconds) < 60) return rtf.format(diffSeconds, "second");
|
|
64
|
+
if (Math.abs(diffMinutes) < 60) return rtf.format(diffMinutes, "minute");
|
|
65
|
+
if (Math.abs(diffHours) < 24) return rtf.format(diffHours, "hour");
|
|
66
|
+
return rtf.format(diffDays, "day");
|
|
67
|
+
},
|
|
68
|
+
number: (value, options) => new Intl.NumberFormat(locale, options).format(value)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function createI18nFromMessages(locale, messages) {
|
|
72
|
+
return {
|
|
73
|
+
locale,
|
|
74
|
+
messages,
|
|
75
|
+
translate: (namespace) => {
|
|
76
|
+
const fn = ((key, params) => {
|
|
77
|
+
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
78
|
+
const raw = getNestedValue(messages, fullKey);
|
|
79
|
+
let result = typeof raw === "string" ? raw : key;
|
|
80
|
+
if (params) {
|
|
81
|
+
for (const [paramKey, paramValue] of Object.entries(params)) {
|
|
82
|
+
result = result.replace(new RegExp(`\\{${paramKey}\\}`, "g"), String(paramValue));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
});
|
|
87
|
+
fn.raw = (key) => {
|
|
88
|
+
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
89
|
+
return getNestedValue(messages, fullKey);
|
|
90
|
+
};
|
|
91
|
+
return fn;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
exports.I18nProvider = I18nProvider;
|
|
97
|
+
exports.createI18nFromMessages = createI18nFromMessages;
|
|
98
|
+
exports.useFormatter = useFormatter;
|
|
99
|
+
exports.useLocale = useLocale;
|
|
100
|
+
exports.useTranslations = useTranslations;
|
|
101
|
+
//# sourceMappingURL=chunk-YXN2K77G.js.map
|
|
102
|
+
//# sourceMappingURL=chunk-YXN2K77G.js.map
|
|
@@ -0,0 +1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AA,IAAI,MAAA,GAAS,OAAO,GAAA,KAAQ,QAAA,GAAW,GAAA,GAAM,GAAA;AAC7C,QAAA,IAAI,MAAA,EAAQ;AACV,UAAA,KAAA,MAAW,CAAC,QAAA,EAAU,UAAU,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AAC3D,YAAA,MAAA,GAAS,MAAA,CAAO,OAAA,CAAQ,IAAI,MAAA,CAAO,CAAA,GAAA,EAAM,QAAQ,CAAA,GAAA,CAAA,EAAO,GAAG,CAAA,EAAG,MAAA,CAAO,UAAU,CAAC,CAAA;AAAA,UAClF;AAAA,QACF;AACA,QAAA,OAAO,MAAA;AAAA,MACT,CAAA,CAAA;AACA,MAAA,EAAA,CAAG,GAAA,GAAM,CAAC,GAAA,KAAgB;AACxB,QAAA,MAAM,UAAU,SAAA,GAAY,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,GAAK,GAAA;AACpD,QAAA,OAAO,cAAA,CAAe,UAAU,OAAO,CAAA;AAAA,MACzC,CAAA;AACA,MAAA,OAAO,EAAA;AAAA,IACT;AAAA,GACF;AACF","file":"chunk-YXN2K77G.js","sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\n\ntype TranslateFn = ((key: string, params?: Record<string, unknown>) => string) & {\n /** Return the raw (unparsed) value at a given key — useful for arrays/objects in messages */\n raw: (key: string) => unknown\n}\n\nexport interface I18nContextValue {\n translate: (namespace?: string) => TranslateFn\n locale: string\n messages?: Record<string, unknown>\n}\n\nconst I18nContext = createContext<I18nContextValue | null>(null)\n\nexport type I18nProviderProps = {\n children: ReactNode\n value: I18nContextValue\n}\n\nexport function I18nProvider({ children, value }: I18nProviderProps) {\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>\n}\n\nexport function useTranslations(namespace?: string): TranslateFn {\n const context = useContext(I18nContext)\n if (!context) {\n const fallback = ((key: string, params?: Record<string, unknown>) => {\n let result = namespace ? `${namespace}.${key}` : key\n if (params) {\n for (const [paramKey, paramValue] of Object.entries(params)) {\n result = result.replace(`{${paramKey}}`, String(paramValue))\n }\n }\n return result\n }) as TranslateFn\n fallback.raw = (key: string) => key\n return fallback\n }\n const translateFn = context.translate(namespace) as TranslateFn\n if (!translateFn.raw) {\n translateFn.raw = (key: string) => {\n const messages = context.messages\n if (!messages) return undefined\n const fullKey = namespace ? `${namespace}.${key}` : key\n return getNestedValue(messages, fullKey)\n }\n }\n return translateFn\n}\n\nfunction getNestedValue(object: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.')\n let current: unknown = object\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== 'object') return undefined\n current = (current as Record<string, unknown>)[part]\n }\n return current\n}\n\nexport function useLocale(): string {\n const context = useContext(I18nContext)\n return context?.locale ?? 'en'\n}\n\nexport type I18nFormatter = {\n dateTime: (date: Date, options?: Intl.DateTimeFormatOptions) => string\n relativeTime: (date: Date, options?: Intl.RelativeTimeFormatOptions) => string\n number: (value: number, options?: Intl.NumberFormatOptions) => string\n}\n\nexport function useFormatter(): I18nFormatter {\n const locale = useLocale()\n return {\n dateTime: (date: Date, options?: Intl.DateTimeFormatOptions) =>\n new Intl.DateTimeFormat(locale, options).format(date),\n relativeTime: (date: Date) => {\n const now = Date.now()\n const diffMs = date.getTime() - now\n const diffSeconds = Math.round(diffMs / 1000)\n const diffMinutes = Math.round(diffMs / 60000)\n const diffHours = Math.round(diffMs / 3600000)\n const diffDays = Math.round(diffMs / 86400000)\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' })\n if (Math.abs(diffSeconds) < 60) return rtf.format(diffSeconds, 'second')\n if (Math.abs(diffMinutes) < 60) return rtf.format(diffMinutes, 'minute')\n if (Math.abs(diffHours) < 24) return rtf.format(diffHours, 'hour')\n return rtf.format(diffDays, 'day')\n },\n number: (value: number, options?: Intl.NumberFormatOptions) =>\n new Intl.NumberFormat(locale, options).format(value),\n }\n}\n\n/**\n * Create an I18nContextValue from a flat messages object and locale.\n * Messages should be a nested object where keys are namespaces\n * and values are objects of translation key → ICU message string.\n *\n * This performs simple string interpolation with {param} placeholders.\n * For full ICU MessageFormat (plurals, select, etc.), use intl-messageformat.\n */\nexport function createI18nFromMessages(\n locale: string,\n messages: Record<string, unknown>,\n): I18nContextValue {\n return {\n locale,\n messages,\n translate: (namespace?: string) => {\n const fn = ((key: string, params?: Record<string, unknown>) => {\n const fullKey = namespace ? `${namespace}.${key}` : key\n const raw = getNestedValue(messages, fullKey)\n let result = typeof raw === 'string' ? raw : key\n if (params) {\n for (const [paramKey, paramValue] of Object.entries(params)) {\n result = result.replace(new RegExp(`\\\\{${paramKey}\\\\}`, 'g'), String(paramValue))\n }\n }\n return result\n }) as TranslateFn\n fn.raw = (key: string) => {\n const fullKey = namespace ? `${namespace}.${key}` : key\n return getNestedValue(messages, fullKey)\n }\n return fn\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, FormEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
type GlassModalSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full';
|
|
5
|
+
interface GlassModalShellProps {
|
|
6
|
+
/** Whether the modal is open */
|
|
7
|
+
open: boolean;
|
|
8
|
+
/** Called when the modal should close */
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
/** Gradient for the accent bar (e.g. "from-blue-400 to-blue-600") */
|
|
11
|
+
gradient?: string;
|
|
12
|
+
/** Icon displayed in the hero (h-5 w-5 recommended) */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** Small label above the title */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** Modal title */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Subtitle below the title */
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
/** Actions rendered to the right of the title (buttons, badges) */
|
|
21
|
+
headerActions?: ReactNode;
|
|
22
|
+
/** Modal content */
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
/** Footer content (buttons). If not provided, no footer is shown. */
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
/** If provided, the content is wrapped in a <form> that calls this on submit */
|
|
27
|
+
onSubmit?: (event: FormEvent) => void;
|
|
28
|
+
/** Max width of the modal panel */
|
|
29
|
+
maxWidth?: GlassModalSize;
|
|
30
|
+
/** Close button aria-label */
|
|
31
|
+
closeLabel?: string;
|
|
32
|
+
/** Extra class on the panel */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** z-index class for nested modals (default "z-50", use "z-[160]" for modals on top of modals) */
|
|
35
|
+
zIndex?: string;
|
|
36
|
+
}
|
|
37
|
+
declare function GlassModalShell({ open, onClose, gradient, icon, label, title, subtitle, headerActions, children, footer, onSubmit, maxWidth, closeLabel, className, zIndex, }: GlassModalShellProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
type DynamicIslandConfirmProps = {
|
|
40
|
+
open: boolean;
|
|
41
|
+
onClose: () => void;
|
|
42
|
+
onConfirm: () => void;
|
|
43
|
+
title: string;
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
iconBackground?: string;
|
|
46
|
+
appName?: string;
|
|
47
|
+
confirmLabel?: string;
|
|
48
|
+
cancelLabel?: string;
|
|
49
|
+
};
|
|
50
|
+
declare function DynamicIslandConfirm({ open, onClose, onConfirm, title, icon, iconBackground, appName, confirmLabel, cancelLabel, }: DynamicIslandConfirmProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
export { DynamicIslandConfirm as D, type GlassModalSize as G, GlassModalShell as a, type GlassModalShellProps as b };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, FormEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
type GlassModalSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full';
|
|
5
|
+
interface GlassModalShellProps {
|
|
6
|
+
/** Whether the modal is open */
|
|
7
|
+
open: boolean;
|
|
8
|
+
/** Called when the modal should close */
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
/** Gradient for the accent bar (e.g. "from-blue-400 to-blue-600") */
|
|
11
|
+
gradient?: string;
|
|
12
|
+
/** Icon displayed in the hero (h-5 w-5 recommended) */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** Small label above the title */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** Modal title */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Subtitle below the title */
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
/** Actions rendered to the right of the title (buttons, badges) */
|
|
21
|
+
headerActions?: ReactNode;
|
|
22
|
+
/** Modal content */
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
/** Footer content (buttons). If not provided, no footer is shown. */
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
/** If provided, the content is wrapped in a <form> that calls this on submit */
|
|
27
|
+
onSubmit?: (event: FormEvent) => void;
|
|
28
|
+
/** Max width of the modal panel */
|
|
29
|
+
maxWidth?: GlassModalSize;
|
|
30
|
+
/** Close button aria-label */
|
|
31
|
+
closeLabel?: string;
|
|
32
|
+
/** Extra class on the panel */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** z-index class for nested modals (default "z-50", use "z-[160]" for modals on top of modals) */
|
|
35
|
+
zIndex?: string;
|
|
36
|
+
}
|
|
37
|
+
declare function GlassModalShell({ open, onClose, gradient, icon, label, title, subtitle, headerActions, children, footer, onSubmit, maxWidth, closeLabel, className, zIndex, }: GlassModalShellProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
type DynamicIslandConfirmProps = {
|
|
40
|
+
open: boolean;
|
|
41
|
+
onClose: () => void;
|
|
42
|
+
onConfirm: () => void;
|
|
43
|
+
title: string;
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
iconBackground?: string;
|
|
46
|
+
appName?: string;
|
|
47
|
+
confirmLabel?: string;
|
|
48
|
+
cancelLabel?: string;
|
|
49
|
+
};
|
|
50
|
+
declare function DynamicIslandConfirm({ open, onClose, onConfirm, title, icon, iconBackground, appName, confirmLabel, cancelLabel, }: DynamicIslandConfirmProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
export { DynamicIslandConfirm as D, type GlassModalSize as G, GlassModalShell as a, type GlassModalShellProps as b };
|