@optimum-intelligence/opti-ui 0.7.6 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +20 -10
  3. package/dist/components/alert/Alert.d.ts +5 -2
  4. package/dist/components/alert/Alert.js +67 -65
  5. package/dist/components/alert/Alert.js.map +1 -1
  6. package/dist/components/app-shell/AppShell.d.ts +25 -8
  7. package/dist/components/app-shell/AppShell.js +428 -397
  8. package/dist/components/app-shell/AppShell.js.map +1 -1
  9. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +6 -1
  10. package/dist/components/breadcrumbs/Breadcrumbs.js +42 -40
  11. package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -1
  12. package/dist/components/calendar/Calendar.js +140 -136
  13. package/dist/components/calendar/Calendar.js.map +1 -1
  14. package/dist/components/combobox/Combobox.d.ts +9 -3
  15. package/dist/components/combobox/Combobox.js +220 -231
  16. package/dist/components/combobox/Combobox.js.map +1 -1
  17. package/dist/components/command-palette/CommandPalette.d.ts +13 -4
  18. package/dist/components/command-palette/CommandPalette.js +91 -89
  19. package/dist/components/command-palette/CommandPalette.js.map +1 -1
  20. package/dist/components/data-table/DataTable.d.ts +51 -17
  21. package/dist/components/data-table/DataTable.js +489 -278
  22. package/dist/components/data-table/DataTable.js.map +1 -1
  23. package/dist/components/data-table/DataTableContent.d.ts +7 -1
  24. package/dist/components/data-table/DataTableContent.js +247 -211
  25. package/dist/components/data-table/DataTableContent.js.map +1 -1
  26. package/dist/components/data-table/DataTableFilters.d.ts +56 -4
  27. package/dist/components/data-table/DataTableFilters.js +493 -77
  28. package/dist/components/data-table/DataTableFilters.js.map +1 -1
  29. package/dist/components/data-table/layout.d.ts +5 -0
  30. package/dist/components/data-table/layout.js +23 -1
  31. package/dist/components/data-table/layout.js.map +1 -1
  32. package/dist/components/data-table/types.d.ts +35 -2
  33. package/dist/components/data-table/useDataTable.d.ts +1 -1
  34. package/dist/components/data-table/useDataTable.js +386 -332
  35. package/dist/components/data-table/useDataTable.js.map +1 -1
  36. package/dist/components/date-picker/DatePicker.d.ts +5 -0
  37. package/dist/components/date-picker/DatePicker.js +148 -140
  38. package/dist/components/date-picker/DatePicker.js.map +1 -1
  39. package/dist/components/date-picker/DateRangePicker.d.ts +2 -0
  40. package/dist/components/date-picker/DateRangePicker.js +171 -164
  41. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  42. package/dist/components/date-picker/PickerField.d.ts +6 -3
  43. package/dist/components/date-picker/PickerField.js +166 -159
  44. package/dist/components/date-picker/PickerField.js.map +1 -1
  45. package/dist/components/dialog/ConfirmDialog.d.ts +5 -2
  46. package/dist/components/dialog/ConfirmDialog.js +79 -77
  47. package/dist/components/dialog/ConfirmDialog.js.map +1 -1
  48. package/dist/components/dialog/Dialog.d.ts +5 -2
  49. package/dist/components/dialog/Dialog.js +65 -63
  50. package/dist/components/dialog/Dialog.js.map +1 -1
  51. package/dist/components/drawer/Drawer.d.ts +13 -4
  52. package/dist/components/drawer/Drawer.js +122 -164
  53. package/dist/components/drawer/Drawer.js.map +1 -1
  54. package/dist/components/field/Field.d.ts +38 -9
  55. package/dist/components/field/Field.js +66 -1
  56. package/dist/components/field/Field.js.map +1 -1
  57. package/dist/components/file-upload/FileUpload.js +2 -0
  58. package/dist/components/file-upload/FileUpload.js.map +1 -1
  59. package/dist/components/input/Input.d.ts +9 -16
  60. package/dist/components/input/Input.js +124 -206
  61. package/dist/components/input/Input.js.map +1 -1
  62. package/dist/components/map/colors.d.ts +2 -2
  63. package/dist/components/map/colors.js +12 -3
  64. package/dist/components/map/colors.js.map +1 -1
  65. package/dist/components/number-field/NumberField.d.ts +12 -3
  66. package/dist/components/number-field/NumberField.js +109 -130
  67. package/dist/components/number-field/NumberField.js.map +1 -1
  68. package/dist/components/pagination/Pagination.js +135 -186
  69. package/dist/components/pagination/Pagination.js.map +1 -1
  70. package/dist/components/progress/Progress.d.ts +2 -1
  71. package/dist/components/progress/Progress.js.map +1 -1
  72. package/dist/components/search-input/SearchInput.d.ts +5 -2
  73. package/dist/components/search-input/SearchInput.js +47 -45
  74. package/dist/components/search-input/SearchInput.js.map +1 -1
  75. package/dist/components/select/Select.d.ts +13 -3
  76. package/dist/components/select/Select.js +144 -139
  77. package/dist/components/select/Select.js.map +1 -1
  78. package/dist/components/spinner/Spinner.d.ts +6 -2
  79. package/dist/components/spinner/Spinner.js +42 -40
  80. package/dist/components/spinner/Spinner.js.map +1 -1
  81. package/dist/components/stat-card/StatCard.d.ts +7 -2
  82. package/dist/components/stat-card/StatCard.js +1 -1
  83. package/dist/components/stat-card/StatCard.js.map +1 -1
  84. package/dist/components/stepper/Stepper.js +44 -40
  85. package/dist/components/stepper/Stepper.js.map +1 -1
  86. package/dist/components/toast/Toast.d.ts +17 -1
  87. package/dist/components/toast/Toast.js +65 -33
  88. package/dist/components/toast/Toast.js.map +1 -1
  89. package/dist/components.json +475 -68
  90. package/dist/icons/index.d.ts +4 -0
  91. package/dist/icons/index.js +12 -1
  92. package/dist/icons/index.js.map +1 -1
  93. package/dist/index.d.ts +3 -0
  94. package/dist/index.js +7 -4
  95. package/dist/labels/Labels.d.ts +93 -0
  96. package/dist/labels/Labels.js +96 -0
  97. package/dist/labels/Labels.js.map +1 -0
  98. package/dist/labels/hu.d.ts +17 -0
  99. package/dist/labels/hu.js +124 -0
  100. package/dist/labels/hu.js.map +1 -0
  101. package/dist/llms-full.txt +274 -48
  102. package/dist/llms.txt +11 -4
  103. package/dist/opti-ui.css +370 -47
  104. package/dist/theme/ThemeProvider.d.ts +8 -4
  105. package/dist/theme/ThemeProvider.js.map +1 -1
  106. package/dist/utils/media.d.ts +9 -2
  107. package/dist/utils/media.js +10 -3
  108. package/dist/utils/media.js.map +1 -1
  109. package/package.json +5 -2
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { useLabels } from "../../labels/Labels.js";
2
3
  import { Button } from "../button/Button.js";
