From 64d67a9005d1a921d0116cc49e245f27c6b9c83c Mon Sep 17 00:00:00 2001 From: atomiks Date: Thu, 13 Jun 2024 18:45:31 +1000 Subject: [PATCH] [CheckboxGroup] Component and Hook Init conformance tests Fix label context test test Update --- .../css/index.js | 158 ++++++++++++++ .../css/index.tsx | 158 ++++++++++++++ .../system/index.js | 125 +++++++++++ .../system/index.tsx | 125 +++++++++++ .../tailwind/index.js | 123 +++++++++++ .../tailwind/index.tsx | 112 ++++++++++ .../UnstyledCheckboxGroupNested.js | 146 +++++++++++++ .../UnstyledCheckboxGroupNested.tsx | 146 +++++++++++++ .../checkbox-group/checkbox-group.md | 102 +++++++++ .../UnstyledCheckboxIndeterminateGroup.js | 20 +- .../UnstyledCheckboxIndeterminateGroup.tsx | 20 +- docs/data/base/pages.ts | 1 + docs/data/base/pagesApi.js | 8 + .../base-ui/api/checkbox-group-label.json | 19 ++ .../base-ui/api/checkbox-group-root.json | 19 ++ docs/pages/base-ui/api/checkbox-root.json | 1 + .../base-ui/api/use-checkbox-group-label.json | 28 +++ .../api/use-checkbox-group-parent.json | 37 ++++ .../base-ui/api/use-checkbox-group-root.json | 42 ++++ docs/pages/base-ui/api/use-checkbox-root.json | 1 + .../react-checkbox-group/[docsTab]/index.js | 54 +++++ .../base-ui/react-checkbox-group/index.js | 13 ++ .../checkbox-group-label.json | 10 + .../checkbox-group-root.json | 10 + .../api-docs/checkbox-root/checkbox-root.json | 3 + .../use-checkbox-group-label.json | 10 + .../use-checkbox-group-parent.json | 1 + .../use-checkbox-group-root.json | 1 + .../use-checkbox-root/use-checkbox-root.json | 3 + docs/translations/translations.json | 1 + .../src/Checkbox/Root/CheckboxRoot.tsx | 43 +++- .../src/Checkbox/Root/CheckboxRoot.types.ts | 5 + .../src/Checkbox/Root/useCheckboxRoot.ts | 27 ++- .../Label/CheckboxGroupLabel.test.tsx | 28 +++ .../Label/CheckboxGroupLabel.tsx | 63 ++++++ .../Label/CheckboxGroupLabel.types.ts | 6 + .../Label/useCheckboxGroupLabel.ts | 46 ++++ .../Label/useCheckboxGroupLabel.types.ts | 20 ++ .../Parent/useCheckboxGroupParent.test.tsx | 204 ++++++++++++++++++ .../Parent/useCheckboxGroupParent.ts | 92 ++++++++ .../Parent/useCheckboxGroupParent.types.ts | 23 ++ .../Root/CheckboxGroupRoot.test.tsx | 14 ++ .../CheckboxGroup/Root/CheckboxGroupRoot.tsx | 107 +++++++++ .../Root/CheckboxGroupRoot.types.ts | 22 ++ .../Root/CheckboxGroupRootContext.ts | 19 ++ .../Root/useCheckboxGroupRoot.tsx | 63 ++++++ .../Root/useCheckboxGroupRoot.types.ts | 19 ++ .../src/CheckboxGroup/index.barrel.ts | 23 ++ packages/mui-base/src/CheckboxGroup/index.ts | 23 ++ packages/mui-base/src/index.ts | 1 + .../src/utils/defaultRenderFunctions.tsx | 4 + 51 files changed, 2318 insertions(+), 31 deletions(-) create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/css/index.js create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/css/index.tsx create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/system/index.js create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/system/index.tsx create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/tailwind/index.js create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/tailwind/index.tsx create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupNested.js create mode 100644 docs/data/base/components/checkbox-group/UnstyledCheckboxGroupNested.tsx create mode 100644 docs/data/base/components/checkbox-group/checkbox-group.md create mode 100644 docs/pages/base-ui/api/checkbox-group-label.json create mode 100644 docs/pages/base-ui/api/checkbox-group-root.json create mode 100644 docs/pages/base-ui/api/use-checkbox-group-label.json create mode 100644 docs/pages/base-ui/api/use-checkbox-group-parent.json create mode 100644 docs/pages/base-ui/api/use-checkbox-group-root.json create mode 100644 docs/pages/base-ui/react-checkbox-group/[docsTab]/index.js create mode 100644 docs/pages/base-ui/react-checkbox-group/index.js create mode 100644 docs/translations/api-docs/checkbox-group-label/checkbox-group-label.json create mode 100644 docs/translations/api-docs/checkbox-group-root/checkbox-group-root.json create mode 100644 docs/translations/api-docs/use-checkbox-group-label/use-checkbox-group-label.json create mode 100644 docs/translations/api-docs/use-checkbox-group-parent/use-checkbox-group-parent.json create mode 100644 docs/translations/api-docs/use-checkbox-group-root/use-checkbox-group-root.json create mode 100644 packages/mui-base/src/CheckboxGroup/Label/CheckboxGroupLabel.test.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Label/CheckboxGroupLabel.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Label/CheckboxGroupLabel.types.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Label/useCheckboxGroupLabel.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Label/useCheckboxGroupLabel.types.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Parent/useCheckboxGroupParent.test.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Parent/useCheckboxGroupParent.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Parent/useCheckboxGroupParent.types.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Root/CheckboxGroupRoot.test.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Root/CheckboxGroupRoot.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Root/CheckboxGroupRoot.types.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Root/CheckboxGroupRootContext.ts create mode 100644 packages/mui-base/src/CheckboxGroup/Root/useCheckboxGroupRoot.tsx create mode 100644 packages/mui-base/src/CheckboxGroup/Root/useCheckboxGroupRoot.types.ts create mode 100644 packages/mui-base/src/CheckboxGroup/index.barrel.ts create mode 100644 packages/mui-base/src/CheckboxGroup/index.ts diff --git a/docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/css/index.js b/docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/css/index.js new file mode 100644 index 0000000000..0baafd979a --- /dev/null +++ b/docs/data/base/components/checkbox-group/UnstyledCheckboxGroupIntroduction/css/index.js @@ -0,0 +1,158 @@ +import * as React from 'react'; +import { useTheme } from '@mui/system'; +import * as Checkbox from '@base_ui/react/Checkbox'; +import * as CheckboxGroup from '@base_ui/react/CheckboxGroup'; +import Check from '@mui/icons-material/Check'; + +export default function UnstyledCheckboxIndeterminateGroup() { + return ( +
+ + + Colors + +
+ + + +
+
+ +
+ ); +} + +const grey = { + 100: '#E5EAF2', + 300: '#C7D0DD', + 500: '#9DA8B7', + 600: '#6B7A90', + 800: '#303740', + 900: '#1C2025', +}; + +function useIsDarkMode() { + const theme = useTheme(); + return theme.palette.mode === 'dark'; +} + +function Label(props) { + // eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/no-noninteractive-element-interactions + return