Giter Club home page Giter Club logo

salt-ds's Introduction

Salt

@salt-ds/core @salt-ds/lab @salt-ds/theme @salt-ds/icons

Salt provides you with a suite of UI components and a flexible theming system. With no customisation, the default theme offers an attractive and modern look-and-feel, with both light and dark variants and support for a range of UI densities. We have included a theming system which allows you to easily create theme variations, or in fact substitute alternate themes.

Salt has been developed with the following design goals:

  • Providing a comprehensive set of commonly-used UI controls.
  • Complying with WCAG 2.1 accessibility guidelines.
  • To be lightweight and performant.
  • Offering flexible styling and theming support.
  • Minimizing dependencies on third-party libraries.

Installation

There are four packages you can install:

  • @salt-ds/core is required, this contains stable components and receives new features and patch updates when needed.
  • @salt-ds/lab is where we introduce new components which are under initial development until they are stable and moved over to core. This is typically an unstable environment and may have major breaking changes.
  • @salt-ds/theme is required, this contains the Salt .css files required for any application you develop with Salt.
  • @salt-ds/icons contains SVG-based icons you can use in your application.

Depending on the package manager you use, edit and run one of the following commands to install the packages you need:

npm install @salt-ds/core @salt-ds/theme @salt-ds/lab @salt-ds/icons

Or

yarn add @salt-ds/core @salt-ds/theme @salt-ds/lab @salt-ds/icons

You will then need to import the .css files into your application, along with any components that you plan to use.

Here’s a quick example of a Call-to-Action (CTA) button for your reference:

import { Button, SaltProvider } from "@salt-ds/core";

import "@salt-ds/theme/index.css";

function App() {
  return (
    <SaltProvider>
      <Button variant="cta">CTA Button</Button>
    </SaltProvider>
  );
}

Accessibility

Salt is a high-quality, WCAG 2.1 compliant solution for building great, accessible experiences for your users.

Screen reader support & compatibility

We support specific combinations of assistive technologies (ATs) and browsers, outlined in the table below.

Operating System Web browser Screen reader
Windows Firefox NVDA
Chrome JAWS
macOS Safari VoiceOver

Thanks

Chromatic

Thanks to Chromatic for providing the visual testing platform that helps us review UI changes and catch visual regressions.

salt-ds's People

Contributors

alycrys avatar ararus avatar daviereid avatar dependabot[bot] avatar el-dav avatar eleanorhaproff avatar feliciackh avatar fercas123 avatar github-actions[bot] avatar heswell avatar immanuelbaskaran avatar james-nash avatar joanammoreira avatar joshwooding avatar liamsms avatar libertymayc avatar lilyvc avatar lukeac123 avatar maleeha13 avatar mark-tate avatar mikearildbrown avatar navkaur76 avatar origami-z avatar pseys avatar renovate[bot] avatar sion-docs avatar thusharaj07 avatar vineet119 avatar yunjungyeh avatar zarkopernar 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

salt-ds's Issues

AriaAnnouncer should not break layout

The aria announcer creates a pixel sized element on the page. This can break user layouts. We should make sure it is not within the document flow.

Standardise TypeScript import order

IDE has "Organize Imports" which uses TypeScript language service to sort import order. Some of the PR uses this, which creates more diff for review. So it would be good to enable it via prettier for example.

Convert Breadcrumbs tests from jest to cypress

We want to migrate all tests to Cypress. So lab/src/tests/breadcrumbs need to be converted and housed at labs/src/tests/__e2e/breadcrumbs

See many existing examples for cypress patterns/conventions
The Cypress tests can consume StoryBook stories as fixtures

Consuming app CSS loading order error

Symptom

CSS override from a consuming app will behave differently during a dev build and a prod build, due to CSS loading order issue.

Reproduce

