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

@shopify/checkout-ui-react

v0.6.0

Published

Checkout UI library

Downloads

292

Readme

@shopify/checkout-ui-react

This library provides reference implementations of the UI components available in Checkout. These components are copied from a private Shopify repo periodically to serve primarily as a reference implementation.

This library is intended to be used to help produce WYSIWYG editors for Shopify checkout extensions that will use Checkout UI Extensions at runtime. Since Checkout UI Extensions components do not actually render to the DOM, these components help demonstrate the necessary styles and event handling for the UI components that Checkout UI Extensions maps to. These are the exact same components used at Shopify to render a Checkout UI extension.

More components are available in this package than are provided by Checkout UI Extensions. The set of components we provide will grow over time (and if you see anything in this library you would love to add, please raise an issue in the UI Extensions repo), but this library includes all of the UI components we use throughout checkout as a convenience for us at Shopify in generating this package. Any components, properties, or other functionality that you see in this package that does not match the component APIs provided by Checkout UI Extensions is considered unstable, and may be removed or changed at any time without notice. Additionally, components in this library have no documentation; refer to the Checkout UI Extensions component documentation for details on the usage of the many components and props provided by this library.

Installation

@shopify/checkout-ui-react is provided as npm package.

yarn add @shopify/checkout-ui-react
#or
npm install @shopify/checkout-ui-react

Technical details

This library is authored with React. However, the Checkout UI Extensions host that Shopify provides aliases all React APIs to Preact, a lightweight alternative to React. If you are using these components directly, we recommend you do the same (see the webpack section below for details).

The UI components in this library require a few pieces of React context, and some global styles. To make this easier for you, we’ve included a single Context component you can wrap around your React application that will provide all of these global requirements. You can import this component from @shopify/checkout-ui-react/ui-extensions:

import React from 'react';
import {Context} from '@shopify/checkout-ui-react/ui-extensions';
import {Text} from '@shopify/checkout-ui-react';

export default function App() {
  return (
    <Context>
      <AppUi />
    </Context>
  );
}

function AppUi() {
  return <Text>I can safely use UI components now!</Text>;
}

webpack

Shopify uses webpack to bundle code for running in the browser. This package provides a function you can use to augment an existing webpack configuration with all that is necessary to properly build this library. This includes additional configuration for handling the JavaScript build outputs for this library, as well as CSS, SVGs, and other assets.

// in webpack.config.js

const {addWebpackConfig} = require('@shopify/checkout-ui-react/webpack');

module.exports = addWebpackConfig({
  // Your own webpack config goes here
});

// `addWebpackConfig` accepts some options to customize the build
module.exports = addWebpackConfig(
  {
    // Your own webpack config goes here
  },
  {
    // disable the automatic `preact` aliasing:
    preact: false,
    // whether build is for development or production. Defaults to `NODE_ENV === "development"`
    development: true,
  },
);

If you are not using webpack to bundle your application, you will need to replicate the handling of various file types in the build tool you are using. Additionally, unlike with Shopify’s Polaris component library, this library does not offer plain HTML/ CSS assets.

Contributing

As noted above, this repo is periodically updated from a private Shopify repo that is the source of truth. As a result, no contributions are currently being accepted for this library.

License

MIT © Shopify, see LICENSE.md for details.