0.1.8 • Published 3 years ago

react-ultralite-ui v0.1.8

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
3 years ago

ADCAT UI Component Library


Author: Indrajeet Ambadekar

Installation:

npm install -S react-ultralite-ui

For a better experience, use fontawesome as well

Available Components:

  • Input fields Number field, Text field , date field
  • Select Field
  • Progress Bar
  • Modal
  • Toggle Switch
  • CheckBox
  • Sliding Drawer (Right-to-Left motion)
  • Text input with auto suggest
  • Accordion (Top-to-Bottom motion)

Please refer the below content to understand the usage of available components in detail:

Input Field

Usage:
  import {InputField} from "adcat-ui";



  <InputField
    type="text"
    className="text-field" // your classname
    label="User name"
    name="username"
    value={uname}
    placeholder="Enter user name"
    onChange={(value) => {
      setTestStr(value); //use a set-state or custom callback.
    }}
    textStyle="uppercase" // optional. `uppercase` returns string in uppercase
    iconLeft={<i className="fas fa-user" />}
    iconRight={<i className="fas fa-user" />}
  />
Parameters:
AttributeDescriptionMandatory
type"text" / "Number" / "email" / "password" / "date"YES
classNameuser defined stringNO
labelcustom string or ''YES
namecustom stringYES
valuejavascript variableYES
disabledboolean true/falseNO
onChangecallback that returns the value of inputNO
onFocuscallback that returns the javascript event on focusNO
onBlurcallback that returns the javascript event on blurNO
onKeyPresscallback that returns the javascript event on Key PressNO
onKeyUpcallback that returns the javascript event on Key UpNO
onKeyDowncallback that returns the javascript event on Key DownNO
autoFocusboolean true/falseNO
iconLeftprovide jsx to display font-awesome icon or image on the left end of inputNO
iconRightprovide jsx to display font-awesome icon or image on the left end of inputNO
data-testidincase you want to add a test id for jest/enzyme/react-testing-libraryNO

Select Field

Usage:
  import {SelectField} from "adcat-ui";



  <SelectField
    noDefault={false}
    value={maritalStatus}
    onChange={(value) => setMaritalStatus(value)}
    className="select-field"
    label="Marital status"
  >
    <option value="SINGLE">Single</option>
    <option value="MARRIED">Married</option>
    <option value="WIDOW">Widow</option>
    <option value="DIVORCED">Divorced</option>
  </SelectField>
Parameters:
AttributeDescriptionMandatory
noDefaultType: Boolean (true/false). Setting this to false adds and empty option with empty value to use as placeholder. setting this to true removes the empty option and user defined options are displayedNO (Default false)
classNameuser defined stringNO
labelcustom string or ''YES
onChangecallback that returns the value of inputNO
data-testidincase you want to add a test id for jest/enzyme/react-testing-libraryNO
  **Note:
  `option` children with value and content are mandatory for this component

TextBox

Usage:
  import {TextBox} from "adcat-ui";



  <TextBox
    className="address-box"
    name="address-box"
    value={addressOfResidence || ''}
    onChange={(value) =>
      // dom something with the `value`
    }
    label="Address of residence"
    rows={2}
    textAreaStyles={{ resize: 'vertical' }}
    labelStyles={{ color: 'red' }}
    wrapperStyles={{ backgroundColor: 'red' }}
  >
  </TextBox>
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
labelcustom string or ''YES
namecustom stringYES
valuejavascript variableYES
disabledboolean true/falseNO
onChangecallback that returns the value of inputNO
onFocuscallback that returns the javascript event on focusNO
onBlurcallback that returns the javascript event on blurNO
onKeyPresscallback that returns the javascript event on Key PressNO
onKeyUpcallback that returns the javascript event on Key UpNO
onKeyDowncallback that returns the javascript event on Key DownNO
rowsSpecifies the visible number of lines in a text areaNO
colsSpecifies the visible width of a text areaNO
textAreaStylesText Area Styles (Object)NO
labelStylesLabel Styles (Object)NO
wrapperStylesWrapper Styles (Object)NO

Progress Bar

Usage:
  import {ProgressBar} from "adcat-ui";



  <ProgressBar
    className="upload-progress"
    value={50} // maximum 100. takes value as percentage eg:(40% / 50%)
    height={20}
    fillLabel={`Floating value that moves with value`}
    label={`Fixed value displayed at end of progress bar`}
    bgColor="#ececec"
  />
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
labelFixed value displayed at end of progress barYES
fillLabelFloating value that moves with valueYES
bgColorhex color codeYES
heightHeight in pixels for the progress barYES
valuebetween 0 and 100YES

Modal

Usage:
  import {UiModal} from "adcat-ui";



  <UiModal id="modal-id" isShowing={modalFlag} hide={togglePwdModal}>
    // html goes here
  </UiModal>
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
idunique id for modal indetificationYES
isShowingBoolean (true/false)YES
hidecallback function to dismiss the dialog by setting the value of isShowing attribute to falseYES

Toggle Switch

Usage:
  import {Switch} from "adcat-ui";



  <Switch
    name={`unique-name`}
    onChange={(value) => {
      toggleAccount(value);
    }}
    checked={flag}
  ></Switch>
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
nameunique name for switch indetificationYES
checkedBoolean (true/false)YES
disabledBoolean (true/false)NO
onChangecallback that returns the opposite value of inputYES

CheckBox

Usage:
  import {Checkbox} from "adcat-ui";



  <Checkbox
    className="item-select"
    checked={flag}
    onChange={(value) => handleClick(value)}
  />
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
checkedBoolean (true/false)YES
disabledBoolean (true/false)NO
onChangecallback that returns the opposite value of inputYES

Sliding Drawer

Usage:
  import {SlideDrawer} from "adcat-ui";



  <SlideDrawer
    show={flag}
    id="info-drawer"
    handleClose={dismissDialog}
  >
    // HTML goes here
  </SlideDrawer>

SlideDrawer opens RTL(right-to-left)

Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
idunique id for drawer indetificationYES
showBoolean (true/false)YES
handleClosecallback function to dismiss the drawer by setting the value of show attribute to falseYES

Accordion

Usage:
  import {Accordian} from "adcat-ui";



  <Accordion
    title={<div className="accordian-heading">According Heading</div>}
  >
    // HTML goes here
  </Accordion>
Parameters:
AttributeDescriptionMandatory
classNameuser defined stringNO
titlestring or jsxYES
openIconcustom icon(image/svg/fontawesome-icon) to open the accordianNO
collapseIconcustom icon(image/svg/fontawesome-icon) to collapse the accordianNO

Text input with auto suggest

Usage:
  import {AutoComplete} from "adcat-ui";



  <AutoComplete
    dataSet={suggestedUsers} //array
    onChange={(value) => setSearchParams(value)}
    onKeyUp={(event) => {
      if (event.keyCode === 13 || event.keyCode === 32) {
        _fetchUsers();
      }
    }}
    label="Search users by name/email/username"
    onSelect={(item) => _selectUser(item)}     // callback to select item
    iconLeft={<i className="fas fa-users" />}  // optional image/svg/fontawesome-icon
    iconRight={                                // optional image/svg/fontawesome-icon
      <i
        className="fas fa-times"
        onClick={() => {
          setSuggUsers([]);
          setSearchParams("");
        }}
      />
    }
    autoFocus={true}
    placeholder="John Doe"
    value={searchParams}
    renderItem={(x) => (                        // jsx to display suggestion list
      <div className="sugg-user-row">
        <div className="grid" md={1}>
          <div className="content">
            <i className="fas fa-user" />
          </div>
        </div>
        <div className="grid" md={11}>
          <div className="content">
            <div className="user-name">
              {x.firstname} {x.lastname} [email: {x.email}]
            </div>
          </div>
        </div>
      </div>
    )}
  />