How to use the @instructure/console/macro.warn function in @instructure/console

To help you get started, we’ve selected a few @instructure/console 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 instructure / instructure-ui / packages / ui-link / src / Link / index.js View on Github external
get containsTruncateText () {
    let truncateText = false

    React.Children.forEach(this.props.children, (child) => {
      if (child && matchComponentTypes(child, ['TruncateText'])) {
        truncateText = true
      }
    })

    warn( // if display prop is used, warn about icon or TruncateText
      !truncateText || this.props.display === undefined,
      '[Link] Using the display property with TruncateText may cause layout issues.'
    )

    return truncateText
  }
github instructure / instructure-ui / packages / ui-link / src / Link / index.js View on Github external
renderIcon () {
    warn( // if display prop is used, warn about icon or TruncateText
      this.props.display === undefined,
      '[Link] Using the display property with an icon may cause layout issues.'
    )

    return <span>{callRenderProp(this.props.renderIcon)}</span>
  }
github instructure / instructure-ui / packages / ui-react-utils / src / hack.js View on Github external
hackProps.forEach((hackProp) => {
    warn(
      (typeof props[hackProp] === 'undefined'),
      `[${displayName}] The \`${hackProp}\` prop is a temporary hack and will be removed in a future release. ${message}`
    )
  })
}
github instructure / instructure-ui / packages / ui-a11y / src / ScreenReaderFocusRegion.js View on Github external
return iframes.map((iframe) => {
        let body = null
        try {
          body = iframe.contentDocument.body
        } catch (e) {
          warn(false, `[ui-a11y] could not find a document for iframe: ${e}`, iframe)
        }
        return body
      })
      .filter(body => body !== null)
github instructure / instructure-ui / packages / ui-themeable / src / ApplyTheme / index.js View on Github external
getChildContext () {
    let theme = this.props.theme || {}

    const parentThemeContext = ThemeContext.getThemeContext(this.context) || {}

    if (parentThemeContext.immutable && parentThemeContext.theme) {
      warn(
        !this.props.theme,
        '[ApplyTheme] Parent theme is immutable. Cannot apply theme: %O',
        this.props.theme
      )
      theme = parentThemeContext.theme
    } else if (parentThemeContext.theme) {
      theme = mergeDeep(parentThemeContext.theme, theme)
    }

    return ThemeContext.makeThemeContext(theme, parentThemeContext.immutable || this.props.immutable)
  }
github instructure / instructure-ui / packages / ui-react-utils / src / experimental.js View on Github external
experimentalProps.forEach((experimentalProp) => {
    warn(
      (typeof props[experimentalProp] === 'undefined'),
      `[${displayName}] The \`${experimentalProp}\` prop is experimental and its API could change significantly in a future release. ${message}`
    )
  })
}
github instructure / instructure-ui / packages / ui-react-utils / src / deprecated.js View on Github external
return (props, propName, componentName, ...rest) => {
      const isDeprecatedValue = deprecated.includes(props[propName])

      const warningMessage = (message && typeof message === 'function') ? message({ props, propName, propValue: props[propName] }) : (
        `The '${props[propName]}' value for the \`${propName}\` prop is deprecated. ${message || ''}`
      )

      warn(!isDeprecatedValue, `[${componentName}] ${warningMessage}`)

      return isDeprecatedValue ? null : propType(props, propName, componentName, ...rest)
    }
  }
github instructure / instructure-ui / packages / ui-buttons / src / Button / index.js View on Github external
React.Children.forEach(children, (child) => {
          const icon = child && child.type && typeof child.type.glyphName !== 'undefined'
          warn(
            !icon,
            `[Button] Icons as children is deprecated. Please use the 'icon' prop instead.`
          )
        })
      }
github instructure / instructure-ui / packages / ui-themeable / src / setTextDirection.js View on Github external
function setTextDirection () {
  if (hasRan) return
  hasRan = true
  if (canUseDOM) {
    const dir = document.documentElement.getAttribute('dir')
    if (!dir) {
      warn(dir,
        `[themeable] component styles require setting a 'dir' attribute on the HTML element.
        To prevent breaking changes, we'll set it to a default value: 'ltr'.`
      )
      document.documentElement.setAttribute('dir', 'ltr')
    }
  }
}
github instructure / instructure-ui / packages / ui-react-utils / src / experimental.js View on Github external
function warnExperimentalComponent (displayName, message = '') {
  warn(
    false,
    `[${displayName}] is experimental and its API could change significantly in a future release. ${message}`
  )
}

@instructure/console

A babel macro made by Instructure Inc.

MIT
Latest version published 5 days ago

Package Health Score

87 / 100
Full package analysis

Similar packages