@rovula/ui 0.1.43 → 0.1.44

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.
@@ -1,6 +1,6 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  export const badgeVariants = cva([
3
- "inline-flex items-center justify-center rounded-lg px-3 py-1",
3
+ "inline-flex items-center justify-center rounded-[6px] px-3 py-1",
4
4
  "typography-body3",
5
5
  ], {
6
6
  variants: {
@@ -44,7 +44,7 @@ export const badgeVariants = cva([
44
44
  },
45
45
  });
46
46
  export const severityBadgeVariants = cva([
47
- "inline-flex items-center justify-center rounded px-1 py-0.5",
47
+ "inline-flex items-center justify-center rounded-[4px] px-1 py-0.5",
48
48
  "typography-small6 text-[var(--badge-severity-text)]",
49
49
  ], {
50
50
  variants: {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useCallback, useEffect, useMemo, useState } from "react";
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import TextInput from "@/components/TextInput/TextInput";
4
4
  import NumberInput from "@/components/NumberInput";
5
5
  import { Checkbox } from "@/components/Checkbox/Checkbox";
@@ -295,6 +295,22 @@ function EditCellText({ columnId, row, placeholder, autoFocus, errorMessage, onB
295
295
  }
296
296
  function EditCellSelect({ row, columnId, col, autoFocus, onCommit, onBlurField, onKeyDown, keepOpenAfterSelect, errorMessage, }) {
297
297
  var _a, _b, _c, _d, _e;
298
+ const selectRef = useRef(null);
299
+ // Cell mode: React's `autoFocus` fires el.focus() during the commit phase,
300
+ // which causes Headless UI's flushSync-inside-microTask to run while React
301
+ // is still committing → silent failure in concurrent mode. Delay focus to a
302
+ // rAF (same approach as row-mode Tab navigation) so it fires safely after
303
+ // the commit. Cancel on cleanup so StrictMode's double-mount is safe.
304
+ useEffect(() => {
305
+ if (!autoFocus)
306
+ return;
307
+ const el = selectRef.current;
308
+ if (!el)
309
+ return;
310
+ const rafId = requestAnimationFrame(() => el.focus());
311
+ return () => cancelAnimationFrame(rafId);
312
+ // eslint-disable-next-line react-hooks/exhaustive-deps
313
+ }, []);
298
314
  const displayValue = String((_a = row.original[columnId]) !== null && _a !== void 0 ? _a : "");
299
315
  const rawOptions = typeof ((_b = col.editSelectProps) === null || _b === void 0 ? void 0 : _b.options) === "function"
300
316
  ? col.editSelectProps.options(row)
@@ -311,11 +327,11 @@ function EditCellSelect({ row, columnId, col, autoFocus, onCommit, onBlurField,
311
327
  return options[0];
312
328
  return (_a = options.find((o) => o.label === cur)) !== null && _a !== void 0 ? _a : options[0];
313
329
  }, [displayValue, options]);
314
- return (_jsx("div", { children: _jsx(Dropdown, { id: `edit-dd-${columnId}-${row.id}`, options: options, value: selected, onSelect: (opt) => {
330
+ return (_jsx("div", { children: _jsx(Dropdown, { id: `edit-dd-${columnId}-${row.id}`, ref: selectRef, options: options, value: selected, onSelect: (opt) => {
315
331
  if (isPlaceholderOption(opt))
316
332
  return;
317
333
  onCommit(opt.label);
318
- }, size: "sm", variant: "outline", rounded: "normal", fullwidth: true, required: false, isFloatingLabel: false, label: "", keepFooterSpace: false, segmentedInput: true, autoFocus: autoFocus, onBlur: onBlurField, onKeyDown: onKeyDown, keepOpenAfterSelect: keepOpenAfterSelect, portal: true, error: !!errorMessage, errorMessage: errorMessage, className: cn("rounded-md", customInputVariant({ size: "sm" }), displayValue.trim().length > 0 && "font-medium") }) }));
334
+ }, size: "sm", variant: "outline", rounded: "normal", fullwidth: true, required: false, isFloatingLabel: false, label: "", keepFooterSpace: false, segmentedInput: true, autoFocus: false, onBlur: onBlurField, onKeyDown: onKeyDown, keepOpenAfterSelect: keepOpenAfterSelect, portal: true, error: !!errorMessage, errorMessage: errorMessage, className: cn("rounded-md", customInputVariant({ size: "sm" }), displayValue.trim().length > 0 && "font-medium") }) }));
319
335
  }
320
336
  // ---------------------------------------------------------------------------
321
337
  // EditCellNumber — inline number editor
@@ -84,7 +84,10 @@ const Dropdown = forwardRef((_a, ref) => {
84
84
  });
85
85
  };
86
86
  return (_jsx(Combobox, { value: selectedOption, onChange: handleSelect, immediate: true, by: "value", disabled: disabled, children: ({ open }) => (_jsxs("div", { className: cn("relative", fullwidth && "w-full"), children: [_jsx(ComboboxInput, Object.assign({ as: TextInput, ref: inputRef, hasClearIcon: false, endIcon: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ isFocus: open }) }), label: label, autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: segmentedInput ? customInputVariant({ size }) : undefined, displayValue: (opt) => { var _a; return (_a = opt === null || opt === void 0 ? void 0 : opt.label) !== null && _a !== void 0 ? _a : ""; }, readOnly: !filterMode, onChange: handleInputChange }, props)), _jsx(ComboboxOptions, Object.assign({}, (portal
87
- ? { portal: true, anchor: { to: "bottom start", gap: 4 } }
87
+ ? {
88
+ portal: true,
89
+ anchor: { to: "bottom start", gap: 4 },
90
+ }
88
91
  : {}), { className: cn(!portal && "absolute top-full left-0 w-full -mt-3 z-[51]", portal && "z-[51] !max-h-60 w-[var(--input-width)]", "min-w-[154px] max-h-60 overflow-y-auto", "rounded-md bg-modal-dropdown-surface border border-bg-stroke3 text-text-g-contrast-high", optionContainerClassName), style: { boxShadow: "var(--dropdown-menu-shadow)" }, children: renderOptionList() }))] })) }));
89
92
  });
90
93
  Dropdown.displayName = "Dropdown";
@@ -1629,6 +1629,12 @@ input[type=number] {
1629
1629
  .rounded-\[2px\]{
1630
1630
  border-radius: 2px;
1631
1631
  }
1632
+ .rounded-\[4px\]{
1633
+ border-radius: 4px;
1634
+ }
1635
+ .rounded-\[6px\]{
1636
+ border-radius: 6px;
1637
+ }
1632
1638
  .rounded-\[8px\]{
1633
1639
  border-radius: 8px;
1634
1640
  }