How to use the wix-ui-core/withStylable.withStylable function in wix-ui-core

To help you get started, we’ve selected a few wix-ui-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / wix-ui-backoffice / src / components / StylableUIText / UIText.tsx View on Github external
'T4' | 'T4.1' | 'T4.2' | 'T4.3' | 'T4.4' | 'T4.5' | 'T4.6' | 'T4.7' |
    'T5' | 'T5.1';

export type TagName = 'div' | 'span';

export interface UITextProps {
  /** typography of the text */
  appearance?: Appearance;

  /** the tag name to be used */
  tagName?: TagName;
}

const defaultProps: UITextProps = {appearance: 'T1.1', tagName: 'span'};

export const UIText = withStylable(
  CoreText,
  style,
  ({appearance}) => ({appearance}),
  defaultProps
);

UIText.propTypes = {
  ...CoreText.propTypes,

   /** typography of the uitext */
   appearance: oneOf([
    'T1', 'T1.1', 'T1.2', 'T1.3', 'T1.4', 'T1.5', 'T1.6', 'T1.7',
    'T2', 'T2.1', 'T2.2', 'T2.3', 'T2.4',
    'T3', 'T3.1', 'T3.2', 'T3.3', 'T3.4', 'T3.5', 'T3.6', 'T3.7',
    'T4', 'T4.1', 'T4.2', 'T4.3', 'T4.4', 'T4.5', 'T4.6', 'T4.7',
    'T5', 'T5.1'
github wix / wix-ui-tpa / stories / ToggleSwitch / ToggleSwitchExtensionExample.tsx View on Github external
import * as React from 'react';
import {ToggleSwitch} from '../../src/components/ToggleSwitch';

import {ToggleSwitchProps} from 'wix-ui-core/toggle-switch';
import toggleSwitchStylesExt from './ToggleSwitchExt.st.css';
import {withStylable} from 'wix-ui-core/withStylable';
import * as styles from './ToggleSwtichStory.scss';

const ToggleSwitchExt = withStylable(ToggleSwitch, toggleSwitchStylesExt, () => null);

export class ToggleSwitchExtensionExample extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      checked: false,
      disabled: false
    };
  }

  render() {
    return <div>
       this.setState({checked: !this.state.checked})}
                           disabled={this.state.disabled}
                           checked={this.state.checked}/&gt;</div>
github wix / wix-ui-tpa / src / components / Autocomplete / Autocomplete.tsx View on Github external
import { withStylable } from 'wix-ui-core/withStylable';
import ChevronDown from 'wix-ui-icons-common/ChevronDown';
import style from './Autocomplete.st.css';
import { ErrorMessageWrapper, ErrorProps } from '../ErrorMessageWrapper';
import { TPAComponentProps } from '../../types';

export interface TPAAutocompleteProps extends TPAComponentProps {
  /** the error message to display */
  errorMessage?: string;
  /** apply error state*/
  error?: boolean;
}

export type AutocompleteProps = TPAAutocompleteProps &amp; CoreAutocompleteProps;

const AutocompleteWithErrorStates = withStylable&lt;
  CoreAutocompleteProps,
  ErrorProps
&gt;(CoreAutocomplete, style, ({ error }) =&gt; ({ error }));

export type AutocompleteType = React.FunctionComponent &amp; {
  createOption: typeof CoreAutocomplete.createOption;
  createDivider: typeof CoreAutocomplete.createDivider;
};

export const Autocomplete: AutocompleteType = ((props: AutocompleteProps) =&gt; {
  const { errorMessage, error, suffix, ...coreAutocompleteProps } = props;
  const { disabled } = props;

  return (
github wix / wix-ui-backoffice / src / components / Divider / Divider.tsx View on Github external
import {Divider as CoreDivider, DividerProps as CoreDividerProps} from 'wix-ui-core/Divider';
import style from './Divider.st.css';
import {withStylable} from 'wix-ui-core/withStylable';

export const Divider = withStylable(
  CoreDivider,
  style,
  () =&gt; ({})
);
github wix / wix-ui-backoffice / src / components / StylableToggleSwitch / ToggleSwitch.tsx View on Github external
import {withStylable} from 'wix-ui-core/withStylable';

export interface ToggleSwitchProps {
  skin?: 'standard' | 'error' | 'success';
  size?: 'small' | 'medium' | 'large';
}

const defaultProps = {
  skin: 'standard',
  size: 'large',
  uncheckedIcon: ,
  checkedIcon: 
};

export const ToggleSwitch = withStylable(
  CoreToggleSwitch,
  style,
  ({size, skin}) =&gt; ({size, skin}),
  defaultProps
);