Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b81d054
fix for webpack config error
gerwinbeumer Mar 7, 2017
50a3cbe
Wrapped forms function inside document ready
pauldenieuwezaak May 1, 2017
fb9c677
Tweaked forms docs
pauldenieuwezaak May 2, 2017
a914a53
Updated forms readme
pauldenieuwezaak May 2, 2017
3f51459
Hide label when input field has focus and/or a value
pauldenieuwezaak May 2, 2017
eda1195
Styled disabled checked checkbox and radiobutton
pauldenieuwezaak May 2, 2017
e4867b6
Labels for inputs that are used as placeholders now require the class…
pauldenieuwezaak May 3, 2017
009d057
- Deleted (label) element in selector for placeholder (now more gener…
pauldenieuwezaak May 3, 2017
f82ab46
Reverted change that messed up the label-bottom position
pauldenieuwezaak May 3, 2017
9f5777e
Added styling for input[type=date]
pauldenieuwezaak May 3, 2017
075f583
Update readme with (among others) step-by-step getting started guide.
pauldenieuwezaak May 8, 2017
45abf6f
Added note that node.js needs to be installed
pauldenieuwezaak May 9, 2017
6a2f399
Added 'download boilerplate' option to 'How to install' + Changed a h…
pauldenieuwezaak May 9, 2017
d1dfb72
Changed a h3 to a h4
pauldenieuwezaak May 9, 2017
e75f3a3
Added roadmap and contributing to end of readme
pauldenieuwezaak May 9, 2017
4de4499
Merge pull request #15 from CastleCSS/feature/#8_input_type_date_has_…
dariusrosendahl Jul 4, 2017
49f3967
Merge remote-tracking branch 'origin/develop' into feature/#6_Default…
dariusrosendahl Jul 4, 2017
ba8709b
2.0.0
dariusrosendahl Jul 5, 2017
a948c7c
- Version bump to 2.0.0 because of breaking changes
dariusrosendahl Jul 5, 2017
1ca5f54
Merge pull request #14 from CastleCSS/feature/#6_Default_label_not_wo…
dariusrosendahl Jul 5, 2017
5e53d1c
Merge pull request #12 from CastleCSS/feature/#7_Checkbox_checked_not…
dariusrosendahl Jul 5, 2017
a2abaaf
Merge pull request #5 from CastleCSS/feature/webpack_config_error
dariusrosendahl Jul 5, 2017
237c16f
Merge pull request #16 from CastleCSS/feature/#10_Documentation_not_e…
dariusrosendahl Sep 5, 2017
28c3ef4
Changed the classes placeholder to label so change is no longer break…
dariusrosendahl Sep 7, 2017
cc9def9
Wrong version, should be 1.0.8 not 1.8.0
dariusrosendahl Sep 7, 2017
dcdf753
Using input keypress to make jquery respond faster
Sep 22, 2017
02a5deb
Removing default placeholders. Label style fix
Sep 25, 2017
0b93090
Dependencies
Sep 25, 2017
2e44995
style fix label and fallback for placeholder
Sep 25, 2017
476ecf3
package-lock upgrade
Sep 25, 2017
3e949d5
label fixes
Sep 26, 2017
4acbd11
Merge pull request #20 from CastleCSS/label-fixes
dariusrosendahl Sep 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 74 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
# CastleCSS Forms
Quickly add forms with this CastleCSS module.

![CastleCSS logo @CastleCss.com](https://www.doordarius.nl/castlecss-logo-250.png)

## CastleCSS Framework
The form files are part of the [CastleCSS Package](https://github.com/CastleCSS/castlecss)
The form files are part of the [CastleCSS Package](https://github.com/CastleCSS/castlecss).

## How to install
- Install via [npm](https://www.npmjs.com/): ```npm install castlecss-forms```
- Download the [CastleCSS Boilerplate](https://www.github.com/CastleCSS/castlecss-boilerplate). All Packages are included + examples and project setup
- Install via [npm](https://www.npmjs.com/): ```npm install castlecss-forms -S``` (see [below](#getting-started) for a step-by-step guide)
- Require it in your own npm package
- Download or clone the package

## Updating files
CastleCSS is built so it's easy to update, you can just download make it your own as long as you don't ovewrite the core files.
CastleCSS is built in such a way that it's easy to update, you can just download and make it your own as long as you don't overwrite the core files. To update the forms module, just run:

```npm update castlecss-forms```

## Documentation and examples
You can find the documentation and examples at http://www.castlecss.com and [castlecss-docs](https://github.com/CastleCSS/castlecss-docs)

You can find the documentation and examples for CastleCSS Forms [here](http://www.castlecss.com/forms.html). You can also download the [CastleCSS Boilerplate](https://github.com/castlecss/castlecss-boilerplate), which includes CastleCSS Forms.

## Adjusting the variables
Because of the unique update-able setup of CastleCSS you need a seperate variable file to overwrite the default CastleCSS variables. There are a few ways to do this:

- Use the [boilerplate](https://github.com/CastleCSS/castlecss-boilerplate/) which provides the complete distribution of CastleCSS Forms
- Copy variables.scss from /node_modules/castlecss-core/sass/variables.scss into your own scss folder and include it into your main.scss
- Copy the example from the [documentation](http://castlecss.com/forms.html) into your own variables.scss and include it into your main.scss
## Getting started

## Dependencies
Because CastleCSS Forms uses jQuery as dependency, the distributions contain jQuery. There is however a possibility to make use of the jQuery version of your choice, by making use of the no.vendors distributions.
The no.vendor distributions work, as long as the jQuery variable is defined in the global scope.

## Basic structure
The basis structure for your website should look similar like this:
Your project should have a setup similar to the example below (included in the [CastleCSS Boilerplate](https://github.com/CastleCSS/castlecss-boilerplate)).
This way you make sure your own variables overwrite the castle-core variables and your setup is still updatable.

```
| Project directory/
| Your project directory/
|
|-- node_modules/
| | -- castlecss-core/
Expand All @@ -59,37 +53,72 @@ The basis structure for your website should look similar like this:
|-- package.json
```

## Usage
There are a couple of different ways to make use of the CastleCSS Forms library.
### 1. Include CastleCSS Forms in your project
To do this, run the following command in your CLI (make sure you have [Node.js](https://nodejs.org/en/download/) installed on your computer):

```npm install castlecss-forms -S```

All dependencies needed in order for CastleCSS Forms to run properly are now available (in the 'node_modules' folder).


### 2. Include CastleCSS Forms in your sass structure
To enable CastleCSS Forms it is essential that you include the corresponding main.scss file in your project's own sass structure. Essentially, your 'main' sass file should have a setup similar to this (included in the [CastleCSS Boilerplate](https://github.com/CastleCSS/castlecss-boilerplate)):

```
/* core variable files */
@import "node_modules/castlecss-core/sass/variables";

/* Your own variables so they overwrite the core */
@import "variables";

/* rest of core files */
@import "node_modules/castlecss-core/sass/main";
@import "node_modules/castlecss-forms/sass/main";


/* Include your own files below this line
--------------------------------------
*/
```

### 3. Include script library

_Please not that **[jQuery](https://jquery.com/download/) is required** in order for CastleCSS Forms to work. Make sure the CastleCSS Forms scripts load after jQuery is loaded_.

We propose three ways to make use of the CastleCSS Forms script library, which will be listed below. CastleCSS Forms consists of multiple modules, which can be used separately if desired.

### Include as seperate modules
To make use of the modules seperately, use the following scripts:
#### Include all Forms modules
To make use of all the modules, simply include the following scripts (that are located in the 'dist' folder):

```
<script type="text/javascript" src="/path/to/scripts/Forms.min.js"></script>
<script type="text/javascript">
$(function () {
CastleCSS_Forms_Forms();
});
</script>
```

#### Include as separate modules
To make use of the modules separately, use the following scripts (that are located in the 'dist' folder):

```
<script type="text/javascript" src="/path/to/scripts/Vendors.bundle.js"></script>
<!--- The modules of your choice --->
<script type="text/javascript" src="/path/to/scripts/Select.min.js"></script>
<script type="text/javascript" src="/path/to/scripts/FileInput.min.js"></script>
<script type="text/javascript" src="/path/to/scripts/State.min.js"></script>

<script type="text/javascript">
/* For example */
CastleCSS_Forms_Select();
$(function () {
CastleCSS_Forms_Select();
});
</script>
```

### Include
To make use of all the modules, simply include the following scripts:

```
<script type="text/javascript" src="/path/to/scripts/Vendors.bundle.js"></script>
<script type="text/javascript" src="/path/to/scripts/Forms.min.js"></script>
<script type="text/javascript">
CastleCSS_Forms_Forms();
</script>
```

### Require
#### Require
It is possible to require CastleCSS Forms into your project.

```
Expand All @@ -98,13 +127,13 @@ var castlecss_forms = require('castlecss-forms');
/* Use all modules */
castlecss_forms.forms();

/* Use seperate modules */
/* Use separate modules */
castlecss_forms.select();
castlecss_forms.fileinput();
```

### Selectors
The CastleCSS Forms library by default searches for the following elements:
#### Selectors
By default, the CastleCSS Forms library searches for the following elements:

```
...
Expand All @@ -120,7 +149,7 @@ The CastleCSS Forms library by default searches for the following elements:
</select>
```

### Configuration
#### Configuration
By default, the CastleCSS Forms library uses the CastleCSS selectors.
It is possible to configure selectors of your own choice. Just add the following configuration:

Expand All @@ -133,3 +162,11 @@ CastleCSS_Forms_Forms({
CastleCSS_Forms_Select('.yourOwnSelector');
CastleCSS_Forms_FileInput('.yourOwnSelector');
```

## Roadmap
We're currently working hard on making the CastleCSS expansions and improvements. CastleCSS is made to serve as lightweight basis for tailor made software but we do want to give you the option to install a few modules to make your life easier.

Please see the [ROADMAP.MD from the CastleCSS Meta Package](https://github.com/CastleCSS/castlecss/blob/master/ROADMAP.md) for our current plans for the future.

## Contributing
Want to contribute? We'd love your help, please take a look at the roadmap or submit new suggestions.
2 changes: 1 addition & 1 deletion dist/FileInput.external.vendors.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Forms.external.vendors.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Select.external.vendors.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/State.external.vendors.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion dist/Vendor.external.vendors.min.js

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions dist/Vendors.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/State.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var State = function(selector) {
$(this).closest(_selector).addClass('has-focus');
}).on('focusout', 'input, textarea, select', function(){
$(this).closest(_selector).removeClass('has-focus');
}).on('keyup change', 'input, textarea, select', function(){
}).on('input keypress', 'input, textarea, select', function(){
setValue($(this));
});
};
Expand Down
Loading