<commit_before>import styled from 'styled-components';
import { Row, BaseCheckbox, Text } from '@strapi/parts';
import upperFirst from 'lodash/upperFirst';
import PropTypes from 'prop-types';
import React, { memo } from 'react';
import { useIntl } from 'react-intl';
import CollapseLabel from '../CollapseLabel';
import { firstRowWidth } from '../Permissions/utils/constants';

const CustomCheckbox = styled(BaseCheckbox)`
  margin-right: ${({ theme }) => theme.spaces[2]};
`;

const RowLabelWithCheckbox = ({
  children,
  isCollapsable,
  isActive,
  isFormDisabled,
  label,
  onChange,
  onClick,
  checkboxName,
  someChecked,
  value,
}) => {
  const { formatMessage } = useIntl();

  return (
    <Row alignItems="center" paddingLeft={6} style={{ width: firstRowWidth, flexShrink: 0 }}>
      <CustomCheckbox
        name={checkboxName}
        aria-label={formatMessage(
          {
            id: `Settings.permissions.select-all-by-permission`,
            defaultMessage: 'Select all {label} permissions',
          },
          { label }
        )}
        disabled={isFormDisabled}
        // Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
        onValueChange={value =>
          onChange({
            target: {
              name: checkboxName,
              value,
            },
          })}
        indeterminate={someChecked}
        value={value}
      />
      <CollapseLabel<commit_msg>box padding instead of custom style<commit_after>import { Row, BaseCheckbox, Text, Box } from '@strapi/parts';
import upperFirst from 'lodash/upperFirst';
import PropTypes from 'prop-types';
import React, { memo } from 'react';
import { useIntl } from 'react-intl';
import CollapseLabel from '../CollapseLabel';
import { firstRowWidth } from '../Permissions/utils/constants';

const RowLabelWithCheckbox = ({
  children,
  isCollapsable,
  isActive,
  isFormDisabled,
  label,
  onChange,
  onClick,
  checkboxName,
  someChecked,
  value,
}) => {
  const { formatMessage } = useIntl();

  return (
    <Row alignItems="center" paddingLeft={6} style={{ width: firstRowWidth, flexShrink: 0 }}>
      <Box paddingRight={2}>
        <BaseCheckbox
          name={checkboxName}
          aria-label={formatMessage(
            {
              id: `Settings.permissions.select-all-by-permission`,
              defaultMessage: 'Select all {label} permissions',
            },
            { label }
          )}
          disabled={isFormDisabled}
          // Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
          onValueChange={value =>
            onChange({
              target: {
                name: checkboxName,
                value,
              },
            })}
          indeterminate={someChecked}
          value={value}
        />
      </Box>
      <CollapseLabel
{'fraction_non_alphanumeric': 0.12175717744725009, 'fraction_numerical': 0.0034590107229332413, 'mean_word_length': 2.4265402843601898, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3529428', 'n_tokens_mistral': 824, 'n_tokens_neox': 818, 'n_words': 182}