Skip to content

Commit 9b9a1eb

Browse files
committed
fix(ui): styles pass — input bg, toggle checkbox, gradient titles, themeable tooltip/grid/scrollbar
Patch (no API/behaviour breaks; release-please → 3.4.x): - ColorInput/NumberInput: pin --bim-input--bgc to bg-contrast-20 (#3C3C41), not the base Input's contrast-50 (#76767B); slider fill radius. - Checkbox: [toggle] switch mode (sliding knob in a pill track). - Label: [gradient] text mode + --bim-label--gradient. - Panel/Section: gradient header titles via bim-label. - Tooltip: themeable vars + self-healing reparent fix (no orphaning). - Grid: themeable divider colour. Manager: scrollbar colour vars.
1 parent 316f175 commit 9b9a1eb

10 files changed

Lines changed: 271 additions & 22 deletions

File tree

packages/core/src/components/Button/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ export class Button extends LitElement {
210210
/** @deprecated Use `<bim-tooltip>` inside the button instead. */
211211
private _tooltipText?: string;
212212

213+
/**
214+
* The text of the tooltip to be displayed when hovering over the button.
215+
* @type {string}
216+
* @default undefined
217+
* @example <bim-button label="Click me" tooltip-text="This is a tooltip"></bim-button>
218+
* @example const button = document.createElement('bim-button');
219+
* button.label = 'Click me';
220+
* button.tooltipText = 'This is a tooltip';
221+
*/
213222
@property({ type: String, attribute: "tooltip-text", reflect: true })
214223
get tooltipText() { return this._tooltipText; }
215224
set tooltipText(value: string | undefined) {

packages/core/src/components/Checkbox/index.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,56 @@ export class Checkbox extends LitElement implements HasValue<boolean> {
141141
transform: translateY(-100%) scale(1);
142142
}
143143
}
144+
145+
/* ── Toggle / switch mode: bim-checkbox[toggle] ──────────────────
146+
Renders a sliding knob in a pill track instead of the check box.
147+
Knob is a dark ball with an outline; track turns main-base when on. */
148+
.switch-knob {
149+
display: none;
150+
}
151+
152+
:host([toggle]) .input-container {
153+
width: 2rem;
154+
height: 1.1rem;
155+
}
156+
157+
:host([toggle]) input {
158+
width: 100%;
159+
height: 100%;
160+
border-radius: 1rem;
161+
box-shadow: none;
162+
background: var(--bim-checkbox--toggle-track-c, var(--bim-ui_bg-contrast-30));
163+
transition: background-color 0.2s;
164+
}
165+
166+
:host([toggle]) input:checked,
167+
:host([toggle]) input:indeterminate {
168+
background: var(--bim-checkbox--toggle-track-on-c, var(--bim-ui_main-base));
169+
}
170+
171+
:host([toggle]) input + svg {
172+
display: none;
173+
}
174+
175+
:host([toggle]) .switch-knob {
176+
display: block;
177+
position: absolute;
178+
top: 50%;
179+
left: 0.15rem;
180+
width: 0.8rem;
181+
height: 0.8rem;
182+
border-radius: 50%;
183+
background: var(--bim-checkbox--toggle-knob-c, var(--bim-ui_bg-contrast-80));
184+
border: 1px solid var(--bim-checkbox--toggle-knob-bd-c, var(--bim-ui_bg-contrast-40));
185+
box-sizing: border-box;
186+
transform: translateY(-50%);
187+
transition: left 0.2s ease;
188+
pointer-events: none;
189+
}
190+
191+
:host([toggle]) input:checked ~ .switch-knob {
192+
left: calc(100% - 0.95rem);
193+
}
144194
`;
145195

146196
/**
@@ -223,6 +273,17 @@ export class Checkbox extends LitElement implements HasValue<boolean> {
223273
@property({ type: Boolean, reflect: true })
224274
inverted = false;
225275

276+
/**
277+
* Renders the checkbox as a toggle SWITCH (a sliding knob in a pill track)
278+
* instead of a checkbox box. The knob is a dark ball with an outline; the
279+
* track turns `--bim-ui_main-base` when on. Customise via
280+
* `--bim-checkbox--toggle-track-c` / `-track-on-c` / `-knob-c` / `-knob-bd-c`.
281+
* @default false
282+
* @example <bim-checkbox toggle checked></bim-checkbox>
283+
*/
284+
@property({ type: Boolean, reflect: true })
285+
toggle = false;
286+
226287
/**
227288
* A getter that returns the current checked state of the checkbox. This is useful for retrieving the checkbox's value in form submissions or JavaScript interactions as it provides a consistent `value` property as many other components.
228289
* @type {boolean}
@@ -280,6 +341,7 @@ export class Checkbox extends LitElement implements HasValue<boolean> {
280341
.disabled="${this.disabled}"
281342
/>
282343
${this.indeterminate ? ICON_INDETERMINATE : ICON_CHECK}
344+
<span class="switch-knob"></span>
283345
</div>
284346
</label>
285347
`;

packages/core/src/components/ColorInput/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export class ColorInput extends LitElement implements HasValue, HasName {
1717
:host {
1818
/* flex: 1; */
1919
display: block;
20+
/* Give the field a single dark surface (the SAME way NumberInput does),
21+
so the control reads as one box. The swatch/hex sit inside bim-input's
22+
padded field — NOT in a second nested background (which looked like a
23+
"double background"). */
24+
--bim-input--bgc: var(--bim-color-input--bgc, var(--bim-ui_bg-contrast-20));
2025
}
2126
2227
:host(:focus) {

packages/core/src/components/Grid/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class Grid<
8484
}
8585
8686
.grid-divider:hover > div {
87-
background-color: var(--bim-ui_accent-base);
87+
background-color: var(--bim-grid--divider-c, var(--bim-ui_main-base));
8888
}
8989
9090
.divider-horizontal {

packages/core/src/components/Label/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ export class Label extends LitElement {
4848
overflow: hidden;
4949
}
5050
51+
/* Gradient text: the label text fades along a gradient (the icon is not
52+
affected). Customise the gradient via --bim-label--gradient. */
53+
:host([gradient]) .parent p {
54+
background: var(
55+
--bim-label--gradient,
56+
linear-gradient(
57+
90deg,
58+
var(--bim-ui_bg-contrast-100) 0%,
59+
var(--bim-ui_bg-contrast-60) 100%
60+
)
61+
);
62+
-webkit-background-clip: text;
63+
background-clip: text;
64+
-webkit-text-fill-color: transparent;
65+
}
66+
5167
:host([label-hidden]) .parent p,
5268
:host(:empty) .parent p {
5369
display: none;
@@ -116,6 +132,14 @@ export class Label extends LitElement {
116132
@property({ type: Boolean, reflect: true })
117133
vertical = false;
118134

135+
/**
136+
* When `true`, the label text is painted with a gradient (the icon is left
137+
* untouched). Customise the gradient via the `--bim-label--gradient` CSS var.
138+
* @default false
139+
*/
140+
@property({ type: Boolean, reflect: true })
141+
gradient = false;
142+
119143
/**
120144
* Sets the label text programmatically, bypassing the slot.
121145
* Useful when building a dynamic UI via `document.createElement`.

packages/core/src/components/NumberInput/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export class NumberInput extends LitElement implements HasValue, HasName {
1414
:host {
1515
--bim-input--olw: var(--bim-number-input--olw, 2px);
1616
--bim-input--olc: var(--bim-number-input--olc, transparent);
17-
--bim-input--bdrs: var(--bim-number-input--bdrs, var(--bim-ui_size-4xs));
17+
--bim-input--bdrs: var(--bim-number-input--bdrs, var(--bim-ui_size-2xs));
18+
--bim-input--bgc: var(--bim-number-input--bgc, var(--bim-ui_bg-contrast-20));
1819
--bim-input--p: 0 0.375rem;
1920
/* flex: 1; */
2021
display: block;
@@ -79,7 +80,11 @@ export class NumberInput extends LitElement implements HasValue, HasName {
7980
position: absolute;
8081
top: 0;
8182
left: 0;
82-
border-radius: var(--bim-input--bdrs, var(--bim-ui_size-4xs));
83+
/* No radius on the fill itself — the field (.input) is rounded with
84+
overflow:hidden, so the fill's LEFT edge is clipped to the field's
85+
corner while its right edge stays a straight cut mid-field (the
86+
expected slider look). Rounding the fill would round it mid-field. */
87+
border-radius: 0;
8388
}
8489
8590
bim-input {

packages/core/src/components/Panel/src/Panel.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ export class Panel extends LitElement implements HasName {
211211
@property({ type: Boolean, attribute: "header-hidden", reflect: true })
212212
headerHidden = false;
213213

214+
/**
215+
* When `true` (default), the panel's header title is rendered with gradient
216+
* text (via the underlying bim-label). Set `false` for a flat title color.
217+
* Customise the gradient with the `--bim-label--gradient` CSS variable.
218+
* @default true
219+
*/
220+
@property({ type: Boolean, reflect: true })
221+
gradient = true;
222+
214223
/**
215224
* A record that maps element names or labels to transformation functions.
216225
* This record is used to transform the values from elements before they are returned as part of the `value` property.
@@ -301,7 +310,7 @@ export class Panel extends LitElement implements HasName {
301310
${this.label || this.name || this.icon
302311
? html`
303312
<div class="header">
304-
<bim-label .icon=${this.icon}>${this.label || this.name}</bim-label>
313+
<bim-label ?gradient=${this.gradient} .icon=${this.icon}>${this.label || this.name}</bim-label>
305314
<div class="header-end">
306315
<slot name="header-end"></slot>
307316
</div>

packages/core/src/components/Panel/src/Section.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ export class PanelSection extends LitElement implements HasName {
185185
@property({ type: Boolean, reflect: true })
186186
fixed?: boolean;
187187

188+
/**
189+
* When `true` (default), the section's header title is rendered with gradient
190+
* text (matching bim-panel). Set `false` for a flat title color. Customise via
191+
* the `--bim-label--gradient` CSS variable.
192+
* @default true
193+
*/
194+
@property({ type: Boolean, reflect: true })
195+
gradient = true;
196+
188197
/**
189198
* Controls the collapsed state of the panel section. When `collapsed` is true, the content of the section is hidden, and only the header is visible. This property can be toggled to show or hide the section's content, and is reflected to an attribute for easy HTML or JavaScript manipulation. Note that sections marked as `fixed` ignore changes to this property.
190199
* @type {Boolean}
@@ -287,7 +296,7 @@ export class PanelSection extends LitElement implements HasName {
287296
@keydown=${this.onHeaderKeydown}
288297
>
289298
${this.label || this.icon || this.name
290-
? html`<bim-label aria-hidden="true" .icon=${this.icon}>${this.label}</bim-label>`
299+
? html`<bim-label aria-hidden="true" ?gradient=${this.gradient} .icon=${this.icon}>${this.label}</bim-label>`
291300
: null}
292301
<div class="header-end">
293302
<slot name="header-end"></slot>

0 commit comments

Comments
 (0)