Skip to content

refactor(inline-notice): migrate InlineNotice from Flow to TypeScript - #4727

Merged
mergify[bot] merged 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-inline-notice
Jul 30, 2026
Merged

refactor(inline-notice): migrate InlineNotice from Flow to TypeScript#4727
mergify[bot] merged 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-inline-notice

Conversation

@bonchevskyi

@bonchevskyi bonchevskyi commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Convert InlineNotice component to TypeScript

This PR converts src/components/inline-notice from JavaScript with Flow to TypeScript.

Changes

  • Converted InlineNotice.js to InlineNotice.tsx with exported InlineNoticeProps interface
  • Added support for native <div> attributes through React.HTMLAttributes
  • Converted index.js to index.ts, re-exporting the component and its types
  • Converted InlineNotice.stories.js to InlineNotice.stories.tsx
  • Converted __tests__/InlineNotice.test.js to InlineNotice.test.tsx
  • Created .js.flow files for backward compatibility
  • Added InlineNotice exports to src/components/index.ts

Testing

  • Ran tests for inline-notice and inline-error; all 7 tests pass
  • yarn lint:ts, ESLint, and flow check pass
  • Verified the Components/InlineNotice story builds successfully

Summary by CodeRabbit

  • New Features
    • Added an InlineNotice component for inline contextual messages.
    • Supports notice types (default: warning), optional titles, and customizable styling via InlineNoticeProps.
    • Exposed InlineNotice from the main components entry point.
  • Documentation
    • Added Storybook stories showing variants with and without titles.
  • Tests
    • Updated InlineNotice test coverage to align with the component’s rendered structure.

@bonchevskyi
bonchevskyi requested a review from a team as a code owner July 29, 2026 09:49
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: edcf97d6-1099-4663-a94c-bc2c388a1213

📥 Commits

Reviewing files that changed from the base of the PR and between d464f77 and d4dcc84.

📒 Files selected for processing (7)
  • src/components/index.ts
  • src/components/inline-notice/InlineNotice.js.flow
  • src/components/inline-notice/InlineNotice.stories.tsx
  • src/components/inline-notice/InlineNotice.tsx
  • src/components/inline-notice/__tests__/InlineNotice.test.tsx
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts

Walkthrough

Adds a typed InlineNotice component with severity styling, optional titles, package exports, Storybook variants, and updated Enzyme test usage.

Changes

InlineNotice feature

Layer / File(s) Summary
Notice contract and rendering
src/components/inline-notice/InlineNotice.tsx, src/components/inline-notice/InlineNotice.js.flow
Defines typed props and renders severity classes, an optional bold title, and wrapped children.
Component entrypoints
src/components/inline-notice/index.ts, src/components/inline-notice/index.js.flow, src/components/index.ts
Exports InlineNotice and InlineNoticeProps through local and shared component entrypoints.
Stories and test coverage
src/components/inline-notice/InlineNotice.stories.tsx, src/components/inline-notice/__tests__/InlineNotice.test.tsx
Adds titled and untitled Storybook variants and updates Enzyme imports and assertions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: vitali-usik, jpan-box, tjiang-box

Poem

I’m a rabbit with notices, tidy and bright,
Warning and success in a colorful flight.
Titles stand bold, children nest below,
Exports now help the component grow.
Hop, hop—Storybook puts on a show!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating InlineNotice from Flow to TypeScript.
Description check ✅ Passed The description is on-topic and mostly complete, with a clear change summary and testing notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/inline-notice/InlineNotice.js.flow`:
- Around line 7-12: The Flow API must match the TypeScript InlineNoticeProps
contract. In src/components/inline-notice/InlineNotice.js.flow lines 7-12,
extend Props with the native div attributes while omitting title, and support
forwarding those remaining props to the outer div. In
src/components/inline-notice/index.js.flow lines 1-2, re-export the matching
Flow props type consistently with index.ts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56b3a918-e89a-479d-8a84-a86c943339ca

📥 Commits

Reviewing files that changed from the base of the PR and between 411145c and dfef997.

📒 Files selected for processing (7)
  • src/components/index.ts
  • src/components/inline-notice/InlineNotice.js.flow
  • src/components/inline-notice/InlineNotice.stories.tsx
  • src/components/inline-notice/InlineNotice.tsx
  • src/components/inline-notice/__tests__/InlineNotice.test.tsx
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/inline-notice/InlineNotice.js.flow`:
- Around line 7-12: The Flow API must match the TypeScript InlineNoticeProps
contract. In src/components/inline-notice/InlineNotice.js.flow lines 7-12,
extend Props with the native div attributes while omitting title, and support
forwarding those remaining props to the outer div. In
src/components/inline-notice/index.js.flow lines 1-2, re-export the matching
Flow props type consistently with index.ts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56b3a918-e89a-479d-8a84-a86c943339ca

📥 Commits

Reviewing files that changed from the base of the PR and between 411145c and dfef997.

