@oneplatformdev/ui 0.1.10-95 → 0.1.11-4

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.
Files changed (61) hide show
  1. package/AlertDialog/AlertDialog.d.ts.map +1 -1
  2. package/AlertDialog/AlertDialog.js +40 -46
  3. package/AlertDialog/AlertDialog.js.map +1 -1
  4. package/AlertDialog/AlertDialogRoot.d.ts.map +1 -1
  5. package/AlertDialog/AlertDialogRoot.js +37 -33
  6. package/AlertDialog/AlertDialogRoot.js.map +1 -1
  7. package/Button/Button.d.ts.map +1 -1
  8. package/Button/Button.js +69 -46
  9. package/Button/Button.js.map +1 -1
  10. package/Button/Button.stories.js +126 -11
  11. package/Button/Button.stories.js.map +1 -1
  12. package/Button/Button.types.d.ts +7 -6
  13. package/Button/Button.types.d.ts.map +1 -1
  14. package/Button/buttonVariants.d.ts +30 -2
  15. package/Button/buttonVariants.d.ts.map +1 -1
  16. package/Button/buttonVariants.js +137 -21
  17. package/Button/buttonVariants.js.map +1 -1
  18. package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  19. package/ButtonIcon/ButtonIcon.js +55 -25
  20. package/ButtonIcon/ButtonIcon.js.map +1 -1
  21. package/ButtonIcon/ButtonIcon.stories.js +165 -100
  22. package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
  23. package/ButtonIcon/ButtonIcon.types.d.ts +6 -4
  24. package/ButtonIcon/ButtonIcon.types.d.ts.map +1 -1
  25. package/ButtonIcon/buttonIconVariants.d.ts +3 -4
  26. package/ButtonIcon/buttonIconVariants.d.ts.map +1 -1
  27. package/ButtonIcon/buttonIconVariants.js +97 -84
  28. package/ButtonIcon/buttonIconVariants.js.map +1 -1
  29. package/CHANGELOG.md +297 -0
  30. package/Combobox/Combobox.d.ts.map +1 -1
  31. package/Combobox/Combobox.js +107 -106
  32. package/Combobox/Combobox.js.map +1 -1
  33. package/DataTable/useDataTable.d.ts +1 -1
  34. package/Dialog/Dialog.js +14 -14
  35. package/Dialog/Dialog.js.map +1 -1
  36. package/FormRadio/FormRadio.types.d.ts +1 -1
  37. package/FormSelect/FormSelect.d.ts.map +1 -1
  38. package/FormSelect/FormSelect.js +30 -26
  39. package/FormSelect/FormSelect.js.map +1 -1
  40. package/FormSelect/FormSelect.types.d.ts +4 -2
  41. package/FormSelect/FormSelect.types.d.ts.map +1 -1
  42. package/Search/Search.d.ts.map +1 -1
  43. package/Search/Search.js +35 -33
  44. package/Search/Search.js.map +1 -1
  45. package/Select/Select.d.ts.map +1 -1
  46. package/Select/Select.js +23 -23
  47. package/Select/Select.js.map +1 -1
  48. package/Select/SelectRoot.d.ts +2 -1
  49. package/Select/SelectRoot.d.ts.map +1 -1
  50. package/Select/SelectRoot.js +59 -57
  51. package/Select/SelectRoot.js.map +1 -1
  52. package/Textarea/useAutosizeTextArea.d.ts +1 -1
  53. package/package.json +4 -4
  54. package/AlertDialog/AlertDialog.stories.d.ts +0 -47
  55. package/AlertDialog/AlertDialog.stories.d.ts.map +0 -1
  56. package/Button/Button.stories.d.ts +0 -8
  57. package/Button/Button.stories.d.ts.map +0 -1
  58. package/ButtonIcon/ButtonIcon.stories.d.ts +0 -37
  59. package/ButtonIcon/ButtonIcon.stories.d.ts.map +0 -1
  60. package/Select/Select.stories.d.ts +0 -7
  61. package/Select/Select.stories.d.ts.map +0 -1
