How to use the @uifabric/utilities.getNativeProps function in @uifabric/utilities

To help you get started, we’ve selected a few @uifabric/utilities 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 microsoft / fluent-ui-react / src / components / FocusZone / FocusZone.tsx View on Github external
public render() {
    const { rootProps, ariaDescribedBy, ariaLabelledBy, className } = this.props
    const divProps = getNativeProps(this.props, htmlElementProperties)

    const Tag = this.props.elementType || 'div'

    return (
github OfficeDev / office-ui-fabric-react / packages / react-cards / src / components / Card / Card.view.tsx View on Github external
export const CardView: ICardComponent['view'] = props => {
  const Slots = getSlots(props, {
    root: Stack
  });

  const { children, styles, tokens, horizontal, onClick, onKeyDown, ...rest } = props;

  const nativeProps = getNativeProps>(rest, htmlElementProperties);

  // Get childrenGap and childrenMargin token values.
  const childrenGap = tokens && (tokens as ICardTokens).childrenGap;
  const childrenMargin = tokens && (tokens as ICardTokens).childrenMargin;
  const childrenCount = React.Children.count(children);

  /* The map function below takes the Card children and applies the correct margin and gap tokens to them, ensuring at the same time that
   * they are of type CardItem or CardSection. */
  const cardChildren: (React.ReactChild | null)[] = React.Children.map(
    children,
    (child: React.ReactElement, index: number) => {
      if (!child) {
        return null;
      }

      // Ensure that we're dealing with CardItems and CardSections and throw a warning otherwise.
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / CommandBar / CommandBar.base.tsx View on Github external
onGrowData = this._onGrowData
    } = this.props;

    const commandBarData: ICommandBarData = {
      primaryItems: [...items],
      overflowItems: [...overflowItems!],
      minimumOverflowItems: [...overflowItems!].length, // for tracking
      farItems,
      cacheKey: ''
    };

    this._classNames = getClassNames(styles!, { theme: theme! });

    // ResizeGroup will render these attributes to the root <div>.
    // TODO We may need to elevate classNames from  into  ?
    const nativeProps = getNativeProps&gt;(this.props, divProperties);

    return (
      
    );
  }
</div>
github OfficeDev / office-ui-fabric-react / packages / date-time / src / components / DatePicker / DatePicker.base.tsx View on Github external
allFocusable,
      calendarAs: CalendarType = Calendar,
      tabIndex
    } = this.props;
    const { isDatePickerShown, formattedDate, selectedDate } = this.state;

    const classNames = getClassNames(styles, {
      theme: theme!,
      className,
      disabled,
      label: !!label,
      isDatePickerShown
    });

    const calloutId = getId('DatePicker-Callout');
    const nativeProps = getNativeProps&gt;(this.props, divProperties, ['value']);
    const iconProps = textFieldProps &amp;&amp; textFieldProps.iconProps;

    return (
      <div>
        <div aria-owns="{isDatePickerShown" aria-haspopup="true">
          </div></div>
github OfficeDev / office-ui-fabric-react / packages / example-component / src / ExampleComponent.tsx View on Github external
private _onRenderRoot = (props: IExampleComponentProps): JSX.Element =&gt; {
    const { className, href }: IExampleComponentProps = this.props;

    if (!!href) {
      const anchorProps: React.HTMLAttributes =
        getNativeProps(this.props, anchorProperties);

      return (
        <a>
      );
    } else {
      const buttonProps: React.HTMLAttributes =
        getNativeProps(this.props, buttonProperties);

      return (
        </a>
github OfficeDev / office-ui-fabric-react / packages / example-component / src / ExampleComponent.tsx View on Github external
const { className, href }: IExampleComponentProps = this.props;

    if (!!href) {
      const anchorProps: React.HTMLAttributes =
        getNativeProps(this.props, anchorProperties);

      return (
        <a>
      );
    } else {
      const buttonProps: React.HTMLAttributes =
        getNativeProps(this.props, buttonProperties);

      return (
        <button>
      );
    }
  }
</button></a>