Skip to content

Commit 3a10af2

Browse files
authored
Merge branch 'release/2' into 7487-fix-drawer-slot-style
2 parents daba8fc + 5af3f6d commit 3a10af2

File tree

24 files changed

+220
-256
lines changed

24 files changed

+220
-256
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"prettier": "3.5.3",
1414
"rimraf": "6.0.1",
1515
"ts-node": "10.9.2",
16-
"ts-prune": "0.10.3",
1716
"typescript": "5.8.2"
1817
},
1918
"engines": {
@@ -29,7 +28,6 @@
2928
"lint": "pnpm -r lint",
3029
"lint-staged": "lint-staged",
3130
"unused": "pnpm -r unused",
32-
"ts-prune": "git clean -f -d -X packages/adapters/**/src && pnpm -r exec npx ts-prune src -e",
3331
"ncu:major": "ncu && pnpm -r exec ncu",
3432
"ncu:minor": "ncu -t minor -u && pnpm -r exec ncu -t minor -u -x @types/react,@stencil/core,@unocss/*",
3533
"ncu:patch": "ncu -t patch -u && pnpm -r exec ncu -t patch -u -x @types/react",

packages/.ts-prunerc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/components/src/components/@else/all/component.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type States = Generic.Element.Members<RequiredStates, OptionalStates>;
1515
// @Component({
1616
// tag: 'kol-all',
1717
// })
18-
// ts-prune-ignore-next
1918
export class KolAll implements Generic.Element.ComponentApi<RequiredProps, OptionalProps, RequiredStates, OptionalStates> {
2019
@State() public state: States = {};
2120

packages/components/src/components/@else/counter/component.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { h, Host, State } from '@stencil/core';
1010
// },
1111
// shadow: true,
1212
// })
13-
// ts-prune-ignore-next
1413
export class KolCounter {
1514
@State() public state = {
1615
_count: 0,

packages/components/src/components/nav/style.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@
3131
.entry-item {
3232
flex-grow: 1;
3333
}
34+
35+
.entry {
36+
.kol-span-wc {
37+
place-items: start;
38+
}
39+
40+
.button {
41+
text-align: left;
42+
}
43+
}
3444
}

packages/components/src/components/single-select/shadow.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class KolSingleSelect implements SingleSelectAPI {
5050
@Method()
5151
// eslint-disable-next-line @typescript-eslint/require-await
5252
public async getValue(): Promise<StencilUnknown | undefined> {
53-
return this.state._value;
53+
return this._value;
5454
}
5555

5656
@Method()
@@ -80,9 +80,14 @@ export class KolSingleSelect implements SingleSelectAPI {
8080
}
8181
};
8282

83+
/**
84+
* If there are options and the current input value doesn't match any option's label,
85+
* resets the input value to match the label of the currently selected option.
86+
* Closes the dropdown and resets the opened state.
87+
*/
8388
private onBlur() {
8489
if (Array.isArray(this.state._options) && this.state._options.length > 0 && !this.state._options.some((option) => option.label === this._inputValue)) {
85-
this._inputValue = this.state._options.find((option) => (option as Option<string>).value === this.state._value)?.label as string;
90+
this._inputValue = this.state._options.find((option) => (option as Option<string>).value === this._value)?.label as string;
8691
this._filteredOptions = [...this.state._options];
8792
}
8893
this._isOpen = false;
@@ -110,7 +115,7 @@ export class KolSingleSelect implements SingleSelectAPI {
110115
this.controller.onFacade.onChange(new CustomEvent('change', { bubbles: true, detail: { name: this.state._name, value: option.value } }), option.value);
111116
this._filteredOptions = [...this.state._options];
112117

113-
this.controller.setFormAssociatedValue(this.state._value);
118+
this.controller.setFormAssociatedValue(this._value);
114119
}
115120

116121
private onInput(event: Event) {
@@ -281,7 +286,7 @@ export class KolSingleSelect implements SingleSelectAPI {
281286
}}
282287
tabIndex={-1}
283288
role="option"
284-
aria-selected={this.state._value === (option as Option<string>).value ? 'true' : undefined}
289+
aria-selected={this._value === (option as Option<string>).value ? 'true' : undefined}
285290
onClick={(event: Event) => {
286291
this.selectOption(option as Option<string>);
287292
this.refInput?.focus();
@@ -313,7 +318,7 @@ export class KolSingleSelect implements SingleSelectAPI {
313318
name="options"
314319
id={`option-radio-${index}`}
315320
value={(option as Option<string>).value}
316-
checked={this.state._value === (option as Option<string>).value || index === this._focusedOptionIndex}
321+
checked={this._value === (option as Option<string>).value || index === this._focusedOptionIndex}
317322
/>
318323

319324
<label htmlFor={`option-radio-${index}`} class="radio-label">
@@ -571,7 +576,6 @@ export class KolSingleSelect implements SingleSelectAPI {
571576
_id: `id-${nonce()}`,
572577
_label: '', // ⚠ required
573578
_options: [],
574-
_value: '',
575579
_hideClearButton: false,
576580
};
577581

packages/components/src/components/toolbar/shadow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class KolToolbar implements ToolbarAPI {
3838
};
3939

4040
return '_href' in element ? (
41-
<KolLinkWcTag {...element} {...props} ref={catchRef}></KolLinkWcTag>
41+
<KolLinkWcTag {...element} {...props} ref={catchRef} _role="button"></KolLinkWcTag>
4242
) : (
4343
<KolButtonWcTag {...element} {...props} ref={catchRef}></KolButtonWcTag>
4444
);

packages/components/src/components/toolbar/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use '../@shared/mixins' as *;
22
@use '../style' as *;
33
@use '../tooltip/style.scss' as *;
4+
@use '../button' as *;
45

56
@layer kol-component {
67
.toolbar {

packages/components/src/components/toolbar/test/__snapshots__/snapshot.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`kol-toolbar should render with _label="Text" _items=[{"_label":"Button"
55
<template shadowrootmode="open">
66
<div aria-label="Text" class="toolbar" role="toolbar">
77
<kol-button-wc _label="Button" _tabindex="0" class="button kol-toolbar-item normal"></kol-button-wc>
8-
<kol-link-wc _href="#" _label="Link" _tabindex="-1" class="button kol-toolbar-item normal"></kol-link-wc>
8+
<kol-link-wc _href="#" _label="Link" _role="button" _tabindex="-1" class="button kol-toolbar-item normal"></kol-link-wc>
99
</div>
1010
</template>
1111
</kol-toolbar>

packages/components/src/schema/utils/contrast/contrast.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type RGBA = [number, number, number, number];
3131
// const randomColor = () => Math.floor(Math.random() * 16777215).toString(16);
3232

3333
// https://24ways.org/2010/calculating-color-contrast/
34-
// ts-prune-ignore-next
3534
export const getContrastYIQ = (r: number, g: number, b: number): number => {
3635
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
3736
return yiq >= 128 ? -1 : 1;
@@ -46,7 +45,6 @@ export type ColorContrast<T> = ColorPair<T> & {
4645
contrast: number;
4746
};
4847

49-
// ts-prune-ignore-next
5048
export const calcColorContrast = (baseColor: RGB, contrastColor: RGB, ratio: number, dir = 1): ColorContrast<RGB> => {
5149
const color: RGB = [
5250
Math.max(Math.min(Math.round(contrastColor[0] + dir * Math.max(1, contrastColor[0] / 100)), 255), 0),
@@ -68,7 +66,6 @@ export const calcColorContrast = (baseColor: RGB, contrastColor: RGB, ratio: num
6866

6967
const cache: Map<unknown, ColorContrast<RGB>> = new Map();
7068

71-
// ts-prune-ignore-next
7269
export const getColorContrast = (baseColor: RGB, contrastColor: RGB, ratio: number, dir = 1): ColorContrast<RGB> => {
7370
if (cache.has(baseColor)) {
7471
return cache.get(baseColor) as ColorContrast<RGB>;

0 commit comments

Comments
 (0)