GithubHelp home page GithubHelp logo

saleor / macaw-ui Goto Github PK

View Code? Open in Web Editor NEW
92.0 92.0 32.0 13.09 MB

MacawUI: an official UI design kit for Saleor

Home Page: https://macaw-ui.vercel.app

TypeScript 96.58% JavaScript 0.85% Shell 0.06% HTML 0.12% CSS 0.01% MDX 2.38%
hacktoberfest react react-components typescript

macaw-ui's Introduction

saleor-commerce-logo
Commerce that works with your language and stack
GraphQL native, API-only platform for scalable composable commerce.

Join our community:
Website | Twitter | GitHub Discussions | Discord

Table of Contents

What makes Saleor special?

  • Technology-agnostic - no monolithic plugin architecture or technology lock-in.

  • GraphQL only - Not afterthought API design or fragmentation across different styles of API.

  • Headless and API only - APIs are the only way to interact, configure, or extend the backend.

  • Open source - a single version of Saleor without feature fragmentation or commercial limitations.

  • Cloud native - battle tested on global brands.

  • Native-multichannel - Per channel control of pricing, currencies, stock, product, and more.

Why API-only Architecture?

Saleor's API-first extensibility provides powerful tools for developers to extend backend using webhooks, attributes, metadata, apps, subscription queries, API extensions, dashboard iframes.

Compared to traditional plugin architectures (monoliths) it provides the following benefits:

  • There is less downtime as apps are deployed independently.
  • Reliability and performance - custom logic is separated from the core.
  • Simplified upgrade paths - eliminates incompatibility conflicts between extensions.
  • Technology-agnostic - works with any technology, stack, or language.
  • Parallel development - easier to collaborate than with a monolithic core.
  • Simplified debugging - easier to narrow down bugs in independent services.
  • Scalability - extensions and apps can be scaled independently.

What are the tradeoffs?

If you are a single developer working with a small business that doesn't have high traffic or a critical need for 24/7 availability, using a service-oriented approach might feel more complex compared to the traditional WordPress or Magento approach that provides a language-specific framework, runtime, database schema, aspect-oriented programming, and other tools to a quick start.

However, if you deploy on a daily basis, reliability and uptime is critical, you need to collaborate with other developers, or you have non-trivial requirements you might be in the right place.

Features

  • Enterprise ready: Secure, scalable, and stable. Battle-tested by big brands
  • Dashboard: User-friendly, fast, and productive. (Decoupled project repo )
  • Global by design Multi-currency, multi-language, multi-warehouse, tutti multi!
  • CMS: Manage product or marketing content.
  • Product management: A rich content model for large and complex catalogs.
  • Orders: Flexible order model, split payments, multi-warehouse, returns, and more.
  • Customers: Order history and preferences.
  • Promotion engine: Sales, vouchers, cart rules, giftcards.
  • Payment orchestration: multi-gateway, extensible payment API, flexible flows.
  • Cart: Advanced payment and tax options, with full control over discounts and promotions.
  • Payments: Flexible API architecture allows integration of any payment method.
  • Translations: Fully translatable catalog.
  • SEO: Unlimited SEO freedom with headless architecture.
  • Apps: Extend dashboard via iframe with any web stack.

Saleor Dashboard - Modern UI for managing your e-commerce

Installation

See the Saleor docs for step-by-step installation and deployment instructions.

Note: The main branch is the development version of Saleor and it may be unstable. To use the latest stable version, download it from the Releases page or switch to a release tag.

The current production-ready version is 3.x and you should use this version for all three components:

Saleor Cloud

The fastest way to develop with Saleor is by using developer accounts in Saleor Cloud.

Register here or install our CLI tool:

npm i -g @saleor/cli

and run the following command:

saleor register

Bootstrap your first storefront with:

saleor storefront create --url {your-saleor-graphql-endpoint}

Documentation

Saleor documentation is available here: docs.saleor.io

To contribute, please see the saleor/saleor-docs repository.

Saleor Platform

The easiest way to run all components of Saleor (API, storefront, and dashboard) together on your local machine is to use the saleor-platform project. Go to that repository for instructions on how to use it.

View saleor-platform

Storefront

