How to use wix-ui-core - 10 common examples

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 / Checkbox / Checkbox.e2e.ts View on Github external
eyes.it('should be indetermined', async () => {
      await autoExampleDriver.setProps({indeterminate: true});
      const driver = checkboxTestkitFactory({dataHook});
      // TODO: implement driver.isIndeterminate() in wix-ui-core
      // expect(await driver.isIndeterminate()).toBeTruthy();
    });
  });
github wix / wix-ui-backoffice / src / components / LabelWithOptions / LabelWithOptions.tsx View on Github external
import ChevronDown from 'wix-ui-icons-common/ChevronDown';
import style from './LabelWithOptions.st.css';
import { Tooltip } from '../Tooltip';
import { getInputSuffix } from '../Input/InputSuffixes';
import FormFieldError from 'wix-ui-icons-common/system/FormFieldError';

export interface LabelWithOptionsProps {
  // The size of the LabelWithOptions
  size?: 'large' | 'medium' | 'small';
}

const defaultProps = {
  size: 'medium'
};

const StyledLabelWithOptions = withStylable<
  CoreLabelWithOptionsProps,
  LabelWithOptionsProps
>(CoreLabelWithOptions, style, ({ size }) => ({ size }), defaultProps);

export type LabelWithOptionsType = React.SFC<
  CoreLabelWithOptionsProps & LabelWithOptionsProps
> & {
  createOption: typeof CoreLabelWithOptions.createOption;
  createDivider: typeof CoreLabelWithOptions.createDivider;
};

const defaultSuffix = ;
const renderSuffix = ({ isError, disabled }) =>
  getInputSuffix({
    error: isError ? 'Selection is required!' : null,
    disabled,
github wix / wix-ui-backoffice / src / components / Input / Input.tsx View on Github external
InputProps as CoreInputProps
} from 'wix-ui-core/dist/src/components/input';
import { withStylable } from 'wix-ui-core/dist/src/utils/withStylable';
import style from './Input.st.css';
import { getInputSuffix } from './InputSuffixes';

export interface InputProps {
  // The size of the input
  size?: 'large' | 'medium' | 'small';
}

const defaultProps = {
  size: 'medium'
};

export const StyledInput = withStylable(
  CoreInput,
  style,
  ({ size }) => ({ size }),
  defaultProps
);

export const Input: React.SFC = (
  props: CoreInputProps & InputProps
) => {
  const { error, disabled, suffix } = props;

  return (
github wix / wix-ui-backoffice / src / components / Autocomplete / Autocomplete.tsx View on Github external
} from 'wix-ui-core/dist/src/components/autocomplete';
import { withStylable } from 'wix-ui-core/dist/src/utils/withStylable';
import ChevronDown from 'wix-ui-icons-common/ChevronDown';
import style from './Autocomplete.st.css';
import { getInputSuffix } from '../Input';

export interface AutocompleteProps {
  // The size of the autocomplete
  size?: 'large' | 'medium' | 'small';
}

const defaultProps = {
  size: 'medium'
};

const StyledAutocomplete = withStylable<
  CoreAutocompleteProps,
  AutocompleteProps
>(CoreAutocomplete, style, ({ size }) => ({ size }), defaultProps);

export type AutocompleteType = React.SFC<
  CoreAutocompleteProps & AutocompleteProps
> & {
  createOption: typeof CoreAutocomplete.createOption;
  createDivider: typeof CoreAutocomplete.createDivider;
};

const defaultSuffix = ;
export const Autocomplete: AutocompleteType = ((
  props: CoreAutocompleteProps & AutocompleteProps
) => {
  const { error, disabled, suffix } = props;
github wix / wix-ui-backoffice / src / components / Checkbox / Checkbox.e2e.ts View on Github external
it('should be unchecked and not disabled by default', async () => {
    const driver = checkboxTestkitFactory({dataHook});
    expect(await driver.isChecked()).toBe(false);
    expect(await driver.isDisabled()).toBe(false);
  });
github wix / wix-ui-backoffice / src / components / Checkbox / Checkbox.e2e.ts View on Github external
it('should be checked when clicked', async () => {
    const driver = checkboxTestkitFactory({dataHook});
    expect(await driver.isChecked()).toBe(false);
    await driver.click();
    expect(await driver.isChecked()).toBe(true);
  });
});
github wix / wix-ui-backoffice / src / components / Checkbox / Checkbox.e2e.ts View on Github external
eyes.it('should be unchecked', async () => {
      const driver = checkboxTestkitFactory({dataHook});
      expect(await driver.isChecked()).toBeFalsy();
    });
github wix / wix-ui-backoffice / src / components / AddressInput / AddressInput.spec.tsx View on Github external
import * as React from 'react';
import { createDriverFactory } from 'wix-ui-test-utils/driver-factory';
import { addressInputDriverFactory } from './AddressInput.driver';
import { AddressInput } from '.';
import { mount } from 'enzyme';
import { GoogleMapsClientStub } from 'wix-ui-core/dist/src/components/address-input/GoogleMapsClientStub';
import * as helper from 'wix-ui-core/dist/src/components/address-input/AddressInputTestHelper';
import * as waitForCond from 'wait-for-cond';
import { AddressInputProps } from './AddressInput';
import Search from 'wix-ui-icons-common/Search';

GoogleMapsClientStub.setAddresses([helper.ADDRESS_1, helper.ADDRESS_2]);
GoogleMapsClientStub.setGeocode(helper.GEOCODE_1);

const commonProps = {
  apiKey: '',
  Client: GoogleMapsClientStub,
  lang: 'ru',
  onSelect: () => null
};

describe('AddressInput', () => {
  const createDriver = createDriverFactory(addressInputDriverFactory);

  it('should always set the core prop forceContentElementVisibility to false', () => {
    const props = {
      ...commonProps,
      forceContentElementVisibility: true
github wix / wix-ui-backoffice / src / components / AddressInput / AddressInput.spec.tsx View on Github external
import * as React from 'react';
import { createDriverFactory } from 'wix-ui-test-utils/driver-factory';
import { addressInputDriverFactory } from './AddressInput.driver';
import { AddressInput } from '.';
import { mount } from 'enzyme';
import { GoogleMapsClientStub } from 'wix-ui-core/dist/src/components/address-input/GoogleMapsClientStub';
import * as helper from 'wix-ui-core/dist/src/components/address-input/AddressInputTestHelper';
import * as waitForCond from 'wait-for-cond';
import { AddressInputProps } from './AddressInput';
import Search from 'wix-ui-icons-common/Search';

GoogleMapsClientStub.setAddresses([helper.ADDRESS_1, helper.ADDRESS_2]);
GoogleMapsClientStub.setGeocode(helper.GEOCODE_1);

const commonProps = {
  apiKey: '',
  Client: GoogleMapsClientStub,
  lang: 'ru',
  onSelect: () => null
};

describe('AddressInput', () => {
  const createDriver = createDriverFactory(addressInputDriverFactory);

  it('should always set the core prop forceContentElementVisibility to false', () => {
    const props = {
      ...commonProps,
      forceContentElementVisibility: true
    } as AddressInputProps;
github wix / wix-ui-backoffice / src / components / Input / Input.e2e.ts View on Github external
eyes.it('should render', () => {
    const driver = inputTestkitFactory({dataHook});

    expect(driver.element().isDisplayed()).toBe(true);
  });
});