npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@telefonica/mistica

v15.5.0

Published

![Mistica for Web](img/mistica-web-light.svg#gh-light-mode-only) ![Mistica for Web](img/mistica-web-dark.svg#gh-dark-mode-only)

Downloads

9,252

Readme

Mistica for Web Mistica for Web

React components library for Telefonica Design System (Mistica)

Node.js CI

Getting started

Install

yarn add @telefonica/mistica

or

npm install @telefonica/mistica

Start using @telefonica/mistica

Before using any of our components you have to add <ThemeContextProvider> in the root of your React app. Here is a complete example of a form with two text fields and a submit button:

import {createRoot} from 'react-dom/client';
// Import Mistica styles. Depending on the bundler you use, you may need to import it in a different way.
import '@telefonica/mistica/css/mistica.css';

// Use mistica components
import {
  ThemeContextProvider,
  Form,
  Box,
  Stack,
  TextField,
  EmailField,
  ButtonLayout,
  ButtonPrimary,
  alert,
  getMovistarSkin,
} from '@telefonica/mistica';

const App = () => (
  <Form
    onSubmit={(formData) =>
      alert({
        title: 'This is your data',
        message: JSON.stringify(formData, null, 2),
      })
    }
  >
    <Box padding={16}>
      <Stack space={16}>
        <TextField name="name" label="Name" />
        <EmailField name="email" label="Email" />
        <ButtonLayout primaryButton={<ButtonPrimary submit>Send</ButtonPrimary>} />
      </Stack>
    </Box>
  </Form>
);

const misticaTheme = {
  skin: getMovistarSkin(),
  i18n: {locale: 'es-ES', phoneNumberFormattingRegionCode: 'ES'},
};

const container = document.getElementById('app');
const root = createRoot(container);
root.render(
  <ThemeContextProvider theme={misticaTheme}>
    <App />
  </ThemeContextProvider>
);

The theme prop in ThemeContextProvider is mandatory, and you can use it to configure some aspects of the library. There are multiple settings but the only two mandatory fields are skin and i18n. Read the theme config doc for more info.

:warning: Usually, the theme object is constant and won't need to change dynamically in your application, in that case we recommend to extract it to an external const variable outside of the component, this way the object reference will be the same in every re-render. If for some reason the theme must be dynamic in your app, consider to memoize it (for example, with React.useMemo hook).

Mistica in Next.js app router

If you are using Next.js app router, we highly recommend enabling the following experimental config:

experimental: {
  optimizePackageImports: ['@telefonica/mistica'];
}

This will improve the tree shaking of the library, reduce the bundle size and the build time. For more info read this Next blog post: https://vercel.com/blog/how-we-optimized-package-imports-in-next-js

Components

Explore the components in Mistica storybook

Start prototyping interfaces with Mistica components in the Mistica playroom

More docs

Development

  • yarn test: run tests
  • yarn test-acceptance: run acceptance tests headless (you need to start storybook first)
  • yarn test-acceptance --ui: run acceptance tests with ui (you need to start storybook first)
  • yarn lint: check codestyle
  • yarn ts-check: check static types
  • yarn build: build package
  • yarn storybook: starts storybook
  • yarn playroom: starts playroom

More about Mistica

Mistica in other platforms

Contributing

See CONTRIBUTING.md

Mistica Community

About Mistica Community

If you are building a Mistica Community component, place it inside the src/community folder and don't forget to export it in the src/community/index.ts file to make it public.