An open-source storefront example built with Next.js App Router, React.js, TypeScript, GraphQL, and Tailwind CSS.

React Storefront Repository

View Storefront Example

Dashboard

For the dashboard, go to the saleor-dashboard repository.

Contributing

We love your contributions and do our best to provide you with mentorship and support. If you are looking for an issue to tackle, take a look at issues labeled Good first issue

If nothing grabs your attention, check our roadmap or come up with your feature. Just drop us a line or open an issue and we’ll work out how to handle it.

Get more details in our Contributing Guide.

License

Disclaimer: Everything you see here is open and free to use as long as you comply with the license. There are no hidden charges. We promise to do our best to fix bugs and improve the code.

Crafted with ❤️ by Saleor Commerce

[email protected]

macaw-ui's People

Contributors

andrzejewsky avatar cloud11pl avatar dependabot[bot] avatar dominik-zeglen avatar droniu avatar jwm0 avatar kamilpastuszka avatar krzysztofzuraw avatar orzechdev avatar poulch avatar qunm00 avatar sektordv avatar timuric avatar typeofweb avatar witoszekdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macaw-ui's Issues

Implement Alert component

What I'm trying to achieve

I want to have an Alert component that can be used e.g in the dashboard.

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

223410114-5b664e34-10c4-42ee-8999-c1a9fc71df8f

CleanShot 2023-03-10 at 12 50 44@2x

Change font to Inter in MacawUI

What I'm trying to achieve

I want to have the proper font used in MacawUI.

Describe a proposed solution

Apply Inter (variable) font.

Acceptance Criteria

  • <Text /> component should use the Inter font
  • We should bundle the Inter font inside MacawUI (??)

Implement Rich Text input component

What I'm trying to achieve

I want to have rich text input component in new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-15 at 09 41 23@2x

Implement Select input

What I'm trying to achieve

I want a dropdown input with the new MacawUI design based on Figma.

Describe a proposed solution

We should implement Dropdown on top of BaseInput from #232. This story is only about simple Dropdowns without autocomplete.

We should also check the current Dashboard for MUI Dropdown usage and add the missing API

As #342 will be merged we can add a new prop to combobox that will allow users only to select a value from combobox without autocomplete.

Acceptance Criteria

  • Implement new inputs according to the design

[RFC] MacawUI Design System

What we’re trying to achieve

We want to introduce a new version of MacawUI which will be a design system. The current version has a few problems:

  • Macaw UI is using an outdated version of MUI (using the current Macaw + MUI often requires writing some hacks).
  • Moving out of component library constraints requires a lot of work.
  • Macaw and MUI are quite slow by today’s standards, it takes a while to load on fresh render (especially noticeable in apps).

Describe a proposed solution

Introduce a design system consisting of 3 parts:

  • design primitives
  • UI components
  • documentation

What are the goals of the new version of Macaw UI

  • 3rd party applications using embedded in the dashboard should comply with the theme
  • Should support UI components for Dashboard, Cloud, and Apps projects.
  • 3rd party developers should have access to components and design primitives to ensure that their layout and custom components comply with the theme
  • As the macaw theme evolves, 3rd party applications should be backward compatible with the theme
  • We can make assumptions about the stack of the 3rd party developers. Therefore there should be a framework-agnostic way to expose the design system, for example, JS dictionary, CSS variables, etc.

Design primitives

Design primitives (tokens) should be the foundation of the Design System. We will have primitives for:

  1. Typography
  2. Spacing
  3. Colors
  4. Shadows
  5. Border radiuses

Warning
Code examples are created with CSS calc to demonstrate scales but in implementation, we are going to calculate variables inside JS and expose ready values as CSS variables.

Specific values of tokens can be adjusted by the theme creator - in this RFC we want to show the approach to managing and defining them.

Typography

  • Font: Rubik.
  • Font size: calculated as a scale from base font size multiplied by scale. For a visual representation of scale see type-scale.com.
  • Line height: two values for headings and texts.

CSS variables example:

