@justeattakeaway/pie-checkbox 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -71
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,16 +8,6 @@
|
|
|
8
8
|
</a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
# Table of Contents
|
|
12
|
-
|
|
13
|
-
1. [Introduction](#pie-checkbox)
|
|
14
|
-
2. [Installation](#installation)
|
|
15
|
-
3. [Importing the component](#importing-the-component)
|
|
16
|
-
4. [Peer Dependencies](#peer-dependencies)
|
|
17
|
-
5. [Props](#props)
|
|
18
|
-
6. [Events](#events)
|
|
19
|
-
7. [Contributing](#contributing)
|
|
20
|
-
|
|
21
11
|
## pie-checkbox
|
|
22
12
|
|
|
23
13
|
`pie-checkbox` is a Web Component built using the Lit library.
|
|
@@ -38,70 +28,13 @@ $ yarn add @justeattakeaway/pie-checkbox
|
|
|
38
28
|
|
|
39
29
|
For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
|
|
40
30
|
|
|
31
|
+
## Documentation
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
#### JavaScript
|
|
45
|
-
```js
|
|
46
|
-
// Default – for Native JS Applications, Vue, Angular, Svelte, etc.
|
|
47
|
-
import { PieCheckbox } from '@justeattakeaway/pie-checkbox';
|
|
48
|
-
|
|
49
|
-
// If you don't need to reference the imported object, you can simply
|
|
50
|
-
// import the module which registers the component as a custom element.
|
|
51
|
-
import '@justeattakeaway/pie-checkbox';
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
#### React
|
|
55
|
-
```js
|
|
56
|
-
// React
|
|
57
|
-
// For React, you will need to import our React-specific component build
|
|
58
|
-
// which wraps the web component using @lit/react
|
|
59
|
-
import { PieCheckbox } from '@justeattakeaway/pie-checkbox/dist/react';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
> [!NOTE]
|
|
63
|
-
> When using the React version of the component, please make sure to also
|
|
64
|
-
> include React as a [peer dependency](#peer-dependencies) in your project.
|
|
65
|
-
|
|
33
|
+
Visit [Checkbox | PIE Design System](https://pie.design/components/checkbox/code) to view more information on this component.
|
|
66
34
|
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
> [!IMPORTANT]
|
|
70
|
-
> When using `pie-checkbox`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## Props
|
|
74
|
-
|
|
75
|
-
| Property | Type | Default | Description |
|
|
76
|
-
|---|---|---|---|
|
|
77
|
-
| `name` | `string` | - | The name of the checkbox (used as a key/value pair with `value`). This is required in order to work properly with forms. |
|
|
78
|
-
| `value` | `string` `'on'` | The value of the input (used as a key/value pair in HTML forms with `name`). If not passed falls back to the html default value "on". |
|
|
79
|
-
| `required` | `boolean` | `false` | If true, the checkbox is required to be checked before submitting the form. If it is not in checked state, the component validity state will be invalid. |
|
|
80
|
-
| `disabled` | `boolean` | `false` | Indicates whether or not the checkbox is disabled. |
|
|
81
|
-
| `checked` | `boolean` | `false` | Controls whether or not the checkbox is checked. |
|
|
82
|
-
| `defaultChecked` | `boolean` | `false` | Sets the default checked state for the checkbox. This does not directly set the initial checked state when the page loads, use `checked` for that. If the checkbox is inside a form which is reset, the `checked` state will be updated to match `defaultChecked`. |
|
|
83
|
-
| `indeterminate` | `boolean` | `false` | Indicates whether the checkbox visually shows a horizontal line in the box instead of a check/tick. It has no impact on whether the checkbox's value is used in a form submission. That is decided by the checked state, regardless of the indeterminate state. |
|
|
84
|
-
| `assistiveText` | `string` | - | Allows assistive text to be displayed below the checkbox element. |
|
|
85
|
-
| `status` | `'default'`, `'error'`, `'success'` | `'default'` | The status of the checkbox component / assistive text. If you use `status` you must provide an `assistiveText` prop value for accessibility purposes. |
|
|
86
|
-
|
|
87
|
-
In your markup or JSX, you can then use these to set the properties for the `pie-checkbox` component:
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<!-- Native HTML -->
|
|
91
|
-
<pie-checkbox name="mycheckbox">Label</pie-checkbox>
|
|
92
|
-
|
|
93
|
-
<!-- Without a label it is necessary to pass aria-label or aria-labelledby attributes to the component -->
|
|
94
|
-
<pie-checkbox name="mycheckbox" aria-label="Label"></pie-checkbox>
|
|
95
|
-
|
|
96
|
-
<!-- JSX -->
|
|
97
|
-
<PieCheckbox name="mycheckbox">Label</PieCheckbox>
|
|
98
|
-
<PieCheckbox name="mycheckbox" aria-label="Label"></PieCheckbox>
|
|
99
|
-
```
|
|
35
|
+
## Questions
|
|
100
36
|
|
|
101
|
-
|
|
102
|
-
| Event | Type | Description |
|
|
103
|
-
|-------|------|-------------|
|
|
104
|
-
| `change` | `CustomEvent` | Triggered after the checked state of a checkbox changes. |
|
|
37
|
+
Please head to [FAQs | PIE Design System](https://pie.design/support/contact-us/) to see our FAQs and get in touch.
|
|
105
38
|
|
|
106
39
|
## Contributing
|
|
107
40
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-checkbox",
|
|
3
3
|
"description": "PIE Design System Checkbox built using Web Components",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,11 +36,12 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
39
|
+
"@justeattakeaway/pie-components-config": "0.17.0",
|
|
40
|
+
"@justeattakeaway/pie-css": "0.12.1",
|
|
40
41
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@justeattakeaway/pie-assistive-text": "0.
|
|
44
|
+
"@justeattakeaway/pie-assistive-text": "0.7.0",
|
|
44
45
|
"@justeattakeaway/pie-webc-core": "0.24.0"
|
|
45
46
|
},
|
|
46
47
|
"volta": {
|