3
4
  import { AlertDialog } from "./Dialog.js";
4
5
  import { Alert } from "../alert/Alert.js";
@@ -26,79 +27,80 @@ import { jsx, jsxs } from "react/jsx-runtime";
26
27
  */
27
28
  function ConfirmDialog(t0) {
28
29
  const $ = c(43);
29
- const { open, defaultOpen, onOpenChange, onOpenChangeComplete, trigger, title, description, children, confirmLabel, cancelLabel: t1, onConfirm, destructive: t2, pending: t3, error, size: t4, backdropBlur, nestedBackdrop, ref } = t0;
30
- const cancelLabel = t1 === void 0 ? "Cancel" : t1;
31
- const destructive = t2 === void 0 ? false : t2;
32
- const pending = t3 === void 0 ? false : t3;
33
- const size = t4 === void 0 ? "sm" : t4;
34
- let t5;
30
+ const { open, defaultOpen, onOpenChange, onOpenChangeComplete, trigger, title, description, children, confirmLabel, cancelLabel: cancelLabelProp, onConfirm, destructive: t1, pending: t2, error, size: t3, backdropBlur, nestedBackdrop, ref } = t0;
31
+ const destructive = t1 === void 0 ? false : t1;
32
+ const pending = t2 === void 0 ? false : t2;
33
+ const size = t3 === void 0 ? "sm" : t3;
34
+ const text = useLabels();
35
+ const cancelLabel = cancelLabelProp ?? text.cancel;
36
+ let t4;
35
37
  if ($[0] !== onOpenChange || $[1] !== pending) {
36
- t5 = (next) => {
38
+ t4 = (next) => {
37
39
  if (!next && pending) return;
38
40
  onOpenChange?.(next);
39
41
  };
40
42
  $[0] = onOpenChange;
41
43
  $[1] = pending;
42
- $[2] = t5;
43
- } else t5 = $[2];
44
- let t6;
44
+ $[2] = t4;
45
+ } else t4 = $[2];
46
+ let t5;
45
47
  if ($[3] !== trigger) {
46
- t6 = trigger && /* @__PURE__ */ jsx(AlertDialog.Trigger, { render: trigger });
48
+ t5 = trigger && /* @__PURE__ */ jsx(AlertDialog.Trigger, { render: trigger });
47
49
  $[3] = trigger;
48
- $[4] = t6;
49
- } else t6 = $[4];
50
- let t7;
50
+ $[4] = t5;
51
+ } else t5 = $[4];
52
+ let t6;
51
53
  if ($[5] !== title) {
52
- t7 = /* @__PURE__ */ jsx(AlertDialog.Title, { children: title });
54
+ t6 = /* @__PURE__ */ jsx(AlertDialog.Title, { children: title });
53
55
  $[5] = title;
54
- $[6] = t7;
55
- } else t7 = $[6];
56
- let t8;
56
+ $[6] = t6;
57
+ } else t6 = $[6];
58
+ let t7;
57
59
  if ($[7] !== description) {
58
- t8 = description && /* @__PURE__ */ jsx(AlertDialog.Description, { children: description });
60
+ t7 = description && /* @__PURE__ */ jsx(AlertDialog.Description, { children: description });
59
61
  $[7] = description;
60
- $[8] = t8;
61
- } else t8 = $[8];
62
+ $[8] = t7;
63
+ } else t7 = $[8];
64
+ let t8;
65
+ if ($[9] !== t6 || $[10] !== t7) {
66
+ t8 = /* @__PURE__ */ jsxs(AlertDialog.Header, { children: [t6, t7] });
67
+ $[9] = t6;
68
+ $[10] = t7;
69
+ $[11] = t8;
70
+ } else t8 = $[11];
62
71
  let t9;