:root {
  --font-size-scale: 1.2;

  --font-size-1: 0.75rem;
  --font-size-2: calc(var(--font-size-1) * var(--font-size-scale));
  --font-size-3: calc(var(--font-size-2) * var(--font-size-scale));
  --font-size-4: calc(var(--font-size-3) * var(--font-size-scale));
  --font-size-5: calc(var(--font-size-4) * var(--font-size-scale));
  --font-size-6: calc(var(--font-size-5) * var(--font-size-scale));
  --font-size-7: calc(var(--font-size-6) * var(--font-size-scale));
  --font-size-8: calc(var(--font-size-7) * var(--font-size-scale));
  --font-size-9: calc(var(--font-size-8) * var(--font-size-scale));
  --font-size-10: calc(var(--font-size-9) * var(--font-size-scale));

  --line-height-heading: 1.5;
  --line-height-text: 1.2;
}

Spacing

Handpicked by us. CSS variables example:

:root {
  --space-1: 0.0625rem;
  --space-2: 0.125rem;
  --space-3: 0.25rem;
  --space-4: 0.5rem;
  --space-5: 0.75rem;
  --space-6: 1rem;
  --space-7: 1.25rem;
  --space-8: 1.5rem;
  --space-9: 2rem;
  --space-10: 2.5rem;
  --space-11: 3rem;
  --space-12: 4rem;
  --space-13: 5rem;
}

Colors

Hand-picked by us based on color scale generator. MacawUI will then map values from palettes into specific colors for component variants and states. You can see an example mapping on the diagram below.
Untitled
Image 1: Mapping between design primitives for colors.
Frame 3308
Image 2: Example of default palette.
Frame 3320
Image 2: Example of brand palette.

CSS variables:

:root {
  /* values from the palettes */
  --text-primary-foreground: hsla(210, 60%, 60%, 1);

  --button-primary-foreground: hsla(215, 96%, 43%, 1);
  --button-primary-background: hsla(215, 84%, 73%, 1);
  --button-primary-background-active: hsla(215, 94%, 58%, 1);
  --button-primary-background-hover: hsla(215, 100%, 51%, 0.08);
  --button-primary-background-focus: hsla(215, 100%, 51%, 0.12);
  --button-secondary-foreground: hsla(215, 97%, 35%, 1);
}

Shadows

Picked by us. CSS variables:

:root {
  --shadow-1: 0 26px 80px hsla(0, 0, 0, 0);
  --shadow-2: 0 26px 100px hsla(0, 0, 0, 0);
  --shadow-3: 0 26px 80px hsla(0, 0, 0, 0);
}

Border radiuses

Picked by us. CSS variables:

:root {
  --border-radius-1: 2px;
  --border-radius-2: 4px;
  --border-radius-3: 6px;
}

Final tokens

:root {
  --font-size-1: 0.75rem;
  --font-size-2: calc(var(--font-size-1) * var(--font-size-scale));
  --font-size-3: calc(var(--font-size-2) * var(--font-size-scale));
  --font-size-4: calc(var(--font-size-3) * var(--font-size-scale));
  --font-size-5: calc(var(--font-size-4) * var(--font-size-scale));
  --font-size-6: calc(var(--font-size-5) * var(--font-size-scale));
  --font-size-7: calc(var(--font-size-6) * var(--font-size-scale));
  --font-size-8: calc(var(--font-size-7) * var(--font-size-scale));
  --font-size-9: calc(var(--font-size-8) * var(--font-size-scale));
  --font-size-10: calc(var(--font-size-9) * var(--font-size-scale));

  --line-height-heading: 1.5;
  --line-height-text: 1.2;

  --space-1: 0.0625rem;
  --space-2: 0.125rem;
  --space-3: 0.25rem;
  --space-4: 0.5rem;
  --space-5: 0.75rem;
  --space-6: 1rem;
  --space-7: 1.25rem;
  --space-8: 1.5rem;
  --space-9: 2rem;
  --space-10: 2.5rem;
  --space-11: 3rem;
  --space-12: 4rem;
  --space-13: 5rem;

  --text-primary-foreground: hsla(210, 60%, 60%, 1);

  --button-primary-foreground: hsla(215, 96%, 43%, 1);
  --button-primary-background: hsla(215, 84%, 73%, 1);
  --button-primary-background-active: hsla(215, 94%, 58%, 1);
  --button-primary-background-hover: hsla(215, 100%, 51%, 0.08);
  --button-primary-background-focus: hsla(215, 100%, 51%, 0.12);
  --button-secondary-foreground: hsla(215, 97%, 35%, 1);

  --shadow-1: 0 26px 80px hsla(0, 0, 0, 0);
  --shadow-2: 0 26px 100px hsla(0, 0, 0, 0);
  --shadow-3: 0 26px 80px hsla(0, 0, 0, 0);

  --border-radius-1: 2px;
  --border-radius-2: 4px;
  --border-radius-3: 6px;
}

