How to use the sku/react-treat.useStyles function in sku

To help you get started, we’ve selected a few sku 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 seek-oss / braid-design-system / lib / components / Dropdown / Dropdown.tsx View on Github external
(props: DropdownProps, ref) => {
    const {
      children,
      value,
      onChange,
      onBlur,
      onFocus,
      placeholder,
      ...restProps
    } = props;

    const styles = useStyles(styleRefs);

    Children.forEach(children, child => {
      if (!(isValidElement(child) && /^(option|optgroup)$/.test(child.type))) {
        throw new Error(
          '`Dropdown` only accepts children of type `option` or `optgroup`.',
        );
      }
    });

    return (
github seek-oss / braid-design-system / lib / hooks / typography / index.ts View on Github external
export function useHeading({
  weight = 'regular',
  level,
  baseline,
  backgroundContext,
  _LEGACY_SPACE_ = false,
}: UseHeadingParams) {
  const styles = useStyles(styleRefs);
  const textTone = useTextTone({ tone: 'neutral', backgroundContext });

  return classnames(
    styles.fontFamily,
    styles.headingWeight[weight],
    styles.heading[level].base,
    _LEGACY_SPACE_ ? null : styles.heading[level].cropFirstLine,
    textTone,
    {
      [styles.heading[level].baseline]: baseline,
    },
  );
}
github seek-oss / braid-design-system / lib / components / Autosuggest / Autosuggest.tsx View on Github external
function GroupHeading({ children }: GroupHeadingProps) {
  const styles = useStyles(styleRefs);

  return (
github seek-oss / braid-design-system / lib / hooks / typography / index.ts View on Github external
export function useTextSize(size: keyof typeof styleRefs.text) {
  return useStyles(styleRefs).text[size].base;
}
github seek-oss / braid-design-system / lib / components / Autosuggest / Autosuggest.tsx View on Github external
export function Autosuggest({
  id,
  value = fallbackValue,
  suggestions = fallbackSuggestions,
  onChange = noop,
  automaticSelection = false,
  showMobileBackdrop = false,
  scrollToTopOnMobile = true,
  onFocus = noop,
  onBlur = noop,
  placeholder,
  ...restProps
}: AutosuggestProps) {
  const styles = useStyles(styleRefs);

  const fireChange = useCallback(
    (suggestion: Suggestion) =>
      onChange(valueFromSuggestion(suggestion)),
    [onChange],
  );

  const inputRef = useRef(null);
  const rootRef = useRef(null);
  const menuRef = useRef(null);
  const justPressedArrowRef = useRef(false);
  const mobileDetectionRef = useRef(null);
  const {
    normalisedSuggestions,
    groupHeadingIndexes,
    groupHeadingForSuggestion,
github seek-oss / braid-design-system / lib / components / TextArea / TextArea.tsx View on Github external
(
    { value, onChange, onBlur, onFocus, placeholder, limit, ...restProps },
    ref,
  ) => {
    const styles = useStyles(styleRefs);

    return (
      
        {({ className, ...fieldProps }, fieldRef) => (
github seek-oss / braid-design-system / lib / components / Divider / Divider.tsx View on Github external
export const Divider = () => {
  const styles = useStyles(styleRefs);

  return (
    
      
    
  );
};
github seek-oss / braid-design-system / lib / components / Toggle / Toggle.tsx View on Github external
export const Toggle = ({
  id,
  on,
  onChange,
  label,
  align = 'left',
}: ToggleProps) => {
  const styles = useStyles(styleRefs);

  return (
github seek-oss / braid-design-system / lib / hooks / useIcon / index.ts View on Github external
export const useIconContainerSize = ({
  size = 'standard',
}: UseIconContainerSizeProps = {}) => {
  const styles = useStyles(styleRefs);
  return styles.blockSizes[size];
};
github seek-oss / braid-design-system / lib / components / TextLinkRenderer / TextLinkRenderer.tsx View on Github external
function useLinkStyles(showVisited: boolean) {
  const styles = useStyles(styleRefs);
  const inHeading = useContext(HeadingContext);
  const backgroundContext = useBackground();
  const mediumWeight = useWeight('medium');
  const highlightLink = backgroundContext === 'card' || !backgroundContext;

  return [
    highlightLink ? styles.underlineOnHoverOnly : styles.underlineAlways,
    useTextTone({ tone: highlightLink ? 'link' : 'neutral' }),
    !inHeading ? mediumWeight : null,
    showVisited ? styles.visited : null,
  ];
}

sku

Front-end development toolkit, powered by Webpack, Babel, Vanilla Extract and Jest

MIT
Latest version published 1 day ago

Package Health Score

78 / 100
Full package analysis