📒 Files selected for processing (7)
  • src/components/index.ts
  • src/components/inline-notice/InlineNotice.js.flow
  • src/components/inline-notice/InlineNotice.stories.tsx
  • src/components/inline-notice/InlineNotice.tsx
  • src/components/inline-notice/__tests__/InlineNotice.test.tsx
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts
🛑 Comments failed to post (1)
src/components/inline-notice/InlineNotice.js.flow (1)

7-12: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg 'src/components/inline-notice/|inline-notice' || true

echo "== flow files =="
for f in $(git ls-files 'src/components/inline-notice/*'); do
  echo "--- $f"
  wc -l "$f"
  sed -n '1,140p' "$f"
done

echo "== ts/index files =="
git ls-files 'src/components/inline-notice/*' | grep -v '.flow$' | while read -r f; do
  echo "--- $f"
  wc -l "$f"
  sed -n '1,220p' "$f"
done

echo "== searches for InlineNoticeProps and native attrs =="
rg -n "InlineNoticeProps|InlineNoticeType|type Props|interface.*InlineNotice|export function InlineNotice|forwardRef|div" src/components/inline-notice src -g '!node_modules' -g '!dist' -g '!build' || true

Repository: box/box-ui-elements

Length of output: 50376


🏁 Script executed:

#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import pathlib, re

def files():
    base = pathlib.Path('src/components/inline-notice')
    return sorted([p for p in base.glob('*') if p.is_file()])

for p in files():
    text = p.read_text()
    print(f'=== {p} ===')
    print(f'has_flow_marker = {text.startswith("// `@flow`")}')
    print(f'props_kind = None')
    print(f'exports_default_or_named_inline_props = {bool(re.search(r"\bexport\s+(default|.*InlineNoticeProps|.*InlineNoticeProps\b)", text))}')
    print(f'inline_notice_type_refs = {re.findall(r"\bInlineNoticeProps\b|\bInlineNoticeType\b|type Props|interface Props", text)}')
    print('---')
PY

Repository: box/box-ui-elements

Length of output: 538


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files 'src/components/inline-notice/*'

echo "== inline notice files =="
for f in $(git ls-files 'src/components/inline-notice/*'); do
  echo "--- $f"
  wc -l "$f"
  sed -n '1,180p' "$f"
done

echo "== focused API searches =="
rg -n "InlineNoticeProps|InlineNoticeType|type Props|interface Props|forwardRef|<div|as: 'div'|as: \"div\"|...rest" src/components/inline-notice -g '!node_modules' -g '!dist' -g '!build' || true

echo "== Flow API surface probe =="
python3 - <<'PY'
import pathlib, re

base = pathlib.Path('src/components/inline-notice')
for p in sorted(base.glob('*')):
    if not p.is_file():
        continue
    text = p.read_text()
    print(f'=== {p} ===')
    print('has_flow_marker=', text.startswith('// `@flow`'))
    print('flow_file=', p.name.endswith('.flow'))
    print('props_defs=', re.findall(r'(?:type|interface)\s+Props[^;\n{]*(?:{[^}]*}|[^;\n]*)', text))
    print('inline_props_refs=', re.findall(r'\bInlineNoticeProps\b', text))
    print('inline_type_refs=', re.findall(r'\bInlineNoticeType\b', text))
    print('exports=', re.findall(r'export\s+(?:{[^}]+default[^}]+|{[^}]+inlineNoticeProps[^}]+|default|type\s+[A-Za-z_$][\w$]+)[^{]*|export\s+default', text))
PY

Repository: box/box-ui-elements

Length of output: 10266


Align the Flow compatibility surface with the TypeScript API.

The TypeScript API exposes InlineNoticeProps (which is Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>) and passes ...rest to the outer div. Match that in Flow:

  • src/components/inline-notice/InlineNotice.js.flow#L7-L12: add the native div props/...rest shape to type Props.
  • src/components/inline-notice/index.js.flow#L1-L2: re-export a matching Flow props type, aligned with index.ts.
📍 Affects 2 files
  • src/components/inline-notice/InlineNotice.js.flow#L7-L12 (this comment)
  • src/components/inline-notice/index.js.flow#L1-L2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/inline-notice/InlineNotice.js.flow` around lines 7 - 12, The
Flow API must match the TypeScript InlineNoticeProps contract. In
src/components/inline-notice/InlineNotice.js.flow lines 7-12, extend Props with
the native div attributes while omitting title, and support forwarding those
remaining props to the outer div. In src/components/inline-notice/index.js.flow
lines 1-2, re-export the matching Flow props type consistently with index.ts.

