Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: go over react props and jsdoc #3038

Merged
merged 11 commits into from
Jan 23, 2025
Merged

chore: go over react props and jsdoc #3038

merged 11 commits into from
Jan 23, 2025

Conversation

Barsnes
Copy link
Member

@Barsnes Barsnes commented Jan 22, 2025

resolves #2902
resolves #2932

What has been done:

  • Similar JSDoc on all components
  • Highlight if a component is just a native element (textarea for example)
  • Make sure we export in the same manner, no export *, and use Object.assign
  • Composed field components use error, not validation. The ValidationMessage can not be changed away from danger

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Preview deployments for this pull request:

Storybook - 23. Jan 2025 - 12:54

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 53.48% 2958 / 5531
🔵 Statements 53.48% 2958 / 5531
🔵 Functions 85.71% 180 / 210
🔵 Branches 76.69% 520 / 678
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react/src/components/Alert/Alert.tsx 100% 100% 100% 100%
packages/react/src/components/Badge/Badge.tsx 14.28% 100% 0% 14.28% 33-46
packages/react/src/components/Badge/BadgePosition.tsx 25% 100% 0% 25% 34-46
packages/react/src/components/Breadcrumbs/Breadcrumbs.tsx 100% 100% 100% 100%
packages/react/src/components/Button/Button.tsx 96.77% 85.71% 100% 96.77% 75
packages/react/src/components/Card/Card.tsx 75.86% 75% 50% 75.86% 50-57
packages/react/src/components/Checkbox/Checkbox.tsx 100% 75% 100% 100%
packages/react/src/components/Chip/Chips.tsx 100% 62.5% 100% 100%
packages/react/src/components/Details/Details.tsx 100% 80% 100% 100%
packages/react/src/components/Details/DetailsContent.tsx 100% 100% 100% 100%
packages/react/src/components/Details/DetailsSummary.tsx 100% 100% 100% 100%
packages/react/src/components/Divider/Divider.tsx 15.38% 100% 0% 15.38% 14-26
packages/react/src/components/Dropdown/Dropdown.tsx 100% 100% 100% 100%
packages/react/src/components/Dropdown/DropdownTriggerContext.tsx 100% 100% 100% 100%
packages/react/src/components/ErrorSummary/ErrorSummary.tsx 23.52% 100% 0% 23.52% 39-67
packages/react/src/components/ErrorSummary/ErrorSummaryItem.tsx 60% 100% 0% 60% 16-17
packages/react/src/components/ErrorSummary/ErrorSummaryLink.tsx 60% 100% 0% 60% 14-15
packages/react/src/components/Field/Field.tsx 100% 100% 100% 100%
packages/react/src/components/Field/FieldAffix.tsx 55.55% 100% 50% 55.55% 40-48
packages/react/src/components/Field/FieldCounter.tsx 11.62% 100% 0% 11.62% 33, 46-90
packages/react/src/components/Fieldset/Fieldset.tsx 100% 100% 100% 100%
packages/react/src/components/Fieldset/FieldsetDescription.tsx 100% 100% 100% 100%
packages/react/src/components/Fieldset/FieldsetLegend.tsx 100% 100% 100% 100%
packages/react/src/components/Heading/Heading.tsx 100% 50% 100% 100%
packages/react/src/components/Input/Input.tsx 100% 100% 100% 100%
packages/react/src/components/Label/Label.tsx 100% 100% 100% 100%
packages/react/src/components/Link/Link.tsx 100% 50% 100% 100%
packages/react/src/components/List/Lists.tsx 100% 75% 100% 100%
packages/react/src/components/Modal/Modal.tsx 89.39% 76.47% 75% 89.39% 89-93, 97-99
packages/react/src/components/Modal/ModalBlock.tsx 100% 50% 100% 100%
packages/react/src/components/Modal/ModalTrigger.tsx 100% 66.66% 100% 100%
packages/react/src/components/Modal/ModalTriggerContext.tsx 100% 100% 100% 100%
packages/react/src/components/Pagination/Pagination.tsx 100% 50% 100% 100%
packages/react/src/components/Pagination/PaginationButton.tsx 100% 100% 100% 100%
packages/react/src/components/Pagination/PaginationItem.tsx 100% 50% 100% 100%
packages/react/src/components/Pagination/PaginationList.tsx 100% 50% 100% 100%
packages/react/src/components/Pagination/usePagination.ts 100% 95.83% 100% 100%
packages/react/src/components/Paragraph/Paragraph.tsx 100% 100% 100% 100%
packages/react/src/components/Popover/Popover.tsx 92.8% 72.72% 100% 92.8% 170, 206-207, 210-211, 218-219, 224-225
packages/react/src/components/Popover/PopoverTrigger.tsx 83.33% 20% 100% 83.33% 61-63
packages/react/src/components/Popover/PopoverTriggerContext.tsx 100% 100% 100% 100%
packages/react/src/components/Radio/Radio.tsx 100% 75% 100% 100%
packages/react/src/components/Search/Search.tsx 100% 100% 100% 100%
packages/react/src/components/Search/SearchButton.tsx 44.44% 100% 0% 44.44% 33-38
packages/react/src/components/Search/SearchClear.tsx 100% 40% 100% 100%
packages/react/src/components/Search/SearchInput.tsx 100% 100% 100% 100%
packages/react/src/components/Select/Select.tsx 80.95% 50% 66.66% 80.95% 41-44
packages/react/src/components/Select/SelectOptgroup.tsx 100% 50% 100% 100%
packages/react/src/components/Select/SelectOption.tsx 100% 50% 100% 100%
packages/react/src/components/Skeleton/Skeleton.tsx 100% 25% 100% 100%
packages/react/src/components/SkipLink/SkipLink.tsx 100% 100% 100% 100%
packages/react/src/components/Spinner/Spinner.tsx 100% 100% 100% 100%
packages/react/src/components/Switch/Switch.tsx 100% 100% 100% 100%
packages/react/src/components/Table/Table.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableBody.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableCell.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableFoot.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableHead.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableHeaderCell.tsx 100% 100% 100% 100%
packages/react/src/components/Table/TableRow.tsx 100% 100% 100% 100%
packages/react/src/components/Tabs/Tabs.tsx 100% 66.66% 100% 100%
packages/react/src/components/Tabs/TabsList.tsx 100% 100% 100% 100%
packages/react/src/components/Tabs/TabsPanel.tsx 100% 100% 100% 100%
packages/react/src/components/Tabs/TabsTab.tsx 100% 100% 100% 100%
packages/react/src/components/Tag/Tag.tsx 100% 100% 100% 100%
packages/react/src/components/Textarea/Textarea.tsx 100% 100% 100% 100%
packages/react/src/components/Textfield/Textfield.tsx 93.18% 70% 100% 93.18% 134-136
packages/react/src/components/ToggleGroup/ToggleGroup.tsx 100% 100% 100% 100%
packages/react/src/components/Tooltip/Tooltip.tsx 86.4% 75% 60% 86.4% 86-87, 126-129, 143-147, 202-203, 205-206, 208-209
packages/react/src/components/ValidationMessage/ValidationMessage.tsx 100% 50% 100% 100%
Generated in workflow #1769 for commit e21ec0a by the Vitest Coverage Report Action