@@ -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,EAKL,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAwH7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAiC/D,CAAA;AAED,eAAe,WAAW,CAAC"}
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 d, useId as b, Children as j } from "react";
3
- import { AlertDialogRoot as y, AlertDialogContent as u, AlertDialogTrigger as E, AlertDialogHeader as f, AlertDialogTitle as B, AlertDialogDescription as v, AlertDialogFooter as A, AlertDialogAction as D, AlertDialogCancel as R } from "./AlertDialogRoot.js";
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, i = e.trigger ?? {};
7
- return /* @__PURE__ */ t(E, { asChild: !0, ...i, children: r });
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: i = {},
13
- children: l
14
- } = o, n = i.header ?? {}, a = i.title ?? {}, c = i.description ?? {};
15
- return l ? s(l, f) ? d(
16
- l,
17
- { ...l.props || {}, ...n }
18
- ) : /* @__PURE__ */ t(f, { ...n, children: l }) : /* @__PURE__ */ g(f, { children: [
19
- e && s(e, B) ? d(
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) ? d(
23
+ r && s(r, v) ? p(
24
24
  r,
25
- { ...r.props || {}, ...c }
26
- ) : /* @__PURE__ */ t(v, { ...c, children: r })
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: i,
33
- onConfirm: l,
34
- cancelLabel: n = "Cancel",
32
+ onCancel: n,
33
+ onConfirm: i,
34
+ cancelLabel: c = "Cancel",
35
35
  actionLabel: a = "Continue",
36
- variant: c = "confirm"
37
- } = o, k = b(), m = e.footer ?? {}, x = e.cancelButton ?? {}, C = e.actionButton ?? {};
38
- return r ? s(r, A) ? d(
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 || {}, ...m }
41
- ) : /* @__PURE__ */ t(A, { ...m, children: j.map(r, (p, T) => {
42
- if (!p || !s(p)) return;
43
- const h = p, P = d(h, { ...h.props || {}, key: h.key || `footer-${k}-action-${T}` });
44
- return s(p, D) || s(p, R) ? P : /* @__PURE__ */ t(D, { asChild: !0, children: P });
45
- }) }) : /* @__PURE__ */ g(A, { children: [
46
- c !== "alert" && /* @__PURE__ */ t(
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: i,
49
+ onClick: n,
50
50
  ...x,
51
- children: n
51
+ children: c
52
52
  }
53
53
  ),
54
54
  /* @__PURE__ */ t(
55
- D,
55
+ A,
56
56
  {
57
- onClick: l,
58
- ...C,
59
- variant: C.variant || c === "destructive" ? "destructive" : "default",
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: i,
69
- slotProps: l = {},
70
- children: n,
68
+ footer: n,
69
+ slotProps: i = {},
70
+ children: c,
71
71
  ...a
72
- } = o, c = l.content ?? {};
72
+ } = o, l = i.content ?? {};
73
73
  return /* @__PURE__ */ g(y, { ...a, children: [
74
74
  /* @__PURE__ */ t(F, { ...o, children: e }),
75
- n ? s(n, u) ? d(
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: i })
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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yB,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,IAEt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S5D;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 c } from "react/jsx-runtime";
2
- import * as l from "@radix-ui/react-alert-dialog";
3
- import { cn as r } from "@oneplatformdev/utils";
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(l.Root, { "data-slot": "alert-dialog", ...t });
7
+ return /* @__PURE__ */ o(r.Root, { "data-slot": "alert-dialog", ...t });
8
8
  }
9
9
  function N(t) {
10
- return /* @__PURE__ */ o(l.Trigger, { "data-slot": "alert-dialog-trigger", ...t });
10
+ return /* @__PURE__ */ o(r.Trigger, { "data-slot": "alert-dialog-trigger", ...t });
11
11
  }
12
- function d(t) {
13
- return /* @__PURE__ */ o(l.Portal, { "data-slot": "alert-dialog-portal", asChild: !0, ...t });
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
- l.Overlay,
18
+ r.Overlay,
19
19
  {
20
20
  "data-slot": "alert-dialog-overlay",
21
- className: r(
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(d, { children: [
31
+ return /* @__PURE__ */ d(c, { children: [
32
32
  /* @__PURE__ */ o(m, {}),
33
33
  /* @__PURE__ */ o(
34
- l.Content,
34
+ r.Content,
35
35
  {
36
36
  "data-slot": "alert-dialog-content",
37
- className: r(
38
- "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
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: r("flex flex-col gap-2 text-center sm:text-left", a),
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 v(t) {
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: r(
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
- l.Title,
78
+ r.Title,
75
79
  {
76
80
  "data-slot": "alert-dialog-title",
77
- className: r("text-lg font-semibold", a),
81
+ className: l("text-lg font-semibold break-words", a),
78
82
  ...e
79
83
  }
80
84
  );
81
85
  }
82
- function z(t) {
86
+ function v(t) {
83
87
  const { className: a, ...e } = t;
84
88
  return /* @__PURE__ */ o(
85
- l.Description,
89
+ r.Description,
86
90
  {
87
91
  "data-slot": "alert-dialog-description",
88
- className: r("text-muted-foreground text-sm", a),
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 w(t) {
97
+ function h(t) {
94
98
  const { className: a, variant: e, size: s, ...n } = t;
95
99
  return /* @__PURE__ */ o(
96
- l.Action,
100
+ r.Action,
97
101
  {
98
- className: r(i({ variant: e, size: s }), a),
102
+ className: l(i({ variant: e, size: s }), a),
99
103
  ...n
100
104
  }
101
105
  );
102
106
  }
103
- function y(t) {
107
+ function z(t) {
104
108
  const { className: a, variant: e = "outline", size: s, ...n } = t;
105
109
  return /* @__PURE__ */ o(
106
- l.Cancel,
110
+ r.Cancel,
107
111
  {
108
- className: r(i({ variant: e, size: s }), a),
112
+ className: l(i({ variant: e, size: s }), a),
109
113
  ...n
110
114
  }
111
115
  );
112
116
  }
113
117
  export {
114
- w as AlertDialogAction,
115
- y as AlertDialogCancel,
118
+ h as AlertDialogAction,
119
+ z as AlertDialogCancel,
116
120
  A as AlertDialogContent,
117
- z as AlertDialogDescription,
118
- v as AlertDialogFooter,
121
+ v as AlertDialogDescription,
122
+ w as AlertDialogFooter,
119
123
  D as AlertDialogHeader,
120
124
  m as AlertDialogOverlay,
121
- d as AlertDialogPortal,
122
- l as AlertDialogPrimitive,
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 \"bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\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\", 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\", 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,GAAW,GAAGC,EAAA,IAASP;AAC/B,SACE,gBAAAI;AAAA,IAACH,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWO;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASE,EAAmBT,G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AA,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;"}
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,GAAW,GAAGC,EAAA,IAASP;AAC/B,SACE,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A,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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,eAAO,MAAM,MAAM,uFA0ClB,CAAA;AAGD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4ClD,eAAO,MAAM,MAAM,uFAuElB,CAAA;AAGD,eAAe,MAAM,CAAC"}
package/Button/Button.js CHANGED
@@ -1,56 +1,79 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import * as g from "react";
3
- import { Slot as x } from "@radix-ui/react-slot";
4
- import { cn as u } from "@oneplatformdev/utils";
5
- import { buttonVariants as i } from "./buttonVariants.js";
1
+ import { jsx as r, jsxs as z, Fragment as k } from "react/jsx-runtime";
2
+ import * as x from "react";
3
+ import { Slot as I } from "@radix-ui/react-slot";
4
+ import { cn as N } from "@oneplatformdev/utils";
5
+ import { buttonVariants as j } from "./buttonVariants.js";
6
6
  import "@radix-ui/react-tooltip";
7
- import { Tooltip as B } from "../Tooltip/Tooltip.js";
8
- const N = g.forwardRef(
9
- ({
10
- disabled: t,
11
- className: r,
12
- variant: n,
13
- size: e,
14
- asChild: c = !1,
15
- title: l = "",
16
- tooltip: y,
17
- tooltipProps: f = {},
18
- message: b,
19
- ...p
20
- }, a) => {
21
- const s = c ? x : "button", o = b || y || l;
22
- return o ? /* @__PURE__ */ m(
23
- B,
24
- {
25
- ...f || {},
26
- open: f.open ?? (t || !o) ? !1 : void 0,
27
- message: o,
28
- children: /* @__PURE__ */ m(
29
- s,
30
- {
31
- type: "button",
32
- ref: a,
33
- disabled: t,
34
- className: u(i({ variant: n, size: e, className: r })),
35
- ...p
36
- }
37
- )
38
- }
39
- ) : /* @__PURE__ */ m(
40
- s,
7
+ import { Tooltip as A } from "../Tooltip/Tooltip.js";
8
+ import { LoadedIcon as f } from "../LoadedIcon/LoadedIcon.js";
9
+ const C = (a) => {
10
+ const { variant: t, size: n, color: i } = a, o = { color: i, variant: t, size: n };
11
+ if (n === "icon")
12
+ throw console.warn('Button size "icon" is not supported. Please use ButtonIcon component for icon-only buttons.'), new Error('Button size "icon" is not supported. Please use ButtonIcon component for icon-only buttons.');
13
+ if (t === "default")
14
+ return console.warn('Button variant "default" is deprecated. Please use "variant=contained color=primary" instead.'), o.variant = "contained", o.color = "primary", o;
15
+ if (t === "outline")
16
+ return console.warn('Button variant "outline" is deprecated. Please use "variant=outlined color=primary" instead.'), o.variant = "outlined", o.color = "primary", o;
17
+ if (t === "secondary")
18
+ return console.warn('Button variant "secondary" is deprecated. Please use "variant=contained color=secondary" instead.'), o.variant = "contained", o.color = "secondary", o;
19
+ if (t === "destructive")
20
+ return console.warn('Button variant "destructive" is deprecated. Please use "variant=contained color=error" instead.'), o.variant = "contained", o.color = "error", o;
21
+ if (t === "link")
22
+ throw console.warn('Button variant "link" is not implemented yet. Please contact the development team for more information.'), new Error('Button variant "link" is not implemented yet. Please contact the development team for more information.');
23
+ return o;
24
+ }, E = x.forwardRef(
25
+ (a, t) => {
26
+ const {
27
+ disabled: n,
28
+ className: i,
29
+ variant: o,
30
+ color: v,
31
+ size: y,
32
+ asChild: c = !1,
33
+ title: B = "",
34
+ tooltip: h,
35
+ tooltipProps: l = {},
36
+ message: w,
37
+ loading: e = !1,
38
+ children: d,
39
+ startAdornment: m,
40
+ endAdornment: u,
41
+ ...P
42
+ } = a, b = c ? I : "button", s = w || h || B, g = c ? d : /* @__PURE__ */ z(k, { children: [
43
+ !!m && /* @__PURE__ */ r(f, { loading: e, children: m }),
44
+ d,
45
+ !!u && /* @__PURE__ */ r(f, { loading: e, children: u })
46
+ ] }), p = /* @__PURE__ */ r(
47
+ b,
41
48
  {
42
49
  type: "button",
43
- ref: a,
44
- disabled: t,
45
- className: u(i({ variant: n, size: e, className: r })),
46
- ...p
50
+ ref: t,
51
+ disabled: n,
52
+ className: N(
53
+ j({
54
+ ...C({ variant: o, size: y, color: v }),
55
+ className: i
56
+ }),
57
+ e && "pointer-events-none opacity-80"
58
+ ),
59
+ ...P,
60
+ children: g
47
61
  }
48
62
  );
63
+ return s ? /* @__PURE__ */ r(
64
+ A,
65
+ {
66
+ ...l || {},
67
+ open: l.open ?? (n || e || !s) ? !1 : void 0,
68
+ message: s,
69
+ children: p
70
+ }
71
+ ) : p;
49
72
  }
50
73
  );
51
- N.displayName = "Button";
74
+ E.displayName = "Button";
52
75
  export {
53
- N as Button,
54
- N as default
76
+ E as Button,
77
+ E as default
55
78
  };
56
79
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { buttonVariants } from './buttonVariants';\nimport { ButtonProps } from './Button.types';\n\nimport { Tooltip } from '../Tooltip';\n\n// TODO: create ButtonIcon component | update button | add start/end icon\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({\n disabled,\n className,\n variant,\n size,\n asChild = false,\n title = '',\n tooltip,\n tooltipProps = {},\n message,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : \"button\"\n const msg = message || tooltip || title;\n\n if(!msg) {\n return <Comp\n type='button'\n ref={ref}\n disabled={disabled}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n }\n\n return (\n <Tooltip\n {...(tooltipProps || {})}\n open={tooltipProps.open ?? (disabled || !msg) ? false : undefined}\n message={msg}\n >\n <Comp\n type='button'\n ref={ref}\n disabled={disabled}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n </Tooltip>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport default Button;\n"],"names":["Button","React","disabled","className","variant","size","asChild","title","tooltip","tooltipProps","message","props","ref","Comp","Slot","msg","jsx","Tooltip","cn","buttonVariants"],"mappings":";;;;;;;AAUO,MAAMA,IAASC,EAAM;AAAA,EAC1B,CAAC;AAAA,IACE,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,OAAAC,IAAQ;AAAA,IACR,SAAAC;AAAA,IACA,cAAAC,IAAe,CAAA;AAAA,IACf,SAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GACFC,MAAQ;AACV,UAAMC,IAAOP,IAAUQ,IAAO,UACxBC,IAAML,KAAWF,KAAWD;AAElC,WAAIQ,IAWF,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACE,GAAIR,KAAgB,CAAA;AAAA,QACrB,MAAMA,EAAa,SAASP,KAAY,CAACa,KAAO,KAAQ;AAAA,QACxD,SAASA;AAAA,QAET,UAAA,gBAAAC;AAAA,UAACH;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,KAAAD;AAAA,YACA,UAAAV;AAAA,YACA,WAAWgB,EAAGC,EAAe,EAAE,SAAAf,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,YACzD,GAAGQ;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA,IArBK,gBAAAK;AAAA,MAACH;AAAA,MAAA;AAAA,QACN,MAAK;AAAA,QACL,KAAAD;AAAA,QACA,UAAAV;AAAA,QACA,WAAWgB,EAAGC,EAAe,EAAE,SAAAf,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,QACzD,GAAGQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAmBV;AACF;AACAX,EAAO,cAAc;"}
1
+ {"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { ButtonCVAProps, buttonVariants } from './buttonVariants';\nimport { type ButtonProps } from './Button.types';\n\nimport { Tooltip } from '../Tooltip';\nimport { LoadedIcon } from \"../LoadedIcon\";\n\nconst normalizedVariantProperties = (props: ButtonCVAProps): ButtonCVAProps => {\n const { variant, size, color } = props;\n const vls = { color, variant, size }\n if (size === 'icon') {\n console.warn('Button size \"icon\" is not supported. Please use ButtonIcon component for icon-only buttons.')\n throw new Error('Button size \"icon\" is not supported. Please use ButtonIcon component for icon-only buttons.')\n }\n if (variant === 'default') {\n console.warn('Button variant \"default\" is deprecated. Please use \"variant=contained color=primary\" instead.')\n vls.variant = 'contained'\n vls.color = 'primary'\n return vls\n }\n if (variant === 'outline') {\n console.warn('Button variant \"outline\" is deprecated. Please use \"variant=outlined color=primary\" instead.')\n vls.variant = 'outlined'\n vls.color = 'primary'\n return vls\n }\n if (variant === 'secondary') {\n console.warn('Button variant \"secondary\" is deprecated. Please use \"variant=contained color=secondary\" instead.')\n vls.variant = 'contained'\n vls.color = 'secondary'\n return vls\n }\n if (variant === 'destructive') {\n console.warn('Button variant \"destructive\" is deprecated. Please use \"variant=contained color=error\" instead.')\n vls.variant = 'contained'\n vls.color = 'error'\n return vls\n }\n if (variant === 'link') {\n console.warn('Button variant \"link\" is not implemented yet. Please contact the development team for more information.')\n throw new Error('Button variant \"link\" is not implemented yet. Please contact the development team for more information.')\n }\n return vls;\n}\n\n// TODO: create ButtonIcon component | update button | add start/end icon\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props, ref) => {\n const {\n disabled,\n className,\n variant,\n color,\n size,\n asChild = false,\n title = '',\n tooltip,\n tooltipProps = {},\n message,\n loading = false,\n children,\n startAdornment,\n endAdornment,\n ...rest\n } = props;\n const Comp = asChild ? Slot : \"button\"\n const msg = message || tooltip || title;\n\n const content = asChild\n ? children\n : (\n <>\n {!!startAdornment && (\n <LoadedIcon loading={loading}>\n {startAdornment}\n </LoadedIcon>\n )}\n\n {children}\n\n {!!endAdornment && (\n <LoadedIcon loading={loading}>\n {endAdornment}\n </LoadedIcon>\n )}\n </>\n )\n\n const cmp = (\n <Comp\n type='button'\n ref={ref}\n disabled={disabled}\n className={cn(\n buttonVariants({\n ...normalizedVariantProperties({ variant, size, color }),\n className\n }),\n loading && 'pointer-events-none opacity-80',\n )}\n {...rest}\n >\n {content}\n </Comp>\n )\n\n if (!msg) return cmp\n return (\n <Tooltip\n {...(tooltipProps || {})}\n open={tooltipProps.open ?? (disabled || loading || !msg) ? false : undefined}\n message={msg}\n >\n {cmp}\n </Tooltip>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport default Button;\n"],"names":["normalizedVariantProperties","props","variant","size","color","vls","Button","React","ref","disabled","className","asChild","title","tooltip","tooltipProps","message","loading","children","startAdornment","endAdornment","rest","Comp","Slot","msg","content","jsxs","Fragment","jsx","LoadedIcon","cmp","cn","buttonVariants","Tooltip"],"mappings":";;;;;;;;AAUA,MAAMA,IAA8B,CAACC,MAA0C;AAC7E,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,EAAA,IAAUH,GAC3BI,IAAM,EAAE,OAAAD,GAAO,SAAAF,GAAS,MAAAC,EAAA;AAC9B,MAAIA,MAAS;AACX,kBAAQ,KAAK,6FAA6F,GACpG,IAAI,MAAM,6FAA6F;AAE/G,MAAID,MAAY;AACd,mBAAQ,KAAK,+FAA+F,GAC5GG,EAAI,UAAU,aACdA,EAAI,QAAQ,WACLA;AAET,MAAIH,MAAY;AACd,mBAAQ,KAAK,8FAA8F,GAC3GG,EAAI,UAAU,YACdA,EAAI,QAAQ,WACLA;AAET,MAAIH,MAAY;AACd,mBAAQ,KAAK,mGAAmG,GAChHG,EAAI,UAAU,aACdA,EAAI,QAAQ,aACLA;AAET,MAAIH,MAAY;AACd,mBAAQ,KAAK,iGAAiG,GAC9GG,EAAI,UAAU,aACdA,EAAI,QAAQ,SACLA;AAET,MAAIH,MAAY;AACd,kBAAQ,KAAK,yGAAyG,GAChH,IAAI,MAAM,yGAAyG;AAE3H,SAAOG;AACT,GAGaC,IAASC,EAAM;AAAA,EAC1B,CAACN,GAAOO,MAAQ;AACd,UAAM;AAAA,MACJ,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,SAAAR;AAAA,MACA,OAAAE;AAAA,MACA,MAAAD;AAAA,MACA,SAAAQ,IAAU;AAAA,MACV,OAAAC,IAAQ;AAAA,MACR,SAAAC;AAAA,MACA,cAAAC,IAAe,CAAA;AAAA,MACf,SAAAC;AAAA,MACA,SA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