This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 2947b9bd913 snippet (#45174)
2947b9bd913 is described below
commit 2947b9bd913cbe4494794b556688d6434bd8bc30
Author: Shubham Raj <[email protected]>
AuthorDate: Mon Dec 23 15:14:10 2024 +0530
snippet (#45174)
---
airflow/ui/src/components/ui/Checkbox.tsx | 44 +++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/airflow/ui/src/components/ui/Checkbox.tsx
b/airflow/ui/src/components/ui/Checkbox.tsx
new file mode 100644
index 00000000000..bae1b1ce1e7
--- /dev/null
+++ b/airflow/ui/src/components/ui/Checkbox.tsx
@@ -0,0 +1,44 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Checkbox as ChakraCheckbox } from "@chakra-ui/react";
+import * as React from "react";
+
+export type CheckboxProps = {
+ icon?: React.ReactNode;
+ inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
+ rootRef?: React.Ref<HTMLLabelElement>;
+} & ChakraCheckbox.RootProps;
+
+export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
+ (props, ref) => {
+ const { children, icon, inputProps, rootRef, ...rest } = props;
+
+ return (
+ <ChakraCheckbox.Root ref={rootRef} {...rest}>
+ <ChakraCheckbox.HiddenInput ref={ref} {...inputProps} />
+ <ChakraCheckbox.Control>
+ {icon ?? <ChakraCheckbox.Indicator />}
+ </ChakraCheckbox.Control>
+ {children !== undefined && (
+ <ChakraCheckbox.Label>{children}</ChakraCheckbox.Label>
+ )}
+ </ChakraCheckbox.Root>
+ );
+ },
+);