How to use @ui5/webcomponents-react-base - 10 common examples

To help you get started, we’ve selected a few @ui5/webcomponents-react-base 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 SAP / ui5-webcomponents-react / packages / main / src / components / FlexBox / index.tsx View on Github external
children,
    justifyContent,
    direction,
    alignItems,
    height,
    width,
    displayInline,
    wrap,
    style,
    className,
    tooltip,
    slot
  } = props;

  const classes = useStyles();
  const flexBoxClasses = StyleClassHelper.of(classes.flexBox);
  // direction
  flexBoxClasses.put(classes[`flexBoxDirection${direction}`]);
  // justify content
  flexBoxClasses.put(classes[`justifyContent${justifyContent}`]);
  // align items
  flexBoxClasses.put(classes[`alignItems${alignItems}`]);
  // wrapping
  flexBoxClasses.put(classes[`flexWrap${wrap}`]);

  if (displayInline) {
    flexBoxClasses.put(classes.flexBoxDisplayInline);
  }

  if (className) {
    flexBoxClasses.put(className);
  }
github SAP / ui5-webcomponents-react / packages / main / src / components / FilterItem / index.tsx View on Github external
// @ts-ignore
                  if (child.props.hasOwnProperty(changeEventName)) {
                    // @ts-ignore
                    child.props[changeEventName](event);
                  }
                },
                valueParameter: valueParamName,
                style: { width: '100%' }
              });
            })}
          
        );
    }
  }, [valueParamName, changeEventName, filterItems, loading, type, children]);

  const filterItemClasses = StyleClassHelper.of(classes.filterItem);

  return (
    <div title="{tooltip}" style="{style}">
      <div>
        <label>{label}</label>
        {filterComponent}
      </div>
    </div>
  );
});
github SAP / ui5-webcomponents-react / packages / main / src / internal / withWebComponent.tsx View on Github external
}, {});

    const eventMeta = getWebComponentMetadata().getEvents()[eventIdentifier] || {};

    payload = Object.keys(eventMeta).reduce((acc, val) => {
      if (val === 'detail' && e[val]) {
        return {
          ...acc,
          ...e[val]
        };
      }
      acc[val] = (e.detail && e.detail[val]) || e[val];
      return acc;
    }, payload);
    // TODO: Pass Web Component Ref in here?
    eventHandler(Event.of(null, e, payload));
  };
github SAP / ui5-webcomponents-react / packages / charts / src / components / LineChart / index.tsx View on Github external
label: formatTooltipLabel(categoryAxisFormatter, valueAxisFormatter)
        }
      },
      plugins: {
        datalabels: {
          formatter: formatDataLabel(valueAxisFormatter)
        }
      }
    };
  }, [categoryAxisFormatter, valueAxisFormatter]);
  const chartOptions = useMergedConfig(lineChartDefaultConfig, options);

  const theme: any = useTheme();
  const data = useChartData(labels, datasets, colors, theme.theme);

  const chartRef = useConsolidatedRef(ref);
  const handleLegendItemPress = useLegendItemClickHandler(chartRef, legendRef);
  useLegend(chartRef, legendRef, noLegend, handleLegendItemPress);

  return (
github SAP / ui5-webcomponents-react / packages / charts / src / components / ChartContainer / withChartContainer.tsx View on Github external
return (
      <div title="{tooltip}" style="{style}">
        {loading &amp;&amp; datasets.length &gt; 0 &amp;&amp; }
        {/*
        // @ts-ignore */}
        {loading &amp;&amp; datasets.length === 0 &amp;&amp; }
        {datasets.length &gt; 0 &amp;&amp; }
      </div>
    );
  };

  ChartContainer.defaultProps = Component.defaultProps;
  hoistNonReactStatics(ChartContainer, Component);

  return withStyles(styles)(ChartContainer);
};
github SAP / ui5-webcomponents-react / packages / main / src / components / ObjectPageSection / index.tsx View on Github external
(props: ObjectPageSectionPropTypes, ref: RefObject) =&gt; {
    const { title, id, children, titleUppercase, className, style, tooltip } = props;
    const classes = useStyles();

    if (!id) {
      throw new EmptyIdPropException('ObjectPageSection requires a unique ID property!');
    }

    const sectionRef: RefObject = useConsolidatedRef(ref);
    const htmlId = `ObjectPageSection-${id}`;

    useScrollElement(htmlId, sectionRef, {
      spy: true
    });

    const titleClasses = StyleClassHelper.of(classes.title);
    if (titleUppercase) {
      titleClasses.put(classes.uppercase);
    }

    return (
      <section title="{tooltip}" style="{style}" role="region" id="{htmlId}">
        <div role="heading">
          <div>{title}</div>
        </div>
        {/* TODO Check for subsections as they should win over the children */}
        <div>
          <div>{children}</div></div></section>
github SAP / ui5-webcomponents-react / packages / main / src / components / AnalyticalCard / AnalyticalCard.jss.ts View on Github external
const styles = ({ parameters }: JSSTheme) => ({
  card: {
    backgroundColor: parameters.sapUiTileBackground,
    // TODO There is a border mentioned in the specs, but this one looks weird.
    // border: `0.625rem solid ${parameters.sapUiTileBorderColor}`,
    boxShadow: parameters.sapUiShadowLevel0,
    borderRadius: '0.25rem',
    textAlign: 'start',
    overflow: 'hidden',
    position: 'relative',
    fontFamily: parameters.sapUiFontFamily,
    boxSizing: 'border-box'
  },
  content: spacing.sapUiContentPadding
});
github SAP / ui5-webcomponents-react / packages / main / src / components / Avatar / Avatar.karma.tsx View on Github external
it('enter key down', () =&gt; {
    const callback = sinon.spy();
    const wrapper = mountThemedComponent();
    wrapper.find(Avatar).simulate('keyDown', { keyCode: KeyCodes.ENTER });
    expect(callback.called).to.equal(true);
  });
github SAP / ui5-webcomponents-react / packages / main / src / components / Avatar / Avatar.karma.tsx View on Github external
it('other key down', () =&gt; {
    const callback = sinon.spy();
    const wrapper = mountThemedComponent();
    wrapper.find(Avatar).simulate('keyDown', { keyCode: KeyCodes.PAGE_DOWN });
    expect(callback.called).to.equal(false);
  });
});
github SAP / ui5-webcomponents-react / packages / main / src / components / AnalyticalCardHeader / index.tsx View on Github external
const indicatorIcon = useMemo(() => {
      const arrowClasses = StyleClassHelper.of(classes.arrowIndicatorShape);
      switch (arrowIndicator) {
        case DeviationIndicator.Up:
          arrowClasses.put(classes.arrowUp);
          break;
        case DeviationIndicator.Down:
          arrowClasses.put(classes.arrowDown);
          break;
        default:
          arrowClasses.put(classes.arrowRight);
          break;
      }

      switch (indicatorState) {
        case ValueState.Success:
          arrowClasses.put(classes.good);
          break;