Browse Source

Remove useMemo calls

useMemo calls are not needed anymore for new Next versions.
pull/1/head
TheoryOfNekomata 1 year ago
parent
commit
cc5243871d
15 changed files with 51 additions and 52 deletions
  1. +2
    -2
      packages/web/categories/action/react/src/components/ActionButton/index.tsx
  2. +2
    -2
      packages/web/categories/formatted/react/src/components/EmailAddressInput/index.tsx
  3. +4
    -4
      packages/web/categories/formatted/react/src/components/PhoneNumberInput/index.tsx
  4. +4
    -4
      packages/web/categories/formatted/react/src/components/UrlInput/index.tsx
  5. +4
    -4
      packages/web/categories/freeform/react/src/components/MaskedTextInput/index.tsx
  6. +4
    -4
      packages/web/categories/freeform/react/src/components/MultilineTextInput/index.tsx
  7. +4
    -4
      packages/web/categories/freeform/react/src/components/TextInput/index.tsx
  8. +3
    -3
      packages/web/categories/information/react/src/components/Badge/index.tsx
  9. +3
    -3
      packages/web/categories/navigation/react/src/components/LinkButton/index.tsx
  10. +6
    -6
      packages/web/categories/option/react/src/components/DropdownSelect/index.tsx
  11. +3
    -3
      packages/web/categories/option/react/src/components/RadioButton/index.tsx
  12. +3
    -3
      packages/web/categories/option/react/src/components/RadioTickBox/index.tsx
  13. +3
    -3
      packages/web/categories/option/react/src/components/ToggleButton/index.tsx
  14. +3
    -4
      packages/web/categories/option/react/src/components/ToggleSwitch/index.tsx
  15. +3
    -3
      packages/web/categories/option/react/src/components/ToggleTickBox/index.tsx

+ 2
- 2
packages/web/categories/action/react/src/components/ActionButton/index.tsx View File

@@ -77,7 +77,7 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
}: ActionButtonProps, }: ActionButtonProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<ButtonBase.ButtonBaseArgs>(() => ({
const styleProps: ButtonBase.ButtonBaseArgs = {
size, size,
block, block,
variant, variant,
@@ -85,7 +85,7 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
compact, compact,
menuItem, menuItem,
disabled, disabled,
}), [size, block, variant, border, compact, menuItem, disabled]);
};


return ( return (
<button <button


+ 2
- 2
packages/web/categories/formatted/react/src/components/EmailAddressInput/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';


export type EmailAddressInputProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style'> & {
export interface EmailAddressInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -76,7 +76,7 @@ export const EmailAddressInput = React.forwardRef<HTMLInputElement, EmailAddress
{...etcProps} {...etcProps}
className={TextControlBase.Input(styleArgs)} className={TextControlBase.Input(styleArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
type="email" type="email"
data-testid="input" data-testid="input"
/> />


+ 4
- 4
packages/web/categories/formatted/react/src/components/PhoneNumberInput/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';


export type PhoneNumberInputProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style'> & {
export interface PhoneNumberInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -58,7 +58,7 @@ export const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberIn
}: PhoneNumberInputProps, }: PhoneNumberInputProps,
ref, ref,
) => { ) => {
const styleArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const styleArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -66,7 +66,7 @@ export const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberIn
style, style,
resizable: false, resizable: false,
predefinedValues: false, predefinedValues: false,
}), [block, border, size, indicator, style]);
};


return ( return (
<div <div
@@ -76,7 +76,7 @@ export const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberIn
{...etcProps} {...etcProps}
className={TextControlBase.Input(styleArgs)} className={TextControlBase.Input(styleArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
type="tel" type="tel"
data-testid="input" data-testid="input"
/> />


+ 4
- 4
packages/web/categories/formatted/react/src/components/UrlInput/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';


export type UrlInputProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style'> & {
export interface UrlInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -58,7 +58,7 @@ export const UrlInput = React.forwardRef<HTMLInputElement, UrlInputProps>(
}: UrlInputProps, }: UrlInputProps,
ref, ref,
) => { ) => {
const styleArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const styleArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -66,7 +66,7 @@ export const UrlInput = React.forwardRef<HTMLInputElement, UrlInputProps>(
style, style,
resizable: false, resizable: false,
predefinedValues: false, predefinedValues: false,
}), [block, border, size, indicator, style]);
};


