@acrool/react-picker 0.0.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.
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface ICreatePicker<T> extends React.FC<T> {
3
+ }
4
+ import { IValueChange } from '../types';
5
+ /**
6
+ * 產生帶 framer-motion 功能的Picker
7
+ *
8
+ * 需要呼叫 show 才會傳送到 portal
9
+ * @param MainComponent
10
+ * @param DropdownComponent
11
+ */
12
+ declare function createPicker<V extends {}, P>(MainComponent: React.FC<P & IValueChange<V>>, DropdownComponent: React.FC<P & IValueChange<V>>): ICreatePicker<P>;
13
+ export default createPicker;
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './PickerProvider';
3
+ export { default as createPicker } from './compose/createPicker';
@@ -0,0 +1,10 @@
1
+ interface HotkeyListenerProps {
2
+ onKeydown: (e: KeyboardEvent) => void;
3
+ }
4
+ /**
5
+ * 透過 mount unmount 註冊 keydown 事件
6
+ * @param onKeydown
7
+ * @constructor
8
+ */
9
+ declare const HotkeyListener: ({ onKeydown }: HotkeyListenerProps) => null;
10
+ export default HotkeyListener;
@@ -0,0 +1 @@
1
+ export { default } from './HotkeyListener';
@@ -0,0 +1,10 @@
1
+ interface MousedownListenerProps {
2
+ onMousedown: (e: MouseEvent) => void;
3
+ }
4
+ /**
5
+ * 透過 mount unmount 註冊 Mousedown 事件
6
+ * @param onMousedown
7
+ * @constructor
8
+ */
9
+ declare const MousedownListener: ({ onMousedown }: MousedownListenerProps) => null;
10
+ export default MousedownListener;
@@ -0,0 +1 @@
1
+ export { default } from './MousedownListener';
@@ -0,0 +1,10 @@
1
+ interface DropdownCloseListenerProps {
2
+ onPickerHide: () => void;
3
+ }
4
+ /**
5
+ * 透過 mount unmount 註冊 Mousedown 事件
6
+ * @param onMousedown
7
+ * @constructor
8
+ */
9
+ declare const PickerHideListener: ({ onPickerHide }: DropdownCloseListenerProps) => null;
10
+ export default PickerHideListener;
@@ -0,0 +1 @@
1
+ export { default } from './PickerHideListener';
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .acrool-react-picker__motion-animation-wrapper{z-index:1}.acrool-react-picker__root *,.acrool-react-picker__root *:before,.acrool-react-picker__root *:after{box-sizing:border-box;-webkit-box-sizing:border-box;line-height:normal}.acrool-react-picker__root,.acrool-react-picker__main-el{position:relative}
@@ -0,0 +1,25 @@
1
+ import { Transition, Variant } from 'framer-motion';
2
+ type TVariantKey = 'initial' | 'show' | 'exit';
3
+ export type TAnimationVariants = Record<TVariantKey, Variant>;
4
+ export interface IPickerOptions {
5
+ variants?: TAnimationVariants;
6
+ transition?: Transition;
7
+ className?: string;
8
+ isEnableHideWithClickMask?: boolean;
9
+ }
10
+ export interface IValueChange<T = string> {
11
+ value?: T;
12
+ onChange: (value: T) => void;
13
+ }
14
+ export interface IPosition {
15
+ vertical: 'top' | 'bottom';
16
+ horizontal: 'left' | 'right';
17
+ }
18
+ export declare enum EKeyboardKey {
19
+ Escape = "Escape",
20
+ Enter = "Enter",
21
+ Tab = "Tab",
22
+ ArrowUp = "ArrowUp",
23
+ ArrowDown = "ArrowDown"
24
+ }
25
+ export {};
@@ -0,0 +1,5 @@
1
+ import { IPosition } from './types';
2
+ /**
3
+ * 取得適合的顯示位置
4
+ */
5
+ export declare const getVisiblePosition: (el: HTMLDivElement | null) => IPosition;
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@acrool/react-picker",
3
+ "version": "0.0.1",
4
+ "description": "Picker library based for Reactjs",
5
+ "keywords": [
6
+ "acrool",
7
+ "react",
8
+ "typescript",
9
+ "picker",
10
+ "portal"
11
+ ],
12
+ "author": "info@acrool.com",
13
+ "private": false,
14
+ "type": "module",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/acrool/acrool-react-picker.git"
19
+ },
20
+ "module": "./dist/acrool-react-picker.es.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "browser": "./dist/acrool-react-picker.es.js",
25
+ "import": "./dist/acrool-react-picker.es.js"
26
+ },
27
+ "./dist/index.css": "./dist/style.css"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "engines": {
33
+ "node": ">=14"
34
+ },
35
+ "scripts": {
36
+ "dev": "NODE_ENV=development vite build -w",
37
+ "build:claer": "rm -rf ./dist",
38
+ "prepublishOnly": "run-s build",
39
+ "build": "run-s build:claer && tsc && vite build",
40
+ "preview": "vite preview",
41
+ "lint:fix": "eslint ./src --fix",
42
+ "cz": "git-cz",
43
+ "test": "jest",
44
+ "gitlog": "git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cblueby %an %Cgreen(%cr)%Creset'",
45
+ "release": "standard-version --release-as",
46
+ "release:major": "standard-version -r major",
47
+ "release:minor": "standard-version -r minor",
48
+ "release:patch": "standard-version -r patch",
49
+ "release:alpha": "standard-version --prerelease alpha"
50
+ },
51
+ "peerDependencies": {
52
+ "react": "^18.x",
53
+ "react-dom": "^18.x"
54
+ },
55
+ "dependencies": {
56
+ "@acrool/react-portal": "^1.0.1",
57
+ "@acrool/js-logger": "^1.0.23",
58
+ "clsx": "^2.1.1",
59
+ "ulid": "^2.3.0",
60
+ "framer-motion": "^11.3.19"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "^29.5.0",
64
+ "@types/node": "^18.15.11",
65
+ "@types/react": "^18.0.28",
66
+ "@types/react-dom": "^18.0.11",
67
+ "@vitejs/plugin-react-swc": "^3.0.0",
68
+ "cz-git": "^1.6.1",
69
+ "eslint": "^8.37.0",
70
+ "eslint-config-react-app": "^7.0.1",
71
+ "eslint-plugin-simple-import-sort": "^10.0.0",
72
+ "jest": "^29.5.0",
73
+ "jest-environment-jsdom": "^29.5.0",
74
+ "npm-run-all": "^4.1.5",
75
+ "react": "^18.x",
76
+ "react-dom": "^18.x",
77
+ "rollup-plugin-visualizer": "^5.9.0",
78
+ "sass": "^1.77.1",
79
+ "standard-version": "^9.5.0",
80
+ "ts-jest": "^29.1.0",
81
+ "typescript": "^4.9.3",
82
+ "vite": "^4.2.0",
83
+ "vite-plugin-dts": "^2.1.0",
84
+ "vite-plugin-eslint": "^1.8.1",
85
+ "vite-plugin-svgr": "^4.2.0"
86
+ },
87
+ "config": {
88
+ "commitizen": {
89
+ "path": "node_modules/cz-git"
90
+ }
91
+ }
92
+ }