Skip to content

Commit 3a45545

Browse files
authored
Prepare necessary changes for Stencil upgrade (#8080)
2 parents 700b0e6 + 97dcec2 commit 3a45545

File tree

4 files changed

+35
-26
lines changed

4 files changed

+35
-26
lines changed

packages/components/src/functional-components/Collapsible/Collapsible.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { h } from '@stencil/core';
21
import type { FunctionalComponent as FC } from '@stencil/core';
2+
import { h } from '@stencil/core';
33
import type { JSXBase } from '@stencil/core/internal';
44
import clsx from 'clsx';
55
import { KolButtonWcTag } from '../../core/component-names';
6-
import type { HeadingLevel, IconsPropType } from '../../schema';
6+
import type { EventValueOrEventCallback, HeadingLevel, IconsPropType, StencilUnknown } from '../../schema';
77
import KolHeadingFc from '../Heading';
88

99
type ClassType =
@@ -12,12 +12,13 @@ type ClassType =
1212
[className: string]: boolean;
1313
};
1414

15-
export type CollapsibleProps = Omit<JSXBase.HTMLAttributes<HTMLElement>, 'id'> & {
15+
export type CollapsibleProps = Omit<JSXBase.HTMLAttributes<HTMLElement>, 'id' | 'onClick'> & {
1616
id: string;
1717
open?: boolean;
1818
disabled?: boolean;
1919
level?: HeadingLevel;
2020
label: string;
21+
onClick?: EventValueOrEventCallback<MouseEvent, StencilUnknown>;
2122

2223
HeadingProps?: {
2324
ref?: ((elm?: HTMLElement | undefined) => void) | undefined;

packages/components/src/functional-components/inputs/_types/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
export type DefaultInputProps<T> = Omit<T, 'title' | 'autoCapitalize' | 'autoCorrect' | 'spellcheck'> & {
1+
export type DefaultInputProps<T> = Omit<
2+
{
3+
[K in keyof T as K extends `aria${string}` ? never : K]: T[K]; // `aria${string}` is defined in the Stencil HTML types and colliding with our props, hence we remove it.
4+
},
5+
'title' | 'autoCapitalize' | 'autoCorrect' | 'spellcheck'
6+
> & {
27
id: string;
38
ariaDescribedBy?: string[];
49
hideLabel?: boolean;

packages/components/src/global/script.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,29 @@ import { getThemeDetails, setThemeStyle } from 'adopted-style-sheets';
33
import { Log } from '../schema';
44
import { setMode } from '@stencil/core';
55

6-
setMode((elm) => {
7-
try {
8-
if (elm.shadowRoot instanceof ShadowRoot) {
9-
setThemeStyle(elm, getThemeDetails(elm));
6+
export default () => {
7+
setMode((elm) => {
8+
try {
9+
if (elm.shadowRoot instanceof ShadowRoot) {
10+
setThemeStyle(elm, getThemeDetails(elm));
11+
}
12+
} catch (error) {
13+
/**
14+
* Try is needed for SSR.
15+
* - no HTMLElement is available
16+
* - no ShadowRoot is available
17+
*/
1018
}
11-
} catch (error) {
12-
/**
13-
* Try is needed for SSR.
14-
* - no HTMLElement is available
15-
* - no ShadowRoot is available
16-
*/
17-
}
18-
return 'default';
19-
});
20-
21-
import('./devtools')
22-
.then((devTools) => {
23-
if (typeof devTools === 'object' && devTools !== null && typeof devTools.initialize === 'function') {
24-
devTools.initialize();
25-
}
26-
})
27-
.catch((error) => {
28-
Log.error(error);
19+
return 'default';
2920
});
21+
22+
import('./devtools')
23+
.then((devTools) => {
24+
if (typeof devTools === 'object' && devTools !== null && typeof devTools.initialize === 'function') {
25+
devTools.initialize();
26+
}
27+
})
28+
.catch((error) => {
29+
Log.error(error);
30+
});
31+
};

packages/components/src/styles/_global.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@use '../components/a11y' as *;
22
@use '../components/preset' as *;
3+
@use '../components/@shared/mixins' as *;
34

45
@layer kol-global {
56
:host {

0 commit comments

Comments
 (0)