1+ import type { MercuryBundleOptimized } from "@genexus/mercury" ;
12import { CSS_CLASSES } from "../../../html" ;
23import type { ComponentMetadata } from "../../../typings/component-metadata" ;
34import { chameleonImportType } from "../../../utils" ;
45import { parseMetadata } from "../../parseMetadata" ;
56import {
7+ onElevationModel ,
68 plainModel ,
79 withAdditionalInormationEndModel ,
810 withDisabledItemsModel ,
@@ -12,12 +14,20 @@ import {
1214 withSeparatorModel
1315} from "./models" ;
1416
17+ const BASE_BUNDLES : MercuryBundleOptimized [ ] = [
18+ "components/list-box" ,
19+ "chameleon/scrollbar"
20+ ] ;
21+
22+ const customCssOnlyForPreviewDefault = ".list-box { block-size: 170px }" ;
23+ const customCssOnlyForPreviewOnElevation = ".list-box { block-size: 208px }" ;
24+
1525export const listBoxMetadata = parseMetadata ( {
1626 title : "List Box" ,
1727 description :
1828 "A List Box component is a versatile UI element used to present a selectable list of items, offering users a straightforward way to make choices or navigate through options. It's commonly employed in forms, dropdown menus, and selection interfaces where space is limited. The list-box displays a series of options, allowing users to select one or multiple items from the list, depending on its configuration." ,
19- bundles : [ "components/list-box" , "chameleon/scrollbar" ] ,
20- customCssOnlyForPreview : ".list-box { block-size: 154px }" ,
29+ bundles : BASE_BUNDLES ,
30+ customCssOnlyForPreview : customCssOnlyForPreviewDefault ,
2131 codeSnippets : {
2232 plain : {
2333 linkId : "plain" ,
@@ -28,7 +38,7 @@ export const listBoxMetadata = parseMetadata({
2838 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
2939 template : {
3040 tag : "ch-action-list-render" ,
31- class : CSS_CLASSES . LIST_BOX . CLASS ,
41+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
3242 properties : [
3343 { name : "selection" , value : "single" } ,
3444 { name : "model" , value : "listBoxModel" }
@@ -49,7 +59,7 @@ export const listBoxMetadata = parseMetadata({
4959 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
5060 template : {
5161 tag : "ch-action-list-render" ,
52- class : CSS_CLASSES . LIST_BOX . CLASS ,
62+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
5363 properties : [
5464 { name : "selection" , value : "single" } ,
5565 { name : "model" , value : "listBoxModel" }
@@ -70,7 +80,7 @@ export const listBoxMetadata = parseMetadata({
7080 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
7181 template : {
7282 tag : "ch-action-list-render" ,
73- class : CSS_CLASSES . LIST_BOX . CLASS ,
83+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
7484 properties : [
7585 { name : "selection" , value : "single" } ,
7686 { name : "model" , value : "listBoxModel" }
@@ -91,7 +101,7 @@ export const listBoxMetadata = parseMetadata({
91101 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
92102 template : {
93103 tag : "ch-action-list-render" ,
94- class : CSS_CLASSES . LIST_BOX . CLASS ,
104+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
95105 properties : [
96106 { name : "selection" , value : "single" } ,
97107 { name : "model" , value : "listBoxModel" }
@@ -115,7 +125,85 @@ export const listBoxMetadata = parseMetadata({
115125 ] ,
116126 template : {
117127 tag : "ch-action-list-render" ,
118- class : CSS_CLASSES . LIST_BOX . CLASS ,
128+ class : `${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
129+ properties : [
130+ { name : "selection" , value : "single" } ,
131+ { name : "model" , value : "listBoxModel" }
132+ ]
133+ }
134+ } ,
135+
136+ elevation1 : {
137+ linkId : "elevation-1" ,
138+ title : "6. Elevation 1 (Default)" ,
139+ bundles : [ ...BASE_BUNDLES , "utils/elevation" ] ,
140+ customCssOnlyForPreview : customCssOnlyForPreviewOnElevation ,
141+ imports : [
142+ chameleonImportType ( "ActionListModel" ) ,
143+ 'import { getIconPath } from "@genexus/mercury/assets-manager.js";'
144+ ] ,
145+ states : [
146+ {
147+ name : "listBoxModel" ,
148+ type : "ActionListModel" ,
149+ value : onElevationModel
150+ }
151+ ] ,
152+ template : {
153+ tag : "ch-action-list-render" ,
154+ class : `${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ${ CSS_CLASSES . ELEVATION [ 1 ] . SELECTOR } ` ,
155+ properties : [
156+ { name : "selection" , value : "single" } ,
157+ { name : "model" , value : "listBoxModel" }
158+ ]
159+ }
160+ } ,
161+
162+ elevation2 : {
163+ linkId : "elevation-2" ,
164+ title : "7. Elevation 2" ,
165+ bundles : [ ...BASE_BUNDLES , "utils/elevation" ] ,
166+ customCssOnlyForPreview : customCssOnlyForPreviewOnElevation ,
167+ imports : [
168+ chameleonImportType ( "ActionListModel" ) ,
169+ 'import { getIconPath } from "@genexus/mercury/assets-manager.js";'
170+ ] ,
171+ states : [
172+ {
173+ name : "listBoxModel" ,
174+ type : "ActionListModel" ,
175+ value : onElevationModel
176+ }
177+ ] ,
178+ template : {
179+ tag : "ch-action-list-render" ,
180+ class : `${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ${ CSS_CLASSES . ELEVATION [ 2 ] . SELECTOR } ` ,
181+ properties : [
182+ { name : "selection" , value : "single" } ,
183+ { name : "model" , value : "listBoxModel" }
184+ ]
185+ }
186+ } ,
187+
188+ elevation3 : {
189+ linkId : "elevation-3" ,
190+ title : "8. Elevation 3" ,
191+ bundles : [ ...BASE_BUNDLES , "utils/elevation" ] ,
192+ customCssOnlyForPreview : customCssOnlyForPreviewOnElevation ,
193+ imports : [
194+ chameleonImportType ( "ActionListModel" ) ,
195+ 'import { getIconPath } from "@genexus/mercury/assets-manager.js";'
196+ ] ,
197+ states : [
198+ {
199+ name : "listBoxModel" ,
200+ type : "ActionListModel" ,
201+ value : onElevationModel
202+ }
203+ ] ,
204+ template : {
205+ tag : "ch-action-list-render" ,
206+ class : `${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ${ CSS_CLASSES . ELEVATION [ 3 ] . SELECTOR } ` ,
119207 properties : [
120208 { name : "selection" , value : "single" } ,
121209 { name : "model" , value : "listBoxModel" }
@@ -125,7 +213,7 @@ export const listBoxMetadata = parseMetadata({
125213
126214 withAditionalInformationEnd : {
127215 linkId : "with-additional-information-end" ,
128- title : "6 . With Additional Information (End)" ,
216+ title : "9 . With Additional Information (End)" ,
129217 states : [
130218 {
131219 name : "listBoxModel" ,
@@ -136,7 +224,7 @@ export const listBoxMetadata = parseMetadata({
136224 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
137225 template : {
138226 tag : "ch-action-list-render" ,
139- class : CSS_CLASSES . LIST_BOX . CLASS ,
227+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
140228 properties : [
141229 { name : "selection" , value : "single" } ,
142230 { name : "model" , value : "listBoxModel" }
@@ -146,7 +234,7 @@ export const listBoxMetadata = parseMetadata({
146234
147235 disabled : {
148236 linkId : "disabled" ,
149- title : "7 . Disabled" ,
237+ title : "10 . Disabled" ,
150238 states : [
151239 {
152240 name : "listBoxModel" ,
@@ -157,7 +245,7 @@ export const listBoxMetadata = parseMetadata({
157245 imports : [ chameleonImportType ( "ActionListModel" ) ] ,
158246 template : {
159247 tag : "ch-action-list-render" ,
160- class : CSS_CLASSES . LIST_BOX . CLASS ,
248+ class : ` ${ CSS_CLASSES . LIST_BOX . CLASS } ${ CSS_CLASSES . SCROLLABLE . SELECTOR } ` ,
161249 properties : [
162250 { name : "selection" , value : "single" } ,
163251 { name : "model" , value : "listBoxModel" }
0 commit comments