@herca/r-kit 0.0.51 → 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 +243 -8
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +64 -14
- package/dist/clients.d.ts +64 -14
- package/dist/clients.js +238 -8
- 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,
|
|
@@ -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
|
)
|
|
@@ -15419,6 +15424,7 @@ function Select({
|
|
|
15419
15424
|
required,
|
|
15420
15425
|
isSelectOpen,
|
|
15421
15426
|
onOpenChange,
|
|
15427
|
+
searchOptions,
|
|
15422
15428
|
searchPlaceholder = "Search..."
|
|
15423
15429
|
}) {
|
|
15424
15430
|
const [isOpen, setIsOpen] = (0, import_react375.useState)(false);
|
|
@@ -15553,6 +15559,11 @@ function Select({
|
|
|
15553
15559
|
(0, import_react375.useEffect)(() => {
|
|
15554
15560
|
onOpenChange?.(isOpen);
|
|
15555
15561
|
}, [isOpen]);
|
|
15562
|
+
(0, import_react375.useEffect)(() => {
|
|
15563
|
+
if (searchOptions !== void 0) {
|
|
15564
|
+
setSearchTerm(searchOptions);
|
|
15565
|
+
}
|
|
15566
|
+
}, [searchOptions]);
|
|
15556
15567
|
const getDisplayValue = () => {
|
|
15557
15568
|
const isEmpty = value == null || isMulti && asArray(value).length === 0;
|
|
15558
15569
|
if (isEmpty) {
|
|
@@ -34578,7 +34589,7 @@ function TableGroup({
|
|
|
34578
34589
|
{
|
|
34579
34590
|
title: "Delete Row",
|
|
34580
34591
|
icon: "table-delete-row",
|
|
34581
|
-
onClick: () => editor.chain().focus().
|
|
34592
|
+
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34582
34593
|
requiresTable: false,
|
|
34583
34594
|
disabled
|
|
34584
34595
|
}
|
|
@@ -34594,7 +34605,7 @@ function TableGroup({
|
|
|
34594
34605
|
{
|
|
34595
34606
|
title: "Delete Column",
|
|
34596
34607
|
icon: "table-delete-column",
|
|
34597
|
-
onClick: () => editor.chain().focus().
|
|
34608
|
+
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34598
34609
|
requiresTable: false,
|
|
34599
34610
|
disabled
|
|
34600
34611
|
}
|
|
@@ -34908,9 +34919,229 @@ function TextEditor({
|
|
|
34908
34919
|
}
|
|
34909
34920
|
);
|
|
34910
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
|
+
};
|
|
34911
35141
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34912
35142
|
0 && (module.exports = {
|
|
34913
35143
|
BaseCheckbox,
|
|
35144
|
+
BaseRadio,
|
|
34914
35145
|
BaseSwitch,
|
|
34915
35146
|
ButtonDropdown,
|
|
34916
35147
|
ButtonGroup,
|
|
@@ -34951,6 +35182,10 @@ function TextEditor({
|
|
|
34951
35182
|
ModalPreviewAttachment,
|
|
34952
35183
|
ModalTitle,
|
|
34953
35184
|
PreviewItem,
|
|
35185
|
+
Radio,
|
|
35186
|
+
RadioGroup,
|
|
35187
|
+
RadioIndicatorVariants,
|
|
35188
|
+
RadioVariants,
|
|
34954
35189
|
Select,
|
|
34955
35190
|
Sheet,
|
|
34956
35191
|
SheetClose,
|