Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit a8f5dae

Browse files
Merge branch 'master' into docs/tabs
2 parents e7381ca + 3c9785e commit a8f5dae

File tree

15 files changed

+901
-31
lines changed

15 files changed

+901
-31
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
33
<!-- ALL-CONTRIBUTORS-BADGE:END -->
44

5+
[**中文文档Github问题**](https://github.com/chakra-ui/chakra-ui-vue/issues/160)
6+
57
<p align="center">
68
<a href="https://github.com/chakra-ui/chakra-ui-vue">
79
<img src="https://res.cloudinary.com/xtellar/image/upload/v1584242872/chakra-ui/chakra-ui-vue-beta.png" alt="chakra-ui symbol" width="300" />

bundlesize.config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"files": [
3+
{
4+
"path": "./packages/chakra-ui-core/dist/umd/*.js",
5+
"maxSize": "85kB"
6+
}
7+
]
8+
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"now-build-storybook": "build-storybook -o dist/storybook",
3636
"docs:dev": "yarn theme:dev && yarn docs-dev",
3737
"theme:dev": "yarn workspace @chakra-ui/theme-vue build",
38-
"docs-dev": "yarn workspace chakra-ui-docs dev"
38+
"docs-dev": "yarn workspace chakra-ui-docs dev",
39+
"evalbundle": "bundlesize"
3940
},
4041
"dependencies": {
4142
"@babel/core": "^7.9.0",
@@ -117,7 +118,7 @@
117118
"v-scroll-lock": "^1.1.0",
118119
"vue": "^2.6.11",
119120
"vue-error-boundary": "^1.0.3",
120-
"vue-live": "^1.5.1",
121+
"vue-live": "1.5.1",
121122
"vue-loader": "^15.7.1",
122123
"vue-lorem-ipsum": "^0.0.1",
123124
"vue-meta": "^2.3.3",
@@ -134,6 +135,7 @@
134135
"@testing-library/user-event": "^10.0.0",
135136
"@testing-library/vue": "^4.1.0",
136137
"babel-eslint": "^10.0.1",
138+
"bundlesize": "^0.18.0",
137139
"cross-env": "^7.0.2",
138140
"eslint-config-prettier": "^6.10.0",
139141
"eslint-loader": "^3.0.3",

packages/chakra-ui-core/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"files": [
3030
"dist"
3131
],
32+
"bundle-phobia": {
33+
"max-size": "85KB",
34+
"max-overall-size": "85KB"
35+
},
3236
"dependencies": {
3337
"@styled-system/css": "^5.0.23",
3438
"animejs": "^3.1.0",

packages/chakra-ui-docs/components/FileContributors.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
<script>
3333
3434
import { CBox, CLink, CTag, CAvatar, CTagLabel, CHeading, CText } from '@chakra-ui/vue'
35-
// TODO: add custom fetch support to 'file-contributors'
3635
import getFileContributors from 'file-contributors'
3736
3837
export default {
@@ -63,8 +62,9 @@ export default {
6362
'$route.path': {
6463
immediate: true,
6564
handler (newVal, oldVal) {
65+
if (!process.client) return
6666
this.contributors = undefined
67-
if (newVal === '/index') return
67+
if (newVal === '/') return
6868
if (newVal !== oldVal) this.getContributors()
6969
}
7070
}

packages/chakra-ui-docs/components/LiveEditor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ const LiveEditor = {
7272
props: {
7373
code,
7474
layout: Layout
75+
},
76+
on: {
77+
error: (error) => {
78+
console.info('FANCY_ERROR', error)
79+
this.error = error
80+
}
7581
}
7682
})
7783
])
Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,108 @@
1-
# Select
1+
import SEO from '../components/SEO'
2+
3+
<SEO
4+
title="Select"
5+
description="Select component is a component that allows users pick a value from predefined options. Ideally, it should be used when there are more than 5 options, otherwise you might consider using a radio group instead."
6+
/>
7+
8+
# Select
9+
10+
Select component is a component that allows users pick a value from predefined options. Ideally, it should be used when there are more than 5 options, otherwise you might consider using a radio group instead.
11+
12+
## Import
13+
14+
```js
15+
import { CSelect } from '@chakra-ui/vue'
16+
```
17+
18+
## Usage
19+
20+
## Usage
21+
22+
Here's a basic usage of the Select component.
23+
24+
```vue live=true
25+
<template>
26+
<c-box mb="3" w="300px">
27+
<c-select v-model="burgerType" placeholder="Select Burger">
28+
<option value="grilled">Grilled Backyard Burger</option>
29+
<option value="pub-style">The Pub-Style Burger</option>
30+
<option value="jucy-lucy">The Jucy Lucy</option>
31+
</c-select>
32+
</c-box>
33+
</template>
34+
<script>
35+
export default {
36+
data() {
37+
return {
38+
burgerType: ''
39+
}
40+
}
41+
}
42+
</script>
43+
```
44+
45+
### Changing the size of the Select
46+
47+
There are three sizes of select : large (48px), default (40px) and small (32px).
48+
49+
```vue live=true
50+
<c-stack :spacing="3">
51+
<c-select placeholder="large size" size="lg" />
52+
<c-select placeholder="default size" size="md" />
53+
<c-select placeholder="small size" size="sm" />
54+
</c-sack>
55+
```
56+
57+
### Changing the appearance of the Select
58+
59+
Just like the input component, select comes in 3 variants, `outline`, `unstyled`
60+
, `flushed` , and `filled`. Pass the `variant` prop and set it to either of
61+
these values.
62+
63+
```vue live=true
64+
<c-stack :spacing="3">
65+
<c-select variant="outline" placeholder="Outline" />
66+
<c-select variant="filled" placeholder="Filled" />
67+
<c-select variant="flushed" placeholder="Flushed" />
68+
<c-select variant="unstyled" placeholder="Unstyled" />
69+
</c-stack>
70+
```
71+
72+
### Overriding the styles of the Select
73+
74+
Even though the select comes with predefined styles, you can override pretty
75+
much any property. Here's we'll override the background color.
76+
77+
```vue live=true
78+
<c-select
79+
backgroundColor="tomato"
80+
borderColor="tomato"
81+
color="white"
82+
placeholder="Woohoo! A new background color!"
83+
/>
84+
```
85+
86+
## Props
87+
88+
The Select component composes [PseudoBox](/pseudoBox) so you can pass all `PseudoBox` props.
89+
90+
| Name | Type | Default | Description |
91+
| ------------------ | ------------------------------------------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92+
| `size` | `sm`, `md`, `lg` | `md` | The visual size of the `select` element. |
93+
| `icon` | `string` | `chevron-down` | The icon to use in place if the `chevron-down` |
94+
| `iconSize` | `BoxProps['size']` | `20px` | The visual size of the icon |
95+
| `variant` | `outline`, `unstyled`, `flushed`, `filled` | `outline` | The variant of the select style to use. |
96+
| `focusBorderColor` | `string` | | The border color when the select is focused. |
97+
| `errorBorderColor` | `string` | | The border color when `isInvalid` is set to `true`. |
98+
| `isDisabled` | `boolean` | `false` | If `true`, the select will be disabled. This sets `aria-disabled=true` and you can style this state by passing `_disabled` prop. |
99+
| `isInvalid` | `boolean` | `false` | If `true`, the `select` will indicate an error. This sets `aria-invalid=true` and you can style this state by passing `_invalid` prop. |
100+
| `isRequired` | `boolean` | `false` | If `true`, the select element will be required. |
101+
| `isReadOnly` | `boolean` | `false` | If `true`, prevents the value of the select from being edited. |
102+
| `rootProps` | `BoxProps` | | The props to pass to the wrapper of the select. The select is wrapped in a `Box` to help align the icon, if you want to pass some props to that wrapper, use this prop |
103+
104+
## Slots
105+
106+
| Name | Description |
107+
| ------- | -------------------------------------------------------- |
108+
| default | contains the `<option>` element as children of `CSelect` |
Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,100 @@
1-
# Slider
1+
import SEO from '../components/SEO'
2+
3+
<SEO
4+
title="Slider"
5+
description="The Slider is used to allow users to make selections from a range of values."
6+
/>
7+
8+
# Slider
9+
10+
The Slider is used to allow users to make selections from a range of values.
11+
12+
Sliders reflect a range of values along a bar, from which users may select a
13+
single value. They are ideal for adjusting settings such as volume, brightness,
14+
or applying image filters.
15+
16+
## Import
17+
18+
```js
19+
import {
20+
CSlider,
21+
CSliderTrack,
22+
CSliderFilledTrack,
23+
CSliderThumb
24+
} from '@chakra-ui/vue'
25+
```
26+
27+
## Usage
28+
29+
```vue live=true
30+
<c-slider default-value="56">
31+
<c-slider-track />
32+
<c-slider-filled-track />
33+
<c-slider-thumb />
34+
</c-slider>
35+
```
36+
37+
### Changing the slider color
38+
39+
```vue live=true
40+
<c-slider color="pink" default-value="24">
41+
<c-slider-track />
42+
<c-slider-filled-track />
43+
<c-slider-thumb />
44+
</c-slider>
45+
```
46+
47+
## Props
48+
49+
### Slider Props
50+
51+
The `Slider` component wraps all it's children in the [Box](/box) component, so
52+
you can pass all `Box` props to change it's style.
53+
54+
| Name | Type | Default | Description |
55+
| ------------------ | -------------------------- | ------- | ------------------------------------------------------------------------- |
56+
| `value` | `number` | | The value of the slider. |
57+
| `defaultValue` | `number` | | The initial value of the slider. |
58+
| `max` | `number` | | Standard `input` max attribute. |
59+
| `min` | `number` | | Standard `input` min attribute. |
60+
| `step` | `number` | | Standard `input` step attribute. |
61+
| `aria-label` | `string` | | The accessible label. |
62+
| `aria-labelledby` | `string` | | The `id` of the element that labels the sliders |
63+
| `aria-valuetext` | `string` | | The aria-valuetext of the switch for accessibility. |
64+
| `orientation` | `string` | | The orientation of the slider, only `horizontal` is supported for now. |
65+
| `getAriaValueText` | `(value: number ): string` | | The callback to format the `aria-valuetext`. |
66+
| `size` | `sm`, `md`, `lg` | | The size of the slider. |
67+
| `color` | `string` | | The color scheme to use for the slider. Use a color key in `theme.colors` |
68+
| `name` | `string` | | The name of the slider component when used in a form. |
69+
| `id` | `string` | | The id of the slider component when used in a form. |
70+
71+
## Slider Events
72+
73+
| Name | Description |
74+
| ----------- | --------------------------------------------------------------- |
75+
| `change` | Callback fired when the value of the slider changes. |
76+
| `onFocus` | Callback fired when the thumb receives focus |
77+
| `blur` | Callback fired when the thumb is blurred |
78+
| `mouseDown` | Callback fired when the you mousedown on any part of the slider |
79+
| `keyDown` | Callback fired when the you keydown on any part of the slider |
80+
81+
## Slots
82+
83+
| Name | Description |
84+
| ------- | ------------------------------------ |
85+
| default | Slot for the children of the slider. |
86+
87+
### SliderThumb Props
88+
89+
SliderThumb composes [PseudoBox](/pseudobox) so you can pass all PseudoBox props
90+
to change it's style.
91+
92+
### SliderFilledTrack Props
93+
94+
SliderFilledTrack composes [PseudoBox](/pseudobox) so you can pass all PseudoBox
95+
props to change it's style.
96+
97+
### SliderTrack Props
98+
99+
SliderTrack composes [Box](/box) so you can pass all Box props to change it's
100+
style.

0 commit comments

Comments
 (0)