How to use the @storybook/csf.parseKind function in @storybook/csf

To help you get started, we’ve selected a few @storybook/csf 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 storybookjs / storybook / addons / docs / src / blocks / Title.tsx View on Github external
hierarchySeparator: groupSeparator,
  } = (parameters && parameters.options) || {
    showRoots: undefined,
    hierarchyRootSeparator: '|',
    hierarchySeparator: /\/|\./,
  };

  let groups;
  if (typeof showRoots !== 'undefined') {
    groups = selectedKind.split('/');
  } else {
    // This covers off all the remaining cases:
    //   - If the separators were set above, we should use them
    //   - If they weren't set, we should only should use the old defaults if the kind contains '.' or '|',
    //     which for this particular splitting is the only case in which it actually matters.
    ({ groups } = parseKind(selectedKind, { rootSeparator, groupSeparator }));
  }

  return (groups && groups[groups.length - 1]) || selectedKind;
};

@storybook/csf

Component Story Format (CSF) utilities

MIT
Latest version published 4 months ago

Package Health Score

80 / 100
Full package analysis

Popular @storybook/csf functions