Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure jsxFragmentFactory to allow short Fragment syntax in JSX #5503

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class KolBreadcrumb implements API {
{link._hideLabel ? (
<kol-icon _label={link._label} _icons={typeof link._icons === 'string' ? link._icons : 'codicon codicon-symbol-event'} />
) : (
<Fragment>{link._label}</Fragment>
<>{link._label}</>
)}
</span>
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { InputTypeOnDefault } from '../../types/input/types';
Expand Down Expand Up @@ -71,12 +71,12 @@ export class KolInputCheckbox implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-color/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -68,12 +68,12 @@ export class KolInputColor implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-date/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -84,12 +84,12 @@ export class KolInputDate implements ComponentApi {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-email/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -90,12 +90,12 @@ export class KolInputEmail implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-file/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -67,12 +67,12 @@ export class KolInputFile implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-number/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -86,12 +86,12 @@ export class KolInputNumber implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -89,12 +89,12 @@ export class KolInputPassword implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-range/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -92,12 +92,12 @@ export class KolInputRange implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/input-text/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -106,12 +106,12 @@ export class KolInputText implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/input/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ export class KolInput implements Props {
<span class="counter" aria-atomic="true" aria-live="polite">
{this._currentLength}
{this._maxLength && (
<Fragment>
<>
<span aria-label={translate('kol-of')} role="img">
/
</span>
{this._maxLength}
</Fragment>
</>
)}{' '}
<span>{translate('kol-characters')}</span>
</span>
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/select/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { Stringified } from '../../types/common';
import { KoliBriHorizontalIcons } from '../../types/icons';
Expand Down Expand Up @@ -97,12 +97,12 @@ export class KolSelect implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h } from '@stencil/core';
import { Fragment, h } from '@stencil/core';

type Props = {
accessKey: string;
Expand All @@ -16,10 +16,14 @@ export const InternalUnderlinedAccessKey = ({ accessKey, label }: Props) => {
[first, ...rest] = label.split(accessKey);
}
return (
<span>
<>
{first}
{rest.length ? <u>{accessKey}</u> : null}
{rest.length ? rest.join(accessKey) : null}
</span>
{rest.length ? (
<>
<u>{accessKey}</u>
{rest.join(accessKey)}
</>
) : null}
</>
);
};
4 changes: 2 additions & 2 deletions packages/components/src/components/spin/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ function renderSpin(variant: SpinVariantPropType): JSX.Element {
return <slot name="expert"></slot>;
default:
return (
<Fragment>
<>
<span class="bg-spin-1"></span>
<span class="bg-spin-2"></span>
<span class="bg-spin-3"></span>
<span class="bg-neutral"></span>
</Fragment>
</>
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/textarea/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core';
import { Component, Element, Fragment, h, Host, JSX, Prop, State, Watch } from '@stencil/core';

import { InputTypeOnDefault } from '../../types/input/types';
import { AdjustHeightPropType } from '../../types/props/adjust-height';
Expand Down Expand Up @@ -80,12 +80,12 @@ export class KolTextarea implements API {
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
<span>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
</span>
</span>
</>
) : (
<span>{this.state._label}</span>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/toaster/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ export class KolToastContainer implements API {

public render(): JSX.Element {
return (
<Fragment>
<>
{this.state._toastStates.length > 1 && (
<kol-button _label={translate('kol-toast-close-all')} class="close-all" _on={{ onClick: this.handleCloseAllClick.bind(this) }}></kol-button>
)}
{this.state._toastStates.map((toastState) => (
<InternalToast toastState={toastState} onClose={() => this.handleClose(toastState)} key={toastState.id} />
))}
</Fragment>
</>
);
}
}
1 change: 1 addition & 0 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"noUnusedParameters": true,
"jsx": "react",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"removeComments": true,
Expand Down
Loading