Giter Club home page Giter Club logo

react-tailwind's Introduction

AdaptUI React Tailwind

React UI built with @adaptui/react, ariakit & tailwind

Get Started

Documentation & Getting Started

Storybook

Start the development server

yarn storybook

Build the storybook

yarn build-storybook

Build

Build the components ready for packages with tree shaking ability into dist folder

yarn build

Release

Release a new version

yarn release

Note: Before running,

Create a new Github Token as per the docs and export to the CLI env like export GITHUB_TOKEN=xxxx

Commit

git add . && yarn commit

Uses gacp

  • Runs Husky to improve the commits.
  • Husky runs Lint Staged as a pre-commit hook to run lintes & formatters
  • Husky lints the commit message with Commitlint

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Navin Moorthy

💻

Anurag Hazra

💻

MC Naveen

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

react-tailwind's People

Contributors

anuraghazra avatar depfu[bot] avatar kodiakhq[bot] avatar mcnaveen avatar navin-moorthy avatar renovate-bot avatar renovate[bot] 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

Watchers

 avatar  avatar  avatar  avatar

react-tailwind's Issues

[RFC] Avatar Component

Avatar API RFC

Components

  • Avatar
  • AvatarGroup - Stack for holding multiple avatars
  • AvatarBadge (optional) maybe we can use our badge component.

Props

  • src string - Image URL
  • name string - Alt for the image, will also be used for placeholder initials
  • size string - Size of the Avatar
  • onError - Function called when image failed to load
  • fallback React.ReactNode - custom fallback element

API

<Avatar src="https://bit.ly/dan-abramov" size="md" name="Dan Abrahmov" />

When the image is loading we will show the placeholder initials

Usage with icon

<Avatar><UserIcon/><Avatar/>

image

fallback

If there is an error loading the avatar image, the component falls back to an
alternative in the following order:

  • the provided fallback
  • the initials which is calculated from name prop
  • a generic avatar icon
<Avatar
  fallback={<GenericUserIcon />}
  src="https://bit.ly/dan-abramov"
  size="md"
  name="Dan Abrahmov"
/>

image

AvatarGroup

Avatar group is a stack or flex container to hold multiple avatars in a group.

Props

  • limit number - Max number of avatars to show inside the group, rest of them
    will get sliced.

API

<AvatarGroup limit={3}>
  <Avatar name="Remy Sharp" src="..." />
  <Avatar name="Travis Howard" src="..." />
  <Avatar name="Cindy Baker" src="..." />
  <Avatar name="Agnes Walker" src="..." />
  <Avatar name="Trevor Henderson" src="..." />
</AvatarGroup>

