Giter Site home page Giter Site logo

dopplr-labs / tail-kit Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 3.0 8.44 MB

React UI kit built using tailwindcss

Home Page: https://tail-kit.web.app/

JavaScript 2.86% TypeScript 95.65% CSS 1.38% HTML 0.11%
component-library react tailwindcss tailwindui ui-kit

tail-kit's People

Contributors

abinashpanda avatar dependabot[bot] avatar hnagrath09 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

Watchers

 avatar  avatar  avatar  avatar  avatar

tail-kit's Issues

InputNumber

Describe the component
InputNumber component to enter a number within a certain range with the mouse or keyboard.

Describe the component props
The InputNumber would have all the props as a default <input type="checkbox" /> html element with some additional properties such as

Prop Description Required Type Default Value
defaultValue The initial value no number
disabled If disable the input no boolean false
max The max value no number Number.MAX_SAFE_INTEGER
min The min value no number Number.MIN_SAFE_INTEGER

Describe the component use cases

  • A clear and concise description of components use case (if possible with code). It might be used a story in storybook.

Alert Component

Alert component to show an error, warning, success, or info message.

Alert Props

Prop Description Required Type Default Value
type Type of the alert which can be either AlertType.error or AlertType.warning or AlertType.success or AlertType.info no AlertType AlertType.info
title Alert title yes React.ReactNode
content Alert content no React.ReactNode
icon Alert icon no JSX.Element or boolean
actions Alert action buttons no JSX.Element
closable Making alert closable. It would render (X) button no boolean true
onClose Function to be called on pressing the (X) button no (event: React.MouseEvent<HTMLButtonElement>) => void

Additional Copmonents

AlertButton

Prop Description Required Type Default Value
type Type of button no AlertButtonType AlertButtonType.primary
label Button label yes string
icon Button icon no JSX.Element
loading Button loading no boolean
className additional classes no string
style addtional styles no React.CSSProperties

Stories

  • Info alert
  • Success alert
  • Warning alert
  • Error alert (preferably list of form submit errors)
  • Alert with actions
  • Alert with only title
  • Alert with custom icon
  • Alert with close action

Checkbox Component

Describe the component
Checkbox component to render a checkbox

Describe the component props
The checkbox would have all the props as a default <input type="checkbox" /> html element with some additional properties such as

Prop Description Required Type Default Value
checked specifies if the checkbox is selected no boolean false
onChange callback function that is triggered when the checkbox state changes no (event: React.ChangeEvent<HTMLInputElement> => void
label checkbox label no React.ReactNode
error specifies if there is any form error with the checkbox, it would change the border or background color to error color depending on checked value boolean
className additional classes no string
style additional styles no React.CSSProperties

Describe the component use cases

  • Default checked checkbox
<Checkbox value={true} />
  • Rendering a default checkbox with label
<Checkbox value={rememberMe} onChange={toggleRememberMe} label="Remember Me" />
  • Rendering the checkbox with error
<Checkbox value={termsAgreed} onChange={toggleTermsAgreed} label="I agree to the terms and conditions" error={!termsAgreed} />

Register ref is not working for Select component

Describe the bug
Register ref of hook useForm imported from react-hook-form is not working with Select component

To Reproduce
Steps to reproduce the behavior:

  1. Create a Form component
const handleSubmit = data => console.log(data);

<Form onSubmit={handleSubmit}>
  <Form.Item name='gender' label='Gender'>
    <Select
        options={['Male', 'Female', 'Other']}
        placeholder="Select your gender"
        className="w-full"
     />
  </Form.Item>
  <Button type='submit' label='Submit' />
</Form>
  1. Click on Submit button.
  2. Will be unable to see data of Select component in console.

Add Month & Year navigation in Date Picker

Is your feature request related to a problem? Please describe.
Add quick Navigation support for Month and Year in Date Picker to directly pick a value rather than moving one value at a time.
Snapshot of antd date-picker
Screenshot 2021-08-18 at 9 54 53 AM

Describe the solution you'd like
Inside Date Picker, a user should be able to click on the year to see and navigate through a decade in single click.

Automation

Add automation for

  • Running tests and code coverage on PR
  • Deploy the storybook for the PR on netlify and notify on the PR
  • Setup dependabot
  • Templates for new component issues and error issues

Create a common hook for syncing state and props

Currently, the useSyncedState hook updates the local state with the props. But this hook still lacks functionality to update to call onChange handlers from the props on updating local state. So to solve this problem almost every component has implemented a different logic. This is not maintainable in long term. There should be a common hook in the form of

const [inputValue, setInputValue] = useSyncedState(value, {
  // callback function called when the state is updated
  onStateChange: (updatedValue) => {
    onChange?.(updatedValue)
  },
  // comparator function to compare when the state and prop differs
  // for perfomance optimization the hook should use shallow comparision by default
  // but for the complex cases like date picker, user should have a way to provide a comparator function
  comparator: (a, b) => a === b
})

In the above example, the value and onChange are props provided to the component, when we want to run it as a controlled component. In absence of these props, the component should behave as an uncontrolled component. So it should also maintain its own state. But this poses a challenge of inputValue state with value prop. If there is a new value, it should update the inputValue and if there is any change in inputValue, it should update the value by calling the onChange prop.

This hook also aims to provide a simpler mental model to the component developer to consider this element as a simple uncontrolled element and use inputValue and setInputValue as it is. The logic of syncing should be handled by hook itself.

Unable to publish on npmjs

Describe the bug
npm publish command is not able to publish the latest changes on npmjs.com. This is happening after adding Form component. Error message is telling that Form component has circular dependency with it's other compound component elements.

To Reproduce
Steps to reproduce the behavior:

  1. Pull the latest develop branch
  2. Use npm publish command
  3. Bump the version

onChange is not triggered when increment/decrement buttons are used in InputNumber

onChange function is not called if values are changed using increment/decrement arrow buttons in InputNumber component.

Steps to Reproduce

import { InputNumber } from '@tail-kit/tail-kit'

export default function BugReproduction(){
  const [value, setValue] = useState(3);

  function handleChange(event) {
     console.log('New Value', event.target.value);
     setValue(event.target.value);
  }
   
   return <InputNumber value={value} onChange={handleChange} />
}

handleChange will not be called if value of input is changed using Arrow buttons

Installing tail-kit in external project throws error

Describe the bug
Use tail-kit in external projects throws ** Invalid hook call** error. This happens because tail-kit is also bundled with react and in the projects where these versions don't match, it throws an error. On further inspection, it is found that tail-kit uses react as a dependency, instead, it should be used as peer-dependency.

To Reproduce
Steps to reproduce the behavior:
https://codesandbox.io/s/resizable-panes-forked-r5c0r?file=/src/index.js

Using tailwind jit mode causes CSS issues for alert component

Describe the bug
Base Color is computed based on the alert type prop provided by the user. Switching to JIT mode in tailwindCSS is purging the possible classes of the alert component.

To Reproduce
Steps to reproduce the behavior:

  1. Add mode: 'jit' in tailwind.config.js
  2. See alert component in storybook

Expected behavior
Fix CSS classes for the alert component to support jit mode.

Screenshots

Screenshot 2021-07-18 at 8 35 24 AM

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.