UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

54 lines (50 loc) 1.32 kB
"use client"; import { Group } from "../group/group.js"; import { ToggleGroupContext, useToggleGroup } from "./use-toggle-group.js"; import { TogglePropsContext, component, useRootComponentProps } from "./toggle.js"; import { useMemo } from "react"; import { jsx } from "react/jsx-runtime"; //#region src/components/toggle/toggle-group.tsx const ToggleGroupRoot = component((props) => { const [, { colorScheme, size, variant, attached,...rest }] = useRootComponentProps(props, "group", { transferProps: [ "size", "variant", "colorScheme" ] }); const { disabled, readOnly, value, getGroupProps, onChange, onChangeMapRef } = useToggleGroup(rest); return /* @__PURE__ */ jsx(TogglePropsContext, { value: useMemo(() => ({ colorScheme, size, variant, focusVisibleRing: attached ? "inside" : void 0 }), [ variant, size, colorScheme, attached ]), children: /* @__PURE__ */ jsx(ToggleGroupContext, { value: useMemo(() => ({ disabled, readOnly, value, onChange, onChangeMapRef }), [ value, disabled, readOnly, onChange, onChangeMapRef ]), children: /* @__PURE__ */ jsx(Group, { attached, ...getGroupProps() }) }) }); }, "group")(); //#endregion export { ToggleGroupRoot }; //# sourceMappingURL=toggle-group.js.map