File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 },
3636 "dependencies" : {
3737 "@popperjs/core" : " ^2.11.5" ,
38- "blue-web" : " ^1.23.0 " ,
38+ "blue-web" : " ^1.25.1 " ,
3939 "bootstrap" : " ~5.3.3" ,
4040 "clsx" : " ^1.1.1"
4141 },
Original file line number Diff line number Diff line change 1+ import clsx from "clsx"
2+ import { ComponentProps , ReactNode } from "react"
3+
4+ export type FieldGroupProps = ComponentProps < "details" > & {
5+ header ?: ReactNode
6+ isExpanded ?: boolean
7+ headerClassName ?: string
8+ id ?: string
9+ heading ?: number
10+ pageHeader ?: boolean
11+ }
12+
13+ export default function FieldGroup ( {
14+ className,
15+ children,
16+ open,
17+ header,
18+ isExpanded = true ,
19+ headerClassName,
20+ id,
21+ heading,
22+ pageHeader,
23+ ...rest
24+ } : FieldGroupProps ) {
25+ return (
26+ < details
27+ className = { clsx ( "blue-field-group" , className ) }
28+ open = { isExpanded }
29+ { ...rest }
30+ >
31+ < summary
32+ role = "heading"
33+ aria-level = { heading }
34+ className = { clsx ( headerClassName , {
35+ "blue-page-header w-100 mt-0" : pageHeader ,
36+ h1 : heading === 1 ,
37+ h2 : heading === 2 ,
38+ h3 : heading === 3 ,
39+ h4 : heading === 4 ,
40+ h5 : heading === 5 ,
41+ h6 : heading === 6
42+ } ) }
43+ >
44+ < svg
45+ xmlns = "http://www.w3.org/2000/svg"
46+ width = "1em"
47+ height = "1em"
48+ fill = "currentColor"
49+ aria-hidden = "true"
50+ className = "blue-field-group-chevron bi bi-chevron-right fs-6 opacity-50"
51+ viewBox = "0 0 16 16"
52+ >
53+ < path
54+ fillRule = "evenodd"
55+ d = "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"
56+ />
57+ </ svg >
58+ { header }
59+ { id !== undefined && id !== null && id !== "" && (
60+ < small className = "text-secondary ms-1" > { id } </ small >
61+ ) }
62+ </ summary >
63+ { children }
64+ </ details >
65+ )
66+ }
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ import {
1717 App as AppIcon ,
1818 Search ,
1919 Window ,
20- PlayBtn
20+ PlayBtn ,
21+ CardHeading
2122} from "react-bootstrap-icons"
2223
2324import { ComponentPage } from "./pages/ComponentPage"
@@ -235,6 +236,9 @@ function App() {
235236 case "Button" :
236237 icon = < PlayBtn />
237238 break
239+ case "FieldGroup" :
240+ icon = < CardHeading />
241+ break
238242 default :
239243 icon = < FileCode />
240244 }
@@ -250,8 +254,7 @@ function App() {
250254 buttonContent = {
251255 comp . displayName &&
252256 ( [
253- "Actions" ,
254- "MenuItem"
257+ "FieldGroup"
255258 ] . includes (
256259 comp . displayName
257260 ) ? (
Original file line number Diff line number Diff line change 1+ import FieldGroup from "../../../components/FieldGroup"
2+
3+ export default function FieldGroupBasicUsage ( ) {
4+ return (
5+ < FieldGroup header = "Field group 1" > Content of field group 1</ FieldGroup >
6+ )
7+ }
Original file line number Diff line number Diff line change 1+ import FieldGroup from "../../../components/FieldGroup"
2+
3+ export default function FieldGroupHeadings ( ) {
4+ return (
5+ < FieldGroup header = "Field group 1" pageHeader heading = { 2 } >
6+ Content of field group 1
7+ </ FieldGroup >
8+ )
9+ }
You can’t perform that action at this time.
0 commit comments