Skip to content

Commit 6c8e41a

Browse files
authored
feat(listbox): add listbox component styling (#193)
1 parent 300db7b commit 6c8e41a

File tree

5 files changed

+113
-90
lines changed

5 files changed

+113
-90
lines changed

package-lock.json

Lines changed: 0 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/* @docs */
2+
/* @docs */
3+
4+
/* @bootstrap docs */
5+
// $list-group-color: var(--#{$prefix}body-color);
6+
// $list-group-bg: var(--#{$prefix}body-bg);
7+
// $list-group-border-color: var(--#{$prefix}border-color);
8+
// $list-group-border-width: var(--#{$prefix}border-width);
9+
// $list-group-border-radius: var(--#{$prefix}border-radius);
10+
11+
// $list-group-item-padding-y: $spacer * .5;
12+
// $list-group-item-padding-x: $spacer;
13+
// // fusv-disable
14+
// $list-group-item-bg-scale: -80%; // Deprecated in v5.3.0
15+
// $list-group-item-color-scale: 40%; // Deprecated in v5.3.0
16+
// // fusv-enable
17+
18+
// $list-group-hover-bg: var(--#{$prefix}tertiary-bg);
19+
// $list-group-active-color: $component-active-color;
20+
// $list-group-active-bg: $component-active-bg;
21+
// $list-group-active-border-color: $list-group-active-bg;
22+
23+
// $list-group-disabled-color: var(--#{$prefix}secondary-color);
24+
// $list-group-disabled-bg: $list-group-bg;
25+
26+
// $list-group-action-color: var(--#{$prefix}secondary-color);
27+
// $list-group-action-hover-color: var(--#{$prefix}emphasis-color);
28+
29+
// $list-group-action-active-color: var(--#{$prefix}body-color);
30+
// $list-group-action-active-bg: var(--#{$prefix}secondary-bg);
31+
/* @bootstrap docs */
32+
33+
.listbox {
34+
position: relative;
35+
border: var(--#{$prefix}list-group-border-width) solid
36+
var(--#{$prefix}list-group-border-color);
37+
38+
.list-group-item {
39+
border-width: 0 0 var(--#{$prefix}list-group-border-width);
40+
}
41+
42+
> .list-group-item:last-child {
43+
border-bottom: unset;
44+
}
45+
46+
.list-group-list {
47+
margin: 0;
48+
padding: 0;
49+
overflow: auto;
50+
position: relative;
51+
border-radius: inherit;
52+
53+
&:not(:first-child) {
54+
&,
55+
> .list-group-item:first-child {
56+
border-top-left-radius: unset;
57+
border-top-right-radius: unset;
58+
}
59+
}
60+
61+
&:not(:last-child) {
62+
&,
63+
> .list-group-item:last-child {
64+
border-bottom-left-radius: unset;
65+
border-bottom-right-radius: unset;
66+
}
67+
}
68+
69+
&:last-child {
70+
> .list-group-item:last-child {
71+
border-bottom: unset;
72+
}
73+
}
74+
}
75+
76+
&.selectable {
77+
.list-group-list .list-group-item {
78+
cursor: pointer;
79+
80+
&.focused,
81+
&:hover {
82+
&:not(.active) {
83+
color: var(--#{$prefix}list-group-action-hover-color);
84+
background-color: var(
85+
--#{$prefix}list-group-action-hover-bg
86+
);
87+
}
88+
89+
&.active {
90+
filter: brightness(95%);
91+
}
92+
}
93+
}
94+
}
95+
}

src/assets/scss/theme.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@import "components/field";
2323
@import "components/icon";
2424
@import "components/input";
25+
@import "components/listbox";
2526
@import "components/loading";
2627
@import "components/menu";
2728
@import "components/modal";

src/components.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default [
1212
"Field",
1313
"Icon",
1414
"Input",
15+
"Listbox",
1516
"Loading",
1617
"Menu",
1718
"Modal",

src/plugins/theme.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,22 @@ const bootstrapConfig: OrugaOptions = {
252252
iconRightClass: "icon-right",
253253
counterClass: "help counter",
254254
},
255+
listbox: {
256+
override: true,
257+
rootClass: "listbox list-group",
258+
selectableClass: "selectable",
259+
filterableClass: "filterable",
260+
disabledClass: "disabled",
261+
headerClass: "list-group-header list-group-item",
262+
filterClass: "list-group-filter list-group-item",
263+
footerClass: "list-group-footer list-group-item",
264+
emptyClass: "list-group-empty list-group-item",
265+
listClass: "list-group-list",
266+
itemClass: "list-group-item",
267+
itemSelectedClass: "active",
268+
itemFocusedClass: "focused",
269+
itemDisabledClass: "disabled",
270+
},
255271
loading: {
256272
override: true,
257273
rootClass: "loading",

0 commit comments

Comments
 (0)