Skip to content
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
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { getElementDir } from "../../utils/dom";
import { queryActions } from "../action-bar/utils";
import { SLOTS as ACTION_GROUP_SLOTS } from "../action-group/resources";
Expand Down Expand Up @@ -76,7 +76,7 @@ export const ExpandToggle: FunctionalComponent<ExpandToggleProps> = ({
tooltip,
ref,
scale,
}) => {
}): VNode => {
const rtl = getElementDir(el) === "rtl";

const text = expanded ? collapseText : expandText;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { JSXAttributes } from "@stencil/core/internal";
import { FloatingLayout } from "../../utils/floating-ui";

Expand Down Expand Up @@ -33,7 +33,7 @@ export const FloatingArrow: FunctionalComponent<FloatingArrowProps> = ({
floatingLayout,
key,
ref,
}) => {
}): VNode => {
const { width, height, strokeWidth } = DEFAULTS;
const svgX = width / 2;
const isVertical = floatingLayout === "vertical";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { JSXBase } from "@stencil/core/internal";

export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
Expand All @@ -11,7 +11,7 @@ export function constrainHeadingLevel(level: number): HeadingLevel {
return Math.min(Math.max(Math.ceil(level), 1), 6) as HeadingLevel;
}

export const Heading: FunctionalComponent<HeadingProps> = (props, children) => {
export const Heading: FunctionalComponent<HeadingProps> = (props, children): VNode => {
const HeadingTag = props.level ? `h${props.level}` : "div";

delete props.level;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { JSXBase } from "@stencil/core/internal";
import { Scale, Status } from "../interfaces";
import { IconNameOrString } from "../icon/interfaces";
Expand All @@ -21,7 +21,7 @@ export const Validation: FunctionalComponent<ValidationProps> = ({
id,
icon,
message,
}) => (
}): VNode => (
<div class={CSS.validationContainer}>
<calcite-input-message aria-live="polite" icon={icon} id={id} scale={scale} status={status}>
{message}
Expand Down
36 changes: 17 additions & 19 deletions packages/calcite-components/src/components/functional/XButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { JSXAttributes, JSXBase } from "@stencil/core/internal";
import { Scale } from "../interfaces";
import { getIconScale } from "../../utils/component";

export interface XButtonOptions extends JSXAttributes {
export interface XButtonProps extends JSXAttributes {
disabled: boolean;
label: string;
scale: Scale;
Expand All @@ -14,26 +14,24 @@ export const CSS = {
button: "x-button",
};

export function XButton({
export const XButton: FunctionalComponent<XButtonProps> = ({
disabled,
key,
label,
onClick,
ref,
scale,
}: XButtonOptions): FunctionalComponent {
return (
<button
aria-label={label}
class={CSS.button}
disabled={disabled}
key={key}
onClick={onClick}
ref={ref}
tabIndex={-1}
type="button"
>
<calcite-icon icon="x" scale={getIconScale(scale)} />
</button>
);
}
}): VNode => (
<button
aria-label={label}
class={CSS.button}
disabled={disabled}
key={key}
onClick={onClick}
ref={ref}
tabIndex={-1}
type="button"
>
<calcite-icon icon="x" scale={getIconScale(scale)} />
</button>
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { StarIconProps } from "../interfaces";

export const StarIcon: FunctionalComponent<StarIconProps> = ({ full, scale, partial }) => (
export const StarIcon: FunctionalComponent<StarIconProps> = ({ full, scale, partial }): VNode => (
<calcite-icon
{...{
class: partial ? undefined : "icon",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";

interface StepBarProps {
active: boolean;
Expand All @@ -23,7 +23,7 @@ export const StepBar: FunctionalComponent<StepBarProps> = ({
complete,
error,
key,
}) => (
}): VNode => (
<svg
class={{
[CSS.stepBar]: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/utils/form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionalComponent, h } from "@stencil/core";
import { FunctionalComponent, h, VNode } from "@stencil/core";
import { Writable } from "type-fest";
import { IconNameOrString, Status } from "../components";
import { closestElementCrossShadowBoundary, queryElementRoots } from "./dom";
Expand Down Expand Up @@ -597,7 +597,7 @@ interface HiddenFormInputSlotProps {
*/
export const HiddenFormInputSlot: FunctionalComponent<HiddenFormInputSlotProps> = ({
component,
}) => {
}): VNode => {
syncHiddenFormInput(component);

return <slot name={hiddenFormInputSlotName} />;
Expand Down
18 changes: 8 additions & 10 deletions packages/calcite-components/src/utils/interactive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,19 @@ export function disconnectInteractive(component: InteractiveComponent): void {
restoreInteraction(component);
}

export interface InteractiveContainerOptions extends JSXAttributes {
export interface InteractiveContainerProps extends JSXAttributes {
disabled: boolean;
}

export const CSS = {
container: "interaction-container",
};

export function InteractiveContainer(
{ disabled }: InteractiveContainerOptions,
export const InteractiveContainer: FunctionalComponent<InteractiveContainerProps> = (
{ disabled },
children: VNode[],
): FunctionalComponent {
return (
<div class={CSS.container} inert={disabled}>
{...children}
</div>
);
}
): VNode => (
<div class={CSS.container} inert={disabled}>
{...children}
</div>
);