@herca/r-kit 0.0.51 → 0.0.54

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 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
  )
@@ -12823,6 +12828,7 @@ function TablePagination({
12823
12828
  nextOnClick,
12824
12829
  prevOnClick,
12825
12830
  wrapperClassName,
12831
+ setNumberLink,
12826
12832
  dropdownContentClassName,
12827
12833
  dropdownTriggerClassName,
12828
12834
  dropdownItemClassName
@@ -12938,11 +12944,15 @@ function TablePagination({
12938
12944
  }
12939
12945
  const active = currentPage === item;
12940
12946
  return /* @__PURE__ */ (0, import_jsx_runtime379.jsx)(
12941
- "button",
12947
+ "a",
12942
12948
  {
12943
- onClick: () => numberOnClick?.(item),
12949
+ href: setNumberLink !== void 0 ? setNumberLink?.(`?page=${item}`, item) : `?page=${item}`,
12950
+ onClick: (e) => {
12951
+ e.preventDefault();
12952
+ numberOnClick?.(item);
12953
+ },
12944
12954
  className: (0, import_clsx5.default)(
12945
- "size-9 cursor-pointer rounded-lg",
12955
+ "grid size-9 cursor-pointer place-items-center rounded-lg",
12946
12956
  active ? "bg-primary-1000 hover:bg-primary-1000 *:text-white" : "hover:bg-primary-50 *:text-gray-700"
12947
12957
  ),
12948
12958
  children: /* @__PURE__ */ (0, import_jsx_runtime379.jsx)(
@@ -15419,6 +15429,7 @@ function Select({
15419
15429
  required,
15420
15430
  isSelectOpen,
15421
15431
  onOpenChange,
15432
+ searchOptions,
15422
15433
  searchPlaceholder = "Search..."
15423
15434
  }) {
15424
15435
  const [isOpen, setIsOpen] = (0, import_react375.useState)(false);
@@ -15553,6 +15564,11 @@ function Select({
15553
15564
  (0, import_react375.useEffect)(() => {
15554
15565
  onOpenChange?.(isOpen);
15555
15566
  }, [isOpen]);
15567
+ (0, import_react375.useEffect)(() => {
15568
+ if (searchOptions !== void 0) {
15569
+ setSearchTerm(searchOptions);
15570
+ }
15571
+ }, [searchOptions]);
15556
15572
  const getDisplayValue = () => {
15557
15573
  const isEmpty = value == null || isMulti && asArray(value).length === 0;
15558
15574
  if (isEmpty) {
@@ -34578,7 +34594,7 @@ function TableGroup({
34578
34594
  {
34579
34595
  title: "Delete Row",
34580
34596
  icon: "table-delete-row",
34581
- onClick: () => editor.chain().focus().addRowAfter().run(),
34597
+ onClick: () => editor.chain().focus().deleteRow().run(),
34582
34598
  requiresTable: false,
34583
34599
  disabled
34584
34600
  }
@@ -34594,7 +34610,7 @@ function TableGroup({
34594
34610
  {
34595
34611
  title: "Delete Column",
34596
34612
  icon: "table-delete-column",
34597
- onClick: () => editor.chain().focus().addColumnBefore().run(),
34613
+ onClick: () => editor.chain().focus().deleteColumn().run(),
34598
34614
  requiresTable: false,
34599
34615
  disabled
34600
34616
  }
@@ -34908,9 +34924,229 @@ function TextEditor({
34908
34924
  }
34909
34925
  );
34910
34926
  }
34927
+
34928
+ // src/components/radio/radio.tsx
34929
+ var import_react396 = __toESM(require("react"), 1);
34930
+
34931
+ // src/components/radio/radio-variants.ts
34932
+ var import_class_variance_authority13 = require("class-variance-authority");
34933
+ var RadioVariants = (0, import_class_variance_authority13.cva)(
34934
+ "flex items-center justify-center rounded-full border transition-all focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none",
34935
+ {
34936
+ variants: {
34937
+ size: {
34938
+ sm: "h-4 w-4",
34939
+ md: "h-5 w-5",
34940
+ lg: "h-6 w-6"
34941
+ },
34942
+ color: {
34943
+ primary: "border-primary-1000 focus-visible:ring-primary-900",
34944
+ secondary: "border-gray-600 focus-visible:ring-gray-500",
34945
+ success: "border-success-500 focus-visible:ring-success-400",
34946
+ danger: "border-danger-500 focus-visible:ring-danger-400",
34947
+ warning: "border-warning-500 focus-visible:ring-warning-400",
34948
+ info: "border-info-500 focus-visible:ring-info-400",
34949
+ orange: "border-orange-500 focus-visible:ring-orange-400",
34950
+ purple: "border-purple-500 focus-visible:ring-purple-400",
34951
+ gray: "border-gray-600 focus-visible:ring-gray-500"
34952
+ }
34953
+ },
34954
+ defaultVariants: {
34955
+ size: "md",
34956
+ color: "primary"
34957
+ }
34958
+ }
34959
+ );
34960
+ var RadioIndicatorVariants = (0, import_class_variance_authority13.cva)("rounded-full transition-all", {
34961
+ variants: {
34962
+ size: {
34963
+ sm: "h-2 w-2",
34964
+ md: "h-2.5 w-2.5",
34965
+ lg: "h-3 w-3"
34966
+ },
34967
+ color: {
34968
+ primary: "bg-primary-1000",
34969
+ secondary: "bg-gray-600",
34970
+ success: "bg-success-500",
34971
+ danger: "bg-danger-500",
34972
+ warning: "bg-warning-500",
34973
+ info: "bg-info-500",
34974
+ orange: "bg-orange-500",
34975
+ purple: "bg-purple-500",
34976
+ gray: "bg-gray-600"
34977
+ }
34978
+ },
34979
+ defaultVariants: {
34980
+ size: "md",
34981
+ color: "primary"
34982
+ }
34983
+ });
34984
+
34985
+ // src/components/radio/radio.tsx
34986
+ var import_jsx_runtime412 = require("react/jsx-runtime");
34987
+ var RadioGroupContext = (0, import_react396.createContext)(
34988
+ void 0
34989
+ );
34990
+ var RadioGroup = ({
34991
+ value,
34992
+ defaultValue,
34993
+ onValueChange,
34994
+ disabled = false,
34995
+ required = false,
34996
+ name,
34997
+ size = "md",
34998
+ color = "primary",
34999
+ className,
35000
+ label,
35001
+ hint,
35002
+ description,
35003
+ errorMessages,
35004
+ direction = "vertical",
35005
+ children
35006
+ }) => {
35007
+ const [internalValue, setInternalValue] = import_react396.default.useState(
35008
+ defaultValue ?? value ?? ""
35009
+ );
35010
+ const currentValue = value !== void 0 ? value : internalValue;
35011
+ const handleValueChange = (newValue) => {
35012
+ if (value === void 0) {
35013
+ setInternalValue(newValue);
35014
+ }
35015
+ onValueChange?.(newValue);
35016
+ };
35017
+ return /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
35018
+ RadioGroupContext.Provider,
35019
+ {
35020
+ value: {
35021
+ value: currentValue,
35022
+ onValueChange: handleValueChange,
35023
+ disabled,
35024
+ name,
35025
+ size,
35026
+ color
35027
+ },
35028
+ children: /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
35029
+ FormField,
35030
+ {
35031
+ label,
35032
+ hint,
35033
+ description,
35034
+ errorMessages,
35035
+ className,
35036
+ required,
35037
+ size,
35038
+ children: /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
35039
+ "div",
35040
+ {
35041
+ role: "radiogroup",
35042
+ "aria-required": required,
35043
+ className: cn(
35044
+ "flex gap-4",
35045
+ direction === "vertical" ? "flex-col" : "flex-row flex-wrap"
35046
+ ),
35047
+ children
35048
+ }
35049
+ )
35050
+ }
35051
+ )
35052
+ }
35053
+ );
35054
+ };
35055
+ var BaseRadio = ({
35056
+ id: providedId,
35057
+ value,
35058
+ checked,
35059
+ disabled: disabledProp = false,
35060
+ required = false,
35061
+ size: sizeProp,
35062
+ color: colorProp,
35063
+ onCheckedChange,
35064
+ className
35065
+ }) => {
35066
+ const generatedId = (0, import_react396.useId)();
35067
+ const id = providedId ?? generatedId;
35068
+ const context = (0, import_react396.useContext)(RadioGroupContext);
35069
+ const isChecked = context ? context.value === value : checked ?? false;
35070
+ const disabled = disabledProp ?? context?.disabled ?? false;
35071
+ const name = context?.name;
35072
+ const size = sizeProp ?? context?.size ?? "md";
35073
+ const color = colorProp ?? context?.color ?? "primary";
35074
+ const handleChange = () => {
35075
+ if (disabled) return;
35076
+ if (context) {
35077
+ context.onValueChange?.(value);
35078
+ } else {
35079
+ onCheckedChange?.(!isChecked);
35080
+ }
35081
+ };
35082
+ return /* @__PURE__ */ (0, import_jsx_runtime412.jsxs)(
35083
+ "button",
35084
+ {
35085
+ type: "button",
35086
+ role: "radio",
35087
+ id,
35088
+ "aria-checked": isChecked,
35089
+ "aria-required": required,
35090
+ disabled,
35091
+ onClick: handleChange,
35092
+ className: cn(
35093
+ RadioVariants({ size, color }),
35094
+ !isChecked && "border-gray-300",
35095
+ disabled && "cursor-not-allowed opacity-50",
35096
+ !disabled && "hover:border-opacity-80 cursor-pointer",
35097
+ "bg-white",
35098
+ className
35099
+ ),
35100
+ children: [
35101
+ Boolean(name) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
35102
+ "input",
35103
+ {
35104
+ type: "radio",
35105
+ name,
35106
+ value,
35107
+ checked: isChecked,
35108
+ onChange: () => {
35109
+ },
35110
+ className: "sr-only",
35111
+ disabled,
35112
+ required
35113
+ }
35114
+ ),
35115
+ /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(
35116
+ "span",
35117
+ {
35118
+ className: cn(
35119
+ RadioIndicatorVariants({ size, color }),
35120
+ isChecked ? "scale-100" : "scale-0 bg-transparent"
35121
+ )
35122
+ }
35123
+ )
35124
+ ]
35125
+ }
35126
+ );
35127
+ };
35128
+ var Radio = ({ label, description, className, size: sizeProp, ...props }) => {
35129
+ const generatedId = (0, import_react396.useId)();
35130
+ const id = props?.id ?? generatedId;
35131
+ const context = (0, import_react396.useContext)(RadioGroupContext);
35132
+ const size = sizeProp ?? context?.size ?? "md";
35133
+ const labelSizeClasses = {
35134
+ sm: "text-xs",
35135
+ md: "text-sm",
35136
+ lg: "text-base"
35137
+ };
35138
+ return /* @__PURE__ */ (0, import_jsx_runtime412.jsxs)("div", { className: cn("inline-flex items-center gap-2", className), children: [
35139
+ /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(BaseRadio, { ...props, id, size }),
35140
+ /* @__PURE__ */ (0, import_jsx_runtime412.jsxs)("div", { className: "flex flex-col", children: [
35141
+ Boolean(label) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(FormLabel, { htmlFor: id, className: labelSizeClasses[size], children: label }),
35142
+ Boolean(description) && /* @__PURE__ */ (0, import_jsx_runtime412.jsx)(FormDescription, { children: description })
35143
+ ] })
35144
+ ] });
35145
+ };
34911
35146
  // Annotate the CommonJS export names for ESM import in node:
34912
35147
  0 && (module.exports = {
34913
35148
  BaseCheckbox,
35149
+ BaseRadio,
34914
35150
  BaseSwitch,
34915
35151
  ButtonDropdown,
34916
35152
  ButtonGroup,
@@ -34951,6 +35187,10 @@ function TextEditor({
34951
35187
  ModalPreviewAttachment,
34952
35188
  ModalTitle,
34953
35189
  PreviewItem,
35190
+ Radio,
35191
+ RadioGroup,
35192
+ RadioIndicatorVariants,
35193
+ RadioVariants,
34954
35194
  Select,
34955
35195
  Sheet,
34956
35196
  SheetClose,