return ( return (
<div <div
@@ -76,7 +76,7 @@ export const UrlInput = React.forwardRef<HTMLInputElement, UrlInputProps>(
{...etcProps} {...etcProps}
className={TextControlBase.Input(styleArgs)} className={TextControlBase.Input(styleArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
type="url" type="url"
data-testid="input" data-testid="input"
/> />


+ 4
- 4
packages/web/categories/freeform/react/src/components/MaskedTextInput/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';


export type MaskedTextInputProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface MaskedTextInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -59,7 +59,7 @@ export const MaskedTextInput = React.forwardRef<HTMLInputElement, MaskedTextInpu
}: MaskedTextInputProps, }: MaskedTextInputProps,
ref, ref,
) => { ) => {
const textInputBaseArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const textInputBaseArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -67,7 +67,7 @@ export const MaskedTextInput = React.forwardRef<HTMLInputElement, MaskedTextInpu
style, style,
resizable: false, resizable: false,
predefinedValues: false, predefinedValues: false,
}), [block, border, size, indicator, style]);
};


return ( return (
<div <div
@@ -77,7 +77,7 @@ export const MaskedTextInput = React.forwardRef<HTMLInputElement, MaskedTextInpu
{...etcProps} {...etcProps}
className={TextControlBase.Input(textInputBaseArgs)} className={TextControlBase.Input(textInputBaseArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
type="password" type="password"
data-testid="input" data-testid="input"
/> />


+ 4
- 4
packages/web/categories/freeform/react/src/components/MultilineTextInput/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';


export type MultilineTextInputProps = Omit<React.HTMLProps<HTMLTextAreaElement>, 'size' | 'style'> & {
export interface MultilineTextInputProps extends Omit<React.HTMLProps<HTMLTextAreaElement>, 'size' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -59,7 +59,7 @@ export const MultilineTextInput = React.forwardRef<HTMLTextAreaElement, Multilin
}: MultilineTextInputProps, }: MultilineTextInputProps,
ref, ref,
) => { ) => {
const textInputBaseArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const textInputBaseArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -67,7 +67,7 @@ export const MultilineTextInput = React.forwardRef<HTMLTextAreaElement, Multilin
style, style,
resizable: true, resizable: true,
predefinedValues: false, predefinedValues: false,
}), [block, border, size, indicator, style]);
};


return ( return (
<div <div
@@ -77,7 +77,7 @@ export const MultilineTextInput = React.forwardRef<HTMLTextAreaElement, Multilin
{...etcProps} {...etcProps}
className={TextControlBase.Input(textInputBaseArgs)} className={TextControlBase.Input(textInputBaseArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
style={{ style={{
height: TextControlBase.MIN_HEIGHTS[size], height: TextControlBase.MIN_HEIGHTS[size],
}} }}


+ 4
- 4
packages/web/categories/freeform/react/src/components/TextInput/index.tsx View File

@@ -6,7 +6,7 @@ export enum TextInputType {
SEARCH = 'search', SEARCH = 'search',
} }


export type TextInputProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface TextInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -69,7 +69,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
}: TextInputProps, }: TextInputProps,
ref, ref,
) => { ) => {
const textInputBaseArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const textInputBaseArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -77,7 +77,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
style, style,
resizable: false, resizable: false,
predefinedValues: false, predefinedValues: false,
}), [block, border, size, indicator, style]);
};


