Coder Social home page Coder Social logo

atom-learning / components Goto Github PK

View Code? Open in Web Editor NEW
39.0 14.0 5.0 27.8 MB

A collection of generic React components built using stitches, including components that cover layout, content, data collection, media and a host of other UI concerns.

Home Page: https://atomlearning.design

License: GNU General Public License v3.0

JavaScript 1.24% TypeScript 98.58% HTML 0.09% Shell 0.03% MDX 0.06%
react stitches component-library

components's People

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

Watchers

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

components's Issues

`Tabs.TriggerList`: scrolling to the end/begin of a list does not hide the arrow

Component Name (*)

Tabs.TriggerList

Expected Behaviour (*)

  1. Render a Tabs.TriggerList that overflows.
  2. Horizontally scroll to the end of the list.
  3. The scroll indicator (arrow) should be hidden.

When I scroll the Tabs.TriggerList horizontally using a touch device or trackpad for example, the scroll indicator arrows are not hidden when I reach

Actual Behaviour (*)

The scroll indicator (arrow) is still visible.

Steps to reproduce (*)

See above.

Other information (*)

It seems that the is-the-end-of-the-list-reached-check is only happening onClick.

Feature request: RadioGroupField layout options

Component Name(*) or Feature Name

RadioGroupField

Description(*)

  • Ability to format and pass styles to the RadioGroup to enable it to display horizontally

Designs and UX wireframes(*)

Screenshot 2021-05-06 at 11 43 41

Additional Information

We should have rules or guidelines in place for the use case of each layout before introducing this. This would help with making sure that everything is properly documented and that we don’t start introducing inconsistencies across other components that may need optional layout formatting.

Feature request: AlertDialog

Component Name(*) or Feature Name

AlertDialog

Description(*)

All of our AlertDialogs now have an updated design with an icon in the header and a divider to separate the title

It would be good to avoid having to copy these stylings everytime we need to use this component

Designs and UX wireframes(*)

image

Additional Information

Feature request: HOC for Tooltips

HOC for Tooltips

Make it possible to add tooltips to any component without much code overhead / hassle

Description(*)

const ButtonWithTooltip = withTooltip(<Button ... />, "Tooltip Text")

Feature request: <Input type=password/> hide/show value

<Input type=password/> hide/show value

Description(*)

Our PasswordField component has some logic to show or hide the entered password when the user clicks an eye icon. I think we should move this logic down to the underlying Input component so that we get this behaviour whenever type = "password".

This will allow us to compose other, more specific types of password field and get consistent show/hide behaviour for free.

For example, the CreatePasswordField would get it for free.

RadioField: Using 'required' prop gives TS error; no red asterisk on 'required' label; gray line below label

RadioField

Expected Behaviour

  • Using 'required' prop will not generate a TS error
  • Label should have a red asterisk when 'required' prop is used
  • No line under label

Actual Behaviour (*)

  • Using 'required' prop will not generate a TS error #2322
  • Label does not have a red asterisk when 'required' prop is used
  • Gray line under label

Steps to reproduce (*)

Other information

Screen Shot 2021-08-03 at 11 47 45
Screen Shot 2021-08-03 at 11 48 07
Screen Shot 2021-08-03 at 11 57 18

Please include Browser Name and version, OS and version

Feature request: Tokenise Durations (ms)

Feature Name

Duration (ms) Tokenisation

Description

In favour of the fact that the values we use to style our components are tokenised, can we have all durations to be tokenised as well ?
example : transition: 'transform $<token>'

Feature request: Form Component - localStorage persist functionality

Add persist to sessionStorage functionality to the form component

Form.tsx

Description

  • Integrate persist functionality for the form using sessionStorage
  • As a USER I want to be able to keep my form data between refreshes
  • As a DEV I want an integrated and easy to use option to retain form data between refreshes so I don't have to write a custom approach each time

Update request: Table