63
- if ($[9] !== t7 || $[10] !== t8) {
64
- t9 = /* @__PURE__ */ jsxs(AlertDialog.Header, { children: [t7, t8] });
65
- $[9] = t7;
66
- $[10] = t8;
67
- $[11] = t9;
68
- } else t9 = $[11];
69
- let t10;
70
72
  if ($[12] !== error) {
71
- t10 = error && /* @__PURE__ */ jsx(Alert, {
73
+ t9 = error && /* @__PURE__ */ jsx(Alert, {
72
74
  tone: "danger",
73
75
  children: error
74
76
  });
75
77
  $[12] = error;
76
- $[13] = t10;
77
- } else t10 = $[13];
78
- let t11;
78
+ $[13] = t9;
79
+ } else t9 = $[13];
80
+ let t10;
79
81
  if ($[14] !== pending) {
80
- t11 = /* @__PURE__ */ jsx(Button, {
82
+ t10 = /* @__PURE__ */ jsx(Button, {
81
83
  variant: "secondary",
82
84
  disabled: pending
83
85
  });
84
86
  $[14] = pending;
85
- $[15] = t11;
86
- } else t11 = $[15];
87
- let t12;
88
- if ($[16] !== cancelLabel || $[17] !== t11) {
89
- t12 = /* @__PURE__ */ jsx(AlertDialog.Close, {
90
- render: t11,
87
+ $[15] = t10;
88
+ } else t10 = $[15];
89
+ let t11;
90
+ if ($[16] !== cancelLabel || $[17] !== t10) {
91
+ t11 = /* @__PURE__ */ jsx(AlertDialog.Close, {
92
+ render: t10,
91
93
  children: cancelLabel
92
94
  });
93
95
  $[16] = cancelLabel;
94
- $[17] = t11;
95
- $[18] = t12;
96
- } else t12 = $[18];
97
- const t13 = destructive ? "danger" : "primary";
98
- let t14;
99
- if ($[19] !== confirmLabel || $[20] !== onConfirm || $[21] !== pending || $[22] !== t13) {
100
- t14 = /* @__PURE__ */ jsx(Button, {
101
- variant: t13,
96
+ $[17] = t10;
97
+ $[18] = t11;
98
+ } else t11 = $[18];
99
+ const t12 = destructive ? "danger" : "primary";
100
+ let t13;
101
+ if ($[19] !== confirmLabel || $[20] !== onConfirm || $[21] !== pending || $[22] !== t12) {
102
+ t13 = /* @__PURE__ */ jsx(Button, {
103
+ variant: t12,
102
104
  loading: pending,
103
105
  onClick: onConfirm,
104
106
  children: confirmLabel
@@ -106,28 +108,28 @@ function ConfirmDialog(t0) {
106
108
  $[19] = confirmLabel;
107
109
  $[20] = onConfirm;
108
110
  $[21] = pending;
109
- $[22] = t13;
110
- $[23] = t14;
111
- } else t14 = $[23];
111
+ $[22] = t12;
112
+ $[23] = t13;
113
+ } else t13 = $[23];
114
+ let t14;
115
+ if ($[24] !== t11 || $[25] !== t13) {
116
+ t14 = /* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [t11, t13] });
117
+ $[24] = t11;
118
+ $[25] = t13;
119
+ $[26] = t14;
120
+ } else t14 = $[26];
112
121
  let t15;
113
- if ($[24] !== t12 || $[25] !== t14) {
114
- t15 = /* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [t12, t14] });
115
- $[24] = t12;
116
- $[25] = t14;
117
- $[26] = t15;
118
- } else t15 = $[26];
119
- let t16;
120
- if ($[27] !== backdropBlur || $[28] !== children || $[29] !== nestedBackdrop || $[30] !== ref || $[31] !== size || $[32] !== t10 || $[33] !== t15 || $[34] !== t9) {
121
- t16 = /* @__PURE__ */ jsxs(AlertDialog.Content, {
122
+ if ($[27] !== backdropBlur || $[28] !== children || $[29] !== nestedBackdrop || $[30] !== ref || $[31] !== size || $[32] !== t14 || $[33] !== t8 || $[34] !== t9) {
123
+ t15 = /* @__PURE__ */ jsxs(AlertDialog.Content, {
122
124
  ref,
123
125
  size,
124
126
  backdropBlur,
125
127
  nestedBackdrop,
126
128
  children: [
127
- t9,
129
+ t8,
128
130
  children,
129
- t10,
130
- t15
131
+ t9,
132
+ t14
131
133
  ]
132
134
  });
133
135
  $[27] = backdropBlur;
@@ -135,29 +137,29 @@ function ConfirmDialog(t0) {
135
137
  $[29] = nestedBackdrop;
136
138
  $[30] = ref;
137
139
  $[31] = size;
138
- $[32] = t10;
139
- $[33] = t15;
140
+ $[32] = t14;
141
+ $[33] = t8;
140
142
  $[34] = t9;
141
- $[35] = t16;
142
- } else t16 = $[35];
143
- let t17;
144
- if ($[36] !== defaultOpen || $[37] !== onOpenChangeComplete || $[38] !== open || $[39] !== t16 || $[40] !== t5 || $[41] !== t6) {
145
- t17 = /* @__PURE__ */ jsxs(AlertDialog.Root, {
143
+ $[35] = t15;
144
+ } else t15 = $[35];
145
+ let t16;
146
+ if ($[36] !== defaultOpen || $[37] !== onOpenChangeComplete || $[38] !== open || $[39] !== t15 || $[40] !== t4 || $[41] !== t5) {
147
+ t16 = /* @__PURE__ */ jsxs(AlertDialog.Root, {
146
148
  open,
147
149
  defaultOpen,
148
- onOpenChange: t5,
150
+ onOpenChange: t4,
149
151
  onOpenChangeComplete,
150
- children: [t6, t16]
152
+ children: [t5, t15]
151
153
  });
152
154
  $[36] = defaultOpen;
153
155
  $[37] = onOpenChangeComplete;
154
156
  $[38] = open;
155
- $[39] = t16;
156
- $[40] = t5;
157
- $[41] = t6;
158
- $[42] = t17;
159
- } else t17 = $[42];
160
- return t17;
157
+ $[39] = t15;
158
+ $[40] = t4;
159
+ $[41] = t5;
160
+ $[42] = t16;
161
+ } else t16 = $[42];
162
+ return t16;
161
163
  }
162
164
  //#endregion
163
165
  export { ConfirmDialog };
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.js","names":["React","Alert","Button","AlertDialog","DialogBackdropBlur","ConfirmDialogProps","ref","Ref","HTMLDivElement","open","defaultOpen","onOpenChange","onOpenChangeComplete","trigger","ReactElement","title","ReactNode","description","children","confirmLabel","cancelLabel","onConfirm","destructive","pending","error","size","backdropBlur","nestedBackdrop","ConfirmDialog","t0","$","_c","t1","t2","t3","t4","undefined","t5","next","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","_c"],"sources":["../../../src/components/dialog/ConfirmDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Alert } from '../alert/Alert';\nimport { Button } from '../button/Button';\nimport { AlertDialog, type DialogBackdropBlur } from './Dialog';\n\nexport interface ConfirmDialogProps {\n /** Ref to the dialog popup. */\n ref?: React.Ref<HTMLDivElement>;\n /** Whether the dialog is open (controlled). */\n open?: boolean;\n /** Initial state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the dialog opens or closes. Not called to close while `pending`. */\n onOpenChange?: (open: boolean) => void;\n /** Called once the open or close transition has finished, e.g. to unmount the dialog. */\n onOpenChangeComplete?: (open: boolean) => void;\n /** Element that opens the dialog, e.g. `<Button>Delete</Button>`. Omit when `open` is controlled. */\n trigger?: React.ReactElement;\n /** The question, e.g. \"Delete this truck?\". */\n title: React.ReactNode;\n /** What happens when confirmed. */\n description?: React.ReactNode;\n /** Extra content between the description and the buttons. */\n children?: React.ReactNode;\n /** Text of the confirm button. */\n confirmLabel: React.ReactNode;\n /** Text of the cancel button. */\n cancelLabel?: React.ReactNode;\n /** Called by the confirm button. The dialog stays open; close it when the action succeeds. */\n onConfirm: () => void;\n /** Red confirm button, for actions that delete or cannot be undone. */\n destructive?: boolean;\n /** The action is running: the confirm button spins and the dialog cannot be closed. */\n pending?: boolean;\n /** Why the action failed, shown above the buttons. */\n error?: React.ReactNode;\n /** Dialog width. */\n size?: 'sm' | 'md' | 'lg';\n /** How strongly the page behind the dialog is blurred. */\n backdropBlur?: DialogBackdropBlur;\n /** Blur the dialog or drawer this one opens from, instead of showing no backdrop. */\n nestedBackdrop?: boolean;\n}\n\n/**\n * Asks before an action runs: title, description, cancel and confirm buttons,\n * a pending state that keeps the dialog open, and room for the error.\n * For other layouts compose `AlertDialog`.\n *\n * @example\n * <ConfirmDialog\n * open={deleting}\n * onOpenChange={setDeleting}\n * title=\"Delete this truck?\"\n * description=\"Its trips stay, without a truck.\"\n * confirmLabel=\"Delete\"\n * destructive\n * pending={mutation.isPending}\n * error={mutation.error?.message}\n * onConfirm={() => mutation.mutate()}\n * />\n */\nexport function ConfirmDialog({\n open,\n defaultOpen,\n onOpenChange,\n onOpenChangeComplete,\n trigger,\n title,\n description,\n children,\n confirmLabel,\n cancelLabel = 'Cancel',\n onConfirm,\n destructive = false,\n pending = false,\n error,\n size = 'sm',\n backdropBlur,\n nestedBackdrop,\n ref,\n}: ConfirmDialogProps) {\n return (\n <AlertDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next) => {\n if (!next && pending) return;\n onOpenChange?.(next);\n }}\n onOpenChangeComplete={onOpenChangeComplete}\n >\n {trigger && <AlertDialog.Trigger render={trigger} />}\n <AlertDialog.Content ref={ref} size={size} backdropBlur={backdropBlur} nestedBackdrop={nestedBackdrop}>\n <AlertDialog.Header>\n <AlertDialog.Title>{title}</AlertDialog.Title>\n {description && <AlertDialog.Description>{description}</AlertDialog.Description>}\n </AlertDialog.Header>\n {children}\n {error && <Alert tone=\"danger\">{error}</Alert>}\n <AlertDialog.Footer>\n <AlertDialog.Close render={<Button variant=\"secondary\" disabled={pending} />}>{cancelLabel}</AlertDialog.Close>\n <Button variant={destructive ? 'danger' : 'primary'} loading={pending} onClick={onConfirm}>\n {confirmLabel}\n </Button>\n </AlertDialog.Footer>\n </AlertDialog.Content>\n </AlertDialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;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AAwBmB"}
1
+ {"version":3,"file":"ConfirmDialog.js","names":["React","Alert","Button","AlertDialog","DialogBackdropBlur","useLabels","ConfirmDialogProps","ref","Ref","HTMLDivElement","open","defaultOpen","onOpenChange","onOpenChangeComplete","trigger","ReactElement","title","ReactNode","description","children","confirmLabel","cancelLabel","onConfirm","destructive","pending","error","size","backdropBlur","nestedBackdrop","ConfirmDialog","t0","$","_c","cancelLabelProp","t1","t2","t3","undefined","text","cancel","t4","next","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","_c"],"sources":["../../../src/components/dialog/ConfirmDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Alert } from '../alert/Alert';\nimport { Button } from '../button/Button';\nimport { AlertDialog, type DialogBackdropBlur } from './Dialog';\nimport { useLabels } from '../../labels/Labels';\n\nexport interface ConfirmDialogProps {\n /** Ref to the dialog popup. */\n ref?: React.Ref<HTMLDivElement>;\n /** Whether the dialog is open (controlled). */\n open?: boolean;\n /** Initial state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the dialog opens or closes. Not called to close while `pending`. */\n onOpenChange?: (open: boolean) => void;\n /** Called once the open or close transition has finished, e.g. to unmount the dialog. */\n onOpenChangeComplete?: (open: boolean) => void;\n /** Element that opens the dialog, e.g. `<Button>Delete</Button>`. Omit when `open` is controlled. */\n trigger?: React.ReactElement;\n /** The question, e.g. \"Delete this truck?\". */\n title: React.ReactNode;\n /** What happens when confirmed. */\n description?: React.ReactNode;\n /** Extra content between the description and the buttons. */\n children?: React.ReactNode;\n /** Text of the confirm button. */\n confirmLabel: React.ReactNode;\n /**\n * Text of the cancel button. Set app-wide with `LabelsProvider` (`cancel`).\n * @default 'Cancel'\n */\n cancelLabel?: React.ReactNode;\n /** Called by the confirm button. The dialog stays open; close it when the action succeeds. */\n onConfirm: () => void;\n /** Red confirm button, for actions that delete or cannot be undone. */\n destructive?: boolean;\n /** The action is running: the confirm button spins and the dialog cannot be closed. */\n pending?: boolean;\n /** Why the action failed, shown above the buttons. */\n error?: React.ReactNode;\n /** Dialog width. */\n size?: 'sm' | 'md' | 'lg';\n /** How strongly the page behind the dialog is blurred. */\n backdropBlur?: DialogBackdropBlur;\n /** Blur the dialog or drawer this one opens from, instead of showing no backdrop. */\n nestedBackdrop?: boolean;\n}\n\n/**\n * Asks before an action runs: title, description, cancel and confirm buttons,\n * a pending state that keeps the dialog open, and room for the error.\n * For other layouts compose `AlertDialog`.\n *\n * @example\n * <ConfirmDialog\n * open={deleting}\n * onOpenChange={setDeleting}\n * title=\"Delete this truck?\"\n * description=\"Its trips stay, without a truck.\"\n * confirmLabel=\"Delete\"\n * destructive\n * pending={mutation.isPending}\n * error={mutation.error?.message}\n * onConfirm={() => mutation.mutate()}\n * />\n */\nexport function ConfirmDialog({\n open,\n defaultOpen,\n onOpenChange,\n onOpenChangeComplete,\n trigger,\n title,\n description,\n children,\n confirmLabel,\n cancelLabel: cancelLabelProp,\n onConfirm,\n destructive = false,\n pending = false,\n error,\n size = 'sm',\n backdropBlur,\n nestedBackdrop,\n ref,\n}: ConfirmDialogProps) {\n const text = useLabels();\n const cancelLabel = cancelLabelProp ?? text.cancel;\n return (\n <AlertDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next) => {\n if (!next && pending) return;\n onOpenChange?.(next);\n }}\n onOpenChangeComplete={onOpenChangeComplete}\n >\n {trigger && <AlertDialog.Trigger render={trigger} />}\n <AlertDialog.Content ref={ref} size={size} backdropBlur={backdropBlur} nestedBackdrop={nestedBackdrop}>\n <AlertDialog.Header>\n <AlertDialog.Title>{title}</AlertDialog.Title>\n {description && <AlertDialog.Description>{description}</AlertDialog.Description>}\n </AlertDialog.Header>\n {children}\n {error && <Alert tone=\"danger\">{error}</Alert>}\n <AlertDialog.Footer>\n <AlertDialog.Close render={<Button variant=\"secondary\" disabled={pending} />}>{cancelLabel}</AlertDialog.Close>\n <Button variant={destructive ? 'danger' : 'primary'} loading={pending} onClick={onConfirm}>\n {confirmLabel}\n </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AArB;EAAAqB,EAAA,MAAAqB;EAAArB,EAAA,MAAAS;EAAAT,EAAA,MAAAW;EAAAX,EAAA,MAAAsB;CAAA,OAAAA,MAAAtB,EAAA;CAAA,OAxBnBsB;AAwBmB"}
@@ -12,7 +12,10 @@ export interface DialogContentProps extends BaseDialog.Popup.Props {
12
12
  placement?: DialogPlacement;
13
13
  /** Render the corner close button. */
14
14
  showClose?: boolean;
15
- /** Accessible name of the close button. */
15
+ /**
16
+ * Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`).
17
+ * @default 'Close'
18
+ */
16
19
  closeLabel?: string;
17
20
  /** How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. */
18
21
  backdropBlur?: DialogBackdropBlur;
@@ -24,7 +27,7 @@ export interface DialogContentProps extends BaseDialog.Popup.Props {
24
27
  */
25
28
  nestedBackdrop?: boolean;
26
29
  }
27
- declare function DialogContent({ size, placement, showClose, closeLabel, backdropBlur, backdropProps, nestedBackdrop, className, children, ref, ...props }: DialogContentProps): import("react").JSX.Element;
30
+ declare function DialogContent({ size, placement, showClose, closeLabel: closeLabelProp, backdropBlur, backdropProps, nestedBackdrop, className, children, ref, ...props }: DialogContentProps): import("react").JSX.Element;
28
31
  declare function DialogTitle({ className, ref, ...props }: BaseDialog.Title.Props): import("react").JSX.Element;
29
32
  declare function DialogDescription({ className, ref, ...props }: BaseDialog.Description.Props): import("react").JSX.Element;
30
33
  /**
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { usePortalContainer } from "../../utils/portal.js";
3
3
  import { withClass } from "../../utils/cx.js";
4
+ import { useLabels } from "../../labels/Labels.js";
4
5
  import { createPrimitive } from "../../utils/primitive.js";
5
6
  import { XIcon } from "../../icons/index.js";
6
7
  import { c } from "react/compiler-runtime";
@@ -13,6 +14,7 @@ function DialogContent(t0) {
13
14
  let backdropProps;
14
15
  let children;
15
16
  let className;
17
+ let closeLabelProp;
16
18
  let props;
17
19
  let ref;
18
20
  let t1;
@@ -20,111 +22,111 @@ function DialogContent(t0) {
20
22
  let t3;
21
23
  let t4;
22
24
  let t5;
23
- let t6;
24
25
  if ($[0] !== t0) {
25
- ({size: t1, placement: t2, showClose: t3, closeLabel: t4, backdropBlur: t5, backdropProps, nestedBackdrop: t6, className, children, ref, ...props} = t0);
26
+ ({size: t1, placement: t2, showClose: t3, closeLabel: closeLabelProp, backdropBlur: t4, backdropProps, nestedBackdrop: t5, className, children, ref, ...props} = t0);
26
27
  $[0] = t0;
27
28
  $[1] = backdropProps;
28
29
  $[2] = children;
29
30
  $[3] = className;
30
- $[4] = props;
31
- $[5] = ref;
32
- $[6] = t1;
33
- $[7] = t2;
34
- $[8] = t3;
35
- $[9] = t4;
36
- $[10] = t5;
37
- $[11] = t6;
31
+ $[4] = closeLabelProp;
32
+ $[5] = props;
33
+ $[6] = ref;
34
+ $[7] = t1;
35
+ $[8] = t2;
36
+ $[9] = t3;
37
+ $[10] = t4;
38
+ $[11] = t5;
38
39
  } else {
39
40
  backdropProps = $[1];
40
41
  children = $[2];
41
42
  className = $[3];
42
- props = $[4];
43
- ref = $[5];
44
- t1 = $[6];
45
- t2 = $[7];
46
- t3 = $[8];
47
- t4 = $[9];
48
- t5 = $[10];
49
- t6 = $[11];
43
+ closeLabelProp = $[4];
44
+ props = $[5];
45
+ ref = $[6];
46
+ t1 = $[7];
47
+ t2 = $[8];
48
+ t3 = $[9];
49
+ t4 = $[10];
50
+ t5 = $[11];
50
51
  }
51
52
  const size = t1 === void 0 ? "md" : t1;
52
53
  const placement = t2 === void 0 ? "center" : t2;
53
54
  const showClose = t3 === void 0 ? true : t3;
54
- const closeLabel = t4 === void 0 ? "Close" : t4;
55
- const backdropBlur = t5 === void 0 ? "md" : t5;
56
- const nestedBackdrop = t6 === void 0 ? false : t6;
55
+ const backdropBlur = t4 === void 0 ? "md" : t4;
56
+ const nestedBackdrop = t5 === void 0 ? false : t5;
57
+ const text = useLabels();
58
+ const closeLabel = closeLabelProp ?? text.close;
57
59
  const container = usePortalContainer();
58
- const t7 = nestedBackdrop || void 0;
59
- const t8 = backdropProps?.className;
60
+ const t6 = nestedBackdrop || void 0;
61
+ const t7 = backdropProps?.className;
62
+ let t8;
63
+ if ($[12] !== t7) {
64
+ t8 = withClass("oui-dialog__backdrop", t7);
65
+ $[12] = t7;
66
+ $[13] = t8;
67
+ } else t8 = $[13];
60
68
  let t9;
61
- if ($[12] !== t8) {
62
- t9 = withClass("oui-dialog__backdrop", t8);
63
- $[12] = t8;
64
- $[13] = t9;
65
- } else t9 = $[13];
66
- let t10;
67
- if ($[14] !== backdropBlur || $[15] !== backdropProps || $[16] !== t7 || $[17] !== t9) {
68
- t10 = /* @__PURE__ */ jsx(Dialog.Backdrop, {
69
+ if ($[14] !== backdropBlur || $[15] !== backdropProps || $[16] !== t6 || $[17] !== t8) {
70
+ t9 = /* @__PURE__ */ jsx(Dialog.Backdrop, {
69
71
  "data-blur": backdropBlur,
70
- "data-show-nested": t7,
72
+ "data-show-nested": t6,
71
73
  ...backdropProps,
72
- className: t9
74
+ className: t8
73
75
  });
74
76
  $[14] = backdropBlur;
75
77
  $[15] = backdropProps;
76
- $[16] = t7;
77
- $[17] = t9;
78
- $[18] = t10;
79
- } else t10 = $[18];
80
- let t11;
78
+ $[16] = t6;
79
+ $[17] = t8;
80
+ $[18] = t9;
81
+ } else t9 = $[18];
82
+ let t10;
81
83
  if ($[19] !== className) {
82
- t11 = withClass("oui-dialog", className);
84
+ t10 = withClass("oui-dialog", className);
83
85
  $[19] = className;
84
- $[20] = t11;
85
- } else t11 = $[20];
86
- let t12;
86
+ $[20] = t10;
87
+ } else t10 = $[20];
88
+ let t11;
87
89
  if ($[21] !== closeLabel || $[22] !== showClose) {
88
- t12 = showClose && /* @__PURE__ */ jsx(Dialog.Close, {
90
+ t11 = showClose && /* @__PURE__ */ jsx(Dialog.Close, {
89
91
  className: "oui-dialog__close",
90
92
  "aria-label": closeLabel,
91
93
  children: /* @__PURE__ */ jsx(XIcon, {})
92
94
  });
93
95
  $[21] = closeLabel;
94
96
  $[22] = showClose;
95
- $[23] = t12;
96
- } else t12 = $[23];
97
- let t13;
98
- if ($[24] !== children || $[25] !== placement || $[26] !== props || $[27] !== ref || $[28] !== size || $[29] !== t11 || $[30] !== t12) {
99
- t13 = /* @__PURE__ */ jsxs(Dialog.Popup, {
97
+ $[23] = t11;
98
+ } else t11 = $[23];
99
+ let t12;
100
+ if ($[24] !== children || $[25] !== placement || $[26] !== props || $[27] !== ref || $[28] !== size || $[29] !== t10 || $[30] !== t11) {
101
+ t12 = /* @__PURE__ */ jsxs(Dialog.Popup, {
100
102
  ref,
101
- className: t11,
103
+ className: t10,
102
104
  "data-size": size,
103
105
  "data-placement": placement,
104
106
  ...props,
105
- children: [children, t12]
107
+ children: [children, t11]
106
108
  });
107
109
  $[24] = children;
108
110
  $[25] = placement;
109
111
  $[26] = props;
110
112
  $[27] = ref;
111
113
  $[28] = size;
112
- $[29] = t11;
113
- $[30] = t12;
114
- $[31] = t13;
115
- } else t13 = $[31];
116
- let t14;
117
- if ($[32] !== container || $[33] !== t10 || $[34] !== t13) {
118
- t14 = /* @__PURE__ */ jsxs(Dialog.Portal, {
114
+ $[29] = t10;
115
+ $[30] = t11;
116
+ $[31] = t12;
117
+ } else t12 = $[31];
118
+ let t13;
119
+ if ($[32] !== container || $[33] !== t12 || $[34] !== t9) {
120
+ t13 = /* @__PURE__ */ jsxs(Dialog.Portal, {
119
121
  container,
120
- children: [t10, t13]
122
+ children: [t9, t12]
121
123
  });
122
124
  $[32] = container;
123
- $[33] = t10;
124
- $[34] = t13;
125
- $[35] = t14;
126
- } else t14 = $[35];
127
- return t14;
125
+ $[33] = t12;
126
+ $[34] = t9;
127
+ $[35] = t13;
128
+ } else t13 = $[35];
129
+ return t13;
128
130
  }
129
131
  function DialogTitle(t0) {
130
132
  const $ = c(10);
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["Dialog","BaseDialog","AlertDialog","BaseAlertDialog","withClass","createPrimitive","usePortalContainer","XIcon","DialogSize","DialogPlacement","DialogBackdropBlur","DialogContentProps","Popup","Props","size","placement","showClose","closeLabel","backdropBlur","backdropProps","Backdrop","nestedBackdrop","DialogContent","t0","$","_c","children","className","props","ref","t1","t2","t3","t4","t5","t6","undefined","container","t7","t8","t9","t10","t11","t12","t13","t14","DialogTitle","DialogDescription","DialogHeader","DialogBody","DialogFooter","Root","Trigger","Content","Header","Title","Description","Body","Footer","Close","createHandle","AlertDialogContentProps","Exclude","AlertDialogContent","AlertDialogTitle","AlertDialogDescription","_c","BaseDialog","Dialog","BaseAlertDialog","AlertDialog"],"sources":["../../../src/components/dialog/Dialog.tsx"],"sourcesContent":["import { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';\nimport { withClass } from '../../utils/cx';\nimport { createPrimitive } from '../../utils/primitive';\nimport { usePortalContainer } from '../../utils/portal';\nimport { XIcon } from '../../icons';\n\nexport type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n/** `center` is a modal; the edges turn the dialog into a sheet / drawer. */\nexport type DialogPlacement = 'center' | 'right' | 'left' | 'bottom';\n/** Blur applied to the page behind a modal: none, 4px, 8px or 16px. */\nexport type DialogBackdropBlur = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface DialogContentProps extends BaseDialog.Popup.Props {\n /** Width of a centered dialog, or of a sheet. */\n size?: DialogSize;\n /** `center` modal, or a sheet docked to an edge. */\n placement?: DialogPlacement;\n /** Render the corner close button. */\n showClose?: boolean;\n /** Accessible name of the close button. */\n closeLabel?: string;\n /** How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. */\n backdropBlur?: DialogBackdropBlur;\n /** Props for the backdrop behind the dialog. */\n backdropProps?: BaseDialog.Backdrop.Props;\n /**\n * Blur the dialog or drawer this one opens from. Nested dialogs otherwise\n * show no backdrop, so the parent stays sharp behind them.\n */\n nestedBackdrop?: boolean;\n}\n\nfunction DialogContent({\n size = 'md',\n placement = 'center',\n showClose = true,\n closeLabel = 'Close',\n backdropBlur = 'md',\n backdropProps,\n nestedBackdrop = false,\n className,\n children,\n ref,\n ...props\n}: DialogContentProps) {\n const container = usePortalContainer();\n return (\n <BaseDialog.Portal container={container}>\n <BaseDialog.Backdrop\n data-blur={backdropBlur}\n data-show-nested={nestedBackdrop || undefined}\n {...backdropProps}\n className={withClass('oui-dialog__backdrop', backdropProps?.className)}\n />\n <BaseDialog.Popup\n ref={ref}\n className={withClass('oui-dialog', className)}\n data-size={size}\n data-placement={placement}\n {...props}\n >\n {children}\n {showClose && (\n <BaseDialog.Close className=\"oui-dialog__close\" aria-label={closeLabel}>\n <XIcon />\n </BaseDialog.Close>\n )}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DialogTitle({ className, ref, ...props }: BaseDialog.Title.Props) {\n return <BaseDialog.Title ref={ref} className={withClass('oui-dialog__title', className)} {...props} />;\n}\n\nfunction DialogDescription({ className, ref, ...props }: BaseDialog.Description.Props) {\n return <BaseDialog.Description ref={ref} className={withClass('oui-dialog__description', className)} {...props} />;\n}\n\nconst DialogHeader = createPrimitive('div', 'oui-dialog__header', 'DialogHeader');\nconst DialogBody = createPrimitive('div', 'oui-dialog__body', 'DialogBody');\nconst DialogFooter = createPrimitive('div', 'oui-dialog__footer', 'DialogFooter');\n\n/**\n * Modal dialog and side sheet. Compose:\n * `Dialog.Root` › `Dialog.Trigger` + `Dialog.Content` › `Dialog.Header` (`Title`, `Description`), `Dialog.Body`, `Dialog.Footer`.\n * Use `render={<Button />}` on `Dialog.Trigger` / `Dialog.Close` to style them as buttons.\n */\nexport const Dialog = {\n Root: BaseDialog.Root,\n Trigger: BaseDialog.Trigger,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: BaseDialog.Close,\n createHandle: BaseDialog.createHandle,\n};\n\n// ─── Alert dialog ────────────────────────────────────────────────────────────\n\nexport interface AlertDialogContentProps extends BaseAlertDialog.Popup.Props {\n /** Dialog width. */\n size?: Exclude<DialogSize, 'full'>;\n /** How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. */\n backdropBlur?: DialogBackdropBlur;\n /** Blur the dialog or drawer this one opens from, instead of showing no backdrop. */\n nestedBackdrop?: boolean;\n}\n\nfunction AlertDialogContent({\n size = 'sm',\n backdropBlur = 'md',\n nestedBackdrop = false,\n className,\n ref,\n ...props\n}: AlertDialogContentProps) {\n const container = usePortalContainer();\n return (\n <BaseAlertDialog.Portal container={container}>\n <BaseAlertDialog.Backdrop\n className=\"oui-dialog__backdrop\"\n data-blur={backdropBlur}\n data-show-nested={nestedBackdrop || undefined}\n />\n <BaseAlertDialog.Popup\n ref={ref}\n className={withClass('oui-dialog', className)}\n data-size={size}\n data-placement=\"center\"\n {...props}\n />\n </BaseAlertDialog.Portal>\n );\n}\n\nfunction AlertDialogTitle({ className, ref, ...props }: BaseAlertDialog.Title.Props) {\n return <BaseAlertDialog.Title ref={ref} className={withClass('oui-dialog__title', className)} {...props} />;\n}\n\nfunction AlertDialogDescription({ className, ref, ...props }: BaseAlertDialog.Description.Props) {\n return (\n <BaseAlertDialog.Description ref={ref} className={withClass('oui-dialog__description', className)} {...props} />\n );\n}\n\n/** Confirmation dialog that requires an explicit choice (no outside-click dismissal). */\nexport const AlertDialog = {\n Root: BaseAlertDialog.Root,\n Trigger: BaseAlertDialog.Trigger,\n Content: AlertDialogContent,\n Header: DialogHeader,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: BaseAlertDialog.Close,\n};\n"],"mappings":";;;;;;;;;;AAiCA,SAAAsB,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAN;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAA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AM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAApGO;AAAoG;AAG7G,SAAAkC,uBAAA1C,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAE;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAgC,CAAA,CAAAI,WAAAE,KAAA,GAAAD,SAAAL;EAA+DC,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAF,YAAAH,EAAA;EAAAI,QAAAJ,EAAA;EAAAK,MAAAL,EAAA;CAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAG,WAAA;EAEzCG,KAAA1B,UAAU,2BAA2BuB,SAAS;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAI,SAAAJ,EAAA,OAAAK,OAAAL,EAAA,OAAAM,IAAA;EAAjGC,KAAA,oBAAAsC,YAAA,aAAA;GAAkCxC;GAAgB,WAAAC;GAA+C,GAAMF;EAAK,CAAA;EAAIJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAAhHO;AAAgH;;AAKpH,IAAa7B,gBAAc;CACzBiD,MAAMhD,YAAgBgD;CACtBC,SAASjD,YAAgBiD;CACzBC,SAASU;CACTT,QAAQN;CACRO,OAAOS;CACPR,aAAaS;CACbR,MAAMR;CACNS,QAAQR;CACRS,OAAOxD,YAAgBwD;AACzB"}
1
+ {"version":3,"file":"Dialog.js","names":["Dialog","BaseDialog","AlertDialog","BaseAlertDialog","withClass","createPrimitive","usePortalContainer","XIcon","useLabels","DialogSize","DialogPlacement","DialogBackdropBlur","DialogContentProps","Popup","Props","size","placement","showClose","closeLabel","backdropBlur","backdropProps","Backdrop","nestedBackdrop","DialogContent","t0","$","_c","children","className","closeLabelProp","props","ref","t1","t2","t3","t4","t5","undefined","text","close","container","t6","t7","t8","t9","t10","t11","t12","t13","DialogTitle","DialogDescription","DialogHeader","DialogBody","DialogFooter","Root","Trigger","Content","Header","Title","Description","Body","Footer","Close","createHandle","AlertDialogContentProps","Exclude","AlertDialogContent","AlertDialogTitle","AlertDialogDescription","_c","BaseDialog","Dialog","BaseAlertDialog","AlertDialog"],"sources":["../../../src/components/dialog/Dialog.tsx"],"sourcesContent":["import { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';\nimport { withClass } from '../../utils/cx';\nimport { createPrimitive } from '../../utils/primitive';\nimport { usePortalContainer } from '../../utils/portal';\nimport { XIcon } from '../../icons';\nimport { useLabels } from '../../labels/Labels';\n\nexport type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n/** `center` is a modal; the edges turn the dialog into a sheet / drawer. */\nexport type DialogPlacement = 'center' | 'right' | 'left' | 'bottom';\n/** Blur applied to the page behind a modal: none, 4px, 8px or 16px. */\nexport type DialogBackdropBlur = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface DialogContentProps extends BaseDialog.Popup.Props {\n /** Width of a centered dialog, or of a sheet. */\n size?: DialogSize;\n /** `center` modal, or a sheet docked to an edge. */\n placement?: DialogPlacement;\n /** Render the corner close button. */\n showClose?: boolean;\n /**\n * Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`).\n * @default 'Close'\n */\n closeLabel?: string;\n /** How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. */\n backdropBlur?: DialogBackdropBlur;\n /** Props for the backdrop behind the dialog. */\n backdropProps?: BaseDialog.Backdrop.Props;\n /**\n * Blur the dialog or drawer this one opens from. Nested dialogs otherwise\n * show no backdrop, so the parent stays sharp behind them.\n */\n nestedBackdrop?: boolean;\n}\n\nfunction DialogContent({\n size = 'md',\n placement = 'center',\n showClose = true,\n closeLabel: closeLabelProp,\n backdropBlur = 'md',\n backdropProps,\n nestedBackdrop = false,\n className,\n children,\n ref,\n ...props\n}: DialogContentProps) {\n const text = useLabels();\n const closeLabel = closeLabelProp ?? text.close;\n const container = usePortalContainer();\n return (\n <BaseDialog.Portal container={container}>\n <BaseDialog.Backdrop\n data-blur={backdropBlur}\n data-show-nested={nestedBackdrop || undefined}\n {...backdropProps}\n className={withClass('oui-dialog__backdrop', backdropProps?.className)}\n />\n <BaseDialog.Popup\n ref={ref}\n className={withClass('oui-dialog', className)}\n data-size={size}\n data-placement={placement}\n {...props}\n >\n {children}\n {showClose && (\n <BaseDialog.Close className=\"oui-dialog__close\" aria-label={closeLabel}>\n <XIcon />\n </BaseDialog.Close>\n )}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DialogTitle({ className, ref, ...props }: BaseDialog.Title.Props) {\n return <BaseDialog.Title ref={ref} className={withClass('oui-dialog__title', className)} {...props} />;\n}\n\nfunction DialogDescription({ className, ref, ...props }: BaseDialog.Description.Props) {\n return <BaseDialog.Description ref={ref} className={withClass('oui-dialog__description', className)} {...props} />;\n}\n\nconst DialogHeader = createPrimitive('div', 'oui-dialog__header', 'DialogHeader');\nconst DialogBody = createPrimitive('div', 'oui-dialog__body', 'DialogBody');\nconst DialogFooter = createPrimitive('div', 'oui-dialog__footer', 'DialogFooter');\n\n/**\n * Modal dialog and side sheet. Compose:\n * `Dialog.Root` › `Dialog.Trigger` + `Dialog.Content` › `Dialog.Header` (`Title`, `Description`), `Dialog.Body`, `Dialog.Footer`.\n * Use `render={<Button />}` on `Dialog.Trigger` / `Dialog.Close` to style them as buttons.\n */\nexport const Dialog = {\n Root: BaseDialog.Root,\n Trigger: BaseDialog.Trigger,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: BaseDialog.Close,\n createHandle: BaseDialog.createHandle,\n};\n\n// ─── Alert dialog ────────────────────────────────────────────────────────────\n\nexport interface AlertDialogContentProps extends BaseAlertDialog.Popup.Props {\n /** Dialog width. */\n size?: Exclude<DialogSize, 'full'>;\n /** How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. */\n backdropBlur?: DialogBackdropBlur;\n /** Blur the dialog or drawer this one opens from, instead of showing no backdrop. */\n nestedBackdrop?: boolean;\n}\n\nfunction AlertDialogContent({\n size = 'sm',\n backdropBlur = 'md',\n nestedBackdrop = false,\n className,\n ref,\n ...props\n}: AlertDialogContentProps) {\n const container = usePortalContainer();\n return (\n <BaseAlertDialog.Portal container={container}>\n <BaseAlertDialog.Backdrop\n className=\"oui-dialog__backdrop\"\n data-blur={backdropBlur}\n data-show-nested={nestedBackdrop || undefined}\n />\n <BaseAlertDialog.Popup\n ref={ref}\n className={withClass('oui-dialog', className)}\n data-size={size}\n data-placement=\"center\"\n {...props}\n />\n </BaseAlertDialog.Portal>\n );\n}\n\nfunction AlertDialogTitle({ className, ref, ...props }: BaseAlertDialog.Title.Props) {\n return <BaseAlertDialog.Title ref={ref} className={withClass('oui-dialog__title', className)} {...props} />;\n}\n\nfunction AlertDialogDescription({ className, ref, ...props }: BaseAlertDialog.Description.Props) {\n return (\n <BaseAlertDialog.Description ref={ref} className={withClass('oui-dialog__description', className)} {...props} />\n );\n}\n\n/** Confirmation dialog that requires an explicit choice (no outside-click dismissal). */\nexport const AlertDialog = {\n Root: BaseAlertDialog.Root,\n Trigger: BaseAlertDialog.Trigger,\n Content: AlertDialogContent,\n Header: DialogHeader,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: BaseAlertDialog.Close,\n};\n"],"mappings":";;;;;;;;;;;AAqCA,SAAAuB,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAN;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CA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.g. `<Button>Details</Button>`. Omit when `open` is controlled. */
18
18
  trigger?: React.ReactElement;
19
- /** Header title; also the drawer's accessible name. */
20
- title: React.ReactNode;
19
+ /** Header title; also the drawer's accessible name. Needed unless `header` replaces the built-in header. */
20
+ title?: React.ReactNode;
21
21
  /** Small label above the title, e.g. the record type. */
22
22
  eyebrow?: React.ReactNode;
23
23
  /** Supporting text under the title. */
24
24
  description?: React.ReactNode;
25
25
  /** Header content next to the close button (edit, delete, a menu…). */
26
26
  actions?: React.ReactNode;
27
+ /**
28
+ * Replaces the built-in header (eyebrow, title, description, actions and close button) inside the pinned
29
+ * header bar; `null` drops the bar. Put a `Dialog.Title` in it so the drawer keeps an accessible name;
30
+ * `Dialog.Close` closes it.
31
+ */
32
+ header?: React.ReactNode;
27
33
  /** Pinned to the bottom, for form buttons. */
28
34
  footer?: React.ReactNode;
29
35
  /** Edge the drawer slides in from. A `bottom` sheet is full width, as tall as its content, up to 85% of the screen. */
@@ -39,7 +45,10 @@ export interface DrawerProps {
39
45
  modal?: boolean;
40
46
  /** How strongly the page behind a modal drawer is blurred. Override the radius with `--oui-backdrop-blur`. */
41
47
  backdropBlur?: DialogBackdropBlur;
42
- /** Accessible name of the close button. */
48
+ /**
49
+ * Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`).
50
+ * @default 'Close'
51
+ */
43
52
  closeLabel?: string;
44
53
  /** Class name for the drawer panel. */
45
54
  className?: string;
@@ -54,4 +63,4 @@ export interface DrawerProps {
54
63
  * it a bottom sheet, for filters and actions on phones. For a free-form
55
64
  * sheet use `Dialog.Content` with `placement`.
56
65
  */
57
- export declare function Drawer({ open: openProp, defaultOpen, onOpenChange, onOpenChangeComplete, trigger, title, eyebrow, description, actions, footer, side, size, dismissible, modal, backdropBlur, closeLabel, className, bodyProps, children, ref, }: DrawerProps): React.JSX.Element;
66
+ export declare function Drawer({ open: openProp, defaultOpen, onOpenChange, onOpenChangeComplete, trigger, title, header, eyebrow, description, actions, footer, side, size, dismissible, modal, backdropBlur, closeLabel: closeLabelProp, className, bodyProps, children, ref, }: DrawerProps): React.JSX.Element;