@component-hook/picker 1.0.4 → 1.1.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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +118 -118
  3. package/package.json +2 -2
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Tzuyi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Tzuyi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,118 +1,118 @@
1
- # @component-hook/picker
2
-
3
- Picker component with `vue3` and `react`.
4
-
5
- <p>
6
- <a href="https://npm-stat.com/charts.html?package=@component-hook/picker">
7
- <img src="https://img.shields.io/npm/dm/@component-hook/picker.svg" alt="npm"/>
8
- </a>
9
- <a href="https://www.npmjs.com/package/@component-hook/picker">
10
- <img src="https://img.shields.io/npm/v/@component-hook/picker.svg" alt="npm"/>
11
- </a>
12
- </p>
13
-
14
- ## Features
15
-
16
- - Supports `single-column` and `cascade` picker
17
- - Scroll wheel 3D effect for smooth selection
18
- - Customize `title`, `confirm` and `cancel` buttons
19
- - Flexible column structure for different use cases
20
- - Built-in `DatePicker` and `TimePicker` components
21
- - Full TypeScript support
22
-
23
- ## Documentation
24
-
25
- For detailed documentation and usage examples, please visit: [Official Docs](https://tzuyi0817.github.io/component-hook/#/component/vue-picker).
26
-
27
- ## Installation
28
-
29
- ```bash
30
- # Using npm
31
- $ npm install @component-hook/picker
32
-
33
- # Using yarn
34
- $ yarn add @component-hook/picker
35
-
36
- # Using pnpm
37
- $ pnpm install @component-hook/picker
38
- ```
39
-
40
- ## Base Usage
41
-
42
- ### Vue3
43
-
44
- ```vue
45
- <script setup lang="ts">
46
- import { ref } from 'vue';
47
- import { Picker } from '@component-hook/picker/vue';
48
-
49
- const isShowPicker = ref(false);
50
- const pickerValues = ref<number[]>([]);
51
- const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
52
-
53
- function onConfirm(value: number[]) {
54
- pickerValues.value = value;
55
- }
56
-
57
- function onCancel() {
58
- console.log('cancel');
59
- }
60
- </script>
61
-
62
- <template>
63
- <picker
64
- v-model:show="isShowPicker"
65
- :columns="columns"
66
- title="Base Selector"
67
- @confirm="onConfirm"
68
- @cancel="onCancel"
69
- />
70
-
71
- <button @click="isShowPicker = true">toggle Base picker</button>
72
-
73
- <p class="mt-6 text-sm font-mono">Selected value: {{ pickerValues.join('') || 'not selected yet' }}</p>
74
- </template>
75
- ```
76
-
77
- ### React
78
-
79
- ```tsx
80
- import { useState } from 'react';
81
- import { Picker } from '@component-hook/picker/react';
82
-
83
- const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
84
-
85
- export function BasePicker() {
86
- const [showPicker, setShowPicker] = useState(false);
87
- const [pickerValues, setPickerValues] = useState<number[]>([]);
88
-
89
- function onConfirm(values: number[]) {
90
- setPickerValues(values);
91
- }
92
-
93
- return (
94
- <>
95
- <Picker
96
- show={showPicker}
97
- columns={columns}
98
- title="Base Selector"
99
- onClose={() => setShowPicker(false)}
100
- onConfirm={onConfirm}
101
- onCancel={onCancel}
102
- />
103
-
104
- <button onClick={() => setShowPicker(true)}>toggle Base picker</button>
105
-
106
- <p>Selected value: {pickerValues.join('') || 'not selected yet'}</p>
107
- </>
108
- );
109
- }
110
-
111
- function onCancel() {
112
- console.log('cancel');
113
- }
114
- ```
115
-
116
- ## License
117
-
118
- This project is licensed under the MIT License.
1
+ # @component-hook/picker
2
+
3
+ Picker component with `vue3` and `react`.
4
+
5
+ <p>
6
+ <a href="https://npm-stat.com/charts.html?package=@component-hook/picker">
7
+ <img src="https://img.shields.io/npm/dm/@component-hook/picker.svg" alt="npm"/>
8
+ </a>
9
+ <a href="https://www.npmjs.com/package/@component-hook/picker">
10
+ <img src="https://img.shields.io/npm/v/@component-hook/picker.svg" alt="npm"/>
11
+ </a>
12
+ </p>
13
+
14
+ ## Features
15
+
16
+ - Supports `single-column` and `cascade` picker
17
+ - Scroll wheel 3D effect for smooth selection
18
+ - Customize `title`, `confirm` and `cancel` buttons
19
+ - Flexible column structure for different use cases
20
+ - Built-in `DatePicker` and `TimePicker` components
21
+ - Full TypeScript support
22
+
23
+ ## Documentation
24
+
25
+ For detailed documentation and usage examples, please visit: [Official Docs](https://tzuyi0817.github.io/component-hook/#/component/vue-picker).
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ # Using npm
31
+ $ npm install @component-hook/picker
32
+
33
+ # Using yarn
34
+ $ yarn add @component-hook/picker
35
+
36
+ # Using pnpm
37
+ $ pnpm install @component-hook/picker
38
+ ```
39
+
40
+ ## Base Usage
41
+
42
+ ### Vue3
43
+
44
+ ```vue
45
+ <script setup lang="ts">
46
+ import { Picker } from '@component-hook/picker/vue';
47
+ import { ref } from 'vue';
48
+
49
+ const isShowPicker = ref(false);
50
+ const pickerValues = ref<number[]>([]);
51
+ const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
52
+
53
+ function onConfirm(value: number[]) {
54
+ pickerValues.value = value;
55
+ }
56
+
57
+ function onCancel() {
58
+ console.log('cancel');
59
+ }
60
+ </script>
61
+
62
+ <template>
63
+ <picker
64
+ v-model:show="isShowPicker"
65
+ :columns="columns"
66
+ title="Base Selector"
67
+ @confirm="onConfirm"
68
+ @cancel="onCancel"
69
+ />
70
+
71
+ <button @click="isShowPicker = true">toggle Base picker</button>
72
+
73
+ <p class="mt-6 text-sm font-mono">Selected value: {{ pickerValues.join('') || 'not selected yet' }}</p>
74
+ </template>
75
+ ```
76
+
77
+ ### React
78
+
79
+ ```tsx
80
+ import { Picker } from '@component-hook/picker/react';
81
+ import { useState } from 'react';
82
+
83
+ const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
84
+
85
+ export function BasePicker() {
86
+ const [showPicker, setShowPicker] = useState(false);
87
+ const [pickerValues, setPickerValues] = useState<number[]>([]);
88
+
89
+ function onConfirm(values: number[]) {
90
+ setPickerValues(values);
91
+ }
92
+
93
+ return (
94
+ <>
95
+ <Picker
96
+ show={showPicker}
97
+ columns={columns}
98
+ title="Base Selector"
99
+ onClose={() => setShowPicker(false)}
100
+ onConfirm={onConfirm}
101
+ onCancel={onCancel}
102
+ />
103
+
104
+ <button onClick={() => setShowPicker(true)}>toggle Base picker</button>
105
+
106
+ <p>Selected value: {pickerValues.join('') || 'not selected yet'}</p>
107
+ </>
108
+ );
109
+ }
110
+
111
+ function onCancel() {
112
+ console.log('cancel');
113
+ }
114
+ ```
115
+
116
+ ## License
117
+
118
+ This project is licensed under the MIT License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@component-hook/picker",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "description": "Picker component with vue3 and react",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react-transition-group": "^4.4.12",
53
- "sass-embedded": "^1.85.1",
53
+ "sass-embedded": "^1.88.0",
54
54
  "vite-plugin-dts": "^4.5.3"
55
55
  },
56
56
  "scripts": {