This is a very common view, though it is not explicitly stated in Luke's Gospel.
If we consider Luke a reliable historian (see my work here arguing that he is), then it is almost certain that he had a source within Mary & Joseph's family. If we assume that most or all of Luke's nativity account is both fabricated & anonymous (such an assumption, though popular in some places, presupposes naturalism and must discard much historical evidence to do so) then the question is moot.
This post will consider Luke to be a reliable historian.
--
Highly-specific reporting
There are a number of details in the first 2 chapters of Luke that would only be known by a handful of people directly involved, including:
- The discussion between the angel Gabriel and Mary (Luke 1:26-38)
- Specific details from Mary's visit to Elisabeth (Luke 1:39-45)
- Mary's psalm (Luke 1:46-55)
- The encounter with Simeon in the temple (Luke 2:25-35)
- The encounter with Anna in the temple (Luke 2:36-38)
And although Luke points out occasions when people broadcast events in the surrounding area (e.g. the shepherds in Luke 2:17), he contrasts this with Mary who "kept all these things, and pondered them in her heart" (see Luke 2:19).
Several of these events are related with highly-specific details, and most of the individuals involved (e.g. Zacharias, Elisabeth, Simeon, Anna, even Joseph) would have been deceased long before Luke conducted his research. The common thread in all of them is the person of Mary, who would have been able to provide these details and was still living after Easter (for arguments that both Luke & Acts were written within a generation of Easter see Stack Exchange posts here and here).
--
Second hand
If Mary told family members (such as James the Lord's brother, about whom Luke writes a great deal in Acts), then Luke may have obtained personal information from a family member who heard it directly from Mary, making Luke's report second-hand.
--
First hand
If we take this statement literally:
those who from the beginning were eyewitnesses and ministers of the word delivered them to us
Then a report from James on events at which James wasn't present wouldn't be in scope, and Mary would be far and away the most likely source for Luke's writings on personal events in Mary's life. This would make Luke's report firsthand.
In fact, it is curious that while Matthew relates the experiences of Joseph prior to the nativity, Luke does not--Luke relates the experiences of Mary. Although it is not proof, it supports the firsthand argument. Luke apparently didn't meet Joseph (John 19:26-27 indicates Joseph has died prior to the crucifixion, Luke 1:2 implies Luke wasn't an eyewitness of Jesus' ministry--if he joined the movement after the crucifixion then he didn't meet Joseph), so he didn't have Joseph's eyewitness testimony and didn't report it.
--
Conclusion
Did Luke only report information he received from primary sources? We cannot be 100% certain, but if we take him literally at his word, the answer would be yes, and the eyewitness for much of Luke chapters 1 & 2 would almost certainly be Mary.