@herca/r-kit 0.0.49 → 0.0.52
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/dist/clients.cjs +379 -58
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +80 -18
- package/dist/clients.d.ts +80 -18
- package/dist/clients.js +374 -58
- package/dist/clients.js.map +1 -1
- package/package.json +1 -1
package/dist/clients.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var clients_exports = {};
|
|
32
32
|
__export(clients_exports, {
|
|
33
33
|
BaseCheckbox: () => BaseCheckbox,
|
|
34
|
+
BaseRadio: () => BaseRadio,
|
|
34
35
|
BaseSwitch: () => BaseSwitch,
|
|
35
36
|
ButtonDropdown: () => ButtonDropdown,
|
|
36
37
|
ButtonGroup: () => ButtonGroup,
|
|
@@ -71,6 +72,10 @@ __export(clients_exports, {
|
|
|
71
72
|
ModalPreviewAttachment: () => ModalPreviewAttachment,
|
|
72
73
|
ModalTitle: () => ModalTitle,
|
|
73
74
|
PreviewItem: () => PreviewItem,
|
|
75
|
+
Radio: () => Radio,
|
|
76
|
+
RadioGroup: () => RadioGroup,
|
|
77
|
+
RadioIndicatorVariants: () => RadioIndicatorVariants,
|
|
78
|
+
RadioVariants: () => RadioVariants,
|
|
74
79
|
Select: () => Select,
|
|
75
80
|
Sheet: () => Sheet,
|
|
76
81
|
SheetClose: () => SheetClose,
|
|
@@ -829,10 +834,10 @@ var ChipGroup = ({
|
|
|
829
834
|
}, [selected, internalSelected]);
|
|
830
835
|
const toggleSelection = (value) => {
|
|
831
836
|
let newSelected;
|
|
832
|
-
if (multiple
|
|
837
|
+
if (multiple) {
|
|
833
838
|
newSelected = internalSelected.includes(value) ? internalSelected.filter((v3) => v3 !== value) : [...internalSelected, value];
|
|
834
839
|
} else {
|
|
835
|
-
newSelected = [value];
|
|
840
|
+
newSelected = internalSelected.includes(value) ? [] : [value];
|
|
836
841
|
}
|
|
837
842
|
setInternalSelected(newSelected);
|
|
838
843
|
onSelect?.(newSelected);
|
|
@@ -12116,10 +12121,10 @@ var InputFile = (0, import_react361.forwardRef)(
|
|
|
12116
12121
|
/* @__PURE__ */ (0, import_jsx_runtime375.jsxs)(
|
|
12117
12122
|
"label",
|
|
12118
12123
|
{
|
|
12119
|
-
onDragEnter: variant === "large" ? handleDragEnter : void 0,
|
|
12120
|
-
onDragLeave: variant === "large" ? handleDragLeave : void 0,
|
|
12121
|
-
onDragOver: variant === "large" ? handleDragOver : void 0,
|
|
12122
|
-
onDrop: variant === "large" ? handleDrop : void 0,
|
|
12124
|
+
onDragEnter: variant === "large" || variant === "medium" ? handleDragEnter : void 0,
|
|
12125
|
+
onDragLeave: variant === "large" || variant === "medium" ? handleDragLeave : void 0,
|
|
12126
|
+
onDragOver: variant === "large" || variant === "medium" ? handleDragOver : void 0,
|
|
12127
|
+
onDrop: variant === "large" || variant === "medium" ? handleDrop : void 0,
|
|
12123
12128
|
className: cn(
|
|
12124
12129
|
inputFileVariants({ variant }),
|
|
12125
12130
|
"group relative flex items-center gap-2 rounded-lg border px-3 py-2 transition-all",
|
|
@@ -12130,7 +12135,7 @@ var InputFile = (0, import_react361.forwardRef)(
|
|
|
12130
12135
|
variant === "large" && internalErrorMessage !== void 0 && "border-danger-500",
|
|
12131
12136
|
//prettier-ignore
|
|
12132
12137
|
variant === "large" && "flex-col items-center p-5!",
|
|
12133
|
-
variant === "large" && isDragging && "border-primary-500 bg-primary-50",
|
|
12138
|
+
(variant === "large" || variant === "medium") && isDragging && "border-primary-500 bg-primary-50",
|
|
12134
12139
|
//prettier-ignore
|
|
12135
12140
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
12136
12141
|
),
|
|
@@ -12158,7 +12163,7 @@ var InputFile = (0, import_react361.forwardRef)(
|
|
|
12158
12163
|
Text,
|
|
12159
12164
|
{
|
|
12160
12165
|
as: "p",
|
|
12161
|
-
value: variant === "large" && !isDragging && !hint ? `Klik atau drag & drop file disini` : hint,
|
|
12166
|
+
value: (variant === "large" || variant === "medium") && !isDragging && !hint ? `Klik atau drag & drop file disini` : hint,
|
|
12162
12167
|
className: "text-gray-600!"
|
|
12163
12168
|
}
|
|
12164
12169
|
)
|
|
@@ -12985,10 +12990,17 @@ var createCalendarHelpers = ({
|
|
|
12985
12990
|
value,
|
|
12986
12991
|
rangeValue,
|
|
12987
12992
|
disabledDates,
|
|
12988
|
-
dayConfigs
|
|
12993
|
+
dayConfigs,
|
|
12994
|
+
disabled
|
|
12989
12995
|
}) => {
|
|
12990
12996
|
const isDateDisabled = (day) => {
|
|
12991
|
-
|
|
12997
|
+
if (disabledDates.some((d) => d.getTime() === day.fullDate.getTime())) {
|
|
12998
|
+
return true;
|
|
12999
|
+
}
|
|
13000
|
+
if (disabled?.(day.fullDate) === true) {
|
|
13001
|
+
return true;
|
|
13002
|
+
}
|
|
13003
|
+
return false;
|
|
12992
13004
|
};
|
|
12993
13005
|
const getDayConfig = (day) => {
|
|
12994
13006
|
return dayConfigs.find((c) => c.date.getTime() === day.fullDate.getTime());
|
|
@@ -13266,7 +13278,8 @@ function CalendarDayItem({
|
|
|
13266
13278
|
onClick,
|
|
13267
13279
|
variant,
|
|
13268
13280
|
events,
|
|
13269
|
-
backdropOnClick
|
|
13281
|
+
backdropOnClick,
|
|
13282
|
+
disabledDateClassName
|
|
13270
13283
|
}) {
|
|
13271
13284
|
const dayConfig = helpers.getDayConfig(day);
|
|
13272
13285
|
const isSelected = helpers.isDateSelected(day);
|
|
@@ -13302,8 +13315,9 @@ function CalendarDayItem({
|
|
|
13302
13315
|
mode === "single" && variant === "compact" && styleHelpers.getBackgroundClass(),
|
|
13303
13316
|
//prettier-ignore
|
|
13304
13317
|
mode === "range" && !isDisabled && helpers.getRangeBackgroundClass(day),
|
|
13305
|
-
variant === "default" && "h-28 md:h-36 w-full rounded-none flex items-start justify-start group p-1 md:p-3 border-r border-gray-300"
|
|
13318
|
+
variant === "default" && "h-28 md:h-36 w-full rounded-none flex items-start justify-start group p-1 md:p-3 border-r border-gray-300",
|
|
13306
13319
|
//prettier-ignore
|
|
13320
|
+
isDisabled && disabledDateClassName
|
|
13307
13321
|
),
|
|
13308
13322
|
children: [
|
|
13309
13323
|
/* @__PURE__ */ (0, import_jsx_runtime382.jsx)(
|
|
@@ -13482,7 +13496,8 @@ function CalendarGrid({
|
|
|
13482
13496
|
showCalendarTooltip = true,
|
|
13483
13497
|
backdropOnClick,
|
|
13484
13498
|
onEventClick,
|
|
13485
|
-
useLimitEvent = true
|
|
13499
|
+
useLimitEvent = true,
|
|
13500
|
+
disabledDateClassName
|
|
13486
13501
|
}) {
|
|
13487
13502
|
const isMobile = useIsMobile();
|
|
13488
13503
|
const weeks = Array.from(
|
|
@@ -13610,7 +13625,8 @@ function CalendarGrid({
|
|
|
13610
13625
|
onClick,
|
|
13611
13626
|
variant,
|
|
13612
13627
|
events,
|
|
13613
|
-
backdropOnClick: variant === "default" && backdropOnClick ? (day2) => backdropOnClick?.(day2) : void 0
|
|
13628
|
+
backdropOnClick: variant === "default" && backdropOnClick ? (day2) => backdropOnClick?.(day2) : void 0,
|
|
13629
|
+
disabledDateClassName
|
|
13614
13630
|
},
|
|
13615
13631
|
dayIndex
|
|
13616
13632
|
))
|
|
@@ -13995,7 +14011,9 @@ var Calendar2 = ({
|
|
|
13995
14011
|
onMonthChange,
|
|
13996
14012
|
onYearChange,
|
|
13997
14013
|
showDefaultController = false,
|
|
13998
|
-
useLimitEvent = true
|
|
14014
|
+
useLimitEvent = true,
|
|
14015
|
+
disabled,
|
|
14016
|
+
disabledDateClassName
|
|
13999
14017
|
}) => {
|
|
14000
14018
|
const currentDate = /* @__PURE__ */ new Date();
|
|
14001
14019
|
const [currentMonth, setCurrentMonth] = (0, import_react367.useState)(defaultMonth ?? currentDate.getMonth());
|
|
@@ -14020,7 +14038,8 @@ var Calendar2 = ({
|
|
|
14020
14038
|
dayConfigs,
|
|
14021
14039
|
rangeValue,
|
|
14022
14040
|
mode,
|
|
14023
|
-
value
|
|
14041
|
+
value,
|
|
14042
|
+
disabled
|
|
14024
14043
|
});
|
|
14025
14044
|
const calendarState = {
|
|
14026
14045
|
currentMonth,
|
|
@@ -14036,8 +14055,8 @@ var Calendar2 = ({
|
|
|
14036
14055
|
};
|
|
14037
14056
|
const handleDateClick = (day) => {
|
|
14038
14057
|
const dayConfig = calendarHelpers.getDayConfig(day);
|
|
14039
|
-
const
|
|
14040
|
-
if (
|
|
14058
|
+
const disabled2 = (dayConfig?.disabled ?? false) || calendarHelpers.isDateDisabled(day);
|
|
14059
|
+
if (disabled2) {
|
|
14041
14060
|
return;
|
|
14042
14061
|
}
|
|
14043
14062
|
onChange?.(day.fullDate);
|
|
@@ -14252,7 +14271,8 @@ var Calendar2 = ({
|
|
|
14252
14271
|
showCalendarTooltip,
|
|
14253
14272
|
useLimitEvent,
|
|
14254
14273
|
onEventClick,
|
|
14255
|
-
backdropOnClick
|
|
14274
|
+
backdropOnClick,
|
|
14275
|
+
disabledDateClassName
|
|
14256
14276
|
}
|
|
14257
14277
|
)
|
|
14258
14278
|
] })
|
|
@@ -14394,6 +14414,9 @@ var DatePicker = ({
|
|
|
14394
14414
|
trigger,
|
|
14395
14415
|
open,
|
|
14396
14416
|
onOpenChange,
|
|
14417
|
+
minDate,
|
|
14418
|
+
maxDate,
|
|
14419
|
+
disabledDateClassName,
|
|
14397
14420
|
calendarProps,
|
|
14398
14421
|
endDateCalendarProps,
|
|
14399
14422
|
startDateCalendarProps,
|
|
@@ -14674,6 +14697,12 @@ var DatePicker = ({
|
|
|
14674
14697
|
dayWrapperClassname: "justify-between",
|
|
14675
14698
|
onChange: handleCalendarChange,
|
|
14676
14699
|
value: selectedDate,
|
|
14700
|
+
disabled: (date) => {
|
|
14701
|
+
if (minDate !== void 0 && date < minDate) return true;
|
|
14702
|
+
if (maxDate !== void 0 && date > maxDate) return true;
|
|
14703
|
+
return false;
|
|
14704
|
+
},
|
|
14705
|
+
disabledDateClassName,
|
|
14677
14706
|
...calendarProps
|
|
14678
14707
|
}
|
|
14679
14708
|
) : /* @__PURE__ */ (0, import_jsx_runtime389.jsxs)("div", { className: "flex", children: [
|
|
@@ -14785,6 +14814,16 @@ var DatePicker = ({
|
|
|
14785
14814
|
value: dateRange.start,
|
|
14786
14815
|
rangeValue: dateRange,
|
|
14787
14816
|
mode: "range",
|
|
14817
|
+
disabled: (date) => {
|
|
14818
|
+
if (minDate !== void 0 && date < minDate) {
|
|
14819
|
+
return true;
|
|
14820
|
+
}
|
|
14821
|
+
if (maxDate !== void 0 && date > maxDate) {
|
|
14822
|
+
return true;
|
|
14823
|
+
}
|
|
14824
|
+
return false;
|
|
14825
|
+
},
|
|
14826
|
+
disabledDateClassName,
|
|
14788
14827
|
...startDateCalendarProps
|
|
14789
14828
|
}
|
|
14790
14829
|
),
|
|
@@ -14802,6 +14841,16 @@ var DatePicker = ({
|
|
|
14802
14841
|
mode: "range",
|
|
14803
14842
|
defaultMonth: nextMonthData.month,
|
|
14804
14843
|
defaultYear: nextMonthData.year,
|
|
14844
|
+
disabled: (date) => {
|
|
14845
|
+
if (minDate !== void 0 && date < minDate) {
|
|
14846
|
+
return true;
|
|
14847
|
+
}
|
|
14848
|
+
if (maxDate !== void 0 && date > maxDate) {
|
|
14849
|
+
return true;
|
|
14850
|
+
}
|
|
14851
|
+
return false;
|
|
14852
|
+
},
|
|
14853
|
+
disabledDateClassName,
|
|
14805
14854
|
...endDateCalendarProps
|
|
14806
14855
|
}
|
|
14807
14856
|
)
|
|
@@ -15375,6 +15424,7 @@ function Select({
|
|
|
15375
15424
|
required,
|
|
15376
15425
|
isSelectOpen,
|
|
15377
15426
|
onOpenChange,
|
|
15427
|
+
searchOptions,
|
|
15378
15428
|
searchPlaceholder = "Search..."
|
|
15379
15429
|
}) {
|
|
15380
15430
|
const [isOpen, setIsOpen] = (0, import_react375.useState)(false);
|
|
@@ -15509,6 +15559,11 @@ function Select({
|
|
|
15509
15559
|
(0, import_react375.useEffect)(() => {
|
|
15510
15560
|
onOpenChange?.(isOpen);
|
|
15511
15561
|
}, [isOpen]);
|
|
15562
|
+
(0, import_react375.useEffect)(() => {
|
|
15563
|
+
if (searchOptions !== void 0) {
|
|
15564
|
+
setSearchTerm(searchOptions);
|
|
15565
|
+
}
|
|
15566
|
+
}, [searchOptions]);
|
|
15512
15567
|
const getDisplayValue = () => {
|
|
15513
15568
|
const isEmpty = value == null || isMulti && asArray(value).length === 0;
|
|
15514
15569
|
if (isEmpty) {
|
|
@@ -26718,6 +26773,11 @@ var FontSize = Extension.create({
|
|
|
26718
26773
|
|
|
26719
26774
|
// src/components/text-editor/extension/image-node.ts
|
|
26720
26775
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
26776
|
+
var getJustify = (align) => {
|
|
26777
|
+
if (align === "right") return "flex-end";
|
|
26778
|
+
if (align === "center") return "center";
|
|
26779
|
+
return "flex-start";
|
|
26780
|
+
};
|
|
26721
26781
|
var ImageNode = import_extension_image.default.extend({
|
|
26722
26782
|
// jadikan block supaya bisa di-align
|
|
26723
26783
|
inline: false,
|
|
@@ -26756,9 +26816,10 @@ var ImageNode = import_extension_image.default.extend({
|
|
|
26756
26816
|
},
|
|
26757
26817
|
textAlign: {
|
|
26758
26818
|
default: "left",
|
|
26759
|
-
parseHTML: (el) => el.closest("[data-image-wrapper]")?.getAttribute("data-align") ?? "left",
|
|
26760
|
-
renderHTML: () => ({
|
|
26761
|
-
|
|
26819
|
+
parseHTML: (el) => el.getAttribute("data-text-align") ?? el.closest("[data-image-wrapper]")?.getAttribute("data-align") ?? "left",
|
|
26820
|
+
renderHTML: (attrs) => ({
|
|
26821
|
+
"data-text-align": attrs["textAlign"]
|
|
26822
|
+
})
|
|
26762
26823
|
},
|
|
26763
26824
|
url: {
|
|
26764
26825
|
default: null,
|
|
@@ -26776,26 +26837,23 @@ var ImageNode = import_extension_image.default.extend({
|
|
|
26776
26837
|
},
|
|
26777
26838
|
renderHTML({ HTMLAttributes }) {
|
|
26778
26839
|
const {
|
|
26779
|
-
textAlign,
|
|
26780
26840
|
objectFit,
|
|
26781
26841
|
url,
|
|
26782
26842
|
urlTarget,
|
|
26843
|
+
"data-text-align": dataTextAlign,
|
|
26783
26844
|
"data-url": dataUrl,
|
|
26784
|
-
// ← ambil dari sini
|
|
26785
26845
|
"data-url-target": dataUrlTarget,
|
|
26786
26846
|
...rest
|
|
26787
26847
|
} = HTMLAttributes;
|
|
26788
|
-
const align =
|
|
26789
|
-
const getJustify2 = (a) => a === "right" ? "flex-end" : a === "center" ? "center" : "flex-start";
|
|
26848
|
+
const align = typeof dataTextAlign === "string" && dataTextAlign.length > 0 ? dataTextAlign : "left";
|
|
26790
26849
|
const resolvedUrl = url ?? dataUrl ?? null;
|
|
26791
26850
|
const resolvedTarget = urlTarget ?? dataUrlTarget ?? "_self";
|
|
26792
26851
|
const img = [
|
|
26793
26852
|
"img",
|
|
26794
26853
|
mergeAttributes(rest, {
|
|
26795
26854
|
style: `object-fit: ${objectFit ?? "contain"}`,
|
|
26796
|
-
|
|
26797
|
-
...
|
|
26798
|
-
...urlTarget == null ? { "data-url-target": urlTarget } : {}
|
|
26855
|
+
...resolvedUrl !== null ? { "data-url": resolvedUrl } : {},
|
|
26856
|
+
...resolvedTarget != null ? { "data-url-target": resolvedTarget } : {}
|
|
26799
26857
|
})
|
|
26800
26858
|
];
|
|
26801
26859
|
const content = resolvedUrl != null ? ["a", { href: resolvedUrl, target: resolvedTarget }, img] : img;
|
|
@@ -26804,7 +26862,7 @@ var ImageNode = import_extension_image.default.extend({
|
|
|
26804
26862
|
{
|
|
26805
26863
|
"data-image-wrapper": "",
|
|
26806
26864
|
"data-align": align,
|
|
26807
|
-
"style": `display:flex;justify-content:${
|
|
26865
|
+
"style": `display:flex;justify-content:${getJustify(align)};`
|
|
26808
26866
|
},
|
|
26809
26867
|
content
|
|
26810
26868
|
];
|
|
@@ -26820,8 +26878,7 @@ var ImageNode = import_extension_image.default.extend({
|
|
|
26820
26878
|
const align = n.attrs["textAlign"] ?? "left";
|
|
26821
26879
|
const url = n.attrs["url"];
|
|
26822
26880
|
const urlTarget = n.attrs["urlTarget"] ?? "_self";
|
|
26823
|
-
|
|
26824
|
-
wrapper.style.cssText = `display: flex; justify-content: ${getJustify2(align)};`;
|
|
26881
|
+
wrapper.style.cssText = `display: flex; justify-content: ${getJustify(align)};`;
|
|
26825
26882
|
wrapper.setAttribute("data-align", align);
|
|
26826
26883
|
if (n.attrs["src"])
|
|
26827
26884
|
img.setAttribute("src", n.attrs["src"]);
|
|
@@ -26831,6 +26888,17 @@ var ImageNode = import_extension_image.default.extend({
|
|
|
26831
26888
|
img.setAttribute("width", String(n.attrs["width"]));
|
|
26832
26889
|
if (n.attrs["height"])
|
|
26833
26890
|
img.setAttribute("height", String(n.attrs["height"]));
|
|
26891
|
+
img.setAttribute("data-text-align", align);
|
|
26892
|
+
if (url !== null) {
|
|
26893
|
+
img.setAttribute("data-url", url);
|
|
26894
|
+
} else {
|
|
26895
|
+
img.removeAttribute("data-url");
|
|
26896
|
+
}
|
|
26897
|
+
if (urlTarget !== null) {
|
|
26898
|
+
img.setAttribute("data-url-target", urlTarget);
|
|
26899
|
+
} else {
|
|
26900
|
+
img.removeAttribute("data-url-target");
|
|
26901
|
+
}
|
|
26834
26902
|
img.style.objectFit = n.attrs["objectFit"] ?? "contain";
|
|
26835
26903
|
wrapper.innerHTML = "";
|
|
26836
26904
|
if (url !== null) {
|
|
@@ -27124,7 +27192,7 @@ var TableNode = import_extension_table.Table.extend({
|
|
|
27124
27192
|
var table_node_default = TableNode;
|
|
27125
27193
|
|
|
27126
27194
|
// src/components/text-editor/extension/youtube-node.ts
|
|
27127
|
-
var
|
|
27195
|
+
var getJustify2 = (align) => {
|
|
27128
27196
|
switch (align) {
|
|
27129
27197
|
case "left":
|
|
27130
27198
|
return "flex-start";
|
|
@@ -27190,7 +27258,7 @@ var YoutubeNode = Node3.create({
|
|
|
27190
27258
|
const wrapper = document.createElement("div");
|
|
27191
27259
|
wrapper.style.cssText = "display: flex; justify-content: center; margin: 0.5rem 0;";
|
|
27192
27260
|
const updateAlignment = (align) => {
|
|
27193
|
-
wrapper.style.justifyContent =
|
|
27261
|
+
wrapper.style.justifyContent = getJustify2(align);
|
|
27194
27262
|
};
|
|
27195
27263
|
const iframe = document.createElement("iframe");
|
|
27196
27264
|
iframe.setAttribute("src", node.attrs["src"]);
|
|
@@ -33748,6 +33816,16 @@ var target_link_options_default = targetOptions;
|
|
|
33748
33816
|
|
|
33749
33817
|
// src/components/text-editor/partials/modal-insert-image.tsx
|
|
33750
33818
|
var import_jsx_runtime407 = require("react/jsx-runtime");
|
|
33819
|
+
var createDefaultImageForm = () => ({
|
|
33820
|
+
url: null,
|
|
33821
|
+
image: {
|
|
33822
|
+
objectFit: object_fit_options_default[0],
|
|
33823
|
+
source: "",
|
|
33824
|
+
altText: "",
|
|
33825
|
+
width: "200",
|
|
33826
|
+
height: "200"
|
|
33827
|
+
}
|
|
33828
|
+
});
|
|
33751
33829
|
function ModalInsertImage({
|
|
33752
33830
|
isOpen,
|
|
33753
33831
|
onClose,
|
|
@@ -33766,22 +33844,25 @@ function ModalInsertImage({
|
|
|
33766
33844
|
altText: data[0].uploadedData?.data.name ?? ""
|
|
33767
33845
|
};
|
|
33768
33846
|
}
|
|
33769
|
-
}
|
|
33847
|
+
},
|
|
33848
|
+
onDownload
|
|
33770
33849
|
}) {
|
|
33771
33850
|
const [currentTabImage, setCurrentTabImage] = (0, import_react388.useState)("0");
|
|
33851
|
+
const [uploadInputKey, setUploadInputKey] = (0, import_react388.useState)(0);
|
|
33852
|
+
const [uploadFiles, setUploadFiles] = (0, import_react388.useState)([]);
|
|
33772
33853
|
const [errors, setErrors] = (0, import_react388.useState)(
|
|
33773
33854
|
{}
|
|
33774
33855
|
);
|
|
33775
|
-
const [imageForm, setImageForm] = (0, import_react388.useState)(
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
|
|
33779
|
-
|
|
33780
|
-
|
|
33781
|
-
|
|
33782
|
-
|
|
33783
|
-
|
|
33784
|
-
}
|
|
33856
|
+
const [imageForm, setImageForm] = (0, import_react388.useState)(
|
|
33857
|
+
createDefaultImageForm()
|
|
33858
|
+
);
|
|
33859
|
+
const resetFormState = () => {
|
|
33860
|
+
setCurrentTabImage("0");
|
|
33861
|
+
setErrors({});
|
|
33862
|
+
setImageForm(createDefaultImageForm());
|
|
33863
|
+
setUploadFiles([]);
|
|
33864
|
+
setUploadInputKey((prev) => prev + 1);
|
|
33865
|
+
};
|
|
33785
33866
|
const validate = () => {
|
|
33786
33867
|
const newErrors = {};
|
|
33787
33868
|
if (imageForm?.image?.source === "" || imageForm?.image?.source === null || imageForm?.image?.source === void 0) {
|
|
@@ -33800,9 +33881,16 @@ function ModalInsertImage({
|
|
|
33800
33881
|
return Object.keys(newErrors).length === 0;
|
|
33801
33882
|
};
|
|
33802
33883
|
(0, import_react388.useEffect)(() => {
|
|
33803
|
-
if (isOpen
|
|
33884
|
+
if (!isOpen) return;
|
|
33885
|
+
setErrors({});
|
|
33886
|
+
setCurrentTabImage("0");
|
|
33887
|
+
setUploadFiles([]);
|
|
33888
|
+
setUploadInputKey((prev) => prev + 1);
|
|
33889
|
+
if (initialValues !== void 0) {
|
|
33804
33890
|
setImageForm(initialValues);
|
|
33891
|
+
return;
|
|
33805
33892
|
}
|
|
33893
|
+
setImageForm(createDefaultImageForm());
|
|
33806
33894
|
}, [isOpen, initialValues]);
|
|
33807
33895
|
return /* @__PURE__ */ (0, import_jsx_runtime407.jsxs)(Modal, { isOpen, onClose: () => onClose(false), closable: false, children: [
|
|
33808
33896
|
/* @__PURE__ */ (0, import_jsx_runtime407.jsxs)(ModalHeader, { className: "flex-row! items-center justify-between border-b border-gray-200", children: [
|
|
@@ -33826,7 +33914,7 @@ function ModalInsertImage({
|
|
|
33826
33914
|
if (!validate()) return;
|
|
33827
33915
|
onSubmit(imageForm);
|
|
33828
33916
|
onClose(false);
|
|
33829
|
-
|
|
33917
|
+
resetFormState();
|
|
33830
33918
|
},
|
|
33831
33919
|
className: "overflow-auto",
|
|
33832
33920
|
children: [
|
|
@@ -34007,8 +34095,11 @@ function ModalInsertImage({
|
|
|
34007
34095
|
maxSize: (attachmentField?.maxSize ?? 0) * 1024 * 1024,
|
|
34008
34096
|
variant: attachmentField?.variant ?? "medium",
|
|
34009
34097
|
uploadConfig: attachmentField?.uploadConfig,
|
|
34010
|
-
onChange:
|
|
34011
|
-
|
|
34098
|
+
onChange: (files) => {
|
|
34099
|
+
setUploadFiles(files);
|
|
34100
|
+
attachmentField?.onChange?.(files);
|
|
34101
|
+
},
|
|
34102
|
+
value: uploadFiles,
|
|
34012
34103
|
onUploadSuccess: (results) => {
|
|
34013
34104
|
const { url, altText } = attachmentField.extractUploadResult(results);
|
|
34014
34105
|
setCurrentTabImage("0");
|
|
@@ -34024,8 +34115,10 @@ function ModalInsertImage({
|
|
|
34024
34115
|
};
|
|
34025
34116
|
});
|
|
34026
34117
|
attachmentField?.onUploadSuccess?.(results);
|
|
34027
|
-
}
|
|
34028
|
-
|
|
34118
|
+
},
|
|
34119
|
+
onDownload
|
|
34120
|
+
},
|
|
34121
|
+
uploadInputKey
|
|
34029
34122
|
) })
|
|
34030
34123
|
]
|
|
34031
34124
|
}
|
|
@@ -34039,7 +34132,7 @@ function ModalInsertImage({
|
|
|
34039
34132
|
type: "button",
|
|
34040
34133
|
onClick: () => {
|
|
34041
34134
|
onClose(false);
|
|
34042
|
-
|
|
34135
|
+
resetFormState();
|
|
34043
34136
|
},
|
|
34044
34137
|
children: "Cancel"
|
|
34045
34138
|
}
|
|
@@ -34255,7 +34348,8 @@ var import_jsx_runtime409 = require("react/jsx-runtime");
|
|
|
34255
34348
|
function InsertGroup({
|
|
34256
34349
|
editor,
|
|
34257
34350
|
disabled = false,
|
|
34258
|
-
attachmentField
|
|
34351
|
+
attachmentField,
|
|
34352
|
+
onDownload
|
|
34259
34353
|
}) {
|
|
34260
34354
|
const [isModalImageOpen, setIsModalImageOpen] = (0, import_react392.useState)(false);
|
|
34261
34355
|
const [isModalYoutubeOpen, setIsModalYoutubeOpen] = (0, import_react392.useState)(false);
|
|
@@ -34412,7 +34506,8 @@ function InsertGroup({
|
|
|
34412
34506
|
url: form.url?.source ?? null,
|
|
34413
34507
|
urlTarget: form.url?.target?.value ?? "_self"
|
|
34414
34508
|
}).run();
|
|
34415
|
-
}
|
|
34509
|
+
},
|
|
34510
|
+
onDownload
|
|
34416
34511
|
}
|
|
34417
34512
|
)
|
|
34418
34513
|
] });
|
|
@@ -34494,7 +34589,7 @@ function TableGroup({
|
|
|
34494
34589
|
{
|
|
34495
34590
|
title: "Delete Row",
|
|
34496
34591
|
icon: "table-delete-row",
|
|
34497
|
-
onClick: () => editor.chain().focus().
|
|
34592
|
+
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34498
34593
|
requiresTable: false,
|
|
34499
34594
|
disabled
|
|
34500
34595
|
}
|
|
@@ -34510,7 +34605,7 @@ function TableGroup({
|
|
|
34510
34605
|
{
|
|
34511
34606
|
title: "Delete Column",
|
|
34512
34607
|
icon: "table-delete-column",
|
|
34513
|
-
onClick: () => editor.chain().focus().
|
|
34608
|
+
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34514
34609
|
requiresTable: false,
|
|
34515
34610
|
disabled
|
|
34516
34611
|
}
|
|
@@ -34625,7 +34720,8 @@ function TextEditor({
|
|
|
34625
34720
|
ui: ui3,
|
|
34626
34721
|
field,
|
|
34627
34722
|
toolbar,
|
|
34628
|
-
editor: editorProps
|
|
34723
|
+
editor: editorProps,
|
|
34724
|
+
onDownload
|
|
34629
34725
|
}) {
|
|
34630
34726
|
const {
|
|
34631
34727
|
disabled = false,
|
|
@@ -34764,7 +34860,8 @@ function TextEditor({
|
|
|
34764
34860
|
{
|
|
34765
34861
|
disabled: isHtmlMode,
|
|
34766
34862
|
editor,
|
|
34767
|
-
attachmentField
|
|
34863
|
+
attachmentField,
|
|
34864
|
+
onDownload
|
|
34768
34865
|
}
|
|
34769
34866
|
),
|
|
34770
34867
|
table && /* @__PURE__ */ (0, import_jsx_runtime411.jsx)(TableGroup, { disabled: isHtmlMode, editor }),
|
|
@@ -34822,9 +34919,229 @@ function TextEditor({
|
|
|
34822
34919
|
}
|
|
34823
34920
|
);
|
|
34824
34921
|
}
|
|
34922
|
+
|
|
34923
|
+
// src/components/radio/radio.tsx
|
|
34924
|
+
var import_react396 = __toESM(require("react"), 1);
|
|
34925
|
+
|
|
34926
|
+
// src/components/radio/radio-variants.ts
|
|
34927
|
+
var import_class_variance_authority13 = require("class-variance-authority");
|
|
34928
|
+
var RadioVariants = (0, import_class_variance_authority13.cva)(
|
|
34929
|
+
"flex items-center justify-center rounded-full border transition-all focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none",
|
|
34930
|
+
{
|
|
34931
|
+
variants: {
|
|
34932
|
+
size: {
|
|
34933
|
+
sm: "h-4 w-4",
|
|
34934
|
+
md: "h-5 w-5",
|
|
34935
|
+
lg: "h-6 w-6"
|
|
34936
|
+
},
|
|
34937
|
+
color: {
|
|
34938
|
+
primary: "border-primary-1000 focus-visible:ring-primary-900",
|
|
34939
|
+
secondary: "border-gray-600 focus-visible:ring-gray-500",
|
|
34940
|
+
success: "border-success-500 focus-visible:ring-success-400",
|
|
34941
|
+
danger: "border-danger-500 focus-visible:ring-danger-400",
|
|
34942
|
+
warning: "border-warning-500 focus-visible:ring-warning-400",
|
|
34943
|
+
info: "border-info-500 focus-visible:ring-info-400",
|
|
34944
|
+
orange: "border-orange-500 focus-visible:ring-orange-400",
|
|
34945
|
+
purple: "border-purple-500 focus-visible:ring-purple-400",
|
|
34946
|
+
gray: "border-gray-600 focus-visible:ring-gray-500"
|
|
34947
|
+
}
|
|
34948
|
+
},
|
|
34949
|
+
defaultVariants: {
|
|
34950
|
+
size: "md",
|
|
34951
|
+
color: "primary"
|
|
34952
|
+
}
|
|
34953
|
+
}
|
|
34954
|
+
);
|
|
34955
|
+
var RadioIndicatorVariants = (0, import_class_variance_authority13.cva)("rounded-full transition-all", {
|
|
34956
|
+
variants: {
|
|
34957
|
+
size: {
|
|
34958
|
+
sm: "h-2 w-2",
|
|
34959
|
+
md: "h-2.5 w-2.5",
|
|
34960
|
+
lg: "h-3 w-3"
|
|
34961
|
+
},
|
|
34962
|
+
color: {
|
|
34963
|
+
primary: "bg-primary-1000",
|
|
34964
|
+
secondary: "bg-gray-600",
|
|
34965
|
+
success: "bg-success-500",
|
|
34966
|
+
danger: "bg-danger-500",
|
|
34967
|
+
warning: "bg-warning-500",
|
|
34968
|
+
info: "bg-info-500",
|
|
34969
|
+
orange: "bg-orange-500",
|
|
34970
|
+
purple: "bg-purple-500",
|
|
34971
|
+
gray: "bg-gray-600"
|
|
34972
|
+
}
|
|
34973
|
+
},
|
|
34974
|
+
defaultVariants: {
|
|
34975
|
+
size: "md",
|
|
34976
|
+
color: "primary"
|
|
34977
|
+
}
|
|
34978
|
+
});
|
|
34979
|
+
|
|
34980
|
+
// src/components/radio/radio.tsx
|
|
34981
|
+
var import_jsx_runtime412 = require("react/jsx-runtime");
|
|
34982
|
+
var RadioGroupContext = (0, import_react396.createContext)(
|
|
34983
|
+
void 0
|
|
34984
|
+
);
|
|
34985
|
+
var RadioGroup = ({
|
|
34986
|
+
value,
|
|
34987
|
+
defaultValue,
|
|
34988
|
+
onValueChange,
|
|
34989
|
+
disabled = false,
|
|
34990
|
+
required = false,
|
|
34991
|
+
name,
|
|
34992
|
+
size = "md",
|
|
34993
|
+
color = "primary",
|
|
34994
|
+
className,
|
|
34995
|
+
label,
|
|
34996
|
+
hint,
|
|
34997
|
+
description,
|
|
34998
|
+
errorMessages,
|
|
34999
|
+
direction = "vertical",
|
|
35000
|
+
children
|
|
35001
|
+
}) => {
|
|
35002
|
+
const [internalValue, setInternalValue] = import_react396.default.useState(
|
|
35003
|
+
defaultValue ?? value ?? ""
|
|
35004
|
+
);
|
|
35005
|
+
const currentValue = value !== void 0 ? value : internalValue;
|
|
35006
|
+
const handleValueChange = (newValue) => {
|
|
35007
|
+
if (value === void 0) {
|
|
35008
|
+
setInternalValue(newValue);
|
|
35009
|
+
}
|
|
35010
|
+
onValueChange?.(newValue);
|
|
35011
|
+
};
|
|
35012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
|
|
35013
|
+
RadioGroupContext.Provider,
|
|
35014
|
+
{
|
|
35015
|
+
value: {
|
|
35016
|
+
value: currentValue,
|
|
35017
|
+
onValueChange: handleValueChange,
|
|
35018
|
+
disabled,
|
|
35019
|
+
name,
|
|
35020
|
+
size,
|
|
35021
|
+
color
|
|
35022
|
+
},
|
|
35023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
|
|
35024
|
+
FormField,
|
|
35025
|
+
{
|
|
35026
|
+
label,
|
|
35027
|
+
hint,
|
|
35028
|
+
description,
|
|
35029
|
+
errorMessages,
|
|
35030
|
+
className,
|
|
35031
|
+
required,
|
|
35032
|
+
size,
|
|
35033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
|
|
35034
|
+
"div",
|
|
35035
|
+
{
|
|
35036
|
+
role: "radiogroup",
|
|
35037
|
+
"aria-required": required,
|
|
35038
|
+
className: cn(
|
|
35039
|
+
"flex gap-4",
|
|
35040
|
+
direction === "vertical" ? "flex-col" : "flex-row flex-wrap"
|
|
35041
|
+
),
|
|
35042
|
+
children
|
|
35043
|
+
}
|
|
35044
|
+
)
|
|
35045
|
+
}
|
|
35046
|
+
)
|
|
35047
|
+
}
|
|
35048
|
+
);
|
|
35049
|
+
};
|
|
35050
|
+
var BaseRadio = ({
|
|
35051
|
+
id: providedId,
|
|
35052
|
+
value,
|
|
35053
|
+
checked,
|
|
35054
|
+
disabled: disabledProp = false,
|
|
35055
|
+
required = false,
|
|
35056
|
+
size: sizeProp,
|
|
35057
|
+
color: colorProp,
|
|
35058
|
+
onCheckedChange,
|
|
35059
|
+
className
|
|
35060
|
+
}) => {
|
|
35061
|
+
const generatedId = (0, import_react396.useId)();
|
|
35062
|
+
const id = providedId ?? generatedId;
|
|
35063
|
+
const context = (0, import_react396.useContext)(RadioGroupContext);
|
|
35064
|
+
const isChecked = context ? context.value === value : checked ?? false;
|
|
35065
|
+
const disabled = disabledProp ?? context?.disabled ?? false;
|
|
35066
|
+
const name = context?.name;
|
|
35067
|
+
const size = sizeProp ?? context?.size ?? "md";
|
|
35068
|
+
const color = colorProp ?? context?.color ?? "primary";
|
|
35069
|
+
const handleChange = () => {
|
|
35070
|
+
if (disabled) return;
|
|
35071
|
+
if (context) {
|
|
35072
|
+
context.onValueChange?.(value);
|
|
35073
|
+
} else {
|
|
35074
|
+
onCheckedChange?.(!isChecked);
|
|
35075
|
+
}
|
|
35076
|
+
};
|
|
35077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime412.jsxs)(
|
|
35078
|
+
"button",
|
|
35079
|
+
{
|
|
35080
|
+
type: "button",
|
|
35081
|
+
role: "radio",
|
|
35082
|
+
id,
|
|
35083
|
+
"aria-checked": isChecked,
|
|
35084
|
+
"aria-required": required,
|
|
35085
|
+
disabled,
|
|
35086
|
+
onClick: handleChange,
|
|
35087
|
+
className: cn(
|
|
35088
|
+
RadioVariants({ size, color }),
|
|
35089
|
+
!isChecked && "border-gray-300",
|
|
35090
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
35091
|
+
!disabled && "hover:border-opacity-80 cursor-pointer",
|
|
35092
|
+
"bg-white",
|
|
35093
|
+
className
|
|
35094
|
+
),
|
|
35095
|
+
children: [
|
|
35096
|
+
Boolean(name) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
|
|
35097
|
+
"input",
|
|
35098
|
+
{
|
|
35099
|
+
type: "radio",
|
|
35100
|
+
name,
|
|
35101
|
+
value,
|
|
35102
|
+
checked: isChecked,
|
|
35103
|
+
onChange: () => {
|
|
35104
|
+
},
|
|
35105
|
+
className: "sr-only",
|
|
35106
|
+
disabled,
|
|
35107
|
+
required
|
|
35108
|
+
}
|
|
35109
|
+
),
|
|
35110
|
+
/* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
|
|
35111
|
+
"span",
|
|
35112
|
+
{
|
|
35113
|
+
className: cn(
|
|
35114
|
+
RadioIndicatorVariants({ size, color }),
|
|
35115
|
+
isChecked ? "scale-100" : "scale-0 bg-transparent"
|
|
35116
|
+
)
|
|
35117
|
+
}
|
|
35118
|
+
)
|
|
35119
|
+
]
|
|
35120
|
+
}
|
|
35121
|
+
);
|
|
35122
|
+
};
|
|
35123
|
+
var Radio = ({ label, description, className, size: sizeProp, ...props }) => {
|
|
35124
|
+
const generatedId = (0, import_react396.useId)();
|
|
35125
|
+
const id = props?.id ?? generatedId;
|
|
35126
|
+
const context = (0, import_react396.useContext)(RadioGroupContext);
|
|
35127
|
+
const size = sizeProp ?? context?.size ?? "md";
|
|
35128
|
+
const labelSizeClasses = {
|
|
35129
|
+
sm: "text-xs",
|
|
35130
|
+
md: "text-sm",
|
|
35131
|
+
lg: "text-base"
|
|
35132
|
+
};
|
|
35133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime412.jsxs)("div", { className: cn("inline-flex items-center gap-2", className), children: [
|
|
35134
|
+
/* @__PURE__ */ (0, import_jsx_runtime412.jsx)(BaseRadio, { ...props, id, size }),
|
|
35135
|
+
/* @__PURE__ */ (0, import_jsx_runtime412.jsxs)("div", { className: "flex flex-col", children: [
|
|
35136
|
+
Boolean(label) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(FormLabel, { htmlFor: id, className: labelSizeClasses[size], children: label }),
|
|
35137
|
+
Boolean(description) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(FormDescription, { children: description })
|
|
35138
|
+
] })
|
|
35139
|
+
] });
|
|
35140
|
+
};
|
|
34825
35141
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34826
35142
|
0 && (module.exports = {
|
|
34827
35143
|
BaseCheckbox,
|
|
35144
|
+
BaseRadio,
|
|
34828
35145
|
BaseSwitch,
|
|
34829
35146
|
ButtonDropdown,
|
|
34830
35147
|
ButtonGroup,
|
|
@@ -34865,6 +35182,10 @@ function TextEditor({
|
|
|
34865
35182
|
ModalPreviewAttachment,
|
|
34866
35183
|
ModalTitle,
|
|
34867
35184
|
PreviewItem,
|
|
35185
|
+
Radio,
|
|
35186
|
+
RadioGroup,
|
|
35187
|
+
RadioIndicatorVariants,
|
|
35188
|
+
RadioVariants,
|
|
34868
35189
|
Select,
|
|
34869
35190
|
Sheet,
|
|
34870
35191
|
SheetClose,
|