@@ -16,9 +16,10 @@ import { getField } from '@cardstack/runtime-common';
16
16
import type { ComponentLike } from ' @glint/template' ;
17
17
import { CardContainer } from ' @cardstack/boxel-ui/components' ;
18
18
import Modifier from ' ember-modifier' ;
19
+ import { eq } from ' @cardstack/boxel-ui/helpers' ;
19
20
20
21
interface BoxComponentSignature {
21
- Args: { Named: { format? : Format } };
22
+ Args: { Named: { format? : Format ; displayContainer ? : boolean } };
22
23
Blocks: {};
23
24
}
24
25
@@ -89,76 +90,87 @@ export function getBoxComponent(
89
90
};
90
91
}
91
92
92
- let component: TemplateOnlyComponent <{ Args: { format? : Format } }> =
93
- <template >
94
- {{#let ( lookupFormat @ format) as | f | }}
95
- {{#if ( isCard model.value ) }}
96
- <CardContainer
97
- @ displayBoundaries ={{ true }}
98
- class =' field-component-card {{f.format }} -format'
99
- {{cardComponentModifier
100
- card =model.value
101
- format =f.format
102
- fieldType =field.fieldType
103
- fieldName =field.name
104
- }}
105
- data-test-card-format ={{f.format }}
106
- data-test-field-component-card
107
- {{! @glint-ignore Argument of type 'unknown' is not assignable to parameter of type 'Element'}}
108
- ...attributes
109
- >
110
- <f.Implementation
111
- @ cardOrField ={{card }}
112
- @ model ={{model.value }}
113
- @ fields ={{f.fields }}
114
- @ format ={{f.format }}
115
- @ set ={{model.set }}
116
- @ fieldName ={{model.name }}
117
- @ context ={{context }}
118
- />
119
- </CardContainer >
120
- {{else if ( isCompoundField model.value ) }}
121
- <div
122
- data-test-compound-field-format ={{f.format }}
123
- data-test-compound-field-component
124
- {{! @glint-ignore Argument of type 'unknown' is not assignable to parameter of type 'Element'}}
125
- ...attributes
126
- >
127
- <f.Implementation
128
- @ cardOrField ={{card }}
129
- @ model ={{model.value }}
130
- @ fields ={{f.fields }}
131
- @ format ={{f.format }}
132
- @ set ={{model.set }}
133
- @ fieldName ={{model.name }}
134
- @ context ={{context }}
135
- />
136
- </div >
137
- {{else }}
93
+ let component: TemplateOnlyComponent <{
94
+ Args: { format? : Format ; displayContainer? : boolean };
95
+ }> = <template >
96
+ {{#let
97
+ ( lookupFormat @ format) ( if ( eq @ displayContainer false ) false true )
98
+ as | f displayContainer |
99
+ }}
100
+ {{#if ( isCard model.value ) }}
101
+ <CardContainer
102
+ @ displayBoundaries ={{displayContainer }}
103
+ class =' field-component-card
104
+ {{f.format }} -format display-container-{{displayContainer }} '
105
+ {{cardComponentModifier
106
+ card =model.value
107
+ format =f.format
108
+ fieldType =field.fieldType
109
+ fieldName =field.name
110
+ }}
111
+ data-test-card-format ={{f.format }}
112
+ data-test-field-component-card
113
+ {{! @glint-ignore Argument of type 'unknown' is not assignable to parameter of type 'Element'}}
114
+ ...attributes
115
+ >
138
116
<f.Implementation
139
117
@ cardOrField ={{card }}
140
118
@ model ={{model.value }}
141
119
@ fields ={{f.fields }}
142
120
@ format ={{f.format }}
121
+ @ displayContainer ={{@ displayContainer }}
143
122
@ set ={{model.set }}
144
123
@ fieldName ={{model.name }}
145
124
@ context ={{context }}
146
125
/>
147
- {{/if }}
148
- {{/let }}
149
- <style >
150
- .field-component-card.embedded-format {
151
- padding : var (--boxel-sp );
152
- }
126
+ </CardContainer >
127
+ {{else if ( isCompoundField model.value ) }}
128
+ <div
129
+ data-test-compound-field-format ={{f.format }}
130
+ data-test-compound-field-component
131
+ {{! @glint-ignore Argument of type 'unknown' is not assignable to parameter of type 'Element'}}
132
+ ...attributes
133
+ >
134
+ <f.Implementation
135
+ @ cardOrField ={{card }}
136
+ @ model ={{model.value }}
137
+ @ fields ={{f.fields }}
138
+ @ format ={{f.format }}
139
+ @ displayContainer ={{@ displayContainer }}
140
+ @ set ={{model.set }}
141
+ @ fieldName ={{model.name }}
142
+ @ context ={{context }}
143
+ />
144
+ </div >
145
+ {{else }}
146
+ <f.Implementation
147
+ @ cardOrField ={{card }}
148
+ @ model ={{model.value }}
149
+ @ fields ={{f.fields }}
150
+ @ format ={{f.format }}
151
+ @ displayContainer ={{@ displayContainer }}
152
+ @ set ={{model.set }}
153
+ @ fieldName ={{model.name }}
154
+ @ context ={{context }}
155
+ />
156
+ {{/if }}
157
+ {{/let }}
158
+ <style >
159
+ .field-component-card.embedded-format {
160
+ padding : var (--boxel-sp );
161
+ }
153
162
154
- .field-component-card.atom-format {
155
- font : 700 var (--boxel-font-sm );
156
- letter-spacing : var (--boxel-lsp-xs );
157
- padding : 4px var (--boxel-sp-sm );
158
- background-color : var (--boxel-light );
159
- }
160
- < /style >
161
- </template >;
163
+ .field-component-card.atom-format {
164
+ font : 700 var (--boxel-font-sm );
165
+ letter-spacing : var (--boxel-lsp-xs );
166
+ }
167
+
168
+ .field-component-card.atom-format.display-container-true {
169
+ padding : 4px var (--boxel-sp-sm );
170
+ background-color : var (--boxel-light );
171
+ }
172
+ < /style >
173
+ </template >;
162
174
163
175
// when viewed from *outside*, our component is both an invokable component
164
176
// and a proxy that makes our fields available for nested invocation, like
0 commit comments