Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Refs: #6960
  • Loading branch information
Makko74 committed Nov 6, 2024
1 parent c71218f commit f6e4f56
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ exports[`kol-badge should render with _label="**Te**xt" 1`] = `
<span style="background-color: #000; color: #959595;">
<span class="kol-span-wc">
<span>
<span class="md span-label">
<strong>
Te
</strong>
xt
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -20,6 +26,9 @@ exports[`kol-badge should render with _label="Text" _color="#000000" 1`] = `
<span style="background-color: #000; color: #959595;">
<span class="kol-span-wc">
<span>
<span class="md span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -35,6 +44,9 @@ exports[`kol-badge should render with _label="Text" _icons="codicon codicon-home
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="md span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -50,6 +62,9 @@ exports[`kol-badge should render with _label="Text" _icons="codicon codicon-home
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="md span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -64,6 +79,9 @@ exports[`kol-badge should render with _label="Text" 1`] = `
<span style="background-color: #000; color: #959595;">
<span class="kol-span-wc">
<span>
<span class="md span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ exports[`kol-button should render with _label="Label" _ariaDescription="Aria Des
<button aria-describedby="nonce" class="button normal" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -31,6 +34,9 @@ exports[`kol-button should render with _label="Label" _disabled=false 1`] = `
<button class="button normal" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -51,6 +57,9 @@ exports[`kol-button should render with _label="Label" _disabled=true 1`] = `
<button class="button disabled normal" disabled="" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -71,6 +80,9 @@ exports[`kol-button should render with _label="Label" _value="Hello" 1`] = `
<button class="button normal" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -91,6 +103,9 @@ exports[`kol-button should render with _label="Label" _variant="danger" 1`] = `
<button class="button danger" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -111,6 +126,9 @@ exports[`kol-button should render with _label="Label" _variant="ghost" 1`] = `
<button class="button ghost" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -131,6 +149,9 @@ exports[`kol-button should render with _label="Label" _variant="normal" 1`] = `
<button class="button normal" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -151,6 +172,9 @@ exports[`kol-button should render with _label="Label" _variant="primary" 1`] = `
<button class="button primary" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -171,6 +195,9 @@ exports[`kol-button should render with _label="Label" _variant="secondary" 1`] =
<button class="button secondary" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -191,6 +218,9 @@ exports[`kol-button should render with _label="Label" 1`] = `
<button class="button normal" type="button">
<span class="button-inner kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ exports[`kol-link should render with _href="https://google.de" _icons="codicon c
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -31,6 +34,9 @@ exports[`kol-link should render with _href="https://google.de" _icons="codicon c
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -53,6 +59,9 @@ exports[`kol-link should render with _href="https://google.de" _icons="codicon c
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand Down Expand Up @@ -97,6 +106,9 @@ exports[`kol-link should render with _href="https://google.de" _icons="codicon c
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -119,6 +131,9 @@ exports[`kol-link should render with _href="https://google.de" _icons="codicon c
<span class="kol-span-wc">
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand All @@ -140,6 +155,9 @@ exports[`kol-link should render with _label="Label" _href="" _download="download
<a class="external-link" download="download-file.zip" href="javascript:void(0);" rel="noopener" target="blank">
<span class="kol-span-wc">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden="">
<slot name="expert" slot="expert"></slot>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ exports[`kol-tooltip-wc should render with _id="id" _label="Label" _align="botto
<div class="tooltip-area tooltip-arrow"></div>
<span class="kol-span-wc tooltip-area tooltip-content" id="id">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -19,6 +22,9 @@ exports[`kol-tooltip-wc should render with _id="id" _label="Label" _align="left"
<div class="tooltip-area tooltip-arrow"></div>
<span class="kol-span-wc tooltip-area tooltip-content" id="id">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -32,6 +38,9 @@ exports[`kol-tooltip-wc should render with _id="id" _label="Label" _align="right
<div class="tooltip-area tooltip-arrow"></div>
<span class="kol-span-wc tooltip-area tooltip-content" id="id">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -45,6 +54,9 @@ exports[`kol-tooltip-wc should render with _id="id" _label="Label" _align="top"
<div class="tooltip-area tooltip-arrow"></div>
<span class="kol-span-wc tooltip-area tooltip-content" id="id">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand All @@ -58,6 +70,9 @@ exports[`kol-tooltip-wc should render with _id="id" _label="Label" 1`] = `
<div class="tooltip-area tooltip-arrow"></div>
<span class="kol-span-wc tooltip-area tooltip-content" id="id">
<span>
<span class="span-label">
Label
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</span>
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/functional-components/Span/Span.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ const LabelHelper: FC<{ label: string; hideLabel?: boolean; accessKey?: string;
};

const SpanCoreHelper: FC<{ label: string; hideLabel?: boolean; accessKey?: string; hideExpertSlot?: boolean; allowMarkdown?: boolean }> = (
{ hideLabel, label, accessKey, hideExpertSlot, allowMarkdown },
{ hideLabel, label, accessKey, allowMarkdown },
children,
) => {
const hideExpertSlot = !showExpertSlot(label);

return (
<>
{!hideExpertSlot && <LabelHelper label={label} hideLabel={hideLabel} accessKey={accessKey} allowMarkdown={allowMarkdown} />}
{hideExpertSlot && <LabelHelper label={label} hideLabel={hideLabel} accessKey={accessKey} allowMarkdown={allowMarkdown} />}
<span aria-hidden={hideExpertSlot ? 'true' : undefined} class="span-label" hidden={hideExpertSlot}>
{children}
</span>
Expand All @@ -92,14 +94,12 @@ const KolSpanFc: FC<SpanProps> = (props, children) => {
};
}

const hideExpertSlot = !showExpertSlot(label);

return (
<span class={clsx('kol-span-wc', { 'hide-label': hideLabel }, classNames)} {...other}>
{Utils.isObject(TopIconProps) && <IconHelper class="top" {...TopIconProps} />}
<span>
{Utils.isObject(LeftIconProps) && <IconHelper class="left" {...LeftIconProps} />}
<SpanCoreHelper label={label} hideLabel={hideLabel} allowMarkdown={allowMarkdown} accessKey={accessKey} hideExpertSlot={hideExpertSlot}>
<SpanCoreHelper label={label} hideLabel={hideLabel} allowMarkdown={allowMarkdown} accessKey={accessKey}>
{children}
</SpanCoreHelper>
{Utils.isObject(RightIconProps) && <IconHelper class="right" {...RightIconProps} />}
Expand Down

0 comments on commit f6e4f56

Please sign in to comment.