@oneplatformdev/ui 0.1.10-108 → 0.1.10-109
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/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/AlertDialog/AlertDialog.js +40 -46
- package/AlertDialog/AlertDialog.js.map +1 -1
- package/AlertDialog/AlertDialogRoot.d.ts.map +1 -1
- package/AlertDialog/AlertDialogRoot.js +37 -33
- package/AlertDialog/AlertDialogRoot.js.map +1 -1
- package/CHANGELOG.md +8 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAGlB,MAAM,OAAO,CAAC;AAYf,OAAO,
|
|
1
|
+
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAGlB,MAAM,OAAO,CAAC;AAYf,OAAO,EAIL,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAwH7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CA0B/D,CAAA;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement as
|
|
3
|
-
import { AlertDialogRoot as y, AlertDialogContent as
|
|
2
|
+
import { cloneElement as p, useId as b, Children as j } from "react";
|
|
3
|
+
import { AlertDialogRoot as y, AlertDialogContent as P, AlertDialogTrigger as E, AlertDialogHeader as u, AlertDialogTitle as B, AlertDialogDescription as v, AlertDialogFooter as f, AlertDialogAction as A, AlertDialogCancel as R } from "./AlertDialogRoot.js";
|
|
4
4
|
import { isValidReactElement as s } from "@oneplatformdev/utils";
|
|
5
5
|
const F = (o) => {
|
|
6
|
-
const { slotProps: e = {}, children: r } = o,
|
|
7
|
-
return /* @__PURE__ */ t(E, { asChild: !0, ...
|
|
6
|
+
const { slotProps: e = {}, children: r } = o, n = e.trigger ?? {};
|
|
7
|
+
return /* @__PURE__ */ t(E, { asChild: !0, ...n, children: r });
|
|
8
8
|
}, H = (o) => {
|
|
9
9
|
const {
|
|
10
10
|
title: e = "",
|
|
11
11
|
description: r = "",
|
|
12
|
-
slotProps:
|
|
13
|
-
children:
|
|
14
|
-
} = o,
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
{ ...
|
|
18
|
-
) : /* @__PURE__ */ t(
|
|
19
|
-
e && s(e, B) ?
|
|
12
|
+
slotProps: n = {},
|
|
13
|
+
children: i
|
|
14
|
+
} = o, c = n.header ?? {}, a = n.title ?? {}, l = n.description ?? {};
|
|
15
|
+
return i ? s(i, u) ? p(
|
|
16
|
+
i,
|
|
17
|
+
{ ...i.props || {}, ...c }
|
|
18
|
+
) : /* @__PURE__ */ t(u, { ...c, children: i }) : /* @__PURE__ */ g(u, { children: [
|
|
19
|
+
e && s(e, B) ? p(
|
|
20
20
|
e,
|
|
21
21
|
{ ...e.props || {}, ...a }
|
|
22
22
|
) : /* @__PURE__ */ t(B, { ...a, children: e }),
|
|
23
|
-
r && s(r, v) ?
|
|
23
|
+
r && s(r, v) ? p(
|
|
24
24
|
r,
|
|
25
|
-
{ ...r.props || {}, ...
|
|
26
|
-
) : /* @__PURE__ */ t(v, { ...
|
|
25
|
+
{ ...r.props || {}, ...l }
|
|
26
|
+
) : /* @__PURE__ */ t(v, { ...l, children: r })
|
|
27
27
|
] });
|
|
28
28
|
}, I = (o) => {
|
|
29
29
|
const {
|
|
30
30
|
slotProps: e = {},
|
|
31
31
|
children: r,
|
|
32
|
-
onCancel:
|
|
33
|
-
onConfirm:
|
|
34
|
-
cancelLabel:
|
|
32
|
+
onCancel: n,
|
|
33
|
+
onConfirm: i,
|
|
34
|
+
cancelLabel: c = "Cancel",
|
|
35
35
|
actionLabel: a = "Continue",
|
|
36
|
-
variant:
|
|
37
|
-
} = o, k = b(),
|
|
38
|
-
return r ? s(r,
|
|
36
|
+
variant: l = "confirm"
|
|
37
|
+
} = o, k = b(), D = e.footer ?? {}, x = e.cancelButton ?? {}, m = e.actionButton ?? {};
|
|
38
|
+
return r ? s(r, f) ? p(
|
|
39
39
|
r,
|
|
40
|
-
{ ...r.props || {}, ...
|
|
41
|
-
) : /* @__PURE__ */ t(
|
|
42
|
-
if (!
|
|
43
|
-
const h =
|
|
44
|
-
return s(
|
|
45
|
-
}) }) : /* @__PURE__ */ g(
|
|
46
|
-
|
|
40
|
+
{ ...r.props || {}, ...D }
|
|
41
|
+
) : /* @__PURE__ */ t(f, { ...D, children: j.map(r, (d, T) => {
|
|
42
|
+
if (!d || !s(d)) return;
|
|
43
|
+
const h = d, C = p(h, { ...h.props || {}, key: h.key || `footer-${k}-action-${T}` });
|
|
44
|
+
return s(d, A) || s(d, R) ? C : /* @__PURE__ */ t(A, { asChild: !0, children: C });
|
|
45
|
+
}) }) : /* @__PURE__ */ g(f, { children: [
|
|
46
|
+
l !== "alert" && /* @__PURE__ */ t(
|
|
47
47
|
R,
|
|
48
48
|
{
|
|
49
|
-
onClick:
|
|
49
|
+
onClick: n,
|
|
50
50
|
...x,
|
|
51
|
-
children:
|
|
51
|
+
children: c
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
54
|
/* @__PURE__ */ t(
|
|
55
|
-
|
|
55
|
+
A,
|
|
56
56
|
{
|
|
57
|
-
onClick:
|
|
58
|
-
...
|
|
59
|
-
variant:
|
|
57
|
+
onClick: i,
|
|
58
|
+
...m,
|
|
59
|
+
variant: m.variant || l === "destructive" ? "destructive" : "default",
|
|
60
60
|
children: a
|
|
61
61
|
}
|
|
62
62
|
)
|
|
@@ -65,22 +65,16 @@ const F = (o) => {
|
|
|
65
65
|
const {
|
|
66
66
|
trigger: e,
|
|
67
67
|
header: r,
|
|
68
|
-
footer:
|
|
69
|
-
slotProps:
|
|
70
|
-
children:
|
|
68
|
+
footer: n,
|
|
69
|
+
slotProps: i = {},
|
|
70
|
+
children: c,
|
|
71
71
|
...a
|
|
72
|
-
} = o,
|
|
72
|
+
} = o, l = i.content ?? {};
|
|
73
73
|
return /* @__PURE__ */ g(y, { ...a, children: [
|
|
74
74
|
/* @__PURE__ */ t(F, { ...o, children: e }),
|
|
75
|
-
|
|
76
|
-
n,
|
|
77
|
-
{
|
|
78
|
-
...n.props || {},
|
|
79
|
-
...c
|
|
80
|
-
}
|
|
81
|
-
) : /* @__PURE__ */ t(u, { ...c, children: n }) : /* @__PURE__ */ g(u, { ...c, children: [
|
|
75
|
+
c ? /* @__PURE__ */ t(P, { ...l, children: c }) : /* @__PURE__ */ g(P, { ...l, children: [
|
|
82
76
|
/* @__PURE__ */ t(H, { ...o, children: r }),
|
|
83
|
-
/* @__PURE__ */ t(I, { ...o, children:
|
|
77
|
+
/* @__PURE__ */ t(I, { ...o, children: n })
|
|
84
78
|
] })
|
|
85
79
|
] });
|
|
86
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.js","sources":["../../src/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n FC,\n Key,\n PropsWithChildren,\n ReactElement,\n useId,\n} from 'react';\nimport {\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogRoot,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from './AlertDialogRoot';\nimport {\n AlertDialogContentProps,\n AlertDialogDescriptionProps,\n AlertDialogFooterProps,\n AlertDialogHeaderProps,\n AlertDialogProps,\n AlertDialogTitleProps,\n} from './AlertDialog.types';\n\nimport { isValidReactElement } from '@oneplatformdev/utils';\n\nconst RenderAlertDialogTrigger: FC<PropsWithChildren<AlertDialogProps>> = (\n props\n) => {\n const { slotProps = {}, children } = props;\n const triggerProps = slotProps.trigger ?? {};\n return <AlertDialogTrigger asChild {...triggerProps}>{children}</AlertDialogTrigger>;\n};\n\nconst RenderAlertDialogHeader: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n title = '',\n description = '',\n slotProps = {},\n children,\n } = props;\n\n const headerProps = slotProps.header ?? {};\n const titleProps = slotProps.title ?? {};\n const descriptionProps = slotProps.description ?? {};\n\n if(children) {\n return isValidReactElement(children, AlertDialogHeader)\n ? cloneElement<AlertDialogHeaderProps>(\n children as ReactElement<AlertDialogHeaderProps>,\n { ...((children as ReactElement<AlertDialogHeaderProps>).props || {}), ...headerProps }\n )\n : <AlertDialogHeader {...headerProps}>{children}</AlertDialogHeader>\n }\n\n return (\n <AlertDialogHeader>\n {Boolean(title) && isValidReactElement(title, AlertDialogTitle)\n ? cloneElement<AlertDialogTitleProps>(\n title as ReactElement<AlertDialogTitleProps>,\n { ...((title as ReactElement<AlertDialogTitleProps>).props || {}), ...titleProps }\n )\n : <AlertDialogTitle {...titleProps}>{title}</AlertDialogTitle>}\n\n {Boolean(description) && isValidReactElement(description, AlertDialogDescription)\n ? cloneElement<AlertDialogDescriptionProps>(\n description as ReactElement<AlertDialogDescriptionProps>,\n { ...((description as ReactElement<AlertDialogDescriptionProps>).props || {}), ...descriptionProps }\n )\n : <AlertDialogDescription {...descriptionProps}>{description}</AlertDialogDescription>\n }\n </AlertDialogHeader>\n )\n}\n\nconst RenderAlertDialogFooter: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n slotProps = {},\n children,\n onCancel,\n onConfirm,\n cancelLabel = 'Cancel',\n actionLabel = 'Continue',\n variant = 'confirm',\n } = props;\n const footerId = useId();\n\n const footerProps = slotProps.footer ?? {};\n const cancelButtonProps = slotProps.cancelButton ?? {};\n const actionButtonProps = slotProps.actionButton ?? {};\n\n if(children) {\n return isValidReactElement(children, AlertDialogFooter)\n ? cloneElement<AlertDialogFooterProps>(\n children as ReactElement<AlertDialogFooterProps>,\n { ...((children as ReactElement<AlertDialogFooterProps>).props || {}), ...footerProps }\n )\n : (\n <AlertDialogFooter {...footerProps}>\n {Children.map(children, (child, i) => {\n if(!child || !isValidReactElement(child)) return;\n\n const reactChild = child as ReactElement;\n const clonedChild = cloneElement(reactChild, {...(reactChild.props || {}), key: (reactChild.key || `footer-${footerId}-action-${i}` as unknown as Key)});\n\n if(isValidReactElement(child, AlertDialogAction) || isValidReactElement(child, AlertDialogCancel)) {\n return clonedChild;\n }\n\n return (\n <AlertDialogAction asChild>\n {clonedChild}\n </AlertDialogAction>\n )\n })}\n </AlertDialogFooter>\n )\n }\n\n return (\n <AlertDialogFooter>\n {variant !== 'alert' && (\n <AlertDialogCancel\n onClick={onCancel}\n {...cancelButtonProps}\n >\n {cancelLabel}\n </AlertDialogCancel>\n )}\n <AlertDialogAction\n onClick={onConfirm}\n {...actionButtonProps}\n variant={\n actionButtonProps.variant || variant === 'destructive' ? 'destructive' : 'default'\n }\n >\n {actionLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n )\n}\n\n/**\n * Component for show Alert Dialog.\n * @public\n * @see [Documentation](#)\n * @example\n * > Import:\n * ```tsx\n * import { AlertDialog } from '@oneplatformdev/ui/AlertDialog';\n * ```\n * > Simple example:\n * ```tsx\n * <AlertDialog\n * trigger={'Trigger text'} // may be any ReactNode | Button | string\n * variant='alert' // 'confirm' (default) | 'alert' | 'destructive'\n * title='Dialog title'\n * description='Description text...'\n * />\n * ```\n * > Base example:\n * ```tsx\n * <AlertDialog\n * trigger={<Button variant=\"outline\">Simple Trigger</Button>}\n * title='Dialog title'\n * description='Description text...'\n * onCancel={(event) => console.log(event, 'Cancel')}\n * onConfirm={(event) => console.log(event, 'Confirm')}\n * />\n * ```\n * > Trigger example: Button with icon children\n * ```tsx\n * <AlertDialog\n * trigger={<Button variant=\"outline\" size=\"icon\"><PencilLine /></Button>}\n * title=\"Dialog title with icon trigger\"\n * description=\"Description text...\"\n * onCancel={(event) => console.log(event, 'Cancel')}\n * onConfirm={(event) => console.log(event, 'Confirm')}\n * />\n * ```\n *\n * > Full content example:\n * ```tsx\n * <AlertDialog trigger={<Button variant=\"outline\">Full Content Trigger</Button>}>\n * Full Content...\n * </AlertDialog>\n * ```\n *\n * > Full control example:\n * ```tsx\n * <AlertDialog\n * open={true}\n * onOpenChange={(nextState) => console.log(nextState)}\n * trigger={<Button variant=\"outline\">Control Trigger</Button>}\n * header={<div>Custom Header</div>}\n * footer={[\n * <Button key='cancel' variant=\"outline\" onClick={() => {}}>On Action</Button>,\n * <Button key='action' variant=\"outline\" onClick={() => {}}>On Action</Button>,\n * ]}\n * />\n * ```\n */\nexport const AlertDialog: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n trigger,\n header,\n footer,\n slotProps = {},\n children,\n ...rest\n } = props;\n\n const contentProps = slotProps.content ?? {};\n\n return (\n <AlertDialogRoot {...rest}>\n <RenderAlertDialogTrigger {...props}>{trigger}</RenderAlertDialogTrigger>\n {children\n ? isValidReactElement(children, AlertDialogContent)\n ? cloneElement<AlertDialogContentProps>(\n children as ReactElement<AlertDialogContentProps>,\n {\n ...((children as ReactElement<AlertDialogContentProps>).props || {}),\n ...contentProps\n })\n : <AlertDialogContent {...contentProps}>{children}</AlertDialogContent>\n : (\n <AlertDialogContent {...contentProps}>\n <RenderAlertDialogHeader {...props}>{header}</RenderAlertDialogHeader>\n <RenderAlertDialogFooter {...props}>{footer}</RenderAlertDialogFooter>\n </AlertDialogContent>\n )\n }\n </AlertDialogRoot>\n )\n}\n\nexport default AlertDialog;\n"],"names":["RenderAlertDialogTrigger","props","slotProps","children","triggerProps","AlertDialogTrigger","RenderAlertDialogHeader","title","description","headerProps","titleProps","descriptionProps","isValidReactElement","AlertDialogHeader","cloneElement","jsx","AlertDialogTitle","AlertDialogDescription","RenderAlertDialogFooter","onCancel","onConfirm","cancelLabel","actionLabel","variant","footerId","useId","footerProps","cancelButtonProps","actionButtonProps","AlertDialogFooter","child","i","reactChild","clonedChild","AlertDialogAction","AlertDialogCancel","AlertDialog","trigger","header","footer","rest","contentProps","jsxs","AlertDialogRoot","AlertDialogContent"],"mappings":";;;;AA+BA,MAAMA,IAAoE,CACxEC,MACG;AACH,QAAM,EAAE,WAAAC,IAAY,IAAI,UAAAC,MAAaF,GAC/BG,IAAeF,EAAU,WAAW,CAAA;AAC1C,2BAAQG,GAAA,EAAmB,SAAO,IAAE,GAAGD,GAAe,UAAAD,GAAS;AACjE,GAEMG,IAAmE,CAACL,MAAU;AAClF,QAAM;AAAA,IACJ,OAAAM,IAAQ;AAAA,IACR,aAAAC,IAAc;AAAA,IACd,WAAAN,IAAY,CAAA;AAAA,IACZ,UAAAC;AAAA,EAAA,IACEF,GAEEQ,IAAcP,EAAU,UAAU,CAAA,GAClCQ,IAAaR,EAAU,SAAS,CAAA,GAChCS,IAAmBT,EAAU,eAAe,CAAA;AAElD,SAAGC,IACMS,EAAoBT,GAAUU,CAAiB,IAClDC;AAAA,IACAX;AAAA,IACA,EAAE,GAAKA,EAAkD,SAAS,CAAA,GAAK,GAAGM,EAAA;AAAA,EAAY,IAEtF,gBAAAM,EAACF,GAAA,EAAmB,GAAGJ,GAAc,UAAAN,EAAA,CAAS,sBAIjDU,GAAA,EACE,UAAA;AAAA,IAAQN,KAAUK,EAAoBL,GAAOS,CAAgB,IAC1DF;AAAA,MACAP;AAAA,MACA,EAAE,GAAKA,EAA8C,SAAS,CAAA,GAAK,GAAGG,EAAA;AAAA,IAAW,IAEjF,gBAAAK,EAACC,GAAA,EAAkB,GAAGN,GAAa,UAAAH,GAAM;AAAA,IAEpCC,KAAgBI,EAAoBJ,GAAaS,CAAsB,IAC5EH;AAAA,MACAN;AAAA,MACA,EAAE,GAAKA,EAA0D,SAAS,CAAA,GAAK,GAAGG,EAAA;AAAA,IAAiB,IAEnG,gBAA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AAAA,QACC,SAASd;AAAA,QACR,GAAGQ;AAAA,QACJ,SACEA,EAAkB,WAAWL,MAAY,gBAAgB,gBAAgB;AAAA,QAG1E,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,GA8Dac,IAAuD,CAACnC,MAAU;AAC7E,QAAM;AAAA,IACJ,SAAAoC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,WAAArC,IAAY,CAAA;AAAA,IACZ,UAAAC;AAAA,IACA,GAAGqC;AAAA,EAAA,IACDvC,GAEEwC,IAAevC,EAAU,WAAW,CAAA;AAE1C,SACE,gBAAAwC,EAACC,GAAA,EAAiB,GAAGH,GACnB,UAAA;AAAA,IAAA,gBAAAzB,EAACf,GAAA,EAA0B,GAAGC,GAAQ,UAAAoC,EAAA,CAAQ;AAAA,IAC7ClC,IACGS,EAAoBT,GAAUyC,CAAkB,IAC9C9B;AAAA,MACAX;AAAA,MACA;AAAA,QACE,GAAKA,EAAmD,SAAS,CAAA;AAAA,QACjE,GAAGsC;AAAA,MAAA;AAAA,IACL,IACA,gBAAA1B,EAAC6B,GAAA,EAAoB,GAAGH,GAAe,UAAAtC,GAAS,IAElD,gBAAAuC,EAACE,GAAA,EAAoB,GAAGH,GACtB,UAAA;AAAA,MAAA,gBAAA1B,EAACT,GAAA,EAAyB,GAAGL,GAAQ,UAAAqC,EAAA,CAAO;AAAA,MAC5C,gBAAAvB,EAACG,GAAA,EAAyB,GAAGjB,GAAQ,UAAAsC,EAAA,CAAO;AAAA,IAAA,EAAA,CAC9C;AAAA,EAAA,GAGN;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"AlertDialog.js","sources":["../../src/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n FC,\n Key,\n PropsWithChildren,\n ReactElement,\n useId,\n} from 'react';\nimport {\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogRoot,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from './AlertDialogRoot';\nimport {\n AlertDialogDescriptionProps,\n AlertDialogFooterProps,\n AlertDialogHeaderProps,\n AlertDialogProps,\n AlertDialogTitleProps,\n} from './AlertDialog.types';\n\nimport { isValidReactElement } from '@oneplatformdev/utils';\n\nconst RenderAlertDialogTrigger: FC<PropsWithChildren<AlertDialogProps>> = (\n props\n) => {\n const { slotProps = {}, children } = props;\n const triggerProps = slotProps.trigger ?? {};\n return <AlertDialogTrigger asChild {...triggerProps}>{children}</AlertDialogTrigger>;\n};\n\nconst RenderAlertDialogHeader: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n title = '',\n description = '',\n slotProps = {},\n children,\n } = props;\n\n const headerProps = slotProps.header ?? {};\n const titleProps = slotProps.title ?? {};\n const descriptionProps = slotProps.description ?? {};\n\n if(children) {\n return isValidReactElement(children, AlertDialogHeader)\n ? cloneElement<AlertDialogHeaderProps>(\n children as ReactElement<AlertDialogHeaderProps>,\n { ...((children as ReactElement<AlertDialogHeaderProps>).props || {}), ...headerProps }\n )\n : <AlertDialogHeader {...headerProps}>{children}</AlertDialogHeader>\n }\n\n return (\n <AlertDialogHeader>\n {Boolean(title) && isValidReactElement(title, AlertDialogTitle)\n ? cloneElement<AlertDialogTitleProps>(\n title as ReactElement<AlertDialogTitleProps>,\n { ...((title as ReactElement<AlertDialogTitleProps>).props || {}), ...titleProps }\n )\n : <AlertDialogTitle {...titleProps}>{title}</AlertDialogTitle>}\n\n {Boolean(description) && isValidReactElement(description, AlertDialogDescription)\n ? cloneElement<AlertDialogDescriptionProps>(\n description as ReactElement<AlertDialogDescriptionProps>,\n { ...((description as ReactElement<AlertDialogDescriptionProps>).props || {}), ...descriptionProps }\n )\n : <AlertDialogDescription {...descriptionProps}>{description}</AlertDialogDescription>\n }\n </AlertDialogHeader>\n )\n}\n\nconst RenderAlertDialogFooter: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n slotProps = {},\n children,\n onCancel,\n onConfirm,\n cancelLabel = 'Cancel',\n actionLabel = 'Continue',\n variant = 'confirm',\n } = props;\n const footerId = useId();\n\n const footerProps = slotProps.footer ?? {};\n const cancelButtonProps = slotProps.cancelButton ?? {};\n const actionButtonProps = slotProps.actionButton ?? {};\n\n if(children) {\n return isValidReactElement(children, AlertDialogFooter)\n ? cloneElement<AlertDialogFooterProps>(\n children as ReactElement<AlertDialogFooterProps>,\n { ...((children as ReactElement<AlertDialogFooterProps>).props || {}), ...footerProps }\n )\n : (\n <AlertDialogFooter {...footerProps}>\n {Children.map(children, (child, i) => {\n if(!child || !isValidReactElement(child)) return;\n\n const reactChild = child as ReactElement;\n const clonedChild = cloneElement(reactChild, {...(reactChild.props || {}), key: (reactChild.key || `footer-${footerId}-action-${i}` as unknown as Key)});\n\n if(isValidReactElement(child, AlertDialogAction) || isValidReactElement(child, AlertDialogCancel)) {\n return clonedChild;\n }\n\n return (\n <AlertDialogAction asChild>\n {clonedChild}\n </AlertDialogAction>\n )\n })}\n </AlertDialogFooter>\n )\n }\n\n return (\n <AlertDialogFooter>\n {variant !== 'alert' && (\n <AlertDialogCancel\n onClick={onCancel}\n {...cancelButtonProps}\n >\n {cancelLabel}\n </AlertDialogCancel>\n )}\n <AlertDialogAction\n onClick={onConfirm}\n {...actionButtonProps}\n variant={\n actionButtonProps.variant || variant === 'destructive' ? 'destructive' : 'default'\n }\n >\n {actionLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n )\n}\n\n/**\n * Component for show Alert Dialog.\n * @public\n * @see [Documentation](#)\n * @example\n * > Import:\n * ```tsx\n * import { AlertDialog } from '@oneplatformdev/ui/AlertDialog';\n * ```\n * > Simple example:\n * ```tsx\n * <AlertDialog\n * trigger={'Trigger text'} // may be any ReactNode | Button | string\n * variant='alert' // 'confirm' (default) | 'alert' | 'destructive'\n * title='Dialog title'\n * description='Description text...'\n * />\n * ```\n * > Base example:\n * ```tsx\n * <AlertDialog\n * trigger={<Button variant=\"outline\">Simple Trigger</Button>}\n * title='Dialog title'\n * description='Description text...'\n * onCancel={(event) => console.log(event, 'Cancel')}\n * onConfirm={(event) => console.log(event, 'Confirm')}\n * />\n * ```\n * > Trigger example: Button with icon children\n * ```tsx\n * <AlertDialog\n * trigger={<Button variant=\"outline\" size=\"icon\"><PencilLine /></Button>}\n * title=\"Dialog title with icon trigger\"\n * description=\"Description text...\"\n * onCancel={(event) => console.log(event, 'Cancel')}\n * onConfirm={(event) => console.log(event, 'Confirm')}\n * />\n * ```\n *\n * > Full content example:\n * ```tsx\n * <AlertDialog trigger={<Button variant=\"outline\">Full Content Trigger</Button>}>\n * Full Content...\n * </AlertDialog>\n * ```\n *\n * > Full control example:\n * ```tsx\n * <AlertDialog\n * open={true}\n * onOpenChange={(nextState) => console.log(nextState)}\n * trigger={<Button variant=\"outline\">Control Trigger</Button>}\n * header={<div>Custom Header</div>}\n * footer={[\n * <Button key='cancel' variant=\"outline\" onClick={() => {}}>On Action</Button>,\n * <Button key='action' variant=\"outline\" onClick={() => {}}>On Action</Button>,\n * ]}\n * />\n * ```\n */\nexport const AlertDialog: FC<PropsWithChildren<AlertDialogProps>> = (props) => {\n const {\n trigger,\n header,\n footer,\n slotProps = {},\n children,\n ...rest\n } = props;\n\n const contentProps = slotProps.content ?? {};\n\n return (\n <AlertDialogRoot {...rest}>\n <RenderAlertDialogTrigger {...props}>{trigger}</RenderAlertDialogTrigger>\n {children\n ? <AlertDialogContent {...contentProps}>{children}</AlertDialogContent>\n : (\n <AlertDialogContent {...contentProps}>\n <RenderAlertDialogHeader {...props}>{header}</RenderAlertDialogHeader>\n <RenderAlertDialogFooter {...props}>{footer}</RenderAlertDialogFooter>\n </AlertDialogContent>\n )\n }\n </AlertDialogRoot>\n )\n}\n\nexport default AlertDialog;\n"],"names":["RenderAlertDialogTrigger","props","slotProps","children","triggerProps","AlertDialogTrigger","RenderAlertDialogHeader","title","description","headerProps","titleProps","descriptionProps","isValidReactElement","AlertDialogHeader","cloneElement","jsx","AlertDialogTitle","AlertDialogDescription","RenderAlertDialogFooter","onCancel","onConfirm","cancelLabel","actionLabel","variant","footerId","useId","footerProps","cancelButtonProps","actionButtonProps","AlertDialogFooter","child","i","reactChild","clonedChild","AlertDialogAction","AlertDialogCancel","AlertDialog","trigger","header","footer","rest","contentProps","jsxs","AlertDialogRoot","AlertDialogContent"],"mappings":";;;;AA8BA,MAAMA,IAAoE,CACxEC,MACG;AACH,QAAM,EAAE,WAAAC,IAAY,IAAI,UAAAC,MAAaF,GAC/BG,IAAeF,EAAU,WAAW,CAAA;AAC1C,2BAAQG,GAAA,EAAmB,SAAO,IAAE,GAAGD,GAAe,UAAAD,GAAS;AACjE,GAEMG,IAAmE,CAACL,MAAU;AAClF,QAAM;AAAA,IACJ,OAAAM,IAAQ;AAAA,IACR,aAAAC,IAAc;AAAA,IACd,WAAAN,IAAY,CAAA;AAAA,IACZ,UAAAC;AAAA,EAAA,IACEF,GAEEQ,IAAcP,EAAU,UAAU,CAAA,GAClCQ,IAAaR,EAAU,SAAS,CAAA,GAChCS,IAAmBT,EAAU,eAAe,CAAA;AAElD,SAAGC,IACMS,EAAoBT,GAAUU,CAAiB,IAClDC;AAAA,IACAX;AAAA,IACA,EAAE,GAAKA,EAAkD,SAAS,CAAA,GAAK,GAAGM,EAAA;AAAA,EAAY,IAEtF,gBAAAM,EAACF,GAAA,EAAmB,GAAGJ,GAAc,UAAAN,EAAA,CAAS,sBAIjDU,GAAA,EACE,UAAA;AAAA,IAAQN,KAAUK,EAAoBL,GAAOS,CAAgB,IAC1DF;AAAA,MACAP;AAAA,MACA,EAAE,GAAKA,EAA8C,SAAS,CAAA,GAAK,GAAGG,EAAA;AAAA,IAAW,IAEjF,gBAAAK,EAACC,GAAA,EAAkB,GAAGN,GAAa,UAAAH,GAAM;AAAA,IAEpCC,KAAgBI,EAAoBJ,GAAaS,CAAsB,IAC5EH;AAAA,MACAN;AAAA,MACA,EAAE,GAAKA,EAA0D,SAAS,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AC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAS5D;AAED,iBAAS,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAY5D;AACD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,KAAK,CAAC,2CASvF;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,WAAW,CAAC,2CASnG;AAGD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,GAAG,WAAW,2CAQvG;AACD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,GAAG,WAAW,2CAQvG;AAED,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACrB,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "@radix-ui/react-alert-dialog";
|
|
3
|
+
import { cn as l } from "@oneplatformdev/utils";
|
|
4
4
|
import "../Button/Button.js";
|
|
5
5
|
import { buttonVariants as i } from "../Button/buttonVariants.js";
|
|
6
6
|
function x(t) {
|
|
7
|
-
return /* @__PURE__ */ o(
|
|
7
|
+
return /* @__PURE__ */ o(r.Root, { "data-slot": "alert-dialog", ...t });
|
|
8
8
|
}
|
|
9
9
|
function N(t) {
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
10
|
+
return /* @__PURE__ */ o(r.Trigger, { "data-slot": "alert-dialog-trigger", ...t });
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */ o(
|
|
12
|
+
function c(t) {
|
|
13
|
+
return /* @__PURE__ */ o(r.Portal, { "data-slot": "alert-dialog-portal", asChild: !0, ...t });
|
|
14
14
|
}
|
|
15
15
|
function m(t) {
|
|
16
16
|
const { className: a, ...e } = t;
|
|
17
17
|
return /* @__PURE__ */ o(
|
|
18
|
-
|
|
18
|
+
r.Overlay,
|
|
19
19
|
{
|
|
20
20
|
"data-slot": "alert-dialog-overlay",
|
|
21
|
-
className:
|
|
21
|
+
className: l(
|
|
22
22
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
23
23
|
a
|
|
24
24
|
),
|
|
@@ -28,14 +28,18 @@ function m(t) {
|
|
|
28
28
|
}
|
|
29
29
|
function A(t) {
|
|
30
30
|
const { className: a, ...e } = t;
|
|
31
|
-
return /* @__PURE__ */ c
|
|
31
|
+
return /* @__PURE__ */ d(c, { children: [
|
|
32
32
|
/* @__PURE__ */ o(m, {}),
|
|
33
33
|
/* @__PURE__ */ o(
|
|
34
|
-
|
|
34
|
+
r.Content,
|
|
35
35
|
{
|
|
36
36
|
"data-slot": "alert-dialog-content",
|
|
37
|
-
className:
|
|
38
|
-
"
|
|
37
|
+
className: l(
|
|
38
|
+
"fixed top-[50%] left-[50%] z-50 translate-x-[-50%] translate-y-[-50%]",
|
|
39
|
+
"grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 p-6",
|
|
40
|
+
"bg-background border rounded-lg shadow-lg",
|
|
41
|
+
"overflow-x-hidden break-words",
|
|
42
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 duration-200",
|
|
39
43
|
a
|
|
40
44
|
),
|
|
41
45
|
...e
|
|
@@ -49,18 +53,18 @@ function D(t) {
|
|
|
49
53
|
"div",
|
|
50
54
|
{
|
|
51
55
|
"data-slot": "alert-dialog-header",
|
|
52
|
-
className:
|
|
56
|
+
className: l("flex flex-col gap-2 text-center sm:text-left", a),
|
|
53
57
|
...e
|
|
54
58
|
}
|
|
55
59
|
);
|
|
56
60
|
}
|
|
57
|
-
function
|
|
61
|
+
function w(t) {
|
|
58
62
|
const { className: a, ...e } = t;
|
|
59
63
|
return /* @__PURE__ */ o(
|
|
60
64
|
"div",
|
|
61
65
|
{
|
|
62
66
|
"data-slot": "alert-dialog-footer",
|
|
63
|
-
className:
|
|
67
|
+
className: l(
|
|
64
68
|
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
65
69
|
a
|
|
66
70
|
),
|
|
@@ -71,55 +75,55 @@ function v(t) {
|
|
|
71
75
|
function b(t) {
|
|
72
76
|
const { className: a, ...e } = t;
|
|
73
77
|
return /* @__PURE__ */ o(
|
|
74
|
-
|
|
78
|
+
r.Title,
|
|
75
79
|
{
|
|
76
80
|
"data-slot": "alert-dialog-title",
|
|
77
|
-
className:
|
|
81
|
+
className: l("text-lg font-semibold break-words", a),
|
|
78
82
|
...e
|
|
79
83
|
}
|
|
80
84
|
);
|
|
81
85
|
}
|
|
82
|
-
function
|
|
86
|
+
function v(t) {
|
|
83
87
|
const { className: a, ...e } = t;
|
|
84
88
|
return /* @__PURE__ */ o(
|
|
85
|
-
|
|
89
|
+
r.Description,
|
|
86
90
|
{
|
|
87
91
|
"data-slot": "alert-dialog-description",
|
|
88
|
-
className:
|
|
92
|
+
className: l("text-muted-foreground text-sm whitespace-pre-wrap break-words", a),
|
|
89
93
|
...e
|
|
90
94
|
}
|
|
91
95
|
);
|
|
92
96
|
}
|
|
93
|
-
function
|
|
97
|
+
function h(t) {
|
|
94
98
|
const { className: a, variant: e, size: s, ...n } = t;
|
|
95
99
|
return /* @__PURE__ */ o(
|
|
96
|
-
|
|
100
|
+
r.Action,
|
|
97
101
|
{
|
|
98
|
-
className:
|
|
102
|
+
className: l(i({ variant: e, size: s }), a),
|
|
99
103
|
...n
|
|
100
104
|
}
|
|
101
105
|
);
|
|
102
106
|
}
|
|
103
|
-
function
|
|
107
|
+
function z(t) {
|
|
104
108
|
const { className: a, variant: e = "outline", size: s, ...n } = t;
|
|
105
109
|
return /* @__PURE__ */ o(
|
|
106
|
-
|
|
110
|
+
r.Cancel,
|
|
107
111
|
{
|
|
108
|
-
className:
|
|
112
|
+
className: l(i({ variant: e, size: s }), a),
|
|
109
113
|
...n
|
|
110
114
|
}
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
117
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
h as AlertDialogAction,
|
|
119
|
+
z as AlertDialogCancel,
|
|
116
120
|
A as AlertDialogContent,
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
v as AlertDialogDescription,
|
|
122
|
+
w as AlertDialogFooter,
|
|
119
123
|
D as AlertDialogHeader,
|
|
120
124
|
m as AlertDialogOverlay,
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
c as AlertDialogPortal,
|
|
126
|
+
r as AlertDialogPrimitive,
|
|
123
127
|
x as AlertDialogRoot,
|
|
124
128
|
b as AlertDialogTitle,
|
|
125
129
|
N as AlertDialogTrigger
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialogRoot.js","sources":["../../src/AlertDialog/AlertDialogRoot.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\n\nimport { cn } from '@oneplatformdev/utils';\nimport { ButtonProps, buttonVariants } from '../Button';\n\nfunction AlertDialogRoot(props: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger(props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />;\n}\nfunction AlertDialogPortal(props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" asChild {...props} />;\n}\n\nfunction AlertDialogOverlay(props: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPrimitive.Overlay\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...rest}\n />\n )\n}\n\nfunction AlertDialogContent(props: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n data-slot=\"alert-dialog-content\"\n className={cn(\n
|
|
1
|
+
{"version":3,"file":"AlertDialogRoot.js","sources":["../../src/AlertDialog/AlertDialogRoot.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\n\nimport { cn } from '@oneplatformdev/utils';\nimport { ButtonProps, buttonVariants } from '../Button';\n\nfunction AlertDialogRoot(props: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger(props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />;\n}\nfunction AlertDialogPortal(props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" asChild {...props} />;\n}\n\nfunction AlertDialogOverlay(props: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPrimitive.Overlay\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...rest}\n />\n )\n}\n\nfunction AlertDialogContent(props: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n data-slot=\"alert-dialog-content\"\n className={cn(\n 'fixed top-[50%] left-[50%] z-50 translate-x-[-50%] translate-y-[-50%]',\n 'grid w-full max-w-[calc(100%-2rem)] sm:max-w-lg gap-4 p-6',\n 'bg-background border rounded-lg shadow-lg',\n 'overflow-x-hidden break-words',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 duration-200',\n className\n )}\n {...rest}\n />\n </AlertDialogPortal>\n )\n}\n\n\nfunction AlertDialogHeader(props: React.ComponentProps<\"div\">) {\n const { className, ...rest } = props;\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n {...rest}\n />\n )\n}\n\nfunction AlertDialogFooter(props: React.ComponentProps<\"div\">) {\n const { className, ...rest } = props;\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n className\n )}\n {...rest}\n />\n )\n}\nfunction AlertDialogTitle(props: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\"text-lg font-semibold break-words\", className)}\n {...rest}\n />\n )\n}\n\nfunction AlertDialogDescription(props: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n const { className, ...rest } = props;\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn(\"text-muted-foreground text-sm whitespace-pre-wrap break-words\", className)}\n {...rest}\n />\n )\n}\n\n\nfunction AlertDialogAction(props: React.ComponentProps<typeof AlertDialogPrimitive.Action> & ButtonProps) {\n const { className, variant, size, ...rest } = props;\n return (\n <AlertDialogPrimitive.Action\n className={cn(buttonVariants({ variant, size }), className)}\n {...rest}\n />\n )\n}\nfunction AlertDialogCancel(props: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> & ButtonProps) {\n const { className, variant = 'outline', size, ...rest } = props\n return (\n <AlertDialogPrimitive.Cancel\n className={cn(buttonVariants({ variant, size }), className)}\n {...rest}\n />\n )\n}\n\nexport {\n AlertDialogRoot,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogPrimitive\n};\n"],"names":["AlertDialogRoot","props","AlertDialogPrimitive","AlertDialogTrigger","AlertDialogPortal","jsx","AlertDialogOverlay","className","rest","cn","AlertDialogContent","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","variant","size","buttonVariants","AlertDialogCancel"],"mappings":";;;;;AAQA,SAASA,EAAgBC,GAA+D;AACtF,2BAAQC,EAAqB,MAArB,EAA0B,aAAU,gBAAgB,GAAGD,GAAO;AACxE;AAEA,SAASE,EAAmBF,GAAkE;AAC5F,2BAAQC,EAAqB,SAArB,EAA6B,aAAU,wBAAwB,GAAGD,GAAO;AACnF;AACA,SAASG,EAAkBH,GAAiE;AAC1F,SAAO,gBAAAI,EAACH,EAAqB,QAArB,EAA4B,aAAU,uBAAsB,SAAO,IAAE,GAAGD,GAAO;AACzF;AAEA,SAASK,EAAmBL,GAAkE;AAC5F,QAAM,EAAE,WAAAM,GA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AAA,MAC3D,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASM,EAAuBb,GAAsE;AACpG,QAAM,EAAE,WAAAM,GAAW,GAAGC,EAAA,IAASP;AAC/B,SACE,gBAAAI;AAAA,IAACH,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWO,EAAG,iEAAiEF,CAAS;AAAA,MACvF,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAGA,SAASO,EAAkBd,GAA+E;AACxG,QAAM,EAAE,WAAAM,GAAW,SAAAS,GAAS,MAAAC,GAAM,GAAGT,MAASP;AAC9C,SACE,gBAAAI;AAAA,IAACH,EAAqB;AAAA,IAArB;AAAA,MACC,WAAWO,EAAGS,EAAe,EAAE,SAAAF,GAAS,MAAAC,EAAA,CAAM,GAAGV,CAAS;AAAA,MACzD,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,SAASW,EAAkBlB,GAA+E;AACxG,QAAM,EAAE,WAAAM,GAAW,SAAAS,IAAU,WAAW,MAAAC,GAAM,GAAGT,MAASP;AAC1D,SACE,gBAAAI;AAAA,IAACH,EAAqB;AAAA,IAArB;AAAA,MACC,WAAWO,EAAGS,EAAe,EAAE,SAAAF,GAAS,MAAAC,EAAA,CAAM,GAAGV,CAAS;AAAA,MACzD,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.1.10-109 (2025-12-15)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @oneplatformdev/utils to 0.1.1-158
|
|
6
|
+
- Updated @oneplatformdev/hooks to 0.1.0-144
|
|
7
|
+
- Updated @oneplatformdev/tokens to 0.0.1-131
|
|
8
|
+
|
|
1
9
|
## 0.1.10-108 (2025-12-15)
|
|
2
10
|
|
|
3
11
|
### 🧱 Updated Dependencies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/ui",
|
|
3
|
-
"version": "0.1.10-
|
|
3
|
+
"version": "0.1.10-109",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"recharts": "^3.2.0",
|
|
106
106
|
"sonner": "^2.0.7",
|
|
107
107
|
"vaul": "^1.1.2",
|
|
108
|
-
"@oneplatformdev/
|
|
109
|
-
"@oneplatformdev/
|
|
110
|
-
"@oneplatformdev/hooks": "^0.1.0-
|
|
108
|
+
"@oneplatformdev/utils": "^0.1.1-158",
|
|
109
|
+
"@oneplatformdev/tokens": "^0.0.1-131",
|
|
110
|
+
"@oneplatformdev/hooks": "^0.1.0-144"
|
|
111
111
|
}
|
|
112
112
|
}
|