2.17.38 • Published 4 months ago

@up-group-ui/react-controls v2.17.38

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

React-Controls

Background Info

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get started!

Main Features

  • React
  • Isolation
  • Statically Typed
  • TypeScript
  • Styled Components
  • React
  • Validation

Getting Started

  1. Clone the Repo git clone https://github.com/Up-Group/react-controls

  2. Install Dependencies From the root of the project directory, run yarn if you have yarn installed globally. --- or --- npm install.

Styled Components

This project embraces styled-components as it's a fantastic way to style your React components.

Check the components directory for examples.

File Tree Structure

src/
│   ├── Input
│   │   ├── __tests__
│   │   │   ├── __mocks__
│   │   │   │   └── boxMocks.mock.ts
│   │   │   ├── __snapshots__
│   │   │   │   └── index.test.tsx.snap
│   │   │   └── index.test.tsx
│   │   ├── index.tsx
│   │   ├── styles.ts
|   |   ├── Input.tsx
|   |   └── ...
├── index.ts

Generators

Next to come

Testing

Included is a test framework for all of your React testing needs. We are using Jest to run the test suite and generate snapshots, plus Enzyme for component introspection.

Tests should be collocated within the component they represent. Test files should be named index.test.tsx and mocks must be named myMock.mock.ts.

Deployment

Scripts

  • npm run setup:yarn
    • Install the package dependencies via yarn
  • npm install
    • Install dependencies (the ol' fashioned way)
  • npm run test
    • Run the test suite
  • npm run test:watch
    • Run the test suite in watch mode
  • npm run test:update
    • Update the failing snapshot tests

Components

  1. Containers

  2. Display

  3. Inputs

Each input component has the common props :

  • onChange?: (arg: _BaseType, event: any) => void : the onChange handler
  • value?: _BaseType : the type of value
  • disabled?:boolean : the disable state of the component
  • readonly?:boolean : the readonly state of the component
  • tooltip?: string | Tooltip : a tooltip explaining the usage of the component

  • UpCheckbox : provide a component to display a set of option with multiple choice

A checkbox option is defined as : - name:string : the name attribute of the input DOMElement - value:any : the value of the input DOMElement - text?:string : the text to be displayed next to the checkbox - iconName?:string : a icon within the set provided by our UI kit - onChange?:(e:any) => void : the onChange handler - checked:boolean : the checked value of the checkbox

<UpCheckbox options={[{
  text: "My Option 1",
  name: "Option1",
  onChange: this.onOptionChange,
  value: true,
  checked: this.state.option1 === true
}, {
  text: "My Option 2",
  name: "Option2",
  onChange: this.onOptionChange,
  value: true,
  checked: this.state.option2 === true
}, {
  text: "My Option 3",
  name: "Option3",
  onChange: this.onOptionChange,
  value: true,
  checked: this.state.option3 === true
}]} />
  • UpDate : provide a component for selectin date
    • format?:string : the format
    • minDate?:Date : the minimal date of the date picker
    • maxDate?:Date : the maximal date of the date picker
    • value?:Date : in order to set the value from outside
    • onChange?:(e:any) => void : the onChange handler
<UpLabel width="small" inline={true} text="Begin date :">
  <UpDate tooltip="Start dat of ..." maxDate={this.state.endDate} onChange={this.onBeginDateChange} value={this.state.beginDate} />
</UpLabel>
<UpLabel width="small" inline={true} text="End date :">
  <UpDate minDate={this.state.beginDate} onChange={this.onEndDateChange} value={this.state.endDate} />
</UpLabel>
  • UpDateTime : provide a component for selectin date and time
    • format?:string : the format
    • minDate?:Date : the minimal date of the date picker
    • maxDate?:Date : the maximal date of the date picker
    • value?:Date : in order to set the value from outside
    • onChange?:(e:any) => void : the onChange handler
    • tooltip?: string | Tooltip : a tooltip explaining the usage of the component
  <UpLabel inline={true} text="Date and time :">
    <UpDateTime onChange={this.onDateTimeChange} value={this.state.dateTime} />
  </UpLabel>
  • UpEmail : provide a component for specifying email with validation
    • placeholder?: string : the placeholder string of the component
    • height?: HeightSize : the height of the component
    • width?: WidthSize : the width of the component
    • maxLength?:number : the maximume length of the email
    • onChange?:(e:any) => void : the onChange handler
    • tooltip?: string | Tooltip : a tooltip explaining the usage of the component
    • value?:string : in order to set the value from outside
<UpLabel inline={true} text="Email :" textAlign="right" width="small">
  <UpEmail width="xlarge" placeholder="Enter the email used for your identification" onChange={this.onEmailChange} value={this.state.email} />
</UpLabel>
  • UpFile

  • UpInput : a generic component for specifying single line text

    • placeholder?: string : the placeholder string of the component
    • height?: HeightSize : the height of the component
    • width?: WidthSize : the width of the component
    • maxLength?:number : the maximume length of the email
    • onChange?:(e:any) => void : the onChange handler
    • tooltip?: string | Tooltip : a tooltip explaining the usage of the component
 <UpLabel text="Confirmation code :" inline={true} textAlign="right" width="small">
  <UpInput width="xlarge" placeholder="Enter the confirmation code"
    validation={[{
        pattern:/^(\d){4}$/,
        errorMessage:"Must contain 4 digits"
    }]}
    tooltip="The verification code received by SMS"
    iconName="ok-sign"
    maxLength={4}
    value={this.state.code} />
</UpLabel>
  • UpNumber : provide a component for specifying number
    • max?: number : the maximal value of the number
    • min?: number : the minimale value of the number
    • stepSize?:number : the step used during each incrementation/decrementation
    • decimalPlace?:number : the place of the decimal
    • value?:number|string : in order to set the value from outside
 <UpNumber width="xlarge" placeholder="Enter the amount"
                        stepSize={10} onChange={this.onAmountChange} decimalPlace={2}
                        tooltip="The amount of ..."
                        value={this.state.amout} />
  • UpInteger : provide a UpNumber component with min value greater to 0 and decimalPlace equals to 0
    • max?: number : the maximal value of the number
    • min?: number : the minimale value of the number. Invariant -> min > 0
    • stepSize?:number : the step used during each incrementation/decrementation
    • value?:number|string : in order to set the value from outside
 <UpLabel text="Age :" inline={true} textAlign="right" width="small">
    <UpInteger width="xlarge" placeholder="Entrer your age"
      stepSize={10} onChange={this.onAgeChange}
      value={this.state.age} />
</UpLabel>
  • UpPhone : provide a component for specifying a phone number with validation
    • placeholder?: string : the placeholder string of the component
    • height?: HeightSize : the height of the component
    • width?: WidthSize : the width of the component
    • maxLength?:number : the maximume length of the email
    • onChange?:(e:any) => void : the onChange handler
    • tooltip?: string | Tooltip : a tooltip explaining the usage of the component
    • value?:string : in order to set the value from outside
<UpLabel inline={true} text="Phone :" textAlign="right" width="small">
  <UpPhone width="xlarge" placeholder="Enter your phone number" onChange={this.onPhoneChange} value={this.state.phone} />
</UpLabel>
  • UpRadio : provide a component to display a set of option with single choice

A checkbox option is defined as : - value:any : the value of the input DOMElement - text?:string : the text to be displayed next to the checkbox - iconName?:string : a icon within the set provided by our UI kit - onChange?:(e:any) => void : the onChange handler - checked:boolean : the checked value of the checkbox

<UpRadio name="gender" value={this.state.gender}
  options={[{
    text: "Female",
    onChange: this.onGenderChange,
    value: "F",
    checked: this.state.gender === "F"
  }, {
    text: "Male",
    onChange: this.onGenderChange,
    value: "M",
    checked: this.state.gender === "M"
  }]} />
  • UpSelect : provide a select component with data from array or ajax call
    • multiple?: boolean : allow multiple selection
    • data?: any : a array of data for initialisation of the select's options
    • placeholder?: string : the select placeholder message
    • loadingPlaceholder?:string : the text to be displayed during the loading step
    • allowClear?: boolean : Allow o clear the current selection
    • minimumInputLength?: number : the minimum input length for ajax call
    • dataSource?: { id?: string, text?: string, query: string, queryParameterName?: string} : the defintion o data source for dynamically fetch the options by autloading or autcompletion search
    • autoload?:boolean : Autoload the options from the data source
    • noResultsText? : string : the text to be displayed if none data found
    • clearAllText? : string : the text to be displayed for clearAll action
    • clearValueText? : string : the text to be displayed for the clear value action
    • addLabelText? : string : the text to be displayed for the add label action
    • searchPromptText? : string : the text to be displayed during the search step
    • optionRenderer?: React.StatelessComponent : a component fore rendering the option
    • valueRenderer?: React.StatelessComponent : a compoent for rendering the value

An UpSelectOption is defined as : id:number|string : the unique id of the option text:string: the text to be displayed icon:string : the icon to be displayed

<UpLabel inline={true} width="small" text="My todos :">
  <UpSelect autoload={false}
    allowClear={true}
    multiple={false}
    tooltip="Selct the todos completed"
    minimumInputLength={3}
    dataSource={{
      query: "https://jsonplaceholder.typicode.com/todos",
      text: "title"
    }}
    onError={this.onSelectionError} onChange={this.onSelectionChange} value={this.state.todosCompleted} />
</UpLabel>
  • UpText

  • UpTimePicker

Resources

Contributing

See here for our contribution guide. We are on slack, please go here for an invite We'd love to hear from you!

License

See here for the license.

Roadmap

0.2.297

4 months ago

0.2.296

4 months ago

0.2.295

5 months ago

0.2.294

6 months ago

0.2.293

6 months ago

0.2.292

6 months ago

0.2.291

7 months ago

0.2.290

7 months ago

0.2.289

8 months ago

0.2.288

8 months ago

2.17.52

8 months ago

2.17.51

8 months ago

2.17.53

8 months ago

2.17.50

8 months ago

2.17.49

8 months ago

2.17.48

8 months ago

2.17.47

8 months ago

0.2.287

9 months ago

0.2.286

9 months ago

2.17.46

9 months ago

0.2.285

9 months ago

0.2.284

10 months ago

0.2.283

10 months ago

2.17.45

10 months ago

2.17.33

10 months ago

0.2.282

11 months ago

0.2.281

11 months ago

2.17.43

12 months ago

0.2.280

12 months ago

0.2.279

1 year ago

0.2.277

1 year ago

2.17.41

1 year ago

0.2.269

1 year ago

0.2.268

1 year ago

0.2.276

1 year ago

0.2.275

1 year ago

0.2.274

1 year ago

0.2.273

1 year ago

0.2.272

1 year ago

0.2.271

1 year ago

0.2.270

1 year ago

2.17.38

1 year ago

2.17.39

1 year ago

2.17.36

1 year ago

2.17.35

1 year ago

2.17.30

1 year ago

2.17.32

1 year ago

2.17.31

1 year ago

0.2.267

2 years ago

0.2.266

2 years ago

0.2.265

2 years ago

0.2.264

2 years ago

0.2.263

2 years ago

2.17.28

2 years ago

2.17.27

2 years ago

0.2.262

2 years ago

2.17.26

2 years ago

0.2.261

2 years ago

0.2.260

2 years ago

0.2.259

2 years ago

0.2.258

2 years ago

0.2.257

2 years ago

0.2.256

2 years ago

0.2.255

2 years ago

0.2.253

2 years ago

0.2.252

2 years ago

0.2.251

2 years ago

0.2.250

2 years ago

0.2.249

2 years ago

0.2.248

2 years ago

0.2.247

2 years ago

0.2.246

2 years ago

0.2.245

2 years ago

0.2.244

2 years ago

0.2.243

2 years ago

0.2.242

2 years ago

0.2.241

2 years ago

0.2.240

2 years ago

0.2.239

2 years ago

0.2.238

2 years ago

0.2.237

2 years ago

0.2.236

2 years ago

0.2.235

2 years ago

0.2.233

2 years ago

0.2.232

2 years ago

0.2.231

2 years ago

0.2.230

2 years ago

0.2.229

2 years ago

0.2.228

2 years ago

0.2.227

2 years ago

0.2.226

2 years ago

0.2.225

2 years ago

0.2.224

2 years ago

0.2.223

2 years ago

0.2.222

2 years ago

0.2.221

2 years ago

0.2.220

2 years ago

0.2.219

2 years ago

0.2.218

2 years ago

0.2.217

2 years ago

0.2.216

2 years ago

0.2.214

2 years ago

0.2.215

2 years ago

0.2.213

2 years ago

0.2.209

2 years ago

0.2.208

2 years ago

0.2.206

2 years ago

0.2.205

2 years ago

0.2.204

2 years ago

0.2.203

2 years ago

0.2.201

2 years ago

0.2.200

2 years ago

0.2.199

2 years ago

0.2.197

2 years ago

2.17.25

2 years ago

0.2.190

2 years ago

2.17.24

2 years ago

2.17.23

2 years ago

0.2.188

2 years ago

0.2.195

2 years ago

0.2.186

2 years ago

0.2.185

2 years ago

0.2.184

2 years ago

2.17.21

3 years ago

0.2.183

3 years ago

2.17.20

3 years ago

0.2.182

3 years ago

2.17.19

3 years ago

0.2.181

3 years ago

0.2.180

3 years ago

0.2.179

3 years ago

0.2.177

3 years ago

2.17.18

3 years ago

2.17.17

3 years ago

2.17.16

3 years ago

2.17.14

3 years ago

0.2.176

3 years ago

2.17.13

3 years ago

0.2.175

3 years ago

2.17.12

3 years ago

2.17.11

3 years ago

2.17.10

3 years ago

2.17.8

3 years ago

2.17.7

3 years ago

2.17.6

3 years ago

0.2.174

3 years ago

0.2.173

3 years ago

2.17.5

3 years ago

2.17.4

3 years ago

2.17.2

3 years ago

2.17.3

3 years ago

2.17.0

3 years ago

2.17.1

3 years ago

0.2.171

3 years ago

0.2.170

3 years ago

0.2.168

3 years ago

0.2.167

3 years ago

0.2.166

3 years ago

0.2.165

3 years ago

0.2.164

3 years ago

0.2.163

3 years ago

0.2.162

3 years ago

0.2.161

3 years ago

0.2.160

3 years ago

0.2.159

3 years ago

0.2.158

3 years ago

0.2.157

3 years ago

0.2.156

3 years ago

0.2.147

4 years ago

0.2.155

4 years ago

0.2.154

4 years ago

0.2.153

4 years ago

0.2.150

4 years ago

0.2.146

4 years ago

0.1.287

4 years ago

0.2.144

4 years ago

0.2.143

4 years ago

0.2.142

4 years ago

0.2.141

4 years ago

0.2.140

4 years ago

0.1.285

4 years ago

0.2.139

4 years ago

0.2.137

4 years ago

0.2.135

4 years ago

0.2.134

4 years ago

0.2.133

4 years ago

0.2.132

4 years ago

0.2.131

4 years ago

0.2.130

4 years ago

0.2.129

4 years ago

0.2.128

4 years ago

0.2.127

4 years ago

0.2.126

4 years ago

0.2.125

4 years ago

0.2.124

4 years ago

0.2.123

4 years ago

0.2.122

4 years ago

0.2.121

4 years ago

0.2.120

4 years ago

0.2.119

4 years ago

0.2.118

4 years ago

0.2.117

4 years ago

0.1.282

4 years ago

0.1.283

4 years ago

0.1.280

4 years ago

0.2.115

4 years ago

0.2.114

4 years ago

0.2.112

4 years ago

0.2.111

4 years ago

0.2.110

4 years ago

0.2.109

4 years ago

0.2.108

4 years ago

0.2.107

4 years ago

0.2.106

4 years ago

0.2.105

4 years ago

0.2.104

4 years ago

0.2.103

4 years ago

0.2.102

4 years ago

0.2.101

4 years ago

0.2.100

4 years ago

0.2.98

4 years ago

0.2.97

4 years ago

0.2.96

4 years ago

0.2.95

4 years ago

0.2.94

4 years ago

0.2.93

4 years ago

0.2.92

4 years ago

0.2.91

4 years ago

0.2.90

4 years ago

0.2.89

4 years ago

0.2.88

4 years ago

0.2.87

4 years ago

0.2.86

4 years ago

0.2.85

4 years ago

0.2.84

4 years ago

0.2.83

4 years ago

0.2.82

4 years ago

0.2.81

4 years ago

0.2.80

4 years ago

0.2.79

4 years ago

0.2.78

4 years ago

0.2.77

4 years ago

0.2.76

4 years ago

0.2.75

4 years ago

0.2.74

4 years ago

0.2.73

4 years ago

0.2.72

4 years ago

0.2.71

4 years ago

0.2.70

4 years ago

0.2.69

4 years ago

0.2.68

4 years ago

0.2.67

4 years ago

0.2.66

4 years ago

0.2.65

4 years ago

0.2.64

4 years ago

0.2.63

4 years ago

0.2.62

4 years ago

0.2.61

4 years ago

0.2.60

4 years ago

0.2.59

4 years ago

0.2.58

4 years ago

0.2.57

4 years ago

0.2.56

4 years ago

0.2.55

4 years ago

0.2.54

4 years ago

0.2.53

4 years ago

0.2.52

5 years ago

0.2.51

5 years ago

0.2.50

5 years ago

0.2.49

5 years ago

0.2.48

5 years ago

0.2.47

5 years ago

0.2.46

5 years ago

0.2.45

5 years ago

0.2.44

5 years ago

0.2.43

5 years ago

0.2.42

5 years ago

0.2.41

5 years ago

0.2.40

5 years ago

0.2.38

5 years ago

0.2.36

5 years ago

0.2.35

5 years ago

0.2.34

5 years ago

0.2.33

5 years ago

0.2.32

5 years ago

0.2.31

5 years ago

0.2.30

5 years ago

0.2.29

5 years ago

0.2.28

5 years ago

0.2.27

5 years ago

0.2.26

5 years ago

0.2.25

5 years ago

0.2.24

5 years ago

0.2.23

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.19

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.1.278

5 years ago

0.1.277

5 years ago

0.1.275

5 years ago

0.1.274

5 years ago

0.1.276

5 years ago

0.1.271

5 years ago

0.1.273

5 years ago

0.1.272

5 years ago

0.1.270

5 years ago

0.1.268

5 years ago

0.1.267

5 years ago

0.1.266

5 years ago

0.1.265

5 years ago

0.1.264

5 years ago