return ( return (
<div <div
@@ -87,7 +87,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
{...etcProps} {...etcProps}
className={TextControlBase.Input(textInputBaseArgs)} className={TextControlBase.Input(textInputBaseArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
type={type} type={type}
data-testid="input" data-testid="input"
/> />


+ 3
- 3
packages/web/categories/information/react/src/components/Badge/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as BadgeBase from '@tesseract-design/web-base-badge'; import * as BadgeBase from '@tesseract-design/web-base-badge';


export type BadgeProps = React.HTMLProps<HTMLSpanElement> & {
export interface BadgeProps extends React.HTMLProps<HTMLSpanElement> {
rounded?: boolean, rounded?: boolean,
}; };


@@ -13,9 +13,9 @@ export const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
}, },
ref, ref,
) => { ) => {
const badgeStyleProps = React.useMemo<BadgeBase.BadgeBaseArgs>(() => ({
const badgeStyleProps: BadgeBase.BadgeBaseArgs = {
rounded, rounded,
}), [rounded]);
};


return ( return (
<strong <strong


+ 3
- 3
packages/web/categories/navigation/react/src/components/LinkButton/index.tsx View File

@@ -3,7 +3,7 @@ import * as ButtonBase from '@tesseract-design/web-base-button';


type LinkButtonElement = HTMLAnchorElement | HTMLSpanElement; type LinkButtonElement = HTMLAnchorElement | HTMLSpanElement;


export type LinkButtonProps = Omit<React.HTMLProps<LinkButtonElement>, 'size' | 'style'> & {
export interface LinkButtonProps extends Omit<React.HTMLProps<LinkButtonElement>, 'size' | 'style'> {
/** /**
* Size of the component. * Size of the component.
*/ */
@@ -66,7 +66,7 @@ export const LinkButton = React.forwardRef<LinkButtonElement, LinkButtonProps>(
}: LinkButtonProps, }: LinkButtonProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<ButtonBase.ButtonBaseArgs>(() => ({
const styleProps: ButtonBase.ButtonBaseArgs = {
size, size,
block, block,
variant, variant,
@@ -74,7 +74,7 @@ export const LinkButton = React.forwardRef<LinkButtonElement, LinkButtonProps>(
disabled, disabled,
compact, compact,
menuItem, menuItem,
}), [size, block, variant, border, disabled, compact, menuItem]);
};


const commonChildren = ( const commonChildren = (
<> <>


+ 6
- 6
packages/web/categories/option/react/src/components/DropdownSelect/index.tsx View File

@@ -2,14 +2,14 @@ import * as React from 'react';
import * as TextControlBase from '@tesseract-design/web-base-textcontrol'; import * as TextControlBase from '@tesseract-design/web-base-textcontrol';
import * as SelectControlBase from '@tesseract-design/web-base-selectcontrol'; import * as SelectControlBase from '@tesseract-design/web-base-selectcontrol';


type RenderOptionsProps = {
interface RenderOptionsProps {
options: SelectControlBase.SelectOption[], options: SelectControlBase.SelectOption[],
optionComponent?: React.ElementType, optionComponent?: React.ElementType,
optgroupComponent?: React.ElementType, optgroupComponent?: React.ElementType,
level?: number, level?: number,
} }


const RenderOptions: React.VFC<RenderOptionsProps> = ({
const RenderOptions: React.FC<RenderOptionsProps> = ({
options, options,
optionComponent: Option = 'option', optionComponent: Option = 'option',
optgroupComponent: Optgroup = 'optgroup', optgroupComponent: Optgroup = 'optgroup',
@@ -70,7 +70,7 @@ const RenderOptions: React.VFC<RenderOptionsProps> = ({
</> </>
); );


export type DropdownSelectProps = Omit<React.HTMLProps<HTMLSelectElement>, 'size' | 'style' | 'children'> & {
export interface DropdownSelectProps extends Omit<React.HTMLProps<HTMLSelectElement>, 'size' | 'style' | 'children' | 'label'> {
/** /**
* Short textual description indicating the nature of the component's value. * Short textual description indicating the nature of the component's value.
*/ */
@@ -129,7 +129,7 @@ export const DropdownSelect = React.forwardRef<HTMLSelectElement, DropdownSelect
}: DropdownSelectProps, }: DropdownSelectProps,
ref, ref,
) => { ) => {
const styleArgs = React.useMemo<TextControlBase.TextControlBaseArgs>(() => ({
const styleArgs: TextControlBase.TextControlBaseArgs = {
block, block,
border, border,
size, size,
@@ -137,7 +137,7 @@ export const DropdownSelect = React.forwardRef<HTMLSelectElement, DropdownSelect
style, style,
resizable: true, resizable: true,
predefinedValues: true, predefinedValues: true,
}), [block, border, size, style]);
};


return ( return (
<div <div
@@ -147,7 +147,7 @@ export const DropdownSelect = React.forwardRef<HTMLSelectElement, DropdownSelect
{...etcProps} {...etcProps}
className={TextControlBase.Input(styleArgs)} className={TextControlBase.Input(styleArgs)}
ref={ref} ref={ref}
aria-label={label}
aria-label={label?.toString()}
> >
<RenderOptions <RenderOptions
options={options} options={options}


+ 3
- 3
packages/web/categories/option/react/src/components/RadioButton/index.tsx View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import * as ButtonBase from '@tesseract-design/web-base-button'; import * as ButtonBase from '@tesseract-design/web-base-button';
import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol'; import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol';


export type RadioButtonProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface RadioButtonProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> {
/** /**
* Size of the component. * Size of the component.
*/ */
@@ -56,7 +56,7 @@ export const RadioButton = React.forwardRef<HTMLInputElement, RadioButtonProps>(
}: RadioButtonProps, }: RadioButtonProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<ButtonBase.ButtonBaseArgs & CheckControlBase.CheckControlBaseArgs>(() => ({
const styleProps: ButtonBase.ButtonBaseArgs & CheckControlBase.CheckControlBaseArgs = {
size, size,
block, block,
variant, variant,
@@ -67,7 +67,7 @@ export const RadioButton = React.forwardRef<HTMLInputElement, RadioButtonProps>(
appearance: CheckControlBase.CheckControlAppearance.BUTTON, appearance: CheckControlBase.CheckControlAppearance.BUTTON,
type: CheckControlBase.CheckControlType.RADIO, type: CheckControlBase.CheckControlType.RADIO,
uncheckedLabel: false, uncheckedLabel: false,
}), [size, block, variant, border, compact, disabled]);
};


return ( return (
<div <div


+ 3
- 3
packages/web/categories/option/react/src/components/RadioTickBox/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol'; import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol';


export type RadioTickBoxProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface RadioTickBoxProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> {
/** /**
* Should the component occupy the whole width of its parent? * Should the component occupy the whole width of its parent?
*/ */
@@ -34,13 +34,13 @@ export const RadioTickBox = React.forwardRef<HTMLInputElement, RadioTickBoxProps
}: RadioTickBoxProps, }: RadioTickBoxProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<CheckControlBase.CheckControlBaseArgs>(() => ({
const styleProps: CheckControlBase.CheckControlBaseArgs = {
block, block,
compact, compact,
appearance: CheckControlBase.CheckControlAppearance.TICK_BOX, appearance: CheckControlBase.CheckControlAppearance.TICK_BOX,
type: CheckControlBase.CheckControlType.RADIO, type: CheckControlBase.CheckControlType.RADIO,
uncheckedLabel: false, uncheckedLabel: false,
}), [block, compact]);
};


return ( return (
<div <div


+ 3
- 3
packages/web/categories/option/react/src/components/ToggleButton/index.tsx View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import * as ButtonBase from '@tesseract-design/web-base-button'; import * as ButtonBase from '@tesseract-design/web-base-button';
import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol'; import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol';


export type ToggleButtonProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface ToggleButtonProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> {
/** /**
* Size of the component. * Size of the component.
*/ */
@@ -61,7 +61,7 @@ export const ToggleButton = React.forwardRef<HTMLInputElement, ToggleButtonProps
}: ToggleButtonProps, }: ToggleButtonProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<ButtonBase.ButtonBaseArgs & CheckControlBase.CheckControlBaseArgs>(() => ({
const styleProps: ButtonBase.ButtonBaseArgs & CheckControlBase.CheckControlBaseArgs = {
size, size,
block, block,
variant, variant,
@@ -72,7 +72,7 @@ export const ToggleButton = React.forwardRef<HTMLInputElement, ToggleButtonProps
appearance: CheckControlBase.CheckControlAppearance.BUTTON, appearance: CheckControlBase.CheckControlAppearance.BUTTON,
type: CheckControlBase.CheckControlType.CHECKBOX, type: CheckControlBase.CheckControlType.CHECKBOX,
uncheckedLabel: false, uncheckedLabel: false,
}), [size, block, variant, border, compact, disabled]);
};
const defaultRef = React.useRef<HTMLInputElement>(null); const defaultRef = React.useRef<HTMLInputElement>(null);
const theRef = (ref ?? defaultRef) as React.MutableRefObject<HTMLInputElement>; const theRef = (ref ?? defaultRef) as React.MutableRefObject<HTMLInputElement>;




+ 3
- 4
packages/web/categories/option/react/src/components/ToggleSwitch/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol'; import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol';


export type ToggleSwitchProps = Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> & {
export interface ToggleSwitchProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size' | 'type' | 'style'> {
/** /**
* Label of the component when in the unchecked state. * Label of the component when in the unchecked state.
*/ */
@@ -44,14 +44,13 @@ export const ToggleSwitch = React.forwardRef<HTMLInputElement, ToggleSwitchProps
}: ToggleSwitchProps, }: ToggleSwitchProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<CheckControlBase.CheckControlBaseArgs>(() => ({
const styleProps: CheckControlBase.CheckControlBaseArgs = {
block, block,
compact, compact,
menuItem: false,
appearance: CheckControlBase.CheckControlAppearance.SWITCH, appearance: CheckControlBase.CheckControlAppearance.SWITCH,
type: CheckControlBase.CheckControlType.CHECKBOX, type: CheckControlBase.CheckControlType.CHECKBOX,
uncheckedLabel: Boolean(uncheckedLabel), uncheckedLabel: Boolean(uncheckedLabel),
}), [block, compact, uncheckedLabel]);
};


return ( return (
<div <div


+ 3
- 3
packages/web/categories/option/react/src/components/ToggleTickBox/index.tsx View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol'; import * as CheckControlBase from '@tesseract-design/web-base-checkcontrol';


export type ToggleTickBoxProps = Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'style'> & {
export interface ToggleTickBoxProps extends Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'style'> {
/** /**
* Should the component occupy the whole width of its parent? * Should the component occupy the whole width of its parent?
*/ */
@@ -39,13 +39,13 @@ export const ToggleTickBox = React.forwardRef<HTMLInputElement, ToggleTickBoxPro
}: ToggleTickBoxProps, }: ToggleTickBoxProps,
ref, ref,
) => { ) => {
const styleProps = React.useMemo<CheckControlBase.CheckControlBaseArgs>(() => ({
const styleProps: CheckControlBase.CheckControlBaseArgs = {
block, block,
compact, compact,
appearance: CheckControlBase.CheckControlAppearance.TICK_BOX, appearance: CheckControlBase.CheckControlAppearance.TICK_BOX,
type: CheckControlBase.CheckControlType.CHECKBOX, type: CheckControlBase.CheckControlType.CHECKBOX,
uncheckedLabel: false, uncheckedLabel: false,
}), [block, compact]);
};
const defaultRef = React.useRef<HTMLInputElement>(null); const defaultRef = React.useRef<HTMLInputElement>(null);
const theRef = (ref ?? defaultRef) as React.MutableRefObject<HTMLInputElement>; const theRef = (ref ?? defaultRef) as React.MutableRefObject<HTMLInputElement>;




Loading…
Cancel
Save