The code snippet above presents CSS variables that act as a theme contract. If a developer wants to create a new theme they need to use those variables and fulfill the contract. Contract variables should not change.

Changing from one to another theme (e.g light to dark) will use JS API to set CSS variables on root HTML element:

const defaultLightTheme = {
  "--font-size-1": "0.75rem",
  "--font-size-2": "0.9rem",
  "--font-size-3": "1.08rem",
  "--font-size-4": "1.296rem",
  "--font-size-5": "1.5552rem",
  "--font-size-6": "1.86624rem",
  "--font-size-7": "2.23949rem",
  "--font-size-8": "2.68739rem",
  "--font-size-9": "3.22486rem",
  "--font-size-10": "3.86984rem",

  "--line-height-heading": "1.5",
  "--line-height-text": "1.2",

  "--space-1": "0.0625rem",
  "--space-2": "0.125rem",
  "--space-3": "0.25rem",
  "--space-4": "0.5rem",
  "--space-5": "0.75rem",
  "--space-6": "1rem",
  "--space-7": "1.25rem",
  "--space-8": "1.5rem",
  "--space-9": "2rem",
  "--space-10": "2.5rem",
  "--space-11": "3rem",
  "--space-12": "4rem",
  "--space-13": "5rem",

  "--text-primary-foreground": "hsla(210, 60%, 60%, 1)",

  "--button-primary-foreground": "hsla(215, 96%, 43%, 1)",
  "--button-primary-background": "hsla(215, 84%, 73%, 1)",
  "--button-primary-background-active": "hsla(215, 94%, 58%, 1)",
  "--button-primary-background-hover": "hsla(215, 100%, 51%, 0.08)",
  "--button-primary-background-focus": "hsla(215, 100%, 51%, 0.12)",
  "--button-secondary-foreground": "hsla(215, 97%, 35%, 1)",

  "--shadow-1": "0 26px 80px hsla(0,0,0,0)",
  "--shadow-2": "0 26px 100px hsla(0,0,0,0)",
  "--shadow-3": "0 26px 80px hsla(0,0,0,0)",

  "--border-radius-1": "2px",
  "--border-radius-2": "4px",
  "--border-radius-3": "6px",
};

const root = document.documentElement;
Object.entries(defaultLightTheme).map(([key, value]) =>
  root.style.setProperty(key, value)
);

UI Components

Components will use second-level CSS variables for colors and first-level variables for the rest of the properties. This allows us to have more control in applying different themes. CSS variables will be defined in the global CSS variables space (:root). For example Text and Button components will have the following variables:

:root {
  /* 1st level of variables */
  --font-size-1: 1rem;
  --line-height-heading: 1.5;

  /* 2nd level of variables */
  --text-primary-foreground: hsla(210, 60%, 60%, 1);
  --button-primary-foreground: hsla(215, 96%, 43%, 1);
  --button-primary-background: hsla(215, 84%, 73%, 1);
  --button-primary-background-hover: hsla(215, 100%, 51%, 0.08);
  --button-secondary-foreground: hsla(215, 97%, 35%, 1);
}

.text {
  font-size: var(--font-size-1);
  line-height: var(--line-height-heading);
  color: var(--text-primary-foreground);
}

.buttonPrimary {
  color: var(--button-primary-foreground);
  background-color: var(--button-primary-background);
}

.buttonPrimary:hover {
  background-color: var(--button-primary-background-hover);
}

.buttonSecondary {
  color: var(--button-secondary-foreground);
}

Untitled (1)
Image 3: Mappings between UI components and design tokens.

API interface for using components will be created using TypeScript interfaces. The component library will be created as React components. If a component is simple like a button or text we should expose all props. Following the text example we will have:

interface TextProps extends React.ComponentPropsWithoutRef<"p"> {
  variant: "base" | "heading" | "subheading";
  weight: "normal" | "bold";
  as: "h1" | "p";
  children: React.Node;
}

// Later in the code
<Text variant="base" weight="normal" as="h1">
  Short sleeve T-Shirt
</Text>;

Note
UI components API shouldn’t expose the internals of the design system e.g what library we use to build component primitives or what tool we are using as CSS foundation.

Storybook

Will be responsible for visual testing. It will work as documentation in the first stages of the library.

How do we want to achieve a proposed solution

Repository structure and migration process

We can use a single-repo setup with the following directories:

  • src/ - holds the newly created components (new macaw)
  • legacy/ - holds the whole legacy macaw
  • .storybook/ - configuration of storybook
  • dist/ - build output

You can see an example repository structure for CSS Modules

$ tree macaw-ui

macaw-ui
├── dist
├── legacy
├── .storybook
└── src
    ├── index.ts
    ├── styles
    │   ├── globals.css
    │   ├── index.css
    │   └── reset.css
    ├── text
    │   ├── index.ts
    │   ├── text.module.css
    │   ├── text.spec.ts
    │   ├── text.stories.tsx
    │   └── text.tsx
    └── theme
        ├── index.ts
        └── provider.tsx

Given that we have two outputs: old macaw (legacy directory) and new macaw (src directory), we can present them as separate sections within the storybook:
Screenshot 2022-12-16 at 16 57 46
Image 4: Storybook with two sections: legacy and new macaw.

Note
Why not use monorepo? We need to keep it as simple as possible. More complexity, harder to maintain as well as can put a hurdle for contributors. Additionally, monorepos are designed for having multiple packages, that are shared with each other, while in macaw we share just one library and some addons, such as docs or storybook.

Example: macaw-ui/single-repo-concept (with pnpm)

Shipping and exposing bundled code

This is where the problems pop up. Since our library now exposes old and new components, undoubtedly we will face naming conflicts (eg. both versions expose a component named Button). To address it, we essentially have the following options:

Using exports and having two entry points defined

We can define the following entry points definition within package.json

"exports": {
    "./next": {
      "import": "dist/src/index.mjs",
      "require": "dist/src/index.js"
    },
    ".": {
      "import": "dist/legacy/index.mjs",
      "require": "dist/legacy/index.js"
    }
  },

After installing macaw-ui everything will work as previously, but whenever we want to use new components we will use @saleor/macaw-ui/next instead of @saleor/macaw-ui

import { Button as ButtonOld }, mc from "@saleor/macaw-ui"
import { Button as ButtonNew }, mc from "@saleor/macaw-ui/Next"

<ButtonOld>Legacy button</ButtonOld>
<ButtonNew>New button</ButtonNew>

Pros:

  • transparent migration, we don’t have to change anything within the code, we can simply start using new components
  • explicitly picking newly created components
  • easy to remove from the codebase, once we deprecate all of the legacy components we can simply remove them

Cons:

  • explicit entrypoint, we will have to remove it from the entire codebase of the projects, once we fully migrate to the new macaw (changing importy from @saleor/macaw-ui/next to @saleor/macaw-ui everywhere in the project!).

Using an object as a namespace

We can expose everything that is legacy as it is right now, but newly created components under the namespace eg. mc

import { Button }, mc from "@saleor/macaw-ui"

<Button>Legacy button</Button>

<mc.Button>New button</mc.Button>

Pros:

  • fully transparent migration, no more changes needed afterward
  • the explicit distinction between components within the projects and atomic components imported from the component library package

Cons:

  • the tree-shaking problem, object (namespace) cannot be tree shakable (is there any workaround?)

Using prefixed name

We can use prefixes for the newly created components:

import { Button, mcButton } from "@saleor/macaw-ui"

<Button>Legacy button</Button>

<mcButton>New button</mcButton>

Where the mc is the prefix

Pros:

  • fully transparent migration, no more changes needed afterward
  • the explicit distinction between components within the projects and atomic components imported from the component library package
  • three shaking

Cons:

  • prefixes are a bit messy

Using separated repo and package name