Component Name(*) or Feature Name

Table

Description(*)

Update the styling of the table to match the agreed colours etc
Update the table to have 2 variants that alter the row height:

  • one variant will have taller rows to allow using ActionIcons and buttons within it without compromising accessibility on mobile devices
  • one variant will be slimmer for the instances where we are only displaying data

Designs and UX wireframes(*)

image

Feature request: `FormData`

Component Name(*) or Feature Name

HiddenInput, FormData or something similar

Description(*)

Something similar to this component, to take collect hidden data in a form:

import React from 'react'

export const Hidden = React.forwardRef(({ fields }, ref) =>
  Object.keys(fields).map((key) => (
    <input ref={ref} key={key} type="hidden" name={key} value={fields[key] || ''} />
  ))
)

Feature request: Default animations as part of the theme

Component Name(*) or Feature Name

Animations

Description(*)

It would be nice to have a set of default animations (in the form of Utils?) that we can easily add to nodes:

  1. A set of default transitions, so that we have the same Bezier curves and durations for our animations throughout the application when we want to transition CSS properties.
  2. A set of default animation keyframes that we can use as entry effects or after user interaction. For example, a set of predefined animations like Reboundgen or Animate CSS has.

Hopefully having the animations easily available will also increase the usage of animations in our application :)

Feature request: ActionIcon

Component Name(*) or Feature Name

ActionIcon

Description(*)

Please include the expected behaviour and the acceptance criteria for this component.
The component currently sets the nested icon size to 20px in case the ActionIcon size is set to lg or xl. However, when using the appearance=simple the smaller icon looks very small so doesn't work visually

Proposal:
Amend the code to allow the size to be cascaded down if the appearance is set to simple?

Designs and UX wireframes(*)

TBC

Additional Information

Feature request: List - bulletless variant

Component Name(*) or Feature Name

List

Description(*)

We also need a variant that doesn't show any bullets before the list items.

Designs and UX wireframes(*)

Please attach the designs and UX wireframes for this component (or links to the designs).

Additional Information

Button: Button with type="submit' expects 'href' or 'onClick' in TS

Button (*)

Expected Behaviour (*)

Button with type='submit' should have href and onClick as optional props since the parent form can also handle the submit

Actual Behaviour (*)

Button with type='submit' and no href or onClick shows TS error 2322:

Property 'href' is missing in type '{ children: string; type: "submit"; isLoading: boolean; "aria-label": string; }' but required in type '{ onClick?: never; href: string; }'.

Steps to reproduce (*)

Screen Shot 2021-07-30 at 10 57 00

Other information (*)

Screen Shot 2021-07-30 at 10 52 28

Please include Browser Name and version, OS and version

Feature update: explainer text in form fields

Description

Form fields should accept an optional explainerText prop (or similar) to place text between the label and input that explains something about what data being asked for, or how it will be used.

Designs and UX wireframes

This pattern is used in the Pronouns and Date of Birth fields here:
Screenshot 2021-08-10 at 16 53 57

Additional Information

This design is for the Atom Nucelus US sign-up journey, but this pattern will be used more widely going forward.

Feature request: Icon

Component Name

Icon

Description(*)

We are finding that the available sizes on the Icon component sometimes don't cater for all of our needs. Currently, we have to overwrite the size using css prop to introduce a value between sm and medium (20px).

An example where this is done now is that new navigation for the supervisor

Should we consider an in-between size?

Designs and UX wireframes(*)

Additional Information

Jest Dev Dependency: yarn install throws - The engine "node" is incompatible with this module

Expected Behaviour (*)

There should be no error while running yarn install

Actual Behaviour (*)

Following error is thrown

Packing @atom-learning/components@https://github.com/Atom-Learning/components.git#commit=5dc6fa862d3744d9e87b0106d39f35210b85b4c4 from sources
Using Yarn Classic for bootstrap. Reason: "__metadata" key not found in yarn.lock, must be a Yarn classic lockfile