image

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • chore(deps): ⬆️ update dev dependencies (minor) (@babel/cli, @babel/core, @babel/plugin-proposal-private-property-in-object, @babel/preset-env, @babel/preset-react, @babel/preset-typescript, @commitlint/cli, @commitlint/config-conventional, @release-it/conventional-changelog, @storybook/addon-a11y, @storybook/addon-actions, @storybook/addon-essentials, @storybook/builder-webpack5, @storybook/manager-webpack5, @storybook/react, @swc/cli, @swc/core, @swc/jest, @tailwindcss/forms, @testing-library/dom, @testing-library/jest-dom, @testing-library/react, @testing-library/user-event, @types/jest, @types/jest-axe, @types/node, @types/react, @types/react-dom, @types/testing-library__jest-dom, all-contributors-cli, autoprefixer, axe-core, concurrently, eslint, eslint-config-prettier, eslint-plugin-storybook, gacp, husky, jest-axe, lint-staged, patch-package, postcss, postcss-cli, postcss-selector-parser, prettier, prettier-plugin-tailwindcss, react-icons, release-it, storybook-addon-preview, tailwindcss, typescript, webpack)
  • chore(deps): ⬆️ update prod dependencies (minor) (@react-aria/live-announcer, ariakit, ariakit-utils, tailwind-merge)
  • chore(deps): ⬆️ update actions/checkout action to v4
  • chore(deps): ⬆️ update dependency node to v18
  • chore(deps): ⬆️ update dev dependencies (major) (major) (@release-it/conventional-changelog, @storybook/addon-a11y, @storybook/addon-actions, @storybook/addon-essentials, @storybook/builder-webpack5, @storybook/react, @testing-library/dom, @testing-library/jest-dom, @testing-library/react, @types/jest, concurrently, eslint-config-prettier, eslint-plugin-prettier, eslint-plugin-simple-import-sort, jest, jest-axe, jest-environment-jsdom, lint-staged, patch-package, postcss-focus-visible, prettier, release-it, rimraf, sort-package-json, typescript)
  • Click on this checkbox to rebase all open PRs at once

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
npm
package.json
  • @adaptui/react 1.0.0-alpha.9
  • @react-aria/live-announcer 3.1.1
  • ariakit 2.0.0-next.38
  • ariakit-utils 0.17.0-next.24
  • tailwind-merge 1.5.1
  • @babel/cli 7.18.10
  • @babel/core 7.18.10
  • @babel/plugin-proposal-class-properties 7.18.6
  • @babel/plugin-proposal-private-methods 7.18.6
  • @babel/plugin-proposal-private-property-in-object 7.18.6
  • @babel/preset-env 7.18.10
  • @babel/preset-react 7.18.6
  • @babel/preset-typescript 7.18.6
  • @commitlint/cli 17.0.3
  • @commitlint/config-conventional 17.0.3
  • @release-it/conventional-changelog 5.0.0
  • @storybook/addon-a11y 6.5.10
  • @storybook/addon-actions 6.5.10
  • @storybook/addon-essentials 6.5.10
  • @storybook/addon-postcss 2.0.0
  • @storybook/builder-webpack5 6.5.10
  • @storybook/manager-webpack5 6.5.10
  • @storybook/react 6.5.10
  • @swc/cli 0.1.57
  • @swc/core 1.2.224
  • @swc/jest 0.2.22
  • @tailwindcss/forms 0.5.2
  • @testing-library/dom 8.16.1
  • @testing-library/jest-dom 5.16.5
  • @testing-library/react 13.3.0
  • @testing-library/react-hooks 8.0.1
  • @testing-library/user-event 14.4.2
  • @types/jest 28.1.6
  • @types/jest-axe 3.5.4
  • @types/node 18.6.1
  • @types/react 18.0.17
  • @types/react-dom 18.0.6
  • @types/testing-library__jest-dom 5.14.5
  • all-contributors-cli 6.20.0
  • autoprefixer 10.4.8
  • axe-core 4.4.3
  • babel-plugin-jsx-remove-data-test-id 3.0.0
  • browserlist 1.0.1
  • concurrently 7.3.0
  • cross-env 7.0.3
  • eslint 8.21.0
  • eslint-config-prettier 8.5.0
  • eslint-config-react-app 7.0.1
  • eslint-plugin-prettier 4.2.1
  • eslint-plugin-simple-import-sort 7.0.0
  • eslint-plugin-storybook 0.6.4
  • focus-visible 5.2.0
  • gacp 3.0.2
  • glob-fs 0.1.7
  • husky 8.0.1
  • jest 28.1.3
  • jest-axe 6.0.0
  • jest-environment-jsdom 28.1.3
  • lint-staged 13.0.3
  • outdent 0.8.0
  • patch-package 6.4.7
  • pinst 3.0.0
  • postcss 8.4.16
  • postcss-cli 10.0.0
  • postcss-focus-visible 7.1.0
  • postcss-selector-parser 6.0.10
  • prettier 2.7.1
  • prettier-plugin-tailwindcss 0.1.13
  • react 18.2.0
  • react-dom 18.2.0
  • react-icons 4.4.0
  • release-it 15.2.0
  • rimraf 3.0.2
  • sort-package-json 1.57.0
  • storybook-addon-preview 2.2.0
  • tailwindcss 3.1.8
  • typescript 4.7.4
  • webpack 5.74.0
  • react 16.x || 17.x || 18.x
  • react-dom 16.x || 17.x || 18.x
nvm
.nvmrc
  • node 16

  • Check this box to trigger a request for Renovate to run again on this repository

RFC - Alert Component

The Goal:

Create an customizable, extendable & easily stylable Alert Component.

The Alert Component will follow WAI-ARIA Alert

Key Resources for the Alert Component,

image

Component Parts

  • Alert: The wrapper for alert components.
    image
  • AlertIcon: The visual icon for the alert that changes based on the status prop.
    image
  • AlertTitle: The title of the alert to be announced by screen readers.
    image
  • AlertDescription: The description of the alert to be announced by screen readers.
    image
  • AlertActionButton: The action butotn for the alert that changes based on the status prop.

