How to use the @zendeskgarden/react-theming.isRtl function in @zendeskgarden/react-theming

To help you get started, we’ve selected a few @zendeskgarden/react-theming 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 zendeskgarden / react-components / packages / checkboxes / src / views / Message.js View on Github external
const Message = styled.div.attrs(props => ({
  'data-garden-id': COMPONENT_ID,
  'data-garden-version': PACKAGE_VERSION,
  className: classNames(CheckboxStyles['c-chk__message'], {
    [CheckboxStyles['c-chk__message--success']]: props.validation === VALIDATION.SUCCESS,
    [CheckboxStyles['c-chk__message--warning']]: props.validation === VALIDATION.WARNING,
    [CheckboxStyles['c-chk__message--error']]: props.validation === VALIDATION.ERROR,

    // RTL
    [CheckboxStyles['is-rtl']]: isRtl(props)
  })
}))`
  ${props => retrieveTheme(COMPONENT_ID, props)};
github zendeskgarden / react-components / packages / radios / src / views / Message.js View on Github external
const Message = styled.div.attrs(props => ({
  'data-garden-id': COMPONENT_ID,
  'data-garden-version': PACKAGE_VERSION,
  className: classNames(CheckboxStyles['c-chk__message'], CheckboxStyles['c-chk__message--radio'], {
    [CheckboxStyles['c-chk__message--success']]: props.validation === VALIDATION.SUCCESS,
    [CheckboxStyles['c-chk__message--warning']]: props.validation === VALIDATION.WARNING,
    [CheckboxStyles['c-chk__message--error']]: props.validation === VALIDATION.ERROR,

    // RTL
    [CheckboxStyles['is-rtl']]: isRtl(props)
  })
}))`
  ${props => retrieveTheme(COMPONENT_ID, props)};
github zendeskgarden / react-components / packages / forms / src / styled / checkboxes / StyledCheckMessage.js View on Github external
const StyledCheckMessage = styled.div.attrs(props => ({
  className: classNames(CheckboxStyles['c-chk__message'], {
    [CheckboxStyles['c-chk__message--success']]: props.validation === VALIDATION.SUCCESS,
    [CheckboxStyles['c-chk__message--warning']]: props.validation === VALIDATION.WARNING,
    [CheckboxStyles['c-chk__message--error']]: props.validation === VALIDATION.ERROR,

    // RTL
    [CheckboxStyles['is-rtl']]: isRtl(props)
  })
}))`
  ${props => retrieveTheme('forms.check_message', props)};
github zendeskgarden / react-components / packages / notifications / src / Notification.js View on Github external
const Notification = styled.div.attrs(props => ({
  'data-garden-id': COMPONENT_ID,
  'data-garden-version': PACKAGE_VERSION,
  className: classNames(CalloutStyles['c-callout'], CalloutStyles['c-callout--dialog'], {
    // RTL
    [CalloutStyles['is-rtl']]: isRtl(props),

    // Validation types
    [CalloutStyles['c-callout--success']]: props.type === VALIDATION.SUCCESS,
    [CalloutStyles['c-callout--warning']]: props.type === VALIDATION.WARNING,
    [CalloutStyles['c-callout--error']]: props.type === VALIDATION.ERROR,
    [CalloutStyles['c-callout--info']]: props.type === VALIDATION.INFO
  })
}))`
  ${props => retrieveTheme(COMPONENT_ID, props)};
github zendeskgarden / react-components / packages / checkboxes / src / views / Hint.js View on Github external
const Hint = styled.div.attrs(props => ({
  'data-garden-id': COMPONENT_ID,
  'data-garden-version': PACKAGE_VERSION,
  className: classNames(CheckboxStyles['c-chk__hint'], {
    // RTL
    [CheckboxStyles['is-rtl']]: isRtl(props)
  })
}))`
  ${props => retrieveTheme(COMPONENT_ID, props)};
github zendeskgarden / react-components / packages / forms / src / styled / text / StyledTextarea.js View on Github external
const StyledTextarea = styled(StyledTextInput.withComponent('textarea')).attrs(props => ({
  className: classNames(props.className, TextStyles['c-txt__input--area'], {
    [TextStyles['is-resizable']]: props.resizable,

    // RTL
    [TextStyles['is-rtl']]: isRtl(props)
  })
}))`
  ${props => retrieveTheme('forms.text_area', props)};
github zendeskgarden / react-components / packages / toggles / src / views / Message.js View on Github external
const Message = styled.div.attrs(props => ({
  'data-garden-id': COMPONENT_ID,
  'data-garden-version': PACKAGE_VERSION,
  className: classNames(
    CheckboxStyles['c-chk__message'],
    CheckboxStyles['c-chk__message--toggle'],
    {
      [CheckboxStyles['c-chk__message--success']]: props.validation === VALIDATION.SUCCESS,
      [CheckboxStyles['c-chk__message--warning']]: props.validation === VALIDATION.WARNING,
      [CheckboxStyles['c-chk__message--error']]: props.validation === VALIDATION.ERROR,

      // RTL
      [CheckboxStyles['is-rtl']]: isRtl(props)
    }
  )
}))`
  ${props => retrieveTheme(COMPONENT_ID, props)};
github zendeskgarden / react-components / packages / buttons / src / elements / ButtonGroup.js View on Github external
const ButtonGroup = ({ id, selectedKey, onStateChange, children, ...otherProps }) => {
  const [controlledSelectedItem, setControlledSelectedItem] = useState(selectedKey);

  const { selectedItem, focusedItem, getButtonProps, getGroupProps } = useButtonGroup({
    id,
    rtl: isRtl(otherProps),
    defaultSelectedIndex: 0,
    selectedItem: selectedKey === undefined ? controlledSelectedItem : selectedKey,
    onSelect: newSelectedItem => {
      if (onStateChange) {
        onStateChange({ selectedKey: newSelectedItem });
      } else {
        setControlledSelectedItem(newSelectedItem);
      }
    }
  });

  const buttons = Children.map(children, child => {
    if (!isValidElement(child)) {
      return child;
    }
github zendeskgarden / react-components / packages / dropdowns / src / Multiselect / Multiselect.tsx View on Github external
onKeyDown: (e: KeyboardEvent) => {
                  if (!inputValue) {
                    if (isRtl(props) && e.keyCode === KEY_CODES.RIGHT && selectedItems.length > 0) {
                      setFocusedItem(selectedItems[selectedItems.length - 1]);
                    } else if (
                      !isRtl(props) &&
                      e.keyCode === KEY_CODES.LEFT &&
                      selectedItems.length > 0
                    ) {
                      setFocusedItem(selectedItems[selectedItems.length - 1]);
                    } else if (e.keyCode === KEY_CODES.BACKSPACE && selectedItems.length > 0) {
                      (setDownshiftState as any)({
                        type: REMOVE_ITEM_STATE_TYPE,
                        selectedItem: selectedItems[selectedItems.length - 1]
                      });
                      (e as any).nativeEvent.preventDownshiftDefault = true;
                      e.preventDefault();
                      e.stopPropagation();
                    }
                  }
                },
                isVisible: isFocused || inputValue || selectedItems.length === 0,