➤ YN0000: Retrieving https://nightly.yarnpkg.com/latest.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-1.23.0-20210726.1745.cjs
➤ YN0000: Done in 0s 512ms

yarn install v1.23.0-20210726.1745
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The engine "node" is incompatible with this module. Expected version "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0". Got "14.5.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Steps to reproduce (*)

run yarn install

Other information (*)

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Feature request: Stack Content

Component Name(*) or Feature Name

StackContent or something similar 🤷

Description(*)

This component should wrap standard content components like Text, List, Heading, and add bottom margins to space them properly. e.g.

<StackContent>
  <Heading size="lg">Something</Heading> {/* has margin-bottom related to size */}
  <Text>Hello</Text> {/* has no margin bottom */}
</StackContent>

Designs and UX wireframes(*)

No designs

Feature request: Polymorphic Link and Button

Component Name(*) or Feature Name

Polymorphic Link and Button.

Description(*)

From a Slack message:

I saw another #opinion of Jamies that I’m keen on (we had this change in the DS but removed it before merging) https://twitter.com/buildsghost/status/1389294014222934018 - Does anyone have thoughts on this pattern?

Jamie Kyle 🏳️‍🌈Jamie Kyle 🏳️‍🌈 @buildsghost
Design System opinion:
Don't make your and components support both link and button visuals
Do make your and components renders either or based on the props passed to it ("to" should render an anchor, "onClick" should render a button) https://pbs.twimg.com/media/E0fC-UlVoAIzf9l.jpg
TwitterTwitter | May 3rd (49 kB)

Designs and UX wireframes(*)

N/A

Additional Information

`validation={{ required: true }}` should return a generic "This field is required" message

Using this validation={{ required: true }} config now will result in no error message being shown.

Could (should?) we provide some default validation messages at the Form level to allow users to pass i18n strings? e.g.

<Form validationMessages={{ required: 'This field is required', valueAsDate: 'Please add a valid date' }}>
  <InputField validation={{ valueAsDate: true }} />
  <CheckboxField value="yolo" validation={{ required: true }} />
</Form>

Button: Loading state gets rendered in snapshots even when not visible

Component Name (*)

Button

Expected Behaviour (*)

When isLoading=false, the loader shouldn't appear in snapshots

Actual Behaviour (*)

Occasionally the loader shows up in the parent component's snapshot

Examples:

<div
          class="c-dhzjXW c-dhzjXW-ibICGYT-css"
          role="alert"
        >
          <span
            style="position: absolute; border: 0px; width: 1px; height: 1px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; word-wrap: normal;"
          >
            Loading
          </span>
          <div
            class="c-jBOHFZ c-jBOHFZ-jIYkAt-size-md"
          />
          <div
            class="c-jBOHFZ c-jBOHFZ-jIYkAt-size-md"
          />
          <div
            class="c-jBOHFZ c-jBOHFZ-jIYkAt-size-md"
          />
        </div>
      </div>

Other information (*)

This is coming up only in the parent (caller) component

[FieldWrapper]: Styled versions incorrectly applying CSS

Component Name (*)

All the components that are wrapped in FieldWrapper, such as InputField and SelectField

Expected Behaviour (*)

If you make a styled version of one of these components, CSS would be applied the component as a whole.

const StyledInputField = styled(InputField, { mt: '$6' })

In this example it should be applying a margin above the label.

Actual Behaviour (*)

If you make a styled version of one of these components, the CSS does not apply to the FieldWrapper and instead applies to the base input component.

Steps to reproduce (*)

Use the following code, you will notice the margin being applied incorrectly as in the screenshot:

const StyledInputField = styled(InputField, { mt: '$6' })

image

Other information (*)

Chrome browser, Mac OSX 12.0.1

Feature request: Table

Component Name(*) or Feature Name

Table

Description(*)

The component should render a table with a optional header and footer