We can simply create a new repository with a different package name it addresses all of the problems mentioned above, but that means sort of rebranding.

UI components - technology

We have 3 different approaches to technology that will be used:

CSS Modules

  • Pros
    • No additional tooling needed
    • Easy to get started
    • Supported out of the box with many React tooling e.g Next.js or CRA
  • Cons
    • You need to convert JS vars to CSS vars
    • A lot of pure CSS boilerplate
      • Nested selectors
      • Media queries
    • Additional tooling needed for removing not used CSS
  • Example: macaw-css-modules

Tailwind CSS

  • Pros
    • Easy to create breakpoints values
    • Used in many places
    • Utility classes generated by default
  • Cons
    • Colors can be used for every value e.g background-color, text-color, border-color which can be problematic as we have colors for backgrounds only, etc - we lost semantics
    • You need to create a few hacks to map component level API e.g size={1} to gap-1
  • Example: macaw-tailiwind-css

Vanilla Extract

  • Pros
    • Theming of out the box
    • Easy to create variants
    • Easy to create breakpoints values
  • Cons
    • Needs plugins for webpack/vite etc
    • Additional tooling needed for removing not used CSS
    • New library
  • Example: macaw-vanilla-extract

Additional links

Examples

Remove CDN for inter font - use one bundled instead

What I'm trying to achieve

We currently load Inter font for old MacawUI from CDN - we should use one bundled with the new version.

Describe a proposed solution

Remove code that uses CDN to load Inter font and add missing (if there are) font weights to the current variable font.

Acceptance Criteria

  • Inter font not loaded from CDN

Screenshots or mockups

Split align items into flex and grid values.

When using CSS grid values like flex-start for alignItems property are incorrect and vice versa, when using flexbox start or end are incorrect.

alignItems should be split into gridAlignItems and flexAlignItems.

Use status indicator across different views

On some views, we have status indicators, usually presented as a rounded badge (see screenshot below). Would be nice to re-use these indicators across the views.

An example can be product flow, the product table list has channel availability status badges, while when we go to the product page, under the availability section it is not yet present (a bit incossistent)

Screenshots

Screenshot 2022-11-29 at 11 50 14

Let's investigate how we can approach this.

Notification should have a subtitle

Notifications should have a dedicated subtitle for messages such as "From app: XYZ". The subtitle should be in the bottom left corner and have a lighter and smaller font.

mui 5 support

Material-UI v5 (MUI 5) Released.
what about mui 5 support?

Create Text component

Create a Text component that applies design from Figma.

Acceptance Criteria

  • Should apply variants, size, and font-weight based on Figma
  • Bundle font family with MacawUI
  • Text should have an as prop that allows it to be rendered as "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" with default as span

Add dark theme and toggle it inside storybook

What I'm trying to achieve

I want to be able to change the theme while working on components inside Storybook.

Describe a proposed solution

Add theme toggle to Storybook stories.

Acceptance Criteria

  • Add ability to switch themes inside Storybook stories

Add Textarea component

What I'm trying to achieve

I want to have Textarea input component in new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-22 at 13 51 39@2x

why sidebar logo is not optional?

The Sidebar and SidebarDrawer logo is not optional, They are hard coded in code.

Why this ui library so strict to change logo?

themeType === "dark" ? <LogoDark /> : <Logo />

Implement Text input

What I'm trying to achieve

I want to have a text input with the new MacawUI design based on Figma.

Describe a proposed solution

We should implement BaseInput that will hold base styles for all inputs in MacawUI and then
build TextInput on top of that.

We should also check the current Dashboard for MUI TextField usage and add the missing API

Acceptance Criteria

  • Implement new inputs according to the design
  • Each input must state indicators along with variants:
    • variant: error, states: disabled, focused, etc.
    • variant: success, states: disabled, focused, etc.
    • variant: neutral, states: disabled, focused, etc.
  • Prepare a proper storybook story that presents all of the inputs
  • Please use references only for the token (no hardcoded colors/sizes)

Note: remember about labels and icons inside the input

Screenshots or mockups

Image

Macaw UI example setup

Macaw UI setup (example/concept for the RFC)

Considering areas to cover:

  • development setup (dev env, prod env)
  • CI/CD
  • how we approach migration flow
  • storybook
  • docs

