hazo_ui 2.6.2 → 2.6.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.
- package/README.md +151 -53
- package/dist/index.cjs +278 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.js +276 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var React27 = require('react');
|
|
@@ -172,6 +173,37 @@ var require_objectWithoutPropertiesLoose = __commonJS({
|
|
|
172
173
|
module.exports = _objectWithoutPropertiesLoose10, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
173
174
|
}
|
|
174
175
|
});
|
|
176
|
+
|
|
177
|
+
// src/lib/hazo_ui_config.ts
|
|
178
|
+
var default_config = {
|
|
179
|
+
// Headers use default theme colors by default (no override)
|
|
180
|
+
header_background_color: void 0,
|
|
181
|
+
header_text_color: void 0,
|
|
182
|
+
// Submit buttons use primary/default variant (no override needed for default styling)
|
|
183
|
+
submit_button_background_color: void 0,
|
|
184
|
+
submit_button_text_color: void 0,
|
|
185
|
+
submit_button_hover_color: void 0,
|
|
186
|
+
// Cancel buttons use outline variant (no override needed for default styling)
|
|
187
|
+
cancel_button_background_color: void 0,
|
|
188
|
+
cancel_button_text_color: void 0,
|
|
189
|
+
cancel_button_border_color: void 0,
|
|
190
|
+
cancel_button_hover_color: void 0,
|
|
191
|
+
// Clear buttons use outline variant (no override needed for default styling)
|
|
192
|
+
clear_button_background_color: void 0,
|
|
193
|
+
clear_button_text_color: void 0,
|
|
194
|
+
clear_button_border_color: void 0,
|
|
195
|
+
clear_button_hover_color: void 0
|
|
196
|
+
};
|
|
197
|
+
var global_config = { ...default_config };
|
|
198
|
+
function get_hazo_ui_config() {
|
|
199
|
+
return { ...global_config };
|
|
200
|
+
}
|
|
201
|
+
function set_hazo_ui_config(config) {
|
|
202
|
+
global_config = { ...global_config, ...config };
|
|
203
|
+
}
|
|
204
|
+
function reset_hazo_ui_config() {
|
|
205
|
+
global_config = { ...default_config };
|
|
206
|
+
}
|
|
175
207
|
function cn(...inputs) {
|
|
176
208
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
177
209
|
}
|
|
@@ -200,13 +232,36 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
200
232
|
}
|
|
201
233
|
}
|
|
202
234
|
);
|
|
235
|
+
var variant_styles = {
|
|
236
|
+
default: {
|
|
237
|
+
backgroundColor: "var(--primary)",
|
|
238
|
+
color: "var(--primary-foreground)",
|
|
239
|
+
border: "1px solid var(--primary)"
|
|
240
|
+
},
|
|
241
|
+
destructive: {
|
|
242
|
+
backgroundColor: "var(--destructive)",
|
|
243
|
+
color: "white",
|
|
244
|
+
border: "1px solid var(--destructive)"
|
|
245
|
+
},
|
|
246
|
+
outline: {
|
|
247
|
+
backgroundColor: "var(--background)",
|
|
248
|
+
color: "var(--foreground)",
|
|
249
|
+
border: "1px solid var(--border)"
|
|
250
|
+
},
|
|
251
|
+
secondary: {
|
|
252
|
+
backgroundColor: "var(--secondary)",
|
|
253
|
+
color: "var(--secondary-foreground)"
|
|
254
|
+
}
|
|
255
|
+
};
|
|
203
256
|
var Button = React27__namespace.forwardRef(
|
|
204
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
257
|
+
({ className, variant, size, asChild = false, style, ...props }, ref) => {
|
|
205
258
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
259
|
+
const fallback_styles = variant_styles[variant ?? "default"] ?? {};
|
|
206
260
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
207
261
|
Comp,
|
|
208
262
|
{
|
|
209
263
|
className: cn(buttonVariants({ variant, size, className })),
|
|
264
|
+
style: { ...fallback_styles, ...style },
|
|
210
265
|
ref,
|
|
211
266
|
...props
|
|
212
267
|
}
|
|
@@ -787,8 +842,47 @@ function HazoUiMultiFilterDialog({
|
|
|
787
842
|
onFilterChange,
|
|
788
843
|
initialFilters = [],
|
|
789
844
|
title = "Filter",
|
|
790
|
-
description = "Add multiple fields to filter by. Select a field and set its filter value."
|
|
845
|
+
description = "Add multiple fields to filter by. Select a field and set its filter value.",
|
|
846
|
+
headerBackgroundColor,
|
|
847
|
+
headerTextColor,
|
|
848
|
+
submitButtonBackgroundColor,
|
|
849
|
+
submitButtonTextColor,
|
|
850
|
+
cancelButtonBackgroundColor,
|
|
851
|
+
cancelButtonTextColor,
|
|
852
|
+
cancelButtonBorderColor,
|
|
853
|
+
clearButtonBackgroundColor,
|
|
854
|
+
clearButtonTextColor,
|
|
855
|
+
clearButtonBorderColor
|
|
791
856
|
}) {
|
|
857
|
+
const config = get_hazo_ui_config();
|
|
858
|
+
const finalSubmitBgColor = submitButtonBackgroundColor ?? config.submit_button_background_color;
|
|
859
|
+
const finalSubmitTextColor = submitButtonTextColor ?? config.submit_button_text_color;
|
|
860
|
+
const finalCancelBgColor = cancelButtonBackgroundColor ?? config.cancel_button_background_color;
|
|
861
|
+
const finalCancelTextColor = cancelButtonTextColor ?? config.cancel_button_text_color;
|
|
862
|
+
const finalCancelBorderColor = cancelButtonBorderColor ?? config.cancel_button_border_color;
|
|
863
|
+
const finalClearBgColor = clearButtonBackgroundColor ?? config.clear_button_background_color;
|
|
864
|
+
const finalClearTextColor = clearButtonTextColor ?? config.clear_button_text_color;
|
|
865
|
+
const finalClearBorderColor = clearButtonBorderColor ?? config.clear_button_border_color;
|
|
866
|
+
const submitButtonStyles = {
|
|
867
|
+
...finalSubmitBgColor && { backgroundColor: finalSubmitBgColor, borderColor: finalSubmitBgColor },
|
|
868
|
+
...finalSubmitTextColor && { color: finalSubmitTextColor }
|
|
869
|
+
};
|
|
870
|
+
const cancelButtonStyles = {
|
|
871
|
+
...finalCancelBgColor && { backgroundColor: finalCancelBgColor },
|
|
872
|
+
...finalCancelTextColor && { color: finalCancelTextColor },
|
|
873
|
+
...finalCancelBorderColor && { borderColor: finalCancelBorderColor }
|
|
874
|
+
};
|
|
875
|
+
const clearButtonStyles = {
|
|
876
|
+
...finalClearBgColor && { backgroundColor: finalClearBgColor },
|
|
877
|
+
...finalClearTextColor && { color: finalClearTextColor },
|
|
878
|
+
...finalClearBorderColor && { borderColor: finalClearBorderColor }
|
|
879
|
+
};
|
|
880
|
+
const finalHeaderBgColor = headerBackgroundColor ?? config.header_background_color;
|
|
881
|
+
const finalHeaderTextColor = headerTextColor ?? config.header_text_color;
|
|
882
|
+
const headerStyles = {
|
|
883
|
+
...finalHeaderBgColor && { backgroundColor: finalHeaderBgColor },
|
|
884
|
+
...finalHeaderTextColor && { color: finalHeaderTextColor }
|
|
885
|
+
};
|
|
792
886
|
const [isOpen, setIsOpen] = React27.useState(false);
|
|
793
887
|
const [filterFields, setFilterFields] = React27.useState(initialFilters);
|
|
794
888
|
const [isComboboxOpen, setIsComboboxOpen] = React27.useState(false);
|
|
@@ -908,7 +1002,7 @@ function HazoUiMultiFilterDialog({
|
|
|
908
1002
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltipContent })
|
|
909
1003
|
] }) }),
|
|
910
1004
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "cls_filter_dialog_content max-w-lg w-full max-h-[90vh] overflow-y-auto", children: [
|
|
911
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { style: headerStyles, children: [
|
|
912
1006
|
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
|
|
913
1007
|
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
|
|
914
1008
|
] }),
|
|
@@ -978,6 +1072,7 @@ function HazoUiMultiFilterDialog({
|
|
|
978
1072
|
variant: "outline",
|
|
979
1073
|
onClick: handleClearAll,
|
|
980
1074
|
className: "cls_clear_all_btn",
|
|
1075
|
+
style: clearButtonStyles,
|
|
981
1076
|
children: [
|
|
982
1077
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "cls_clear_all_icon h-4 w-4 mr-2" }),
|
|
983
1078
|
"Clear All"
|
|
@@ -989,6 +1084,7 @@ function HazoUiMultiFilterDialog({
|
|
|
989
1084
|
{
|
|
990
1085
|
onClick: handleApply,
|
|
991
1086
|
className: "cls_apply_btn",
|
|
1087
|
+
style: submitButtonStyles,
|
|
992
1088
|
children: "Apply"
|
|
993
1089
|
}
|
|
994
1090
|
),
|
|
@@ -998,6 +1094,7 @@ function HazoUiMultiFilterDialog({
|
|
|
998
1094
|
variant: "outline",
|
|
999
1095
|
onClick: handleCancel,
|
|
1000
1096
|
className: "cls_cancel_btn",
|
|
1097
|
+
style: cancelButtonStyles,
|
|
1001
1098
|
children: "Cancel"
|
|
1002
1099
|
}
|
|
1003
1100
|
)
|
|
@@ -1109,8 +1206,47 @@ function HazoUiMultiSortDialog({
|
|
|
1109
1206
|
onSortChange,
|
|
1110
1207
|
initialSortFields = [],
|
|
1111
1208
|
title = "Sort",
|
|
1112
|
-
description = "Add multiple fields to sort by and reorder them. Use the switch to toggle between ascending and descending."
|
|
1209
|
+
description = "Add multiple fields to sort by and reorder them. Use the switch to toggle between ascending and descending.",
|
|
1210
|
+
headerBackgroundColor,
|
|
1211
|
+
headerTextColor,
|
|
1212
|
+
submitButtonBackgroundColor,
|
|
1213
|
+
submitButtonTextColor,
|
|
1214
|
+
cancelButtonBackgroundColor,
|
|
1215
|
+
cancelButtonTextColor,
|
|
1216
|
+
cancelButtonBorderColor,
|
|
1217
|
+
clearButtonBackgroundColor,
|
|
1218
|
+
clearButtonTextColor,
|
|
1219
|
+
clearButtonBorderColor
|
|
1113
1220
|
}) {
|
|
1221
|
+
const config = get_hazo_ui_config();
|
|
1222
|
+
const finalSubmitBgColor = submitButtonBackgroundColor ?? config.submit_button_background_color;
|
|
1223
|
+
const finalSubmitTextColor = submitButtonTextColor ?? config.submit_button_text_color;
|
|
1224
|
+
const finalCancelBgColor = cancelButtonBackgroundColor ?? config.cancel_button_background_color;
|
|
1225
|
+
const finalCancelTextColor = cancelButtonTextColor ?? config.cancel_button_text_color;
|
|
1226
|
+
const finalCancelBorderColor = cancelButtonBorderColor ?? config.cancel_button_border_color;
|
|
1227
|
+
const finalClearBgColor = clearButtonBackgroundColor ?? config.clear_button_background_color;
|
|
1228
|
+
const finalClearTextColor = clearButtonTextColor ?? config.clear_button_text_color;
|
|
1229
|
+
const finalClearBorderColor = clearButtonBorderColor ?? config.clear_button_border_color;
|
|
1230
|
+
const submitButtonStyles = {
|
|
1231
|
+
...finalSubmitBgColor && { backgroundColor: finalSubmitBgColor, borderColor: finalSubmitBgColor },
|
|
1232
|
+
...finalSubmitTextColor && { color: finalSubmitTextColor }
|
|
1233
|
+
};
|
|
1234
|
+
const cancelButtonStyles = {
|
|
1235
|
+
...finalCancelBgColor && { backgroundColor: finalCancelBgColor },
|
|
1236
|
+
...finalCancelTextColor && { color: finalCancelTextColor },
|
|
1237
|
+
...finalCancelBorderColor && { borderColor: finalCancelBorderColor }
|
|
1238
|
+
};
|
|
1239
|
+
const clearButtonStyles = {
|
|
1240
|
+
...finalClearBgColor && { backgroundColor: finalClearBgColor },
|
|
1241
|
+
...finalClearTextColor && { color: finalClearTextColor },
|
|
1242
|
+
...finalClearBorderColor && { borderColor: finalClearBorderColor }
|
|
1243
|
+
};
|
|
1244
|
+
const finalHeaderBgColor = headerBackgroundColor ?? config.header_background_color;
|
|
1245
|
+
const finalHeaderTextColor = headerTextColor ?? config.header_text_color;
|
|
1246
|
+
const headerStyles = {
|
|
1247
|
+
...finalHeaderBgColor && { backgroundColor: finalHeaderBgColor },
|
|
1248
|
+
...finalHeaderTextColor && { color: finalHeaderTextColor }
|
|
1249
|
+
};
|
|
1114
1250
|
const [isOpen, setIsOpen] = React27.useState(false);
|
|
1115
1251
|
const [sortFields, setSortFields] = React27.useState(initialSortFields);
|
|
1116
1252
|
const [isComboboxOpen, setIsComboboxOpen] = React27.useState(false);
|
|
@@ -1212,7 +1348,7 @@ function HazoUiMultiSortDialog({
|
|
|
1212
1348
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltipContent })
|
|
1213
1349
|
] }) }),
|
|
1214
1350
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "cls_sort_dialog_content max-w-lg", children: [
|
|
1215
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { style: headerStyles, children: [
|
|
1216
1352
|
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
|
|
1217
1353
|
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
|
|
1218
1354
|
] }),
|
|
@@ -1292,6 +1428,7 @@ function HazoUiMultiSortDialog({
|
|
|
1292
1428
|
variant: "outline",
|
|
1293
1429
|
onClick: handleClearAll,
|
|
1294
1430
|
className: "cls_clear_all_btn",
|
|
1431
|
+
style: clearButtonStyles,
|
|
1295
1432
|
children: [
|
|
1296
1433
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "cls_clear_all_icon h-4 w-4 mr-2" }),
|
|
1297
1434
|
"Clear All"
|
|
@@ -1303,6 +1440,7 @@ function HazoUiMultiSortDialog({
|
|
|
1303
1440
|
{
|
|
1304
1441
|
onClick: handleApply,
|
|
1305
1442
|
className: "cls_apply_btn",
|
|
1443
|
+
style: submitButtonStyles,
|
|
1306
1444
|
children: "Apply"
|
|
1307
1445
|
}
|
|
1308
1446
|
),
|
|
@@ -1312,6 +1450,7 @@ function HazoUiMultiSortDialog({
|
|
|
1312
1450
|
variant: "outline",
|
|
1313
1451
|
onClick: handleCancel,
|
|
1314
1452
|
className: "cls_cancel_btn",
|
|
1453
|
+
style: cancelButtonStyles,
|
|
1315
1454
|
children: "Cancel"
|
|
1316
1455
|
}
|
|
1317
1456
|
)
|
|
@@ -6032,6 +6171,41 @@ var HazoUiTextarea = ({
|
|
|
6032
6171
|
);
|
|
6033
6172
|
};
|
|
6034
6173
|
HazoUiTextarea.displayName = "HazoUiTextarea";
|
|
6174
|
+
var VARIANT_PRESETS = {
|
|
6175
|
+
info: {
|
|
6176
|
+
header_background_color: "rgb(191, 219, 254)",
|
|
6177
|
+
description_background_color: "rgb(219, 234, 254)",
|
|
6178
|
+
header_text_color: "rgb(30, 58, 138)",
|
|
6179
|
+
border_color: "rgb(59, 130, 246)",
|
|
6180
|
+
accent_color: "rgb(59, 130, 246)",
|
|
6181
|
+
overlay_class_name: "bg-blue-950/50"
|
|
6182
|
+
},
|
|
6183
|
+
success: {
|
|
6184
|
+
header_background_color: "rgb(187, 247, 208)",
|
|
6185
|
+
description_background_color: "rgb(220, 252, 231)",
|
|
6186
|
+
header_text_color: "rgb(22, 101, 52)",
|
|
6187
|
+
border_color: "rgb(34, 197, 94)",
|
|
6188
|
+
accent_color: "rgb(34, 197, 94)",
|
|
6189
|
+
overlay_class_name: "bg-green-950/50"
|
|
6190
|
+
},
|
|
6191
|
+
warning: {
|
|
6192
|
+
header_background_color: "rgb(253, 230, 138)",
|
|
6193
|
+
description_background_color: "rgb(254, 249, 195)",
|
|
6194
|
+
header_text_color: "rgb(113, 63, 18)",
|
|
6195
|
+
border_color: "rgb(234, 179, 8)",
|
|
6196
|
+
accent_color: "rgb(234, 179, 8)",
|
|
6197
|
+
overlay_class_name: "bg-yellow-950/50"
|
|
6198
|
+
},
|
|
6199
|
+
danger: {
|
|
6200
|
+
header_background_color: "rgb(254, 202, 202)",
|
|
6201
|
+
description_background_color: "rgb(254, 226, 226)",
|
|
6202
|
+
header_text_color: "rgb(127, 29, 29)",
|
|
6203
|
+
border_color: "rgb(239, 68, 68)",
|
|
6204
|
+
accent_color: "rgb(239, 68, 68)",
|
|
6205
|
+
overlay_class_name: "bg-red-950/50",
|
|
6206
|
+
action_button_variant: "destructive"
|
|
6207
|
+
}
|
|
6208
|
+
};
|
|
6035
6209
|
var ANIMATION_PRESETS = {
|
|
6036
6210
|
zoom: {
|
|
6037
6211
|
open: "animate-dialog-zoom",
|
|
@@ -6085,7 +6259,7 @@ function HazoUiDialog({
|
|
|
6085
6259
|
title = "Action required",
|
|
6086
6260
|
description,
|
|
6087
6261
|
actionButtonText = "Confirm",
|
|
6088
|
-
actionButtonVariant
|
|
6262
|
+
actionButtonVariant,
|
|
6089
6263
|
cancelButtonText = "Cancel",
|
|
6090
6264
|
showCancelButton = true,
|
|
6091
6265
|
actionButtonLoading = false,
|
|
@@ -6096,7 +6270,10 @@ function HazoUiDialog({
|
|
|
6096
6270
|
sizeHeight = "min(80vh, 800px)",
|
|
6097
6271
|
openAnimation = "zoom",
|
|
6098
6272
|
closeAnimation = "zoom",
|
|
6273
|
+
variant = "default",
|
|
6274
|
+
splitHeader = true,
|
|
6099
6275
|
headerBackgroundColor,
|
|
6276
|
+
descriptionBackgroundColor,
|
|
6100
6277
|
headerTextColor,
|
|
6101
6278
|
bodyBackgroundColor,
|
|
6102
6279
|
footerBackgroundColor,
|
|
@@ -6111,6 +6288,9 @@ function HazoUiDialog({
|
|
|
6111
6288
|
footerClassName,
|
|
6112
6289
|
showCloseButton = true
|
|
6113
6290
|
}) {
|
|
6291
|
+
const config = get_hazo_ui_config();
|
|
6292
|
+
const variant_preset = variant !== "default" ? VARIANT_PRESETS[variant] : void 0;
|
|
6293
|
+
const resolved_action_button_variant = actionButtonVariant ?? variant_preset?.action_button_variant ?? "default";
|
|
6114
6294
|
const handleConfirm = () => {
|
|
6115
6295
|
onConfirm?.();
|
|
6116
6296
|
};
|
|
@@ -6119,27 +6299,28 @@ function HazoUiDialog({
|
|
|
6119
6299
|
onOpenChange?.(false);
|
|
6120
6300
|
};
|
|
6121
6301
|
const animationClasses = resolveAnimationClasses(openAnimation, closeAnimation);
|
|
6302
|
+
const resolved_border_color = borderColor ?? variant_preset?.border_color;
|
|
6122
6303
|
const contentStyles = {
|
|
6123
6304
|
width: sizeWidth,
|
|
6124
6305
|
maxHeight: sizeHeight,
|
|
6125
|
-
...
|
|
6306
|
+
...resolved_border_color && { borderColor: resolved_border_color }
|
|
6126
6307
|
};
|
|
6308
|
+
const finalHeaderBackgroundColor = headerBackgroundColor ?? variant_preset?.header_background_color ?? config.header_background_color;
|
|
6309
|
+
const finalDescriptionBgColor = descriptionBackgroundColor ?? variant_preset?.description_background_color;
|
|
6310
|
+
const finalHeaderTextColor = headerTextColor ?? variant_preset?.header_text_color ?? config.header_text_color;
|
|
6311
|
+
const is_variant_active = variant !== "default";
|
|
6312
|
+
const has_split_header = splitHeader && !headerBar && !!finalDescriptionBgColor && !!description;
|
|
6313
|
+
const has_merged_variant_header = !splitHeader && is_variant_active && !headerBar && !!description;
|
|
6127
6314
|
const headerStyles = {
|
|
6128
6315
|
...headerBar && {
|
|
6129
6316
|
backgroundColor: headerBarColor,
|
|
6130
|
-
marginLeft: "-1.5rem",
|
|
6131
|
-
marginRight: "-1.5rem",
|
|
6132
|
-
marginTop: "0",
|
|
6133
|
-
marginBottom: "0",
|
|
6134
6317
|
paddingTop: "1.5rem",
|
|
6135
6318
|
paddingBottom: "1.5rem",
|
|
6136
6319
|
paddingLeft: "1.5rem",
|
|
6137
|
-
paddingRight: "1.5rem"
|
|
6138
|
-
borderTopLeftRadius: "inherit",
|
|
6139
|
-
borderTopRightRadius: "inherit"
|
|
6320
|
+
paddingRight: "1.5rem"
|
|
6140
6321
|
},
|
|
6141
|
-
|
|
6142
|
-
|
|
6322
|
+
...!has_split_header && finalHeaderBackgroundColor && !headerBar && { backgroundColor: finalHeaderBackgroundColor },
|
|
6323
|
+
...!has_split_header && finalHeaderTextColor && { color: finalHeaderTextColor }
|
|
6143
6324
|
};
|
|
6144
6325
|
const titleClassName = cn(
|
|
6145
6326
|
"cls_dialog_title",
|
|
@@ -6155,17 +6336,30 @@ function HazoUiDialog({
|
|
|
6155
6336
|
const footerStyles = {
|
|
6156
6337
|
...footerBackgroundColor && { backgroundColor: footerBackgroundColor }
|
|
6157
6338
|
};
|
|
6339
|
+
const finalSubmitBgColor = accentColor ?? variant_preset?.accent_color ?? config.submit_button_background_color;
|
|
6340
|
+
const finalSubmitTextColor = config.submit_button_text_color;
|
|
6341
|
+
const finalCancelBgColor = config.cancel_button_background_color;
|
|
6342
|
+
const finalCancelTextColor = config.cancel_button_text_color;
|
|
6343
|
+
const finalCancelBorderColor = config.cancel_button_border_color;
|
|
6158
6344
|
const actionButtonStyles = {
|
|
6159
|
-
...
|
|
6160
|
-
backgroundColor:
|
|
6161
|
-
borderColor:
|
|
6345
|
+
...finalSubmitBgColor && resolved_action_button_variant === "default" && {
|
|
6346
|
+
backgroundColor: finalSubmitBgColor,
|
|
6347
|
+
borderColor: finalSubmitBgColor
|
|
6348
|
+
},
|
|
6349
|
+
...finalSubmitTextColor && resolved_action_button_variant === "default" && {
|
|
6350
|
+
color: finalSubmitTextColor
|
|
6162
6351
|
}
|
|
6163
6352
|
};
|
|
6353
|
+
const cancelButtonStyles = {
|
|
6354
|
+
...finalCancelBgColor && { backgroundColor: finalCancelBgColor },
|
|
6355
|
+
...finalCancelTextColor && { color: finalCancelTextColor },
|
|
6356
|
+
...finalCancelBorderColor && { borderColor: finalCancelBorderColor }
|
|
6357
|
+
};
|
|
6164
6358
|
return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
6165
6359
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6166
6360
|
DialogOverlay,
|
|
6167
6361
|
{
|
|
6168
|
-
className: cn("cls_hazo_dialog_overlay", overlayClassName)
|
|
6362
|
+
className: cn("cls_hazo_dialog_overlay", overlayClassName ?? variant_preset?.overlay_class_name)
|
|
6169
6363
|
}
|
|
6170
6364
|
),
|
|
6171
6365
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6185,27 +6379,69 @@ function HazoUiDialog({
|
|
|
6185
6379
|
),
|
|
6186
6380
|
style: contentStyles,
|
|
6187
6381
|
children: [
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6382
|
+
has_split_header ? (
|
|
6383
|
+
/* Split header: two rows with different backgrounds */
|
|
6384
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6385
|
+
DialogHeader,
|
|
6386
|
+
{
|
|
6387
|
+
className: cn(
|
|
6388
|
+
"cls_dialog_header shrink-0 p-0 space-y-0",
|
|
6389
|
+
headerClassName
|
|
6390
|
+
),
|
|
6391
|
+
children: [
|
|
6392
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6393
|
+
"div",
|
|
6394
|
+
{
|
|
6395
|
+
className: "cls_dialog_header_title px-6 pt-6 pb-3",
|
|
6396
|
+
style: {
|
|
6397
|
+
...finalHeaderBackgroundColor && { backgroundColor: finalHeaderBackgroundColor },
|
|
6398
|
+
...finalHeaderTextColor && { color: finalHeaderTextColor }
|
|
6399
|
+
},
|
|
6400
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: titleClassName, children: title })
|
|
6401
|
+
}
|
|
6402
|
+
),
|
|
6403
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6404
|
+
"div",
|
|
6405
|
+
{
|
|
6406
|
+
className: "cls_dialog_header_description px-6 py-1.5",
|
|
6407
|
+
style: {
|
|
6408
|
+
backgroundColor: finalDescriptionBgColor,
|
|
6409
|
+
...finalHeaderTextColor && { color: finalHeaderTextColor }
|
|
6410
|
+
},
|
|
6411
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: cn(descriptionClassName, "italic text-xs"), children: description })
|
|
6412
|
+
}
|
|
6413
|
+
)
|
|
6414
|
+
]
|
|
6415
|
+
}
|
|
6416
|
+
)
|
|
6417
|
+
) : (
|
|
6418
|
+
/* Single header: one background, italic description when variant is active */
|
|
6419
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6420
|
+
DialogHeader,
|
|
6421
|
+
{
|
|
6422
|
+
className: cn(
|
|
6423
|
+
"cls_dialog_header shrink-0",
|
|
6424
|
+
!headerBar && "p-6 pb-4",
|
|
6425
|
+
has_merged_variant_header && "pb-3",
|
|
6426
|
+
headerClassName
|
|
6427
|
+
),
|
|
6428
|
+
style: headerStyles,
|
|
6429
|
+
children: [
|
|
6430
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: titleClassName, children: title }),
|
|
6431
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: cn(
|
|
6432
|
+
descriptionClassName,
|
|
6433
|
+
has_merged_variant_header && "italic text-xs mt-1"
|
|
6434
|
+
), children: description })
|
|
6435
|
+
]
|
|
6436
|
+
}
|
|
6437
|
+
)
|
|
6202
6438
|
),
|
|
6203
6439
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6204
6440
|
"div",
|
|
6205
6441
|
{
|
|
6206
6442
|
className: cn(
|
|
6207
6443
|
"cls_dialog_body",
|
|
6208
|
-
"px-6 py-4 overflow-y-auto flex-1",
|
|
6444
|
+
"px-6 py-4 overflow-y-auto flex-1 min-h-0",
|
|
6209
6445
|
contentClassName
|
|
6210
6446
|
),
|
|
6211
6447
|
style: bodyStyles,
|
|
@@ -6215,7 +6451,7 @@ function HazoUiDialog({
|
|
|
6215
6451
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6216
6452
|
DialogFooter,
|
|
6217
6453
|
{
|
|
6218
|
-
className: cn("cls_dialog_footer p-6 pt-4", footerClassName),
|
|
6454
|
+
className: cn("cls_dialog_footer shrink-0 p-6 pt-4", footerClassName),
|
|
6219
6455
|
style: footerStyles,
|
|
6220
6456
|
children: footerContent ? (
|
|
6221
6457
|
// Custom footer content replaces default buttons
|
|
@@ -6230,6 +6466,7 @@ function HazoUiDialog({
|
|
|
6230
6466
|
className: "cls_cancel_button",
|
|
6231
6467
|
variant: "outline",
|
|
6232
6468
|
onClick: handleCancel,
|
|
6469
|
+
style: cancelButtonStyles,
|
|
6233
6470
|
children: cancelButtonText
|
|
6234
6471
|
}
|
|
6235
6472
|
),
|
|
@@ -6238,7 +6475,7 @@ function HazoUiDialog({
|
|
|
6238
6475
|
{
|
|
6239
6476
|
type: "button",
|
|
6240
6477
|
className: "cls_confirm_button",
|
|
6241
|
-
variant:
|
|
6478
|
+
variant: resolved_action_button_variant,
|
|
6242
6479
|
onClick: handleConfirm,
|
|
6243
6480
|
style: actionButtonStyles,
|
|
6244
6481
|
disabled: actionButtonLoading || actionButtonDisabled,
|
|
@@ -6256,7 +6493,7 @@ function HazoUiDialog({
|
|
|
6256
6493
|
DialogPrimitive__namespace.Close,
|
|
6257
6494
|
{
|
|
6258
6495
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
6259
|
-
style: headerBar ? { color: "white" } :
|
|
6496
|
+
style: headerBar ? { color: "white" } : finalHeaderTextColor ? { color: finalHeaderTextColor } : void 0,
|
|
6260
6497
|
children: [
|
|
6261
6498
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
|
|
6262
6499
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
@@ -6291,7 +6528,10 @@ exports.HazoUiRte = HazoUiRte;
|
|
|
6291
6528
|
exports.HazoUiTextarea = HazoUiTextarea;
|
|
6292
6529
|
exports.HazoUiTextbox = HazoUiTextbox;
|
|
6293
6530
|
exports.create_command_suggestion_extension = create_command_suggestion_extension;
|
|
6531
|
+
exports.get_hazo_ui_config = get_hazo_ui_config;
|
|
6294
6532
|
exports.parse_commands_from_text = parse_commands_from_text;
|
|
6533
|
+
exports.reset_hazo_ui_config = reset_hazo_ui_config;
|
|
6534
|
+
exports.set_hazo_ui_config = set_hazo_ui_config;
|
|
6295
6535
|
exports.text_to_tiptap_content = text_to_tiptap_content;
|
|
6296
6536
|
//# sourceMappingURL=index.cjs.map
|
|
6297
6537
|
//# sourceMappingURL=index.cjs.map
|