Designs and UX wireframes(*)

Please attach the designs and UX wireframes for this component (or links to the designs).

Additional Information

Feature request: Badge

Component Name(*) or Feature Name

Badge

Description(*)

We need a badge component in order to be able to replace the react-bootstrap badge.
We need the following states:

  • success
  • warning
  • error
  • info
  • primary

Designs and UX wireframes(*)

Designs available exist in the DS Figma file
image

for info we can use neutral and for primary we can use (coordinated with Miguel for these options)
image

Note: the last 2 options are temporary until the colour palette is extended, but it would be easy to replace the colour values so we can build this without the final list of colours

Additional Information

ValidationError: Icon and spacing from text shrink as text wraps to multiple lines

Component Name (*)

ValidationError

Expected Behaviour (*)

Regardless of the number of lines of text:

  • the icon should remain the same size
  • the icon should remain aligned to the top of the text block
  • the spacing from the text block should not change

Actual Behaviour (*)

When text wraps to more than one line, the icon and spacing shrink, and the icon vertically aligns with the middle of the text block

Screen Shot 2021-07-28 at 13 00 20

Steps to reproduce (*)

Use enough text to wrap to multiple lines

Other information (*)

Google Chrome - version 92.0.4515.107 (Official Build) (x86_64)
macOS Big Sur - version 11.4 (20F71)

Feature request: Button

Component Name

Button

Description(*)

Update isLoading behaviour to allow text replacement when loading, e.g.

<Button isLoading={{ value: true, message: "Doing something…" }}>Click here to do something</Button>

We could retain the same subtle style change as the current loading state but replace the text instead of showing animated dots. I think it could be really useful in more functional dashboards with lots of buttons, to make it clear what is happening.

Not sure about the API for this, value seems a bit meh but it would be nice to use the existing isLoading prop, rather than add a further loadingMessage or similar.

Screen.Recording.2021-11-02.at.16.26.38.mov

Feature request: Add scrollbar config to stitches config

Component Name(*) or Feature Name

Stitches Config - add config

Description(*)

Passing this config should hide scrollbars - scrollbar: 'none'

scrollbar: () => ({
  '&::-webkit-scrollbar': { display: 'none' },
  scrollbarWidth: 'none'
})

Table: problem

Table should set css={{ borderCollapse: 'collapse' }} by default

Feature request: Better scrolling for Tabs in mobile view

Component Name(*) or Feature Name

Tabs.tsx
TabsTriggerList.tsx
TabTrigger.tsx

Description(*)

Ideally, I would want it to snap (and select / focus) one tab at a time, per scroll click - think of google sheets scrolling, it snaps to one cell at a time.

[Select]: Component doesn't accommodate a controlled usage

Component Name (*)

Select

Actual Behaviour (*)

We have many situations where we need to use the select component in a controlled state (ie in EnhancedTable etc). Currently, it works but we get a console log error warning us to select one of the modes.

 Select elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled select element and remove one of these props. More info: https://fb.me/react-controlled-components
    in select (created by Styled.select)
    in Styled.select (created by Select)
    in Select (at PaperSelection.tsx:136)
    in div (created by ForwardRef)
    in ForwardRef (created by ForwardRef)
    in RunningLayerCountProvider (created by o)
    in o (created by ForwardRef)
    in RunningLayerCountProvider (created by o)
    in o (created by ForwardRef)
    in ForwardRef (created by ForwardRef)
    in TotalLayerCountProvider (created by o)
    in o (created by ForwardRef)
    in TotalLayerCountProvider (created by o)

This is caused because defaultValue is set in the component.
image

We could alter the component to request either the value or the default value and one of them to be mandatory instead of setting it in the component

Steps to reproduce (*)

Open any view that uses the select component in a controlled state (like PaperSelection or EnhancedTable with Pagination)

New Text component that does not apply capsize

