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

refactor: 🏷️ Make data-size and data-color behave more predictable #2951

Merged
merged 13 commits into from
Jan 8, 2025

Conversation

mimarz
Copy link
Collaborator

@mimarz mimarz commented Jan 6, 2025

#2943

  • Made it so data-size and data-color also accept any string as default so its the same as behaviour for other data attributes.
    • Except for explicits components
  • Removed references and default values for data-size and data-color in stories as thats contextual.
  • Removed unnecessary override to data-size and data-color to make sure the jsdocs and behaviour is uniform.
  • Added data-color and data-size as global argTypes for storybook so that they show up in controls for all components

Copy link

changeset-bot bot commented Jan 6, 2025

🦋 Changeset detected

Latest commit: 3e31922

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 Patch
@digdir/designsystemet Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-theme Patch

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

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Preview deployments for this pull request:

Storybook - 7. Jan 2025 - 16:35

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 55.1% 3192 / 5793
🔵 Statements 55.1% 3192 / 5793
🔵 Functions 85.84% 182 / 212
🔵 Branches 77.41% 528 / 682
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react/src/types.ts 0% 0% 0% 0%
packages/react/src/components/Avatar/Avatar.tsx 75% 100% 50% 75% 88-98
packages/react/src/components/Badge/Badge.tsx 20% 100% 0% 20% 37-50
packages/react/src/components/Button/Button.tsx 97.05% 85.71% 100% 97.05% 72
packages/react/src/components/Card/Card.tsx 78.12% 75% 50% 78.12% 45-52
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/Combobox/Combobox.tsx 88.46% 69.23% 71.42% 88.46% 166-167, 216-219, 261-262, 270, 279-280, 327-328, 436-460, 464-467
packages/react/src/components/Dropdown/Dropdown.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/Link/Link.tsx 100% 50% 100% 100%
packages/react/src/components/Pagination/Pagination.tsx 100% 50% 100% 100%
packages/react/src/components/Paragraph/Paragraph.tsx 100% 100% 100% 100%
packages/react/src/components/Popover/Popover.tsx 94.69% 76.47% 100% 94.69% 151, 187-188, 191-192, 205-206
packages/react/src/components/Radio/Radio.tsx 100% 75% 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/Tabs/Tabs.tsx 100% 66.66% 100% 100%
packages/react/src/components/Tag/Tag.tsx 100% 100% 100% 100%
packages/react/src/components/ToggleGroup/ToggleGroup.tsx 100% 100% 100% 100%
Generated in workflow #1495 for commit 3e31922 by the Vitest Coverage Report Action

@mimarz mimarz changed the title refactor: 🏷️ Loose default data-size and data-color props refactor: 🏷️ Make data-size and data-color attributes behave the same Jan 6, 2025
@mimarz mimarz changed the title refactor: 🏷️ Make data-size and data-color attributes behave the same refactor: 🏷️ Make data-size and data-color behave more predictable Jan 6, 2025
@mimarz mimarz force-pushed the feat-loosen-data-types branch from d5eca33 to 70d8e79 Compare January 7, 2025 12:23
@mimarz mimarz marked this pull request as ready for review January 7, 2025 13:27
packages/react/src/types.ts Outdated Show resolved Hide resolved
@mimarz mimarz requested a review from Barsnes January 7, 2025 15:34
Copy link
Member

@Barsnes Barsnes left a comment

Choose a reason for hiding this comment

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

Approving this as we have other issues on semantics. The changes to the type is good.

@mimarz mimarz merged commit f242e53 into next Jan 8, 2025
10 checks passed
@mimarz mimarz deleted the feat-loosen-data-types branch January 8, 2025 09:08
Barsnes pushed a commit that referenced this pull request Jan 8, 2025
#2951)

- Made it so `data-size` and `data-color` also accept any string as
default so its the same as behaviour for other data attributes.
  - Except for explicits components
- Removed references and default values for `data-size` and `data-color`
in stories as thats contextual.
- Removed unnecessary override to `data-size` and `data-color` to make
sure the jsdocs and behaviour is uniform.
- Added `data-color` and `data-size` as global `argTypes` for storybook
so that they show up in controls for all components
Barsnes pushed a commit that referenced this pull request Jan 8, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to next, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`next` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `next`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @digdir/designsystemet@1.0.0-next.45

### Minor Changes

- Fix wrong base default color beeing set by the themebuilder
([#2953](#2953))

- Moved typography based sizing formula to design-tokens
([#2796](#2796))

- Removed design-tokens `sizing` & `spacing`, use `size`.
([#2939](#2939))

- Support for building typography based sizing design-tokens
([#2796](#2796))

### Patch Changes

- Rename `data-ds-typography` to `data-typography`
([#2959](#2959))

## @digdir/designsystemet-css@1.0.0-next.45

### Minor Changes

- Removed CSS variables `--ds-spacing-*` & `--ds-sizing-*`, use
`--ds-size-*`.
([#2939](#2939))

- New CSS variables for sizes, `--ds-size-*`
([#2935](#2935))

- Moved typography based sizing formula to design-tokens
([#2796](#2796))

### Patch Changes

- Button: add `height: fit-content`
([#2942](#2942))

- Pagination: Use empty `li` for ellipsis
([#2942](#2942))

- Link: Fix missing underline when using Tailwind
([#2923](#2923))

-   Table: ([#2933](#2933))

    -   Correct footer styling
    -   Automatic focus styling for sorting buttons

- Switch: Adjust design to better align with radio and checkbox
([#2929](#2929))

- Tooltip: Use popover API
([#2916](#2916))

    -   Removes `delay`, this is now `--dsc-tooltip-transition-delay`
    -   Removes `defaultOpen`
    -   Removes `portal`
    -   Removes ability to hover to keep open

- PopoverTrigger: New prop `inline` for use when inline elements (such
as text) need a `Popover`
([#2915](#2915))

## @digdir/designsystemet-theme@1.0.0-next.45

### Minor Changes

- Removed CSS variables `--ds-spacing-*` & `--ds-sizing-*`, use
`--ds-size-*`.
([#2939](#2939))

- Moved typography based sizing formula to design-tokens
([#2796](#2796))

- Removed design-tokens `sizing` & `spacing`, use `size`.
([#2939](#2939))

### Patch Changes

- Rename `data-ds-typography` to `data-typography`
([#2959](#2959))

## @digdir/designsystemet-react@1.0.0-next.45

### Patch Changes

- Pagination: Use empty `li` for ellipsis
([#2942](#2942))

- Add missing `data-size` and `data-color` props to Details
([#2930](#2930))

-   Table: ([#2933](#2933))

    -   Correct footer styling
    -   Automatic focus styling for sorting buttons

- Loosen default types for `data-color` and `data-size` to support
accept `string`
([#2951](#2951))

- Export all utilities
([#2961](#2961))

- Field: Fix `position` not working
([#2931](#2931))

- Tooltip: Use popover API
([#2916](#2916))

    -   Removes `delay`, this is now `--dsc-tooltip-transition-delay`
    -   Removes `defaultOpen`
    -   Removes `portal`
    -   Removes ability to hover to keep open

- PopoverTrigger: New prop `inline` for use when inline elements (such
as text) need a `Popover`
([#2915](#2915))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

2 participants