feat: Add more ui components - #838
aXenDeveloper wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ceed7456be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case "ArrowDown": | ||
| event.preventDefault(); | ||
| focusOption(panel, level, Math.min(count - 1, index + 1)); |
There was a problem hiding this comment.
Compute keyboard movement from enabled options
When a cascader level contains a disabled option before the focused option, index and count refer to the unfiltered column while focusOption indexes a list with disabled buttons removed. Arrow Up/Down therefore skips enabled choices or focuses nothing; for example, with [disabled, A, B], Arrow Down on A requests filtered index 2 and cannot move to B. Derive the current position and bounds from the enabled-option list.
Useful? React with 👍 / 👎.
| } catch { | ||
| setOverride(current => (current === attempt ? previous : current)); | ||
| toast.error(t("reorder_failed"), { |
There was a problem hiding this comment.
Roll back concurrent reorders to confirmed state
If a user performs a second drop before the first onReorder promise settles, previous for the second request is the first optimistic override. When the first request rejects while the second is pending and the second then rejects, this catch restores that already-failed override, leaving the table visibly reordered even though neither change was saved. Serialize reorders or track the last confirmed order separately from pending optimistic attempts.
Useful? React with 👍 / 👎.
| const readRaw = (key: string): null | string => { | ||
| try { | ||
| return window.localStorage.getItem(key); | ||
| } catch { | ||
| return memoryFallback.get(key) ?? null; |
There was a problem hiding this comment.
Read the in-memory value after storage writes fail
When setItem or removeItem throws but getItem still works—such as when storage is full—writeRaw updates memoryFallback, but the dispatched update immediately calls readRaw, which returns the stale local-storage value and never consults the fallback. In that common failure mode the setter or reset appears to do nothing, contrary to the intended session-memory fallback; keys whose writes fail need to read from the fallback thereafter.
Useful? React with 👍 / 👎.
| export const numberPlaces = (value: number) => { | ||
| const length = String(Math.trunc(Math.abs(value))).length; | ||
|
|
||
| return Array.from({ length }, (_, index) => 10 ** (length - index - 1)); |
There was a problem hiding this comment.
Render fractional counter values instead of truncating them
Whenever Counter uses a fractional defaultValue, controlled value, or step (for example step={0.5}), its state and screen-reader value become 0.5, but numberPlaces truncates it and DigitRoller floors each place, so the visible control still shows 0. This makes the displayed value disagree with the value submitted through onValueChange; either render fractional places or explicitly normalize the counter to integers.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c965f85d71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| React.useState(defaultValue); | ||
| const value = valueProp === undefined ? uncontrolledValue : valueProp; | ||
| const selectedPath = React.useMemo( | ||
| () => (value ? findCascaderPath(options, value) : []), |
There was a problem hiding this comment.
Treat empty strings as valid cascader values
When an option has value: "", selecting it successfully commits the empty string, but this truthiness check immediately turns its selectedPath back into an empty array. The trigger therefore continues to show the placeholder, the option is not marked selected, and the clear control is unavailable even though null—not an empty string—is the component's documented empty state. Check value !== null instead.
Useful? React with 👍 / 👎.
| return () => { | ||
| observer.disconnect(); | ||
| }; | ||
| }, [elementRef, isFrozen, root, rootMargin, thresholdKey]); |
There was a problem hiding this comment.
Reobserve when the ref target changes
When the observed element mounts conditionally or the same ref is moved to a replacement node, the ref object's identity and every dependency here remain unchanged, so this effect does not run again. If the first effect saw null, no observer is ever created; if it saw the old node, the hook keeps observing that detached node. Track the actual target through a callback/state ref or otherwise rerun the subscription when elementRef.current changes.
Useful? React with 👍 / 👎.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?