We need to have a component that does all the things Text does apart from applying capsize, which we can use when we want a component to function as a <span>. With capsize applied on Text there is no way to render multiple Text elements as spans without a line break.

This new component could be called BaseText and it would not apply capsize. The component Text could apply styling on top of BaseText via capsize.

Feature request: Radio Card

Component Name(*) or Feature Name

Radio Card

Description(*)

Uses radio button group functionality and combines with a card to supply differently styled labels per option

Designs and UX wireframes(*)

Screenshot 2021-07-13 at 17 07 13
Screenshot 2021-07-13 at 17 07 04

Additional Information

It can likely utilise the RadioButton and RadioButtonGroup components (or logic) but provide the wrapping card and the ability to pass in children to the card.

`CheckboxField` & `RadioGroupField` don't validate correctly

Expected Behaviour (*)

CheckboxField and RadioGroupField should show a validation error if the props are passed correctly and the form is trigged

Actual Behaviour (*)

They do not show an error

Steps to reproduce (*)

Using react-hook-forms, trigger, it should show the error for both required fields

const TriggerValidation = ({ trigger }) => {
  React.useEffect(() => {
    trigger()
  }, [trigger])
  return null
}

<Form
  onSubmit={() => null}
  render={(props) => (
    <>
      <TriggerValidation {...props} />
      <CheckboxField
        label="This is a checkbox"
        name="checkbox-error"
        validation={{ required: "This is the validation error" }}
      />
      <RadioGroupField
        name="options-error"
        label="Legend for radio fields"
        validation={{ required: "This is the validation error" }}
      >
        <RadioGroupField.Item label="This is a radio button" value="1" />
        <RadioGroupField.Item label="This is another radio button" value="2" />
      </RadioGroupField>
    </>
  )}
/>

Feature request: Date picker

Component Name(*) or Feature Name

DatePicker

Description(*)

Essentially wrap the functionality of https://github.com/wojtekmaj/react-date-picker and provide a nice UI layer

Designs and UX wireframes(*)

None available, @Chema-Atom could I get you to take a look if I throw something together?

Additional Information

We're currently using a package that's 4000% (yeah) larger than this one for the same functionality

Feature Request: Tabs

Component Name(*) or Feature Name

Tabs

Description(*)

The component should be able to contain an unlimited amount of sections. Each section should have a trigger that displays its name and a container that would take other components as children and render them. Selecting any trigger should swap the currently displayed content with its own and also style that particular trigger as active, while the previously active trigger should become inactive. Only one tab should be active at any given moment.

Designs and UX wireframes(*)

Wireframes representing the component can be found here.

Additional Information

Feature Update: Alert dialog

Component Name(*) or Feature Name

Alert Dialog

Description(*)

Rendering the second button should become optional or be allowed to be turned off to accommodate for use cases where the user can't go back to the previous step and need to only click the primary button.

Additional Information

This is needed in a few places for the school app

Feature request: Optional label for Form Fields

Component Name(*) or Feature Name

All Form Fields (InputField, CheckboxField etc.)

Description(*)

The Form Field components are a nice and easy way to create different form fields without the hassle of hooking it up to react-hook-form. I noticed that the main reason why I sometimes cannot use the wrappers is because I don't need a label, for example when you combine different fields in one fieldset (dates, etc.).

It would be nice if the label is optional or can be hidden (not sure what is better accessibility-wise).

Additional Information

Technically you could hide the label with a CSS selector like & > label, but I don't think that makes our code very clear to read.

Allow `validation={{ required: true }}` to render a * on the label

Component Name (*)

This behaviour exists across all form components

Expected Behaviour (*)

When using validation like so, I would expect a red * to appear next to the label indicating that the field is required

<CheckboxField
  label="This is a checkbox"
  name="checkbox-error"
  validation={{ required: 'This is the validation error' }}
/>

Actual Behaviour (*)

The * does not appear as the Field components require a second required prop

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.