Usage

<Alert status="success">
  <AlertIcon />
  <AlertTitle>Your browser is outdated!</AlertTitle>
  <AlertDescription>Your experience may be degraded.</AlertDescription>
  <AlertActionButton>Update</AlertActionButton>
  <Button aria-label="close"><ButtonIcon><CloseIcon/></ButtonIcon></Button>
</Alert>

Props

Alert

  • status - The status of the alert - "info" | "warning" | "success" | "error" | "offline

default: "info"

[RFC] Slider Component

Slider API RFC

Goal

Create an accessible, easy to use but still flexible enough slider component.

Following our renderlesskit slider component:
renderlesskit/react slider

Components

  • Slider - Main component
  • Optional (only for flexiblity)
    • SliderTrack
    • SliderThumb
    • SliderThumbTooltip
    • SliderInput

Props

All the basic props from :-
useSliderState

  • defaultValue number | number[]

  • tooltipContent React.ReactNode | (value: number | number[]) => JSX.Element

    Can be used to format tooltip content

  • tooltipVisible boolean

    When tooltipVisible is true, Tooltip will show always, or tooltip will not
    show anyway, even if dragging or hovering.

  • tooltipPlacement

  • thumbContent React.ReactNode | (value: number | number[]) => JSX.Element

API

<Slider defaultValue={10} onChane={e => console.log(e)} />

Multi slider

Two values

<Slider defaultValue={[10, 20]} />

If defaultValues contains exactly two values we render this :-
image

More than two values

<Slider defaultValue={[10, 20, 30, 40]} />

If defaultValues contains more than two values we render this :-

image

Customization

Track

Customization of track can be done via the theme file

Thumb

To change the styles of the thumb users can use the theme file.

To change the thumb content

<Slider thumbContent={<SomeIcon />} />

Showing values in thumb

<Slider thumbContent={value => <span>{value} %</span>} />

Tooltip content

Format tooltip text

const tooltipFormatter = value => `${value}$`;

<Slider tooltipContent={tooltipFormatter} />;

Rendering react elements in tooltipContent

const tooltipFormatter = (value) => <span className="px-2">{value}</span>

<Slider tooltipContent={tooltipFormatter} />

Full customization

Users can do full customization through renderprops

<Slider>
  {state => (
    <>
      <SliderTrack />
      <SliderThumb>
        <VisuallyHidden>
          <SliderInput />
        </VisuallyHidden>
      </SliderThumb>
      <SliderThumbTooltip>Tooltip content</SliderThumbTooltip>
    </>
  )}
</Slider>

[RFC] Theming system & bundle size

The problem

Currently how our theming system works has some downsides to it.

For our theming system we are basically using the tailwind.config.js file to
extend our component themes.

Now issues with this approach is that we have to include our tailwind.config.js
file in our client bundle (we are adding build step specific configs in clientside), thus increasing the bundle size of the end user.

// Importing tailwind config
import tailwindConfig from "../tailwind.config";

ReactDOM.render(
  <React.StrictMode>
    <RenderlesskitProvider tailwindConfig={tailwindConfig}>
      <App />
    </RenderlesskitProvider>
  </React.StrictMode>,
  document.getElementById("root"),
);

Currently our preset.js file imports

  • tailwindcss/colors
  • tailwindcss/defaultTheme
  • deepmerge
  • tailwindPlugins/borderColor
    • tailwindcss/plugin
    • tailwindcss/lib/util/flattenColorPalette
  • tailwindPlugins/utilities
  • tailwindPlugins/variantPlugin
    • postcss-selector-parser
    • tailwindcss/lib/util/buildSelectorVariant
  • can get bigger as we add more plugins and other tailwind specific packages

Size analysis:

  • preset.js - 13kb (unminified)
  • tailwindcss/colors - 5kb (unminified)
  • tailwindcss/defaultTheme - 22kb (unminified)
    • lodash/deepmerge (dependency)
  • tailwindPlugins/variantPlugin
    • postcss-selector-parser (12kb min+gzip)

And remember this can get larger and larger down the dependency list because of dev dependencies getting included in our client bundle.

Screenshots:

  • tailwind/colors
    image

  • tailwind default config
    image

  • postcss-selector-parser
    image

The Solution

A quick fix for this would be to separate our theme from tailwind config. We can
have a separate theme.js file where users can extend the theme which will
eliminate the bundle size issue.

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.