vitali-usik
vitali-usik previously approved these changes Jul 29, 2026
tjiang-box
tjiang-box previously approved these changes Jul 29, 2026
@bonchevskyi
bonchevskyi dismissed stale reviews from tjiang-box and vitali-usik via d464f77 July 29, 2026 17:16
@bonchevskyi
bonchevskyi force-pushed the refactor/flow-to-ts-inline-notice branch from 3082442 to d464f77 Compare July 29, 2026 17:16
@bonchevskyi
bonchevskyi force-pushed the refactor/flow-to-ts-inline-notice branch from d464f77 to d4dcc84 Compare July 30, 2026 08:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/inline-notice/InlineNotice.js.flow`:
- Around line 7-12: Update the Flow props definition in InlineNotice.js.flow by
exporting it as the named InlineNoticeProps type, extending native div
attributes while omitting the native title field and declaring the custom title,
children, className, and type fields. Preserve the existing default export and
align the Flow contract with the TypeScript export.

In `@src/components/inline-notice/InlineNotice.tsx`:
- Line 19: Update the title render condition in InlineNotice.tsx at lines 19-19
and InlineNotice.js.flow at lines 16-16 to check title != null instead of
truthiness, ensuring every non-null ReactNode value, including 0, false, and an
empty string, renders consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: edcf97d6-1099-4663-a94c-bc2c388a1213

📥 Commits

Reviewing files that changed from the base of the PR and between d464f77 and d4dcc84.

📒 Files selected for processing (7)
  • src/components/index.ts
  • src/components/inline-notice/InlineNotice.js.flow
  • src/components/inline-notice/InlineNotice.stories.tsx
  • src/components/inline-notice/InlineNotice.tsx
  • src/components/inline-notice/__tests__/InlineNotice.test.tsx
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts

Comment thread src/components/inline-notice/InlineNotice.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/inline-notice/InlineNotice.js.flow`:
- Around line 7-12: Update the Flow props definition in InlineNotice.js.flow by
exporting it as the named InlineNoticeProps type, extending native div
attributes while omitting the native title field and declaring the custom title,
children, className, and type fields. Preserve the existing default export and
align the Flow contract with the TypeScript export.

In `@src/components/inline-notice/InlineNotice.tsx`:
- Line 19: Update the title render condition in InlineNotice.tsx at lines 19-19
and InlineNotice.js.flow at lines 16-16 to check title != null instead of
truthiness, ensuring every non-null ReactNode value, including 0, false, and an
empty string, renders consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: edcf97d6-1099-4663-a94c-bc2c388a1213

📥 Commits

Reviewing files that changed from the base of the PR and between d464f77 and d4dcc84.

📒 Files selected for processing (7)
  • src/components/index.ts
  • src/components/inline-notice/InlineNotice.js.flow
  • src/components/inline-notice/InlineNotice.stories.tsx
  • src/components/inline-notice/InlineNotice.tsx
  • src/components/inline-notice/__tests__/InlineNotice.test.tsx
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/inline-notice/index.js.flow
  • src/components/inline-notice/index.ts
🛑 Comments failed to post (1)
src/components/inline-notice/InlineNotice.js.flow (1)

7-12: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Tracked files matching inline-notice:"
git ls-files | rg '(^|/)inline-notice/|InlineNotice' || true

echo
echo "Flow/TS files:"
fd -a 'inline-notice|InlineNotice' . | sed 's#^\./##' | sort

echo
echo "Search for Props/InlineNoticeProps/native div type:"
rg -n "type Props|interface InlineNoticeProps|type InlineNoticeProps|Native|native attributes|NativeDivProps|DivProps|title\\?:" src -g '*.{js,js.flow,ts,tsx,jsx}' || true

Repository: box/box-ui-elements

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files with inline-notice (tracked):"
git ls-files 'src/*inline*notice*' 'src/components/inline-notice/*' 'src/components/**/InlineNotice*' | sort || true

echo
echo "Candidate flow file contents:"
for f in src/components/inline-notice/index.js.flow src/components/inline-notice/InlineNotice.js.flow; do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    cat -n "$f"
  fi
done

echo
echo "Candidate TypeScript implementation files:"
for f in src/components/inline-notice/index.ts src/components/inline-notice/index.tsx src/components/inline-notice/InlineNotice.tsx src/components/inline-notice/InlineNotice.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    sed -n '1,220p' "$f" | cat -n
  fi
done

Repository: box/box-ui-elements

Length of output: 2859


Export the Flow equivalent of InlineNoticeProps.

src/components/inline-notice/index.ts re-exports the TypeScript InlineNoticeProps, which extends native <div> attributes and overrides title; the .js.flow side only defines a private local Props and exports the default. Keep the Flow contract aligned by exporting a named Flow props type with the same native div attributes, omitted native title, and the custom title, children, className, and type fields.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/inline-notice/InlineNotice.js.flow` around lines 7 - 12,
Update the Flow props definition in InlineNotice.js.flow by exporting it as the
named InlineNoticeProps type, extending native div attributes while omitting the
native title field and declaring the custom title, children, className, and type
fields. Preserve the existing default export and align the Flow contract with
the TypeScript export.

@mergify mergify Bot added the queued label Jul 30, 2026
@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-30 10:23 UTC · Rule: Automatic strict merge · triggered by rule Automatic merge queue
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-30 10:23 UTC · at d4dcc840d3acffc1bf50350488d015d2070a1f15 · squash

This pull request spent 11 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Summary
    • check-neutral = Summary
    • check-skipped = Summary
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_test_build
    • check-neutral = lint_test_build
    • check-skipped = lint_test_build
  • any of [🛡 GitHub branch protection]:
    • check-success = license/cla
    • check-neutral = license/cla
    • check-skipped = license/cla
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_pull_request
    • check-neutral = lint_pull_request
    • check-skipped = lint_pull_request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants