Skip to content

Conversation

@marcosmoura
Copy link
Contributor

Previous Behavior

Checkboxes didn't have any transition between states.

New Behavior

Checkboxes now have transition between all states, according to the specs

Related Issue(s)

@github-actions
Copy link

Pull request demo site: URL

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-checkbox
Checkbox
34.414 kB
11.801 kB
37.81 kB
12.483 kB
3.396 kB
682 B
react-components
react-components: entire library
1.278 MB
321.251 kB
1.282 MB
322.022 kB
3.757 kB
771 B
react-list
ListItem
112.504 kB
33.252 kB
115.904 kB
33.935 kB
3.4 kB
683 B
react-table
DataGrid
161.201 kB
45.566 kB
164.599 kB
46.302 kB
3.398 kB
736 B
react-table
Table as DataGrid
131.524 kB
36.355 kB
134.919 kB
37.037 kB
3.395 kB
682 B
react-table
Table (Selection only)
69.887 kB
19.719 kB
73.285 kB
20.419 kB
3.398 kB
700 B
react-table
Table (Sort only)
68.53 kB
19.333 kB
71.928 kB
20.028 kB
3.398 kB
695 B
react-tree
FlatTree
149.084 kB
42.653 kB
152.483 kB
43.362 kB
3.399 kB
709 B
react-tree
PersonaFlatTree
149.842 kB
42.781 kB
153.241 kB
43.478 kB
3.399 kB
697 B
react-tree
PersonaTree
146.107 kB
41.644 kB
149.506 kB
42.343 kB
3.399 kB
699 B
react-tree
Tree
145.357 kB
41.518 kB
148.754 kB
42.223 kB
3.397 kB
705 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
68.796 kB
19.903 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.646 kB
68.562 kB
react-components
react-components: FluentProvider & webLightTheme
43.63 kB
14.257 kB
react-list
List
88.922 kB
26.387 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-table
Table (Primitives only)
41.975 kB
13.575 kB
react-timepicker-compat
TimePicker
109.956 kB
36.331 kB
🤖 This report was generated against 9dab740ab7f6b198c81739d41ba4a4daa24fad99

@marcosmoura marcosmoura marked this pull request as ready for review October 24, 2025 12:54
@marcosmoura marcosmoura requested review from a team and mainframev as code owners October 24, 2025 12:54
},
},

unchecked: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need empty style rule?

// Validate visual state by checking computed opacity (0 -> unchecked, 1 -> checked)
cy.get(`[data-test="list-item-${index + 1}"] .fui-Checkbox__indicator > svg`).should($svg => {
// Read computed opacity and coerce to number for robust comparison
const opacity = Number(window.getComputedStyle($svg[0]).opacity);
Copy link
Contributor

@dmytrokirpa dmytrokirpa Oct 24, 2025

Choose a reason for hiding this comment

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

It should probably be aria-hidden or some other data-* attribute, we shouldn't rely on computed styles in tests

},
elementType: 'div',
}),
checkmarkIcon: slot.optional(props.checkmarkIcon, {
Copy link
Contributor

Choose a reason for hiding this comment

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

I maybe missing something, but what's the main idea behind having this as a separate slot?

@dmytrokirpa
Copy link
Contributor

For some reason checkmark icon doesn't render on PR docsite preview https://fluentuipr.z22.web.core.windows.net/pull/35380/public-docsite-v9/react/index.html?path=/docs/components-checkbox--docs#default

Screen.Recording.2025-10-24.at.15.30.55.mov

);
// Checkbox now keeps the checkmark SVG in the DOM for motion/animation.
// Validate visual state by checking computed opacity (0 -> unchecked, 1 -> checked)
cy.get(`[data-test="list-item-${index + 1}"] .fui-Checkbox__indicator > svg`).should($svg => {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you import and interpolate css checkbox className here instead of hardcoded string?

Comment on lines +297 to +305
checked === 'mixed' ? rootStyles.mixed : checked ? rootStyles.checked : rootStyles.unchecked,
checked === 'mixed' ? motionScaleStyles.mixed : checked ? motionScaleStyles.checked : motionScaleStyles.unchecked,
!disabled &&
(checked === 'mixed'
? motionColorStyles.mixed
: checked
? motionColorStyles.checked
: motionColorStyles.unchecked),
disabled && rootStyles.disabled,
Copy link
Contributor

@mainframev mainframev Oct 24, 2025

Choose a reason for hiding this comment

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

I would avoid nested ternaries, looks shorter, but harder to read (https://eslint.org/docs/latest/rules/no-nested-ternary)

consider to abstract this to a function, something like that (just an example):

type checkState = 'checked' | 'unchecked' | 'mixed';

const checkMap: Record<boolean | 'mixed', checkState> = {
  true: 'checked',
  false: 'unchecked',
  mixed: 'mixed',
};

const collectCheckStateClasses = (
  checked: boolean | 'mixed',
  disabled: boolean,
  rootStyles: ReturnType<typeof useRootStyles>, 
  motionScaleStyles: ReturnType<typeof useMotionScaleStyles>,
  motionColorStyles: ReturnType<typeof useMotionColorStyles>,
) => {
  const state = checkMap[checked];

  return [
    rootStyles[state],
    motionScaleStyles[state],
    !disabled && motionColorStyles[state],
  ].filter(Boolean);
};

'use client';

import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
import { GriffelStyle, makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { GriffelStyle, makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
import { type GriffelStyle, makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';

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.

3 participants