Copy link

changeset-bot bot commented Jan 22, 2025

🦋 Changeset detected

Latest commit: e21ec0a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@digdir/designsystemet-react Minor
@digdir/designsystemet Minor
@digdir/designsystemet-css Minor
@digdir/designsystemet-theme Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Barsnes Barsnes marked this pull request as ready for review January 22, 2025 12:56
Copy link
Collaborator

@mimarz mimarz left a comment

Choose a reason for hiding this comment

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

Burde vi brukt jsdoc for å dokumentere når barn skal være en bestemt sub-component? F.eks forventning at ToggleGroup sin children er forventet å være ToggleGroup.Item eller Tabs skal ha Tabs.List og Tabs.Panel.

Det vil indirekte løst forvirring med Alert props tabellen #2760

Dette kunne vi løst i egen PR da. Hva tenker du?

@Barsnes
Copy link
Member Author

Barsnes commented Jan 23, 2025

Burde vi brukt jsdoc for å dokumentere når barn skal være en bestemt sub-component? F.eks forventning at ToggleGroup sin children er forventet å være ToggleGroup.Item eller Tabs skal ha Tabs.List og Tabs.Panel.

Det vil indirekte løst forvirring med Alert props tabellen #2760

Dette kunne vi løst i egen PR da. Hva tenker du?

Eg tenker me kan ta det i eigen PR ja :)
Det er berre eit få komponenta som må ha ein satt struktur, så då er det fint å sette lys på det

@Barsnes Barsnes merged commit fea6de8 into next Jan 23, 2025
10 checks passed
@Barsnes Barsnes deleted the react/props-and-jsdoc branch January 23, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update jsdoc on React components Review React props again to make sure they are consistent
2 participants