Result: concept of how we address that setup, include everything in the RFC

Implement number input with adornment

What I'm trying to achieve

I want to have the number input component in new MacawUI with adornment (e.g unit or currency)

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-23 at 09 50 29@2x
CleanShot 2023-03-23 at 09 50 35@2x

Allow to overwrite Button default color

<Button color={"textNeutralSubdued"} variant={"tertiary"}>
  Log in
</Button>

Expected

Color will be overwritten with textNeutralSubdued

Actual

Prop is not working at all

Woraround

Add inside

Allow adding self-hosted fonts

What I'm trying to achieve

As a developer, I want to add my self-hosted font to MacawUI.

Describe a proposed solution

We should be able to accept custom CSS with font files into the new MacawUI.

Acceptance Criteria

  • Add the ability to inject custom CSS with font settings
  • Fonts should use font family from custom CSS

Screenshots or mockups

Implement Checkbox

What I'm trying to achieve

I want to have a Checkbox with the new MacawUI design based on Figma.

Describe a proposed solution

We should implement the Checkbox component based on Figma designs. It should be accessible so we could use Radix Checkbox for that.

We should also check the current Dashboard for MUI Checkbox usage and add the missing API

Acceptance criteria

  • Implement new checkboxes according to the design
  • Each checkbox must state indicators along with variants:
    • variant: error, states: disabled, focused, etc.
    • variant: neutral, states: disabled, focused, etc.
  • Prepare a proper storybook story that presents all of the checkboxes
  • Please use references only for the token (no hardcoded colors/sizes)

Note: remember about labels

Screenshots or mockups

Image

Implement Autocomplete component

What I'm trying to achieve

I want to have the loading Autocomplete component in the new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

Implement Textarea component

What I'm trying to achieve

I want to have the Textarea component in the new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-22 at 13 51 39@2x

Implement Divider component

What I'm trying to achieve

I want to have Divider component in new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-22 at 13 51 55@2x

Migrate to proper color names

What I'm trying to achieve

We should have color naming that helps us apply colors to different elements in different themes so that I as a developer do not need to use conditional statements for my colors e.g dark ? color.bg-1 : color.bg-2. Those overrides should be applied on color tokens level e.g color.background which then for the light theme will have a value of bg-2 and for the dark theme it will have a value of bg-1.

Describe a proposed solution

We should use color names based on broader elements e.g surface or icons - similar to what Shopify Polaris is doing.

Acceptance Criteria

  • Our colors should be strictly typed on the sprinkles level. It means that developer can only apply e.g surface-gray only to background-color, not to color or border-color
  • Colors should reflect the structure defined in Figma
  • Colors should support multiple themes

Implement Radio input

What I'm trying to achieve

I want to have a Radio input with the new MacawUI design based on Figma.

Describe a proposed solution

We should implement Radio Input based on Figma designs.

We should also check the current Dashboard for MUI Radio usage and add the missing API.

Acceptance Criteria

  • Implement new radios according to the design
  • Each radio must state indicators along with variants:
    • variant: error, states: disabled, focused, etc.
    • variant: success, states: disabled, focused, etc.
    • variant: neutral, states: disabled, focused, etc.
  • Prepare a proper storybook story that presents all of the radios
  • Please consider also radio groups
  • Please use references only for the token (no hardcoded colors/sizes)

Screenshots or mockups

Create ThemeProvider

We need to create a ThemeProvider that will create CSS variables that are derived from design tokens. To make it more type-safe we are going to use https://vanilla-extract.style/.

Acceptance criteria

  • Create a theme contract that will contain all needed CSS variables
  • Create a default light theme that will fulfill a contract
  • Create sprinkles helpers that use CSS variables
  • Create a Box component that consumes CSS variables
  • Create ThemeProvider that will apply the CSS variables

SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

Sentry Issue: SALEOR-APP-CHECKOUT-2G

SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
  at a (webpack://_N_E/../../node_modules/.pnpm/registry.npmjs.org+@[email protected]_vdvb7n236vx4s4shxyxtl27fte/node_modules/@saleor/macaw-ui/dist/esm/index.js:2:603)
  at qi (webpack://_N_E/../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.production.min.js:176:25)
  at exports.useState (webpack://_N_E/../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.production.min.js:26:83)
  at <anonymous> (webpack://_N_E/../../node_modules/.pnpm/registry.npmjs.org+@[email protected]_vdvb7n236vx4s4shxyxtl27fte/node_modules/@saleor/macaw-ui/dist/esm/index.js:2:603)
  at c (webpack://_N_E/../../node_modules/.pnpm/registry.npmjs.org+@[email protected]_vdvb7n236vx4s4shxyxtl27fte/node_modules/@saleor/macaw-ui/dist/esm/index.js:2:603)
...
(12 additional frame(s) were not displayed)

Implement loading Skeleton component

What I'm trying to achieve

I want to have the loading skeleton component in the new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

image

Add Date & DateTime input components

What I'm trying to achieve

I want to have Date & DateTime component in new MacawUI

Describe a proposed solution

Acceptance Criteria

Screenshots or mockups

CleanShot 2023-03-22 at 13 51 03@2x
CleanShot 2023-03-22 at 13 51 12@2x

Setup new repository structure

We need to set up a new repository structure that allows us to develop & maintain both the old (named: legacy) and the latest version (named: next) of MacawUI. After this change, this repository will have the following structure:

  • legacy folder that has current MacawUI files
  • src with new components and tokens

Acceptance criteria:

  • PNPM is used as a package manager
  • New repository structure is created:
    • Storybook inside .storybook folder
    • Current MacawUI folder structure moved to the legacy folder
    • Vite used to build storybook and build package for production
  • New package.json should have exports defined that points to the legacy folder and exports that points to current src under /next path
  • New release process is created. The release should build legacy macaw-ui and new macaw-ui. Then it should create a new tag (next) in GitHub and NPM.

[RFC] Remove MUI

After several discussion we have some reasons to remove MUI from Macaw.

I keep this issue open to evaluate:

  1. How important it is for us (how much this dependency is blocking us)
  2. How much time it will take to remove it
  3. What can we use instead (headless libraries?)
  4. What strategy can we use for migration

Allow SSR with MacawUI

We currently have a naive way of rendering MacawUI - we apply CSS variables on the client. As a proper solution, we should apply them in SSR as well.

Relevant code

setElementVars(document.documentElement, vars, themes[theme]);

Remove pointer-events: none from disabled components

What I'm trying to achieve

We currently apply pointer-events:none to disabled components.

This is causing a problem with for example list items that have a button inside - after you apply pointer-events user can't click the button in the disabled list item. Currently, developers need to add pointer-events:all to the button in this case but I think this is suboptimal and should be fixed.

Describe a proposed solution

We should remove pointer-events:none for disabled components and change cursor to not-allowed instead.

Acceptance Criteria

  • All components that currently have pointer-events:none should be migrated
    • Button
    • List.Item

SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

Sentry Issue: SALEOR-APP-CHECKOUT-9

SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
  at a (webpack://_N_E/../../node_modules/.pnpm/@[email protected]_2y22cl4s2qbk2dsjoypyjtjdfu/node_modules/@saleor/macaw-ui/dist/esm/index.js:1:2119)
  at useState (webpack://_N_E/../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.production.min.js:175:53)
  at n.useState (webpack://_N_E/../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.production.min.js:25:394)
  at n1 (webpack://_N_E/../../node_modules/.pnpm/@[email protected]_2y22cl4s2qbk2dsjoypyjtjdfu/node_modules/@saleor/macaw-ui/dist/esm/index.js:1:2101)
  at c (webpack://_N_E/../../node_modules/.pnpm/@[email protected]_2y22cl4s2qbk2dsjoypyjtjdfu/node_modules/@saleor/macaw-ui/dist/esm/index.js:4:10531)
...
(9 additional frame(s) were not displayed)

Implement Combobox component

What I'm trying to achieve

I want to have the Combobox component in the new MacawUI

Describe a proposed solution

Combine the existing Input component and Downshift library to create the Select component

Tasks

Acceptance Criteria

Screenshots or mockups

image (1)

Create Icon component

Create an Icon component that applies design from Figma.

Acceptance Criteria

  • Should apply size based on Figma

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.