How to use the @instructure/ui-react-utils/lib/safeCloneElement function in @instructure/ui-react-utils

To help you get started, we’ve selected a few @instructure/ui-react-utils 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-table / src / components / Table / index.js View on Github external
{Children.map(children, (child) => {
          if (matchComponentTypes(child, [Head])) {
            return safeCloneElement(child, {
              key: child.props.name,
              isStacked,
            })
          }
          if (matchComponentTypes(child, [Body])) {
            return safeCloneElement(child, {
              key: child.props.name,
              isStacked,
              hover,
              headers,
            })
          }
          return null
        })}
github instructure / instructure-ui / packages / ui-tabs / src / components / Tabs / index.js View on Github external
clonePanel (index, id, selected, panel) {
    return safeCloneElement(panel, {
      ref: (c) => {
        this._panels[index] = c
      },
      id: `panel-${id}`,
      labelledBy: `tab-${id}`,
      selected,
      key: `panel-${id}`,
      variant: this.props.variant,
      padding: panel.props.padding || this.props.padding,
      textAlign: panel.props.textAlign || this.props.textAlign
    })
  }
github instructure / instructure-ui / packages / ui-table / src / components / Table / Body / index.js View on Github external
{Children.map(children, (child) => matchComponentTypes(child, [Row])
          ? safeCloneElement(child, {
            key: child.props.name,
            hover,
            isStacked,
            headers,
          })
          : null)}
github instructure / instructure-ui / packages / ui-tabs / src / components / TabList / index.js View on Github external
clonePanel (index, id, selected, panel) {
    return safeCloneElement(panel, {
      ref: (c) => {
        this._panels[index] = c
      },
      id: `panel-${id}`,
      labelledBy: `tab-${id}`,
      selected,
      key: `panel-${id}`,
      variant: this.props.variant,
      padding: panel.props.padding || this.props.padding,
      textAlign: panel.props.textAlign || this.props.textAlign
    })
  }
github instructure / instructure-ui / packages / ui-table / src / components / Table / Row / index.js View on Github external
{Children.map(children, (child, index) => {
          if (matchComponentTypes(child, [ColHeader])) {
            return child
          }
          if (matchComponentTypes(child, [RowHeader])) {
            return safeCloneElement(child, {
              key: child.props.name,
              isStacked,
            })
          }
          if (matchComponentTypes(child, [Cell])) {
            return safeCloneElement(child, {
              key: child.props.name,
              isStacked,
              header: headers && headers[index],
            })
          }
          return null
        })}