hazo_ui 6.10.0 → 6.11.2
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/CHANGE_LOG.md +123 -0
- package/dist/index.cjs +427 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +429 -89
- package/dist/index.js.map +1 -1
- package/dist/index.locale-picker.cjs +348 -0
- package/dist/index.locale-picker.cjs.map +1 -0
- package/dist/index.locale-picker.d.cts +52 -0
- package/dist/index.locale-picker.d.ts +52 -0
- package/dist/index.locale-picker.js +325 -0
- package/dist/index.locale-picker.js.map +1 -0
- package/package.json +24 -4
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import { twMerge } from 'tailwind-merge';
|
|
|
4
4
|
import * as React27 from 'react';
|
|
5
5
|
import React27__default, { lazy, useRef, useState, useCallback, useEffect, useMemo, Fragment, Suspense, useSyncExternalStore } from 'react';
|
|
6
6
|
import { generateRequestId } from 'hazo_core';
|
|
7
|
-
import { withContext, setBrowserCorrelationId } from 'hazo_core/client';
|
|
7
|
+
import { optional_import, withContext, setBrowserCorrelationId } from 'hazo_core/client';
|
|
8
8
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
12
|
-
import { X, ChevronDown, ChevronUp, Check, Circle, ChevronRight, ChevronLeft, Filter, Plus, ArrowUpDown, icons, Loader2, AlertTriangle, OctagonAlert, CheckCircle2, ChevronsUpDown, Download, Share2, Copy, GripVertical, ArrowUp, ArrowDown, Pencil, Calendar as Calendar$1 } from 'lucide-react';
|
|
12
|
+
import { X, ChevronDown, ChevronUp, Check, Circle, ChevronRight, ChevronLeft, Filter, Plus, ArrowUpDown, icons, Loader2, AlertTriangle, OctagonAlert, CheckCircle2, ChevronsUpDown, Download, Share2, Copy, GripVertical, ArrowUp, ArrowDown, Pencil, Calendar as Calendar$1, Globe } from 'lucide-react';
|
|
13
13
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
14
14
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
15
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
@@ -51,7 +51,7 @@ import TableCell from '@tiptap/extension-table-cell';
|
|
|
51
51
|
import TableHeader from '@tiptap/extension-table-header';
|
|
52
52
|
import TaskList from '@tiptap/extension-task-list';
|
|
53
53
|
import TaskItem from '@tiptap/extension-task-item';
|
|
54
|
-
import { LuBold, LuItalic, LuUnderline, LuAlignLeft, LuAlignCenter, LuAlignRight, LuAlignVerticalJustifyStart, LuAlignVerticalJustifyCenter, LuAlignVerticalJustifyEnd, LuList, LuUndo2, LuRedo2, LuMinus, LuPlus, LuStrikethrough, LuSubscript, LuSuperscript, LuLink, LuRemoveFormatting, LuPalette, LuHighlighter, LuAlignJustify, LuListOrdered, LuListChecks, LuIndentDecrease, LuIndentIncrease, LuTable, LuTableRowsSplit, LuTableColumnsSplit, LuTrash2, LuGrid3X3, LuVariable, LuPaperclip, LuX,
|
|
54
|
+
import { LuBold, LuItalic, LuUnderline, LuAlignLeft, LuAlignCenter, LuAlignRight, LuAlignVerticalJustifyStart, LuAlignVerticalJustifyCenter, LuAlignVerticalJustifyEnd, LuList, LuUndo2, LuRedo2, LuMinus, LuPlus, LuStrikethrough, LuSubscript, LuSuperscript, LuLink, LuRemoveFormatting, LuPalette, LuHighlighter, LuAlignJustify, LuListOrdered, LuListChecks, LuIndentDecrease, LuIndentIncrease, LuImage, LuTable, LuTableRowsSplit, LuTableColumnsSplit, LuTrash2, LuGrid3X3, LuVariable, LuPaperclip, LuX, LuFileText, LuFileCode, LuFile } from 'react-icons/lu';
|
|
55
55
|
import { RxDividerHorizontal } from 'react-icons/rx';
|
|
56
56
|
import { Extension, Node, mergeAttributes } from '@tiptap/core';
|
|
57
57
|
import { commands } from '@uiw/react-md-editor';
|
|
@@ -111,8 +111,8 @@ var require_extends = __commonJS({
|
|
|
111
111
|
function _extends11() {
|
|
112
112
|
return module.exports = _extends11 = Object.assign ? Object.assign.bind() : function(n) {
|
|
113
113
|
for (var e = 1; e < arguments.length; e++) {
|
|
114
|
-
var
|
|
115
|
-
for (var r in
|
|
114
|
+
var t4 = arguments[e];
|
|
115
|
+
for (var r in t4) ({}).hasOwnProperty.call(t4, r) && (n[r] = t4[r]);
|
|
116
116
|
}
|
|
117
117
|
return n;
|
|
118
118
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends11.apply(null, arguments);
|
|
@@ -126,12 +126,12 @@ var require_objectWithoutPropertiesLoose = __commonJS({
|
|
|
126
126
|
"../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
|
|
127
127
|
function _objectWithoutPropertiesLoose10(r, e) {
|
|
128
128
|
if (null == r) return {};
|
|
129
|
-
var
|
|
129
|
+
var t4 = {};
|
|
130
130
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
131
131
|
if (-1 !== e.indexOf(n)) continue;
|
|
132
|
-
|
|
132
|
+
t4[n] = r[n];
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return t4;
|
|
135
135
|
}
|
|
136
136
|
module.exports = _objectWithoutPropertiesLoose10, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
137
137
|
}
|
|
@@ -642,6 +642,122 @@ function Calendar({
|
|
|
642
642
|
);
|
|
643
643
|
}
|
|
644
644
|
Calendar.displayName = "Calendar";
|
|
645
|
+
var hazo_i18n_module = null;
|
|
646
|
+
void optional_import("hazo_i18n").then((mod) => {
|
|
647
|
+
hazo_i18n_module = mod;
|
|
648
|
+
}).catch(() => {
|
|
649
|
+
hazo_i18n_module = null;
|
|
650
|
+
});
|
|
651
|
+
function interpolate(template, vars) {
|
|
652
|
+
if (!vars) return template;
|
|
653
|
+
return template.replace(
|
|
654
|
+
/\{\{\s*(\w+)\s*\}\}/g,
|
|
655
|
+
(whole, name) => Object.prototype.hasOwnProperty.call(vars, name) ? vars[name] : whole
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
function createPackageT(namespace, fallbackCatalog) {
|
|
659
|
+
return function t4(key, vars) {
|
|
660
|
+
const mod = hazo_i18n_module;
|
|
661
|
+
if (mod && typeof mod.t === "function") {
|
|
662
|
+
try {
|
|
663
|
+
const translated = mod.t(`${namespace}.${key}`, vars);
|
|
664
|
+
if (typeof translated === "string" && translated.length > 0) {
|
|
665
|
+
return translated;
|
|
666
|
+
}
|
|
667
|
+
} catch {
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
const template = fallbackCatalog[key];
|
|
671
|
+
if (template === void 0) return key;
|
|
672
|
+
return interpolate(template, vars);
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function resolvePackageLocale(defaultLocale) {
|
|
676
|
+
const mod = hazo_i18n_module;
|
|
677
|
+
if (mod && typeof mod.getStaticLocale === "function") {
|
|
678
|
+
try {
|
|
679
|
+
const locale = mod.getStaticLocale();
|
|
680
|
+
if (typeof locale === "string" && locale.length > 0) return locale;
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return defaultLocale;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// src/locales/en.json
|
|
688
|
+
var en_default = {
|
|
689
|
+
"table.showing": "Showing {{start}}\u2013{{end}} of {{total}}",
|
|
690
|
+
"table.prev": "\u2039 Prev",
|
|
691
|
+
"table.prev_aria": "Previous page",
|
|
692
|
+
"table.next": "Next \u203A",
|
|
693
|
+
"table.next_aria": "Next page",
|
|
694
|
+
"table.search_placeholder": "Search...",
|
|
695
|
+
"table.sort_tooltip": "Click to sort; shift-click to append a secondary sort",
|
|
696
|
+
"table.empty": "No items",
|
|
697
|
+
"table.no_results": "No matches \u2014 adjust your filters",
|
|
698
|
+
"table.error_title": "Couldn't load data",
|
|
699
|
+
"table.error_description": "The data source rejected the request.",
|
|
700
|
+
"rte.undo": "Undo",
|
|
701
|
+
"rte.redo": "Redo",
|
|
702
|
+
"rte.decrease_font_size": "Decrease font size",
|
|
703
|
+
"rte.increase_font_size": "Increase font size",
|
|
704
|
+
"rte.bold": "Bold",
|
|
705
|
+
"rte.italic": "Italic",
|
|
706
|
+
"rte.underline": "Underline",
|
|
707
|
+
"rte.strikethrough": "Strikethrough",
|
|
708
|
+
"rte.subscript": "Subscript",
|
|
709
|
+
"rte.superscript": "Superscript",
|
|
710
|
+
"rte.link": "Link",
|
|
711
|
+
"rte.clear_formatting": "Clear formatting",
|
|
712
|
+
"rte.text_color": "Text color",
|
|
713
|
+
"rte.highlight_color": "Highlight color",
|
|
714
|
+
"rte.align_left": "Align left",
|
|
715
|
+
"rte.align_center": "Align center",
|
|
716
|
+
"rte.align_right": "Align right",
|
|
717
|
+
"rte.justify": "Justify",
|
|
718
|
+
"rte.bullet_list": "Bullet list",
|
|
719
|
+
"rte.ordered_list": "Numbered list",
|
|
720
|
+
"rte.checklist": "Checklist",
|
|
721
|
+
"rte.decrease_indent": "Decrease indent",
|
|
722
|
+
"rte.increase_indent": "Increase indent",
|
|
723
|
+
"rte.horizontal_rule": "Horizontal rule",
|
|
724
|
+
"rte.insert_image": "Insert image",
|
|
725
|
+
"rte.table": "Table",
|
|
726
|
+
"rte.insert_variable": "Insert variable",
|
|
727
|
+
"rte.attach_file": "Attach file",
|
|
728
|
+
"rte.block_type.paragraph": "Paragraph",
|
|
729
|
+
"rte.block_type.heading_1": "Heading 1",
|
|
730
|
+
"rte.block_type.heading_2": "Heading 2",
|
|
731
|
+
"rte.block_type.heading_3": "Heading 3",
|
|
732
|
+
"rte.block_type.ordered_list": "Numbered List",
|
|
733
|
+
"rte.block_type.bullet_list": "Bulleted List",
|
|
734
|
+
"rte.block_type.task_list": "Check List",
|
|
735
|
+
"rte.block_type.code_block": "Code Block",
|
|
736
|
+
"rte.block_type.blockquote": "Quote",
|
|
737
|
+
"filter.title": "Filter",
|
|
738
|
+
"filter.description": "Add fields to filter by. Select a field and set its value.",
|
|
739
|
+
"filter.text_placeholder": "Enter text...",
|
|
740
|
+
"filter.number_placeholder": "Value",
|
|
741
|
+
"filter.select_option_placeholder": "Select option...",
|
|
742
|
+
"filter.select_placeholder": "Select...",
|
|
743
|
+
"filter.pick_date": "Pick a date",
|
|
744
|
+
"filter.on": "On",
|
|
745
|
+
"filter.off": "Off",
|
|
746
|
+
"filter.remove_field_aria": "Remove {{field}} filter",
|
|
747
|
+
"filter.active_filters": "Active filters",
|
|
748
|
+
"filter.no_active_filters": "No active filters",
|
|
749
|
+
"filter.open_dialog_aria": "Open filter dialog",
|
|
750
|
+
"filter.button_label": "Filter",
|
|
751
|
+
"filter.empty_fields": "No filters yet. Add one below to narrow down the results.",
|
|
752
|
+
"filter.all_fields_added": "All fields added",
|
|
753
|
+
"filter.add_filter_field": "Add filter field",
|
|
754
|
+
"filter.search_fields_placeholder": "Search fields...",
|
|
755
|
+
"filter.no_fields_available": "No fields available.",
|
|
756
|
+
"filter.clear_all": "Clear all",
|
|
757
|
+
"filter.cancel": "Cancel",
|
|
758
|
+
"filter.apply": "Apply"
|
|
759
|
+
};
|
|
760
|
+
var t = createPackageT("hazo_ui", en_default);
|
|
645
761
|
function FilterFieldItem({
|
|
646
762
|
filterConfig,
|
|
647
763
|
fieldConfig,
|
|
@@ -665,7 +781,7 @@ function FilterFieldItem({
|
|
|
665
781
|
}
|
|
666
782
|
onValueChange(value);
|
|
667
783
|
},
|
|
668
|
-
placeholder: "
|
|
784
|
+
placeholder: t("filter.text_placeholder"),
|
|
669
785
|
minLength: fieldConfig.textConfig?.minLength,
|
|
670
786
|
maxLength: fieldConfig.textConfig?.maxLength,
|
|
671
787
|
className: "cls_filter_text_input h-8 w-full min-w-0 text-sm"
|
|
@@ -717,7 +833,7 @@ function FilterFieldItem({
|
|
|
717
833
|
}
|
|
718
834
|
onValueChange(numValue);
|
|
719
835
|
},
|
|
720
|
-
placeholder: "
|
|
836
|
+
placeholder: t("filter.number_placeholder"),
|
|
721
837
|
min: fieldConfig.numberConfig?.min,
|
|
722
838
|
max: fieldConfig.numberConfig?.max,
|
|
723
839
|
step: fieldConfig.numberConfig?.allowDecimal ? 0.01 : 1,
|
|
@@ -733,21 +849,21 @@ function FilterFieldItem({
|
|
|
733
849
|
value: filterConfig.value || "",
|
|
734
850
|
onValueChange: (value) => onValueChange(value),
|
|
735
851
|
children: [
|
|
736
|
-
/* @__PURE__ */ jsx(SelectTrigger, { className: "cls_filter_combobox_select h-8 w-full min-w-0 text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "
|
|
852
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "cls_filter_combobox_select h-8 w-full min-w-0 text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("filter.select_option_placeholder") }) }),
|
|
737
853
|
/* @__PURE__ */ jsx(SelectContent, { children: fieldConfig.comboboxOptions?.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
738
854
|
]
|
|
739
855
|
}
|
|
740
856
|
);
|
|
741
857
|
case "boolean": {
|
|
742
|
-
const trueLabel = fieldConfig.booleanLabels?.trueLabel || "
|
|
743
|
-
const falseLabel = fieldConfig.booleanLabels?.falseLabel || "
|
|
858
|
+
const trueLabel = fieldConfig.booleanLabels?.trueLabel || t("filter.on");
|
|
859
|
+
const falseLabel = fieldConfig.booleanLabels?.falseLabel || t("filter.off");
|
|
744
860
|
return /* @__PURE__ */ jsxs(
|
|
745
861
|
Select,
|
|
746
862
|
{
|
|
747
863
|
value: filterConfig.value !== void 0 && filterConfig.value !== null ? String(filterConfig.value) : "",
|
|
748
864
|
onValueChange: (value) => onValueChange(value === "true"),
|
|
749
865
|
children: [
|
|
750
|
-
/* @__PURE__ */ jsx(SelectTrigger, { className: "cls_filter_boolean_select h-8 w-full min-w-0 text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "
|
|
866
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "cls_filter_boolean_select h-8 w-full min-w-0 text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("filter.select_placeholder") }) }),
|
|
751
867
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
752
868
|
/* @__PURE__ */ jsx(SelectItem, { value: "true", children: trueLabel }),
|
|
753
869
|
/* @__PURE__ */ jsx(SelectItem, { value: "false", children: falseLabel })
|
|
@@ -789,7 +905,7 @@ function FilterFieldItem({
|
|
|
789
905
|
),
|
|
790
906
|
children: [
|
|
791
907
|
/* @__PURE__ */ jsx(Calendar$1, { className: "cls_calendar_icon h-3.5 w-3.5 shrink-0" }),
|
|
792
|
-
/* @__PURE__ */ jsx("span", { className: "cls_date_text truncate", children: selectedDate ? format(selectedDate, "MMM d, yyyy") : "
|
|
908
|
+
/* @__PURE__ */ jsx("span", { className: "cls_date_text truncate", children: selectedDate ? format(selectedDate, "MMM d, yyyy") : t("filter.pick_date") })
|
|
793
909
|
]
|
|
794
910
|
}
|
|
795
911
|
) }),
|
|
@@ -823,7 +939,7 @@ function FilterFieldItem({
|
|
|
823
939
|
size: "sm",
|
|
824
940
|
onClick: onDelete,
|
|
825
941
|
className: "cls_delete_btn h-7 w-7 shrink-0 p-0 text-muted-foreground/60 hover:bg-destructive/10 hover:text-destructive",
|
|
826
|
-
"aria-label":
|
|
942
|
+
"aria-label": t("filter.remove_field_aria", { field: fieldConfig.label }),
|
|
827
943
|
children: /* @__PURE__ */ jsx(X, { className: "cls_delete_icon h-3.5 w-3.5" })
|
|
828
944
|
}
|
|
829
945
|
)
|
|
@@ -834,8 +950,8 @@ function HazoUiMultiFilterDialog({
|
|
|
834
950
|
availableFields,
|
|
835
951
|
onFilterChange,
|
|
836
952
|
initialFilters = [],
|
|
837
|
-
title = "
|
|
838
|
-
description = "
|
|
953
|
+
title = t("filter.title"),
|
|
954
|
+
description = t("filter.description"),
|
|
839
955
|
headerBackgroundColor,
|
|
840
956
|
headerTextColor,
|
|
841
957
|
submitButtonBackgroundColor,
|
|
@@ -940,13 +1056,13 @@ function HazoUiMultiFilterDialog({
|
|
|
940
1056
|
};
|
|
941
1057
|
const hasActiveFilters = initialFilters.length > 0;
|
|
942
1058
|
const tooltipContent = hasActiveFilters ? /* @__PURE__ */ jsxs("div", { className: "cls_filter_tooltip_content space-y-1", children: [
|
|
943
|
-
/* @__PURE__ */ jsx("div", { className: "cls_tooltip_title text-xs font-semibold mb-1", children: "
|
|
1059
|
+
/* @__PURE__ */ jsx("div", { className: "cls_tooltip_title text-xs font-semibold mb-1", children: t("filter.active_filters") }),
|
|
944
1060
|
initialFilters.map((filterConfig) => {
|
|
945
1061
|
const fieldConfig = getFieldConfig(filterConfig.field);
|
|
946
1062
|
if (!fieldConfig) return null;
|
|
947
1063
|
let displayValue = String(filterConfig.value);
|
|
948
1064
|
if (fieldConfig.type === "boolean") {
|
|
949
|
-
displayValue = filterConfig.value ? fieldConfig.booleanLabels?.trueLabel || "
|
|
1065
|
+
displayValue = filterConfig.value ? fieldConfig.booleanLabels?.trueLabel || t("filter.on") : fieldConfig.booleanLabels?.falseLabel || t("filter.off");
|
|
950
1066
|
} else if (fieldConfig.type === "combobox") {
|
|
951
1067
|
const option = fieldConfig.comboboxOptions?.find((opt) => opt.value === filterConfig.value);
|
|
952
1068
|
displayValue = option?.label || displayValue;
|
|
@@ -964,7 +1080,7 @@ function HazoUiMultiFilterDialog({
|
|
|
964
1080
|
displayValue
|
|
965
1081
|
] }, filterConfig.field);
|
|
966
1082
|
})
|
|
967
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "cls_filter_tooltip_content text-xs", children: "
|
|
1083
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "cls_filter_tooltip_content text-xs", children: t("filter.no_active_filters") });
|
|
968
1084
|
return /* @__PURE__ */ jsxs(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
969
1085
|
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
970
1086
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
@@ -973,7 +1089,7 @@ function HazoUiMultiFilterDialog({
|
|
|
973
1089
|
variant: "outline",
|
|
974
1090
|
size: "sm",
|
|
975
1091
|
className: "cls_filter_button",
|
|
976
|
-
"aria-label": "
|
|
1092
|
+
"aria-label": t("filter.open_dialog_aria"),
|
|
977
1093
|
children: [
|
|
978
1094
|
/* @__PURE__ */ jsx(
|
|
979
1095
|
Filter,
|
|
@@ -984,7 +1100,7 @@ function HazoUiMultiFilterDialog({
|
|
|
984
1100
|
)
|
|
985
1101
|
}
|
|
986
1102
|
),
|
|
987
|
-
"
|
|
1103
|
+
t("filter.button_label"),
|
|
988
1104
|
hasActiveFilters && /* @__PURE__ */ jsx("span", { className: "cls_filter_count ml-2 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-blue-600 px-1 text-[10px] font-semibold text-white", children: initialFilters.length })
|
|
989
1105
|
]
|
|
990
1106
|
}
|
|
@@ -1018,7 +1134,7 @@ function HazoUiMultiFilterDialog({
|
|
|
1018
1134
|
},
|
|
1019
1135
|
filterConfig.field
|
|
1020
1136
|
);
|
|
1021
|
-
}) }) : /* @__PURE__ */ jsx("div", { className: "cls_empty_filter_fields rounded-lg border border-dashed border-border/70 bg-muted/20 px-4 py-6 text-center text-xs text-muted-foreground", children: "
|
|
1137
|
+
}) }) : /* @__PURE__ */ jsx("div", { className: "cls_empty_filter_fields rounded-lg border border-dashed border-border/70 bg-muted/20 px-4 py-6 text-center text-xs text-muted-foreground", children: t("filter.empty_fields") }),
|
|
1022
1138
|
/* @__PURE__ */ jsx("div", { className: "cls_add_field_section", children: /* @__PURE__ */ jsxs(Popover, { open: isComboboxOpen, onOpenChange: setIsComboboxOpen, children: [
|
|
1023
1139
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1024
1140
|
Button,
|
|
@@ -1030,13 +1146,13 @@ function HazoUiMultiFilterDialog({
|
|
|
1030
1146
|
className: "cls_add_field_combobox w-full justify-start gap-2 border border-dashed border-border/70 text-sm font-medium text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground",
|
|
1031
1147
|
children: [
|
|
1032
1148
|
/* @__PURE__ */ jsx(Plus, { className: "cls_plus_icon h-4 w-4" }),
|
|
1033
|
-
/* @__PURE__ */ jsx("span", { children: availableFieldsToAdd.length === 0 ? "
|
|
1149
|
+
/* @__PURE__ */ jsx("span", { children: availableFieldsToAdd.length === 0 ? t("filter.all_fields_added") : t("filter.add_filter_field") })
|
|
1034
1150
|
]
|
|
1035
1151
|
}
|
|
1036
1152
|
) }),
|
|
1037
1153
|
/* @__PURE__ */ jsx(PopoverContent, { className: "cls_combobox_popover w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
1038
|
-
/* @__PURE__ */ jsx(CommandInput, { placeholder: "
|
|
1039
|
-
/* @__PURE__ */ jsx(CommandList, { children: availableFieldsToAdd.length === 0 ? /* @__PURE__ */ jsx(CommandEmpty, { children: "
|
|
1154
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder: t("filter.search_fields_placeholder"), className: "cls_command_input" }),
|
|
1155
|
+
/* @__PURE__ */ jsx(CommandList, { children: availableFieldsToAdd.length === 0 ? /* @__PURE__ */ jsx(CommandEmpty, { children: t("filter.no_fields_available") }) : /* @__PURE__ */ jsx(CommandGroup, { children: availableFieldsToAdd.map((field) => /* @__PURE__ */ jsx(
|
|
1040
1156
|
CommandItem,
|
|
1041
1157
|
{
|
|
1042
1158
|
value: field.label,
|
|
@@ -1058,7 +1174,7 @@ function HazoUiMultiFilterDialog({
|
|
|
1058
1174
|
onClick: handleClearAll,
|
|
1059
1175
|
className: "cls_clear_all_btn text-muted-foreground hover:text-foreground",
|
|
1060
1176
|
style: clearButtonStyles,
|
|
1061
|
-
children: "
|
|
1177
|
+
children: t("filter.clear_all")
|
|
1062
1178
|
}
|
|
1063
1179
|
) }),
|
|
1064
1180
|
/* @__PURE__ */ jsxs("div", { className: "cls_footer_right flex items-center gap-2", children: [
|
|
@@ -1070,7 +1186,7 @@ function HazoUiMultiFilterDialog({
|
|
|
1070
1186
|
onClick: handleCancel,
|
|
1071
1187
|
className: "cls_cancel_btn",
|
|
1072
1188
|
style: cancelButtonStyles,
|
|
1073
|
-
children: "
|
|
1189
|
+
children: t("filter.cancel")
|
|
1074
1190
|
}
|
|
1075
1191
|
),
|
|
1076
1192
|
/* @__PURE__ */ jsx(
|
|
@@ -1080,7 +1196,7 @@ function HazoUiMultiFilterDialog({
|
|
|
1080
1196
|
onClick: handleApply,
|
|
1081
1197
|
className: "cls_apply_btn",
|
|
1082
1198
|
style: submitButtonStyles,
|
|
1083
|
-
children: "
|
|
1199
|
+
children: t("filter.apply")
|
|
1084
1200
|
}
|
|
1085
1201
|
)
|
|
1086
1202
|
] })
|
|
@@ -3554,6 +3670,23 @@ var BLOCK_TYPES = [
|
|
|
3554
3670
|
{ label: "Code Block", value: "code-block", icon: "code" },
|
|
3555
3671
|
{ label: "Quote", value: "blockquote", icon: "quote" }
|
|
3556
3672
|
];
|
|
3673
|
+
var BLOCK_TYPE_LABEL_KEYS = {
|
|
3674
|
+
paragraph: "rte.block_type.paragraph",
|
|
3675
|
+
"heading-1": "rte.block_type.heading_1",
|
|
3676
|
+
"heading-2": "rte.block_type.heading_2",
|
|
3677
|
+
"heading-3": "rte.block_type.heading_3",
|
|
3678
|
+
"ordered-list": "rte.block_type.ordered_list",
|
|
3679
|
+
"bullet-list": "rte.block_type.bullet_list",
|
|
3680
|
+
"task-list": "rte.block_type.task_list",
|
|
3681
|
+
"code-block": "rte.block_type.code_block",
|
|
3682
|
+
blockquote: "rte.block_type.blockquote"
|
|
3683
|
+
};
|
|
3684
|
+
function get_translated_block_types(t4) {
|
|
3685
|
+
return BLOCK_TYPES.map((type) => ({
|
|
3686
|
+
...type,
|
|
3687
|
+
label: t4(BLOCK_TYPE_LABEL_KEYS[type.value])
|
|
3688
|
+
}));
|
|
3689
|
+
}
|
|
3557
3690
|
|
|
3558
3691
|
// src/components/hazo_ui_rte/utils.ts
|
|
3559
3692
|
function file_to_base64(file) {
|
|
@@ -3598,6 +3731,7 @@ function get_file_extension(filename) {
|
|
|
3598
3731
|
function is_image_file(mime_type) {
|
|
3599
3732
|
return mime_type.startsWith("image/");
|
|
3600
3733
|
}
|
|
3734
|
+
var t2 = createPackageT("hazo_ui", en_default);
|
|
3601
3735
|
var ALL_ON = {
|
|
3602
3736
|
undo_redo: true,
|
|
3603
3737
|
block_type: true,
|
|
@@ -3652,6 +3786,7 @@ var Toolbar = ({
|
|
|
3652
3786
|
}
|
|
3653
3787
|
const tb = { ...ALL_ON, ...toolbar };
|
|
3654
3788
|
const font_family_options = font_families && font_families.length > 0 ? font_families : FONT_FAMILIES;
|
|
3789
|
+
const block_type_options = get_translated_block_types(t2);
|
|
3655
3790
|
const get_current_font_size = () => {
|
|
3656
3791
|
const attrs = editor.getAttributes("textStyle");
|
|
3657
3792
|
return attrs.fontSize || FONT_SIZE_CONFIG.default;
|
|
@@ -3795,7 +3930,7 @@ var Toolbar = ({
|
|
|
3795
3930
|
{
|
|
3796
3931
|
onClick: () => editor.chain().focus().undo().run(),
|
|
3797
3932
|
disabled: !editor.can().undo(),
|
|
3798
|
-
tooltip: "
|
|
3933
|
+
tooltip: t2("rte.undo"),
|
|
3799
3934
|
children: /* @__PURE__ */ jsx(LuUndo2, { className: "h-4 w-4" })
|
|
3800
3935
|
},
|
|
3801
3936
|
"undo"
|
|
@@ -3805,7 +3940,7 @@ var Toolbar = ({
|
|
|
3805
3940
|
{
|
|
3806
3941
|
onClick: () => editor.chain().focus().redo().run(),
|
|
3807
3942
|
disabled: !editor.can().redo(),
|
|
3808
|
-
tooltip: "
|
|
3943
|
+
tooltip: t2("rte.redo"),
|
|
3809
3944
|
children: /* @__PURE__ */ jsx(LuRedo2, { className: "h-4 w-4" })
|
|
3810
3945
|
},
|
|
3811
3946
|
"redo"
|
|
@@ -3816,7 +3951,7 @@ var Toolbar = ({
|
|
|
3816
3951
|
sections.push([
|
|
3817
3952
|
/* @__PURE__ */ jsxs(Select, { value: get_current_block_type(), onValueChange: handle_block_type_change, children: [
|
|
3818
3953
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[130px] text-xs", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
3819
|
-
/* @__PURE__ */ jsx(SelectContent, { children:
|
|
3954
|
+
/* @__PURE__ */ jsx(SelectContent, { children: block_type_options.map((type) => /* @__PURE__ */ jsx(SelectItem, { value: type.value, className: "text-xs", children: type.label }, type.value)) })
|
|
3820
3955
|
] }, "block")
|
|
3821
3956
|
]);
|
|
3822
3957
|
}
|
|
@@ -3846,7 +3981,7 @@ var Toolbar = ({
|
|
|
3846
3981
|
ToolbarButton,
|
|
3847
3982
|
{
|
|
3848
3983
|
onClick: () => handle_font_size_change(-2),
|
|
3849
|
-
tooltip: "
|
|
3984
|
+
tooltip: t2("rte.decrease_font_size"),
|
|
3850
3985
|
children: /* @__PURE__ */ jsx(LuMinus, { className: "h-3 w-3" })
|
|
3851
3986
|
}
|
|
3852
3987
|
),
|
|
@@ -3855,7 +3990,7 @@ var Toolbar = ({
|
|
|
3855
3990
|
ToolbarButton,
|
|
3856
3991
|
{
|
|
3857
3992
|
onClick: () => handle_font_size_change(FONT_SIZE_CONFIG.step),
|
|
3858
|
-
tooltip: "
|
|
3993
|
+
tooltip: t2("rte.increase_font_size"),
|
|
3859
3994
|
children: /* @__PURE__ */ jsx(LuPlus, { className: "h-3 w-3" })
|
|
3860
3995
|
}
|
|
3861
3996
|
)
|
|
@@ -3873,7 +4008,7 @@ var Toolbar = ({
|
|
|
3873
4008
|
{
|
|
3874
4009
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
3875
4010
|
is_active: editor.isActive("bold"),
|
|
3876
|
-
tooltip: "
|
|
4011
|
+
tooltip: t2("rte.bold"),
|
|
3877
4012
|
children: /* @__PURE__ */ jsx(LuBold, { className: "h-4 w-4" })
|
|
3878
4013
|
},
|
|
3879
4014
|
"bold"
|
|
@@ -3887,7 +4022,7 @@ var Toolbar = ({
|
|
|
3887
4022
|
{
|
|
3888
4023
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
3889
4024
|
is_active: editor.isActive("italic"),
|
|
3890
|
-
tooltip: "
|
|
4025
|
+
tooltip: t2("rte.italic"),
|
|
3891
4026
|
children: /* @__PURE__ */ jsx(LuItalic, { className: "h-4 w-4" })
|
|
3892
4027
|
},
|
|
3893
4028
|
"italic"
|
|
@@ -3901,7 +4036,7 @@ var Toolbar = ({
|
|
|
3901
4036
|
{
|
|
3902
4037
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
3903
4038
|
is_active: editor.isActive("underline"),
|
|
3904
|
-
tooltip: "
|
|
4039
|
+
tooltip: t2("rte.underline"),
|
|
3905
4040
|
children: /* @__PURE__ */ jsx(LuUnderline, { className: "h-4 w-4" })
|
|
3906
4041
|
},
|
|
3907
4042
|
"underline"
|
|
@@ -3915,7 +4050,7 @@ var Toolbar = ({
|
|
|
3915
4050
|
{
|
|
3916
4051
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
3917
4052
|
is_active: editor.isActive("strike"),
|
|
3918
|
-
tooltip: "
|
|
4053
|
+
tooltip: t2("rte.strikethrough"),
|
|
3919
4054
|
children: /* @__PURE__ */ jsx(LuStrikethrough, { className: "h-4 w-4" })
|
|
3920
4055
|
},
|
|
3921
4056
|
"strike"
|
|
@@ -3929,7 +4064,7 @@ var Toolbar = ({
|
|
|
3929
4064
|
{
|
|
3930
4065
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
3931
4066
|
is_active: editor.isActive("subscript"),
|
|
3932
|
-
tooltip: "
|
|
4067
|
+
tooltip: t2("rte.subscript"),
|
|
3933
4068
|
children: /* @__PURE__ */ jsx(LuSubscript, { className: "h-4 w-4" })
|
|
3934
4069
|
},
|
|
3935
4070
|
"sub"
|
|
@@ -3943,7 +4078,7 @@ var Toolbar = ({
|
|
|
3943
4078
|
{
|
|
3944
4079
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
3945
4080
|
is_active: editor.isActive("superscript"),
|
|
3946
|
-
tooltip: "
|
|
4081
|
+
tooltip: t2("rte.superscript"),
|
|
3947
4082
|
children: /* @__PURE__ */ jsx(LuSuperscript, { className: "h-4 w-4" })
|
|
3948
4083
|
},
|
|
3949
4084
|
"super"
|
|
@@ -3957,7 +4092,7 @@ var Toolbar = ({
|
|
|
3957
4092
|
if (tb.link) {
|
|
3958
4093
|
items.push(
|
|
3959
4094
|
/* @__PURE__ */ jsxs(Popover, { open: link_popover_open, onOpenChange: set_link_popover_open, children: [
|
|
3960
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { is_active: editor.isActive("link"), tooltip: "
|
|
4095
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { is_active: editor.isActive("link"), tooltip: t2("rte.link"), children: /* @__PURE__ */ jsx(LuLink, { className: "h-4 w-4" }) }) }),
|
|
3961
4096
|
/* @__PURE__ */ jsx(PopoverContent, { className: "w-80 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3962
4097
|
/* @__PURE__ */ jsx(
|
|
3963
4098
|
Input,
|
|
@@ -3993,7 +4128,7 @@ var Toolbar = ({
|
|
|
3993
4128
|
ToolbarButton,
|
|
3994
4129
|
{
|
|
3995
4130
|
onClick: () => editor.chain().focus().unsetAllMarks().clearNodes().run(),
|
|
3996
|
-
tooltip: "
|
|
4131
|
+
tooltip: t2("rte.clear_formatting"),
|
|
3997
4132
|
children: /* @__PURE__ */ jsx(LuRemoveFormatting, { className: "h-4 w-4" })
|
|
3998
4133
|
},
|
|
3999
4134
|
"clear"
|
|
@@ -4007,7 +4142,7 @@ var Toolbar = ({
|
|
|
4007
4142
|
if (tb.text_color) {
|
|
4008
4143
|
items.push(
|
|
4009
4144
|
/* @__PURE__ */ jsxs(Popover, { open: text_color_open, onOpenChange: set_text_color_open, children: [
|
|
4010
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "
|
|
4145
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: t2("rte.text_color"), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
4011
4146
|
/* @__PURE__ */ jsx(LuPalette, { className: "h-4 w-4" }),
|
|
4012
4147
|
/* @__PURE__ */ jsx(
|
|
4013
4148
|
"div",
|
|
@@ -4050,7 +4185,7 @@ var Toolbar = ({
|
|
|
4050
4185
|
if (tb.highlight_color) {
|
|
4051
4186
|
items.push(
|
|
4052
4187
|
/* @__PURE__ */ jsxs(Popover, { open: highlight_color_open, onOpenChange: set_highlight_color_open, children: [
|
|
4053
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "
|
|
4188
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: t2("rte.highlight_color"), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
4054
4189
|
/* @__PURE__ */ jsx(LuHighlighter, { className: "h-4 w-4" }),
|
|
4055
4190
|
/* @__PURE__ */ jsx(
|
|
4056
4191
|
"div",
|
|
@@ -4093,7 +4228,7 @@ var Toolbar = ({
|
|
|
4093
4228
|
{
|
|
4094
4229
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
4095
4230
|
is_active: editor.isActive({ textAlign: "left" }),
|
|
4096
|
-
tooltip: "
|
|
4231
|
+
tooltip: t2("rte.align_left"),
|
|
4097
4232
|
children: /* @__PURE__ */ jsx(LuAlignLeft, { className: "h-4 w-4" })
|
|
4098
4233
|
},
|
|
4099
4234
|
"align-left"
|
|
@@ -4103,7 +4238,7 @@ var Toolbar = ({
|
|
|
4103
4238
|
{
|
|
4104
4239
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
4105
4240
|
is_active: editor.isActive({ textAlign: "center" }),
|
|
4106
|
-
tooltip: "
|
|
4241
|
+
tooltip: t2("rte.align_center"),
|
|
4107
4242
|
children: /* @__PURE__ */ jsx(LuAlignCenter, { className: "h-4 w-4" })
|
|
4108
4243
|
},
|
|
4109
4244
|
"align-center"
|
|
@@ -4113,7 +4248,7 @@ var Toolbar = ({
|
|
|
4113
4248
|
{
|
|
4114
4249
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
4115
4250
|
is_active: editor.isActive({ textAlign: "right" }),
|
|
4116
|
-
tooltip: "
|
|
4251
|
+
tooltip: t2("rte.align_right"),
|
|
4117
4252
|
children: /* @__PURE__ */ jsx(LuAlignRight, { className: "h-4 w-4" })
|
|
4118
4253
|
},
|
|
4119
4254
|
"align-right"
|
|
@@ -4123,7 +4258,7 @@ var Toolbar = ({
|
|
|
4123
4258
|
{
|
|
4124
4259
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
4125
4260
|
is_active: editor.isActive({ textAlign: "justify" }),
|
|
4126
|
-
tooltip: "
|
|
4261
|
+
tooltip: t2("rte.justify"),
|
|
4127
4262
|
children: /* @__PURE__ */ jsx(LuAlignJustify, { className: "h-4 w-4" })
|
|
4128
4263
|
},
|
|
4129
4264
|
"align-justify"
|
|
@@ -4139,7 +4274,7 @@ var Toolbar = ({
|
|
|
4139
4274
|
{
|
|
4140
4275
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
4141
4276
|
is_active: editor.isActive("bulletList"),
|
|
4142
|
-
tooltip: "
|
|
4277
|
+
tooltip: t2("rte.bullet_list"),
|
|
4143
4278
|
children: /* @__PURE__ */ jsx(LuList, { className: "h-4 w-4" })
|
|
4144
4279
|
},
|
|
4145
4280
|
"bullet"
|
|
@@ -4153,7 +4288,7 @@ var Toolbar = ({
|
|
|
4153
4288
|
{
|
|
4154
4289
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
4155
4290
|
is_active: editor.isActive("orderedList"),
|
|
4156
|
-
tooltip: "
|
|
4291
|
+
tooltip: t2("rte.ordered_list"),
|
|
4157
4292
|
children: /* @__PURE__ */ jsx(LuListOrdered, { className: "h-4 w-4" })
|
|
4158
4293
|
},
|
|
4159
4294
|
"ordered"
|
|
@@ -4167,7 +4302,7 @@ var Toolbar = ({
|
|
|
4167
4302
|
{
|
|
4168
4303
|
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
4169
4304
|
is_active: editor.isActive("taskList"),
|
|
4170
|
-
tooltip: "
|
|
4305
|
+
tooltip: t2("rte.checklist"),
|
|
4171
4306
|
children: /* @__PURE__ */ jsx(LuListChecks, { className: "h-4 w-4" })
|
|
4172
4307
|
},
|
|
4173
4308
|
"task"
|
|
@@ -4189,7 +4324,7 @@ var Toolbar = ({
|
|
|
4189
4324
|
}
|
|
4190
4325
|
},
|
|
4191
4326
|
disabled: !editor.can().liftListItem("listItem") && !editor.can().liftListItem("taskItem"),
|
|
4192
|
-
tooltip: "
|
|
4327
|
+
tooltip: t2("rte.decrease_indent"),
|
|
4193
4328
|
children: /* @__PURE__ */ jsx(LuIndentDecrease, { className: "h-4 w-4" })
|
|
4194
4329
|
},
|
|
4195
4330
|
"indent-dec"
|
|
@@ -4205,7 +4340,7 @@ var Toolbar = ({
|
|
|
4205
4340
|
}
|
|
4206
4341
|
},
|
|
4207
4342
|
disabled: !editor.can().sinkListItem("listItem") && !editor.can().sinkListItem("taskItem"),
|
|
4208
|
-
tooltip: "
|
|
4343
|
+
tooltip: t2("rte.increase_indent"),
|
|
4209
4344
|
children: /* @__PURE__ */ jsx(LuIndentIncrease, { className: "h-4 w-4" })
|
|
4210
4345
|
},
|
|
4211
4346
|
"indent-inc"
|
|
@@ -4216,7 +4351,7 @@ var Toolbar = ({
|
|
|
4216
4351
|
const items = [];
|
|
4217
4352
|
if (tb.horizontal_rule) {
|
|
4218
4353
|
items.push(
|
|
4219
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: handle_hr_insert, tooltip: "
|
|
4354
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: handle_hr_insert, tooltip: t2("rte.horizontal_rule"), children: /* @__PURE__ */ jsx(RxDividerHorizontal, { className: "h-4 w-4" }) }, "hr")
|
|
4220
4355
|
);
|
|
4221
4356
|
}
|
|
4222
4357
|
if (tb.image) {
|
|
@@ -4225,7 +4360,7 @@ var Toolbar = ({
|
|
|
4225
4360
|
ToolbarButton,
|
|
4226
4361
|
{
|
|
4227
4362
|
onClick: () => image_input_ref.current?.click(),
|
|
4228
|
-
tooltip: "
|
|
4363
|
+
tooltip: t2("rte.insert_image"),
|
|
4229
4364
|
children: /* @__PURE__ */ jsx(LuImage, { className: "h-4 w-4" })
|
|
4230
4365
|
},
|
|
4231
4366
|
"image"
|
|
@@ -4239,7 +4374,7 @@ var Toolbar = ({
|
|
|
4239
4374
|
ToolbarButton,
|
|
4240
4375
|
{
|
|
4241
4376
|
is_active: editor.isActive("table"),
|
|
4242
|
-
tooltip: "
|
|
4377
|
+
tooltip: t2("rte.table"),
|
|
4243
4378
|
children: /* @__PURE__ */ jsx(LuTable, { className: "h-4 w-4" })
|
|
4244
4379
|
}
|
|
4245
4380
|
) }),
|
|
@@ -4411,7 +4546,7 @@ var Toolbar = ({
|
|
|
4411
4546
|
if (tb.variables && variables.length > 0) {
|
|
4412
4547
|
items.push(
|
|
4413
4548
|
/* @__PURE__ */ jsxs(Popover, { open: variables_menu_open, onOpenChange: set_variables_menu_open, children: [
|
|
4414
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "
|
|
4549
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: t2("rte.insert_variable"), children: /* @__PURE__ */ jsx(LuVariable, { className: "h-4 w-4" }) }) }),
|
|
4415
4550
|
/* @__PURE__ */ jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
4416
4551
|
/* @__PURE__ */ jsx(CommandInput, { placeholder: "Search variables...", className: "h-8 text-xs" }),
|
|
4417
4552
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
@@ -4440,7 +4575,7 @@ var Toolbar = ({
|
|
|
4440
4575
|
ToolbarButton,
|
|
4441
4576
|
{
|
|
4442
4577
|
onClick: () => file_input_ref.current?.click(),
|
|
4443
|
-
tooltip: "
|
|
4578
|
+
tooltip: t2("rte.attach_file"),
|
|
4444
4579
|
children: /* @__PURE__ */ jsx(LuPaperclip, { className: "h-4 w-4" })
|
|
4445
4580
|
},
|
|
4446
4581
|
"attach"
|
|
@@ -8481,7 +8616,7 @@ function LoadingTimeout({
|
|
|
8481
8616
|
label = "content",
|
|
8482
8617
|
className
|
|
8483
8618
|
}) {
|
|
8484
|
-
const
|
|
8619
|
+
const t4 = {
|
|
8485
8620
|
gentle: thresholds?.gentle ?? 5e3,
|
|
8486
8621
|
firm: thresholds?.firm ?? 15e3,
|
|
8487
8622
|
expired: thresholds?.expired ?? 3e4
|
|
@@ -8493,15 +8628,15 @@ function LoadingTimeout({
|
|
|
8493
8628
|
return;
|
|
8494
8629
|
}
|
|
8495
8630
|
setPhase("silent");
|
|
8496
|
-
const gentleTimer = window.setTimeout(() => setPhase("gentle"),
|
|
8497
|
-
const firmTimer = window.setTimeout(() => setPhase("firm"),
|
|
8498
|
-
const expiredTimer = window.setTimeout(() => setPhase("expired"),
|
|
8631
|
+
const gentleTimer = window.setTimeout(() => setPhase("gentle"), t4.gentle);
|
|
8632
|
+
const firmTimer = window.setTimeout(() => setPhase("firm"), t4.firm);
|
|
8633
|
+
const expiredTimer = window.setTimeout(() => setPhase("expired"), t4.expired);
|
|
8499
8634
|
return () => {
|
|
8500
8635
|
window.clearTimeout(gentleTimer);
|
|
8501
8636
|
window.clearTimeout(firmTimer);
|
|
8502
8637
|
window.clearTimeout(expiredTimer);
|
|
8503
8638
|
};
|
|
8504
|
-
}, [active,
|
|
8639
|
+
}, [active, t4.gentle, t4.firm, t4.expired]);
|
|
8505
8640
|
if (!active) {
|
|
8506
8641
|
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
8507
8642
|
}
|
|
@@ -9372,6 +9507,7 @@ function KanbanLaneHead({
|
|
|
9372
9507
|
"div",
|
|
9373
9508
|
{
|
|
9374
9509
|
ref: setNodeRef,
|
|
9510
|
+
"data-lane-key": lane.key,
|
|
9375
9511
|
className: cn(
|
|
9376
9512
|
"cls_hazo_kanban_lane_head mb-2 flex items-center gap-3 rounded-sm px-1 py-1",
|
|
9377
9513
|
isOver && "cls_hazo_kanban_lane_head_over bg-accent/30 ring-1 ring-ring/40"
|
|
@@ -9397,6 +9533,7 @@ function KanbanLaneStrip({
|
|
|
9397
9533
|
"div",
|
|
9398
9534
|
{
|
|
9399
9535
|
ref: setNodeRef,
|
|
9536
|
+
"data-lane-key": lane.key,
|
|
9400
9537
|
className: cn(
|
|
9401
9538
|
"cls_hazo_kanban_lane_strip mb-2 flex items-center gap-3 rounded-md border border-dashed border-border px-2 py-1 text-[11px] uppercase tracking-wider text-muted-foreground",
|
|
9402
9539
|
isOver && "cls_hazo_kanban_lane_strip_over border-solid bg-accent/30 text-foreground ring-1 ring-ring/30"
|
|
@@ -10156,7 +10293,7 @@ function HazoUiKanban({
|
|
|
10156
10293
|
if (lane.collapseWhenEmpty && count === 0) {
|
|
10157
10294
|
return /* @__PURE__ */ jsx(KanbanLaneStrip, { lane, treeKey: tree_key }, lane.key);
|
|
10158
10295
|
}
|
|
10159
|
-
return /* @__PURE__ */ jsxs("div", { className: "cls_hazo_kanban_lane", children: [
|
|
10296
|
+
return /* @__PURE__ */ jsxs("div", { "data-lane-key": lane.key, className: "cls_hazo_kanban_lane", children: [
|
|
10160
10297
|
/* @__PURE__ */ jsx(KanbanLaneHead, { lane, count, treeKey: tree_key }),
|
|
10161
10298
|
only_column ? render_column(only_column, tree_key, lane.key) : /* @__PURE__ */ jsx("div", { className: "cls_hazo_kanban_lane_grid grid gap-3", style: grid_style, children: columns.map((col) => render_column(col, tree_key, lane.key)) })
|
|
10162
10299
|
] }, lane.key);
|
|
@@ -10627,6 +10764,7 @@ function serializeFilter(filter) {
|
|
|
10627
10764
|
const fields = (filter.fields ?? []).map((f) => `${f.field}:${f.operator ?? ""}:${String(f.value)}`).join(",");
|
|
10628
10765
|
return `${filter.search ?? ""}|${fields}`;
|
|
10629
10766
|
}
|
|
10767
|
+
var t3 = createPackageT("hazo_ui", en_default);
|
|
10630
10768
|
function HazoUiTable(props) {
|
|
10631
10769
|
const state = useTableState(props);
|
|
10632
10770
|
const { columns, rows, getRowKey, className, caption } = props;
|
|
@@ -10661,12 +10799,12 @@ function HazoUiTable(props) {
|
|
|
10661
10799
|
) }) : state.serverError != null ? /* @__PURE__ */ jsx("div", { className: "cls_hazo_ui_table_mobile_error py-6", children: renderErrorState(props.error, state.serverError) }) : state.displayed.length === 0 ? /* @__PURE__ */ jsx("div", { className: "cls_hazo_ui_table_mobile_empty py-6", children: noActiveFilters(state.filter) && rows.length === 0 ? typeof props.empty === "string" || props.empty === void 0 ? /* @__PURE__ */ jsx(
|
|
10662
10800
|
EmptyState,
|
|
10663
10801
|
{
|
|
10664
|
-
title: typeof props.empty === "string" && props.empty || "
|
|
10802
|
+
title: typeof props.empty === "string" && props.empty || t3("table.empty")
|
|
10665
10803
|
}
|
|
10666
10804
|
) : props.empty : typeof props.noResults === "string" || props.noResults === void 0 ? /* @__PURE__ */ jsx(
|
|
10667
10805
|
EmptyState,
|
|
10668
10806
|
{
|
|
10669
|
-
title: typeof props.noResults === "string" && props.noResults || "
|
|
10807
|
+
title: typeof props.noResults === "string" && props.noResults || t3("table.no_results")
|
|
10670
10808
|
}
|
|
10671
10809
|
) : props.noResults }) : /* @__PURE__ */ jsx(
|
|
10672
10810
|
TableMobileCards,
|
|
@@ -10689,7 +10827,7 @@ function HazoUiTable(props) {
|
|
|
10689
10827
|
{
|
|
10690
10828
|
type: "button",
|
|
10691
10829
|
onClick: (e) => state.cycleHeaderSort(c.key, e.shiftKey),
|
|
10692
|
-
title: "
|
|
10830
|
+
title: t3("table.sort_tooltip"),
|
|
10693
10831
|
className: "cls_hazo_ui_table_sort_btn inline-flex items-center gap-1 hover:text-foreground",
|
|
10694
10832
|
children: [
|
|
10695
10833
|
/* @__PURE__ */ jsx("span", { children: c.label }),
|
|
@@ -10721,12 +10859,12 @@ function HazoUiTable(props) {
|
|
|
10721
10859
|
children: noActiveFilters(state.filter) && rows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "cls_hazo_ui_table_empty_wrap py-6", children: typeof props.empty === "string" || props.empty === void 0 ? /* @__PURE__ */ jsx(
|
|
10722
10860
|
EmptyState,
|
|
10723
10861
|
{
|
|
10724
|
-
title: typeof props.empty === "string" && props.empty || "
|
|
10862
|
+
title: typeof props.empty === "string" && props.empty || t3("table.empty")
|
|
10725
10863
|
}
|
|
10726
10864
|
) : props.empty }) : /* @__PURE__ */ jsx("div", { className: "cls_hazo_ui_table_no_results_wrap py-6", children: typeof props.noResults === "string" || props.noResults === void 0 ? /* @__PURE__ */ jsx(
|
|
10727
10865
|
EmptyState,
|
|
10728
10866
|
{
|
|
10729
|
-
title: typeof props.noResults === "string" && props.noResults || "
|
|
10867
|
+
title: typeof props.noResults === "string" && props.noResults || t3("table.no_results")
|
|
10730
10868
|
}
|
|
10731
10869
|
) : props.noResults })
|
|
10732
10870
|
}
|
|
@@ -10765,7 +10903,7 @@ function renderCell(c, row, i) {
|
|
|
10765
10903
|
var DEFAULT_NUMBER_LOCALE = "en-US";
|
|
10766
10904
|
function formatValue(value, formatter, currency, locale) {
|
|
10767
10905
|
if (value === null || value === void 0 || value === "") return "\u2014";
|
|
10768
|
-
const lc = locale ?? DEFAULT_NUMBER_LOCALE;
|
|
10906
|
+
const lc = locale ?? resolvePackageLocale(DEFAULT_NUMBER_LOCALE);
|
|
10769
10907
|
switch (formatter) {
|
|
10770
10908
|
case "date": {
|
|
10771
10909
|
const d = value instanceof Date ? value : new Date(value);
|
|
@@ -10840,14 +10978,11 @@ function PaginationFooter({
|
|
|
10840
10978
|
const end = Math.min((page + 1) * pageSize, total);
|
|
10841
10979
|
const lastPage = Math.max(0, Math.ceil(total / pageSize) - 1);
|
|
10842
10980
|
return /* @__PURE__ */ jsxs("div", { className: "cls_hazo_ui_table_pagination flex items-center justify-between gap-3 pt-2 text-sm", children: [
|
|
10843
|
-
/* @__PURE__ */
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
" of ",
|
|
10849
|
-
total
|
|
10850
|
-
] }),
|
|
10981
|
+
/* @__PURE__ */ jsx("span", { className: "cls_hazo_ui_table_page_counter text-muted-foreground", children: t3("table.showing", {
|
|
10982
|
+
start: String(start),
|
|
10983
|
+
end: String(end),
|
|
10984
|
+
total: String(total)
|
|
10985
|
+
}) }),
|
|
10851
10986
|
/* @__PURE__ */ jsxs("div", { className: "cls_hazo_ui_table_page_buttons flex items-center gap-2", children: [
|
|
10852
10987
|
/* @__PURE__ */ jsx(
|
|
10853
10988
|
Button,
|
|
@@ -10856,8 +10991,8 @@ function PaginationFooter({
|
|
|
10856
10991
|
size: "sm",
|
|
10857
10992
|
onClick: () => onPageChange(Math.max(0, page - 1)),
|
|
10858
10993
|
disabled: page === 0,
|
|
10859
|
-
"aria-label": "
|
|
10860
|
-
children: "
|
|
10994
|
+
"aria-label": t3("table.prev_aria"),
|
|
10995
|
+
children: t3("table.prev")
|
|
10861
10996
|
}
|
|
10862
10997
|
),
|
|
10863
10998
|
/* @__PURE__ */ jsx(
|
|
@@ -10867,8 +11002,8 @@ function PaginationFooter({
|
|
|
10867
11002
|
size: "sm",
|
|
10868
11003
|
onClick: () => onPageChange(Math.min(lastPage, page + 1)),
|
|
10869
11004
|
disabled: page >= lastPage,
|
|
10870
|
-
"aria-label": "
|
|
10871
|
-
children: "
|
|
11005
|
+
"aria-label": t3("table.next_aria"),
|
|
11006
|
+
children: t3("table.next")
|
|
10872
11007
|
}
|
|
10873
11008
|
)
|
|
10874
11009
|
] })
|
|
@@ -10912,7 +11047,7 @@ function Toolbar2(props) {
|
|
|
10912
11047
|
setSearchValue(v);
|
|
10913
11048
|
onSearchChange(v);
|
|
10914
11049
|
},
|
|
10915
|
-
placeholder: searchPlaceholder ?? "
|
|
11050
|
+
placeholder: searchPlaceholder ?? t3("table.search_placeholder"),
|
|
10916
11051
|
className: "cls_hazo_ui_table_search w-full sm:max-w-xs"
|
|
10917
11052
|
}
|
|
10918
11053
|
) : /* @__PURE__ */ jsx("div", {}),
|
|
@@ -10960,8 +11095,8 @@ function renderErrorState(error, serverError) {
|
|
|
10960
11095
|
return /* @__PURE__ */ jsx(
|
|
10961
11096
|
EmptyState,
|
|
10962
11097
|
{
|
|
10963
|
-
title: "
|
|
10964
|
-
description: msg || "
|
|
11098
|
+
title: t3("table.error_title"),
|
|
11099
|
+
description: msg || t3("table.error_description")
|
|
10965
11100
|
}
|
|
10966
11101
|
);
|
|
10967
11102
|
}
|
|
@@ -11747,8 +11882,8 @@ function computeEta(durationWindow, unitCount, concurrency = 1, fallbackUnitMs =
|
|
|
11747
11882
|
}
|
|
11748
11883
|
function easeToward(elapsed, eta, maxCap = 0.95) {
|
|
11749
11884
|
if (eta <= 0 || elapsed <= 0) return 0;
|
|
11750
|
-
const
|
|
11751
|
-
return maxCap * (1 - Math.exp(-1.5 *
|
|
11885
|
+
const t4 = elapsed / eta;
|
|
11886
|
+
return maxCap * (1 - Math.exp(-1.5 * t4));
|
|
11752
11887
|
}
|
|
11753
11888
|
function HazoUiProgressBar({
|
|
11754
11889
|
value,
|
|
@@ -12564,7 +12699,212 @@ function makeStatusBadge(statusMap, fallback) {
|
|
|
12564
12699
|
Component.displayName = "StatusBadge(bound)";
|
|
12565
12700
|
return Component;
|
|
12566
12701
|
}
|
|
12702
|
+
function HazoBrowserTab({
|
|
12703
|
+
tabs,
|
|
12704
|
+
on_select,
|
|
12705
|
+
on_close,
|
|
12706
|
+
add_menu,
|
|
12707
|
+
className
|
|
12708
|
+
}) {
|
|
12709
|
+
const handle_close = (e, id) => {
|
|
12710
|
+
e.stopPropagation();
|
|
12711
|
+
on_close?.(id);
|
|
12712
|
+
};
|
|
12713
|
+
return /* @__PURE__ */ jsxs(
|
|
12714
|
+
"div",
|
|
12715
|
+
{
|
|
12716
|
+
role: "tablist",
|
|
12717
|
+
className: cn(
|
|
12718
|
+
"cls_hazo_browser_tab flex items-end gap-0.5 bg-muted px-1.5 pt-1.5",
|
|
12719
|
+
className
|
|
12720
|
+
),
|
|
12721
|
+
children: [
|
|
12722
|
+
tabs.map((tab) => {
|
|
12723
|
+
const is_active = !!tab.active;
|
|
12724
|
+
const is_closable = tab.closable !== false;
|
|
12725
|
+
return /* @__PURE__ */ jsxs(
|
|
12726
|
+
"div",
|
|
12727
|
+
{
|
|
12728
|
+
role: "tab",
|
|
12729
|
+
"aria-selected": is_active,
|
|
12730
|
+
tabIndex: 0,
|
|
12731
|
+
onClick: () => on_select?.(tab.id),
|
|
12732
|
+
onKeyDown: (e) => {
|
|
12733
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
12734
|
+
e.preventDefault();
|
|
12735
|
+
on_select?.(tab.id);
|
|
12736
|
+
}
|
|
12737
|
+
},
|
|
12738
|
+
className: cn(
|
|
12739
|
+
"cls_hazo_browser_tab_tab group flex items-center gap-1.5 rounded-t-md border border-b-0 px-3 py-1.5 text-sm cursor-pointer select-none max-w-[200px]",
|
|
12740
|
+
is_active ? "bg-background text-foreground font-semibold border-border" : "bg-transparent text-muted-foreground border-transparent hover:bg-background/60 hover:text-foreground"
|
|
12741
|
+
),
|
|
12742
|
+
children: [
|
|
12743
|
+
/* @__PURE__ */ jsx("span", { className: "cls_hazo_browser_tab_label truncate", children: tab.label }),
|
|
12744
|
+
is_closable ? /* @__PURE__ */ jsx(
|
|
12745
|
+
"button",
|
|
12746
|
+
{
|
|
12747
|
+
type: "button",
|
|
12748
|
+
"aria-label": `Close ${tab.label}`,
|
|
12749
|
+
onClick: (e) => handle_close(e, tab.id),
|
|
12750
|
+
className: "cls_hazo_browser_tab_close flex-shrink-0 rounded p-0.5 text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-muted hover:text-foreground focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
12751
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
12752
|
+
}
|
|
12753
|
+
) : null
|
|
12754
|
+
]
|
|
12755
|
+
},
|
|
12756
|
+
tab.id
|
|
12757
|
+
);
|
|
12758
|
+
}),
|
|
12759
|
+
add_menu ? /* @__PURE__ */ jsx("div", { className: "cls_hazo_browser_tab_add_menu flex items-center pb-1.5 pl-1", children: add_menu }) : null
|
|
12760
|
+
]
|
|
12761
|
+
}
|
|
12762
|
+
);
|
|
12763
|
+
}
|
|
12764
|
+
var native_name_cache = /* @__PURE__ */ new Map();
|
|
12765
|
+
function get_native_name(code) {
|
|
12766
|
+
const cached = native_name_cache.get(code);
|
|
12767
|
+
if (cached !== void 0) return cached;
|
|
12768
|
+
let name = code;
|
|
12769
|
+
if (typeof Intl !== "undefined" && "DisplayNames" in Intl) {
|
|
12770
|
+
try {
|
|
12771
|
+
const display_names = new Intl.DisplayNames([code], {
|
|
12772
|
+
type: "language",
|
|
12773
|
+
languageDisplay: "standard"
|
|
12774
|
+
});
|
|
12775
|
+
name = display_names.of(code) ?? code;
|
|
12776
|
+
} catch {
|
|
12777
|
+
name = code;
|
|
12778
|
+
}
|
|
12779
|
+
}
|
|
12780
|
+
native_name_cache.set(code, name);
|
|
12781
|
+
return name;
|
|
12782
|
+
}
|
|
12783
|
+
function build_label(code, display) {
|
|
12784
|
+
if (display === "code") return code.toUpperCase();
|
|
12785
|
+
const native = get_native_name(code);
|
|
12786
|
+
if (display === "native+code") return `${native} (${code.toUpperCase()})`;
|
|
12787
|
+
return native;
|
|
12788
|
+
}
|
|
12789
|
+
var STRIPE_FLAGS = {
|
|
12790
|
+
de: { dir: "h", colors: ["#000000", "#DD0000", "#FFCE00"] },
|
|
12791
|
+
fr: { dir: "v", colors: ["#0055A4", "#FFFFFF", "#EF4135"] },
|
|
12792
|
+
it: { dir: "v", colors: ["#009246", "#FFFFFF", "#CE2B37"] },
|
|
12793
|
+
es: { dir: "h", colors: ["#AA151B", "#F1BF00", "#AA151B"] },
|
|
12794
|
+
pt: { dir: "v", colors: ["#046A38", "#FFFFFF", "#DA291C"] },
|
|
12795
|
+
nl: { dir: "h", colors: ["#AE1C28", "#FFFFFF", "#21468B"] }
|
|
12796
|
+
};
|
|
12797
|
+
var NORDIC_CROSS_FLAGS = {
|
|
12798
|
+
sv: { bg: "#006AA7", cross: "#FECC00" },
|
|
12799
|
+
fi: { bg: "#FFFFFF", cross: "#003580" }
|
|
12800
|
+
};
|
|
12801
|
+
function StripeFlag({
|
|
12802
|
+
dir,
|
|
12803
|
+
colors
|
|
12804
|
+
}) {
|
|
12805
|
+
const band = 12 / colors.length;
|
|
12806
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 12", width: "16", height: "12", "aria-hidden": "true", focusable: "false", children: colors.map(
|
|
12807
|
+
(color2, i) => dir === "h" ? /* @__PURE__ */ jsx("rect", { x: 0, y: i * band, width: 16, height: band, fill: color2 }, i) : /* @__PURE__ */ jsx("rect", { x: i * (16 / colors.length), y: 0, width: 16 / colors.length, height: 12, fill: color2 }, i)
|
|
12808
|
+
) });
|
|
12809
|
+
}
|
|
12810
|
+
function NordicCrossFlag({ bg, cross }) {
|
|
12811
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 12", width: "16", height: "12", "aria-hidden": "true", focusable: "false", children: [
|
|
12812
|
+
/* @__PURE__ */ jsx("rect", { width: "16", height: "12", fill: bg }),
|
|
12813
|
+
/* @__PURE__ */ jsx("rect", { x: "5", width: "2", height: "12", fill: cross }),
|
|
12814
|
+
/* @__PURE__ */ jsx("rect", { y: "5", width: "16", height: "2", fill: cross })
|
|
12815
|
+
] });
|
|
12816
|
+
}
|
|
12817
|
+
function get_flag_node(code) {
|
|
12818
|
+
const lang = code.toLowerCase().split(/[-_]/)[0];
|
|
12819
|
+
const cross = NORDIC_CROSS_FLAGS[lang];
|
|
12820
|
+
if (cross) return /* @__PURE__ */ jsx(NordicCrossFlag, { ...cross });
|
|
12821
|
+
const stripes = STRIPE_FLAGS[lang];
|
|
12822
|
+
if (stripes) return /* @__PURE__ */ jsx(StripeFlag, { ...stripes });
|
|
12823
|
+
return /* @__PURE__ */ jsx(Globe, { className: "h-3 w-3", "aria-hidden": "true" });
|
|
12824
|
+
}
|
|
12825
|
+
function FlagIcon({ code }) {
|
|
12826
|
+
return /* @__PURE__ */ jsx("span", { className: "cls_locale_picker_flag inline-flex h-3.5 w-4 shrink-0 items-center justify-center overflow-hidden rounded-[2px]", children: get_flag_node(code) });
|
|
12827
|
+
}
|
|
12828
|
+
function LocalePicker({
|
|
12829
|
+
variant = "dropdown",
|
|
12830
|
+
show = "auto",
|
|
12831
|
+
display = "native",
|
|
12832
|
+
flags = false,
|
|
12833
|
+
alternates,
|
|
12834
|
+
activeLocale,
|
|
12835
|
+
triggerLabel = "Change language",
|
|
12836
|
+
className
|
|
12837
|
+
}) {
|
|
12838
|
+
const options = React27.useMemo(() => {
|
|
12839
|
+
return Object.entries(alternates ?? {}).map(([code, url]) => {
|
|
12840
|
+
const href = safeHref(url);
|
|
12841
|
+
if (!href) return null;
|
|
12842
|
+
return { code, href, label: build_label(code, display) };
|
|
12843
|
+
}).filter((o) => o !== null);
|
|
12844
|
+
}, [alternates, display]);
|
|
12845
|
+
if (show === "never") return null;
|
|
12846
|
+
if (options.length === 0) return null;
|
|
12847
|
+
if (show === "auto" && options.length < 2) return null;
|
|
12848
|
+
if (variant === "inline") {
|
|
12849
|
+
return /* @__PURE__ */ jsx(
|
|
12850
|
+
"nav",
|
|
12851
|
+
{
|
|
12852
|
+
"aria-label": triggerLabel,
|
|
12853
|
+
className: cn("cls_locale_picker_inline flex items-center gap-1", className),
|
|
12854
|
+
children: options.map((opt) => /* @__PURE__ */ jsxs(
|
|
12855
|
+
"a",
|
|
12856
|
+
{
|
|
12857
|
+
href: opt.href,
|
|
12858
|
+
lang: opt.code,
|
|
12859
|
+
"aria-current": opt.code === activeLocale ? "true" : void 0,
|
|
12860
|
+
className: cn(
|
|
12861
|
+
"cls_locale_picker_inline_item inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
12862
|
+
opt.code === activeLocale && "bg-accent font-medium text-accent-foreground"
|
|
12863
|
+
),
|
|
12864
|
+
children: [
|
|
12865
|
+
flags && /* @__PURE__ */ jsx(FlagIcon, { code: opt.code }),
|
|
12866
|
+
/* @__PURE__ */ jsx("span", { children: opt.label })
|
|
12867
|
+
]
|
|
12868
|
+
},
|
|
12869
|
+
opt.code
|
|
12870
|
+
))
|
|
12871
|
+
}
|
|
12872
|
+
);
|
|
12873
|
+
}
|
|
12874
|
+
const active_option = options.find((o) => o.code === activeLocale);
|
|
12875
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
12876
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
12877
|
+
Button,
|
|
12878
|
+
{
|
|
12879
|
+
variant: "outline",
|
|
12880
|
+
size: "sm",
|
|
12881
|
+
lang: activeLocale,
|
|
12882
|
+
"aria-label": triggerLabel,
|
|
12883
|
+
className: cn("cls_locale_picker_trigger gap-1.5", className),
|
|
12884
|
+
children: [
|
|
12885
|
+
flags && /* @__PURE__ */ jsx(FlagIcon, { code: active_option?.code ?? options[0].code }),
|
|
12886
|
+
/* @__PURE__ */ jsx("span", { className: "cls_locale_picker_trigger_label", children: variant === "compact" ? (active_option ?? options[0]).code.toUpperCase() : (active_option ?? options[0]).label }),
|
|
12887
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 opacity-60", "aria-hidden": "true" })
|
|
12888
|
+
]
|
|
12889
|
+
}
|
|
12890
|
+
) }),
|
|
12891
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "cls_locale_picker_content", children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: activeLocale, children: options.map((opt) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioItem, { value: opt.code, asChild: true, children: /* @__PURE__ */ jsxs(
|
|
12892
|
+
"a",
|
|
12893
|
+
{
|
|
12894
|
+
href: opt.href,
|
|
12895
|
+
lang: opt.code,
|
|
12896
|
+
className: "cls_locale_picker_radio_item relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
12897
|
+
children: [
|
|
12898
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
12899
|
+
flags && /* @__PURE__ */ jsx(FlagIcon, { code: opt.code }),
|
|
12900
|
+
/* @__PURE__ */ jsx("span", { children: opt.label })
|
|
12901
|
+
]
|
|
12902
|
+
}
|
|
12903
|
+
) }, opt.code)) }) })
|
|
12904
|
+
] });
|
|
12905
|
+
}
|
|
12906
|
+
LocalePicker.displayName = "LocalePicker";
|
|
12567
12907
|
|
|
12568
|
-
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppFooter, AppHeader, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, CanvasTextToolbar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DEFAULT_ANNOUNCE_EVENT, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiIcon, HazoUiIconPicker, HazoUiImageCropper, HazoUiImageCropperDialog, HazoUiKanban, HazoUiKanbanFilter, HazoUiMemoryDropdown, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LiveRegion, LoadingTimeout, Logo, MarkdownEditor, NotificationCountBadge, NotificationItem, NotificationPanel, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, StatusBadge, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, announce, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, hasUrlParam, isLucideValue, makeStatusBadge, median, parse_commands_from_text, permissionToast, pick_x_label_indices, readRememberedState, reset_hazo_ui_config, resolve_animation_classes, safeHref, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, upsertEntry as upsertMemoryEntry, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useLongPress, useMediaQuery, useRememberedState, useScrollRestore, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock, writeRememberedState };
|
|
12908
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppFooter, AppHeader, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, CanvasTextToolbar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DEFAULT_ANNOUNCE_EVENT, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoBrowserTab, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiIcon, HazoUiIconPicker, HazoUiImageCropper, HazoUiImageCropperDialog, HazoUiKanban, HazoUiKanbanFilter, HazoUiMemoryDropdown, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LiveRegion, LoadingTimeout, LocalePicker, Logo, MarkdownEditor, NotificationCountBadge, NotificationItem, NotificationPanel, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, StatusBadge, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, announce, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, hasUrlParam, isLucideValue, makeStatusBadge, median, parse_commands_from_text, permissionToast, pick_x_label_indices, readRememberedState, reset_hazo_ui_config, resolve_animation_classes, safeHref, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, upsertEntry as upsertMemoryEntry, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useLongPress, useMediaQuery, useRememberedState, useScrollRestore, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock, writeRememberedState };
|
|
12569
12909
|
//# sourceMappingURL=index.js.map
|
|
12570
12910
|
//# sourceMappingURL=index.js.map
|