Using this test repo as an example, clone the repo and run it locally yarn && yarn start uitk-app (modular unfortunately doesn't work with StackBlitz or Code Sandbox) and compare with prod build on github pages (or build and yarn modular serve uitk-app yourself).

Observe the Button position, where dev build would be on top right and prod build would be under the card.

Dev build, local

Dev build, local

Prod build, GitHub page

Prod build, GitHub page

Why

In the example repo, Button is styled with a custom class like below

<Button className="AbsoluteButton">
.AbsoluteButton {
  position: absolute;
  right: 0;
  top: 0;
}

During dev build, index.css is loaded last, followed the order of code

import App from './App';
import './index.css';

dev build style loading

During prod build, CSS is extracted into a static file /static/css/main.0718f2f3.css (contains uitk-theme CSS and index.css) which is loaded before style injected uitk component CSS.

prod build style loading

So if looking into dist/jpmorganchase-uitk-core/dist-es/packages/core/src/button, there is a Button.css.js and Button CSS will be loaded into head at run time.

Potential solution

Option 1

Extract CSS during uitk component build, so consumers can load the CSS like a static asset from theme package.

If we do this, we may as well include both core and lab css into theme css file, to make the theme package representing 'all you need' CSS.

Note that in this approach, all uitk-core/lab CSS will be loaded at once instead of only components being rendered. You may wonder whether this means there are more code being loaded to the browser at run time? Kind of yes and no. Currently all components CSS is bundled in JS as string, so CSS parsing and loading is actually happening after the page is first loaded, which may actually be slower depends on browser strategy. File caching strategy could be another consideration, e.g. for apps, extracting vender css separately maybe beneficial.

Quick test

  1. Modify node_modules/modular-scripts/dist-cjs/build/buildPackage/makeBundle.js and modify _rollupPluginPostcss to use extract: true (this line of source code)
  2. Build packages
  3. Observe dist/jpmorganchase-uitk-core/dist-es/index.css being created
  4. Copy and replace build files to the sample app node_modules
  5. Import import '@jpmorganchase/uitk-core/dist-es/index.css'; in sample app code
  6. Observe Button rendered at the correct position in both dev and prod build

Other options

Given uitk consumers will be using all types of building tools (CRA, modular, webpack, rollup, etc.), we can't assume certain things being done at the tooling level.

Component Migration Progress

Core

Button - 6/15

Initial Alpha

  • Component implemented in TypeScript
  • 3rd-party dependencies removed
  • JSS converted to CSS
  • All examples present in TK1 are implemented as stories in Odyssey

Move to Core Preparation

  • CSS upgraded to use theme variables
  • Jest migrated to cypress
  • Add missing tests in cypress
  • QA (v1-2 visual regression) test passes
  • Tech docs written and published in Storybook
  • Automated Axe tests added and pass
  • Custom styling story created
  • Component API finalised
  • Dev production review
  • ADA review
  • Design review
Card - 0/15

Initial Alpha

  • Component implemented in TypeScript
  • 3rd-party dependencies removed
  • JSS converted to CSS
  • [] All examples present in TK1 are implemented as stories in Odyssey

Move to Core Preparation

  • CSS upgraded to use theme variables
  • Jest migrated to cypress
  • Add missing tests in cypress
  • QA (v1-2 visual regression) test passes
  • Tech docs written and published in Storybook
  • Automated Axe tests added and pass
  • Custom styling story created
  • Component API finalised
  • Dev production review
  • ADA review
  • Design review

Lab

Skip Link - 0/15

Initial Alpha

  • Component implemented in TypeScript
  • 3rd-party dependencies removed
  • JSS converted to CSS
  • All examples present in TK1 are implemented as stories in Odyssey

Move to Core Preparation

  • CSS upgraded to use theme variables
  • Jest migrated to cypress
  • Add missing tests in cypress
  • QA (v1-2 visual regression) test passes
  • Tech docs written and published in Storybook
  • Automated Axe tests added and pass
  • Custom styling story created
  • Component API finalised
  • Dev production review
  • ADA review
  • Design review

Content Status has duplicated `Status` export

Below 2 are duplicated

export const Status = {
  LOADING: "loading" as ContentStatusStatus,
  ERROR: "error" as ContentStatusStatus,
  SUCCESS: "success" as ContentStatusStatus,
  WARNING: "warning" as ContentStatusStatus,
  INFO: "info" as ContentStatusStatus,
};

&

export type Status = keyof typeof Status;

We probably don't need the first one, as TypeScript should be able to check status = Status.INFO the same way as status = "info", and the 2nd one is easier for consumer to write (one less import) with the same benefit of auto inference.

Button Bar

Preparation

  • Existing defect backlog reviewed/evaluated, prioritized, and selected
  • Functional requirements defined: functional test script is defined/written (not coded) and signed off by Dev, Design, ADA and Product leads
  • Non-functional requirements defined (e.g. controlled vs. uncontrolled)
  • Existing enhancements backlog reviewed/evaluated, prioritized, and selected
  • Usability testing plan defined or deemed unnecessary
  • Examples needed to properly demonstrate component features are defined and signed off by Dev, Design, ADA and Product leads

Development

  • Component implemented in/ported to TypeScript
  • 3rd-party dependencies removed
  • JSS converted to CSS
  • CSS upgraded to use characteristics
  • Selected defects resolved
  • Component API finalized
  • Necessary refactoring completed
  • Selected enhancements added

Testing

  • Functional test script is implemented in Cypress and passes
  • Code not covered by the functional test script is identified and reviewed by Dev & Design leads
  • QA (v1-2 visual regression) test passes
  • Automated Axe tests added and pass

Examples

  • All examples present in TK1 are implemented as stories in Odyssey (ported from BitBucket)
  • All examples needed are implemented as stories (either ported from BitBucket or created net new)

Deployment

  • Codemods for migration created and verified
  • Reviews/Signoff
  • Dev production review
  • Design review
  • Product signoff
  • ADA review
  • Documentation
  • Dev docs content provided
  • TK1→Odyssey migration guide provided
  • Design docs provided
  • Consolidated documentation produced by combining dev content, migration guide, and design docs
  • Consolidated documentation published on Storybook
  • Consolidated documentation reviewed and updated according to user feedback
  • Figma symbols
  • New Odyssey Figma symbol created
  • Figma symbol references updated to use new Figma symbol

Add Docs page for labs component

One of the requirement for a lab component to be moved into core package is having a "Docs" page, e.g. Button doc is generated by this MDX button.doc.stories.mdx. What we need is at least

  • Examples
  • API
    • Props Table
    • HTML Anatomy
    • CSS Class
    • Characteristics Used
    • Custom Property API
      Customising styles

Components

  • Accordion
  • AppHeader
  • Avatar #247
  • Badge #194
  • Breadcrumbs
  • ButtonBar
  • Calendar
  • Card
  • Cascading Menu
  • Checkbox #237
  • ColorChooser
  • ComboBox
  • ContactDetails
  • ContentStatus
  • Dialog
  • Dropdown
  • FileDropZone
  • FormField
  • FormattedInput
  • Input
  • Link
  • List
  • Logo
  • MenuButton
  • Metric
  • Overlay
  • Pagination
  • Panel
  • Pill
  • Progress
  • QueryInput
  • RadioButton #201
  • Responsive
  • Scrim
  • SearchInput
  • Slider
  • Spinner
  • StepperInput #214
  • Switch #239
  • Tabstrip
  • ToggleButton
  • TokenizedInput
  • Toolbar
  • Tooltip #219
  • Typography

Dialog, DialogTitle a11y fixes not implemented

Dialog should not read aloud all of this content. Old UITK applied ...other which allowed users to override defaults such as aria-describedby which produces this issue. Similarly, DialogTitle forces h1 to be applied. A fix for this is to use disabledAria. Ideally, we should be able to provide a heading value since we would still need to re-add the span wrapper to achieve the desired heading style.

    <Dialog
      aria-describedby={null}
    >
      <DialogTitle disableAria>
      </DialogTitle>
    </Dialog>

2022.06.10 Release Progress

Not an exhaust list (most labs feature can be pushed back to next release), but create one to track remaining work before cutting a new release.

Theme

  • Characteristics refactor

Icons package

  • Icon and helper is moved from Core to Icons package #200

Promote component to core

  • Layouts (flex, flow, grid, stack) #141
  • (Push back to next release) Form controls
    • Form Field #191 #204
    • Switch (pending move to core) #176
    • Checkbox
    • Input
    • Radio Button #201
    • Stepped Input
  • Card #181
  • Panel #155
  • (Push back to next release) Pill #144 + Move to core
  • Tooltip (dep of FormField) #198

New Lab features

Refer to #121

Doc

  • Docs for new core component
  • Storybook navigation structure #171

Others

  • No foundation token used in core component css #186

Tooltip doesn't have z-index applied

We have --uitk-zIndex-tooltip defined in characteristics but it's not being applied in Tooltip.css. When used with FormField, it will do something like below

text shows above tooltip

Convert Accordion tests from jest to cypress

We want to migrate all tests to Cypress. So lab/src/tests/accordion need to be converted and housed at labs/src/tests/__e2e/accordion

See many existing examples for cypress patterns/conventions
The Cypress tests can consume StoryBook stories as fixtures

Handle prefers-reduced-motion in layer layout component

Currently, we don't handle this in the component's css but there's a storybook example showcasing how it can be achieved. A decision (ADA/design) needs to be made about how we handle this not only in the layer component but also similar components that have animations.

Control spacing of Split Layout

It would be nice for SplitLayout component to use the standard spacing through exposing gap prop, and passing it down into FlexLayout

Css variable docgen plugin type error

When running storybook locally yarn start, there are a few TypeError from the docgen plugin. One of them being

TypeError: Cannot read properties of null (reading 'type')
...
Encountered issue parsing CSS variable declaration "--tab-before-content" in ".../uitk/packages/lab/src/tabs/Tab.css"

This is likely due to --tab-before-content is set to "", which is not fully supported by the parser.

ButtonBar styling issue

Current behavior 😯

When using ButtonBar, the right most button has margins applied

Expected behavior 🤔

Right most button should have no right margin

Steps to reproduce 🕹

N/A

2022.07.01 Release Progress

Theme

  • Characteristic and foundation changes #196
  • Backwards compat standardization #216

Core

  • Form Controls move to Core
  • Pill move to Core #234
  • Layout component ParentChild, Border,Split move to Core #221

Lab

  • Breadcrumb uses Typograph #122
  • Layout doc update #206
  • New layer layout #152

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.