musae 0.2.7 → 0.2.8

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.
@@ -49,6 +49,7 @@ export interface CheckboxGroupProps {
49
49
  /**
50
50
  * @description
51
51
  * change handler
52
+ * @default void 0
52
53
  */
53
54
  onChange?: (value: Key[]) => void;
54
55
  /**
@@ -92,6 +93,7 @@ export interface CheckboxProps extends ComponentProps {
92
93
  /**
93
94
  * @description
94
95
  * disabled
96
+ * @default false
95
97
  */
96
98
  disabled?: boolean;
97
99
  }
@@ -5,13 +5,13 @@ import type { Option } from "../../types/option";
5
5
  * @description
6
6
  * use value
7
7
  */
8
- export declare const useValue: ({ mode, close, isComplex, ...props }: {
8
+ export declare const useValue: <T extends ValueOrValues = ValueOrValues>({ mode, close, isComplex, ...props }: {
9
9
  value: ValueOrValues | undefined;
10
10
  readableOptions: ReadableOptions;
11
11
  mode: Mode | undefined;
12
12
  close: () => void;
13
13
  reset: () => void;
14
- onChange?: (value: ValueOrValues) => void;
14
+ onChange?: (value: T) => void;
15
15
  isComplex: boolean;
16
16
  }) => {
17
17
  value: ValueOrValues | undefined;
@@ -33,7 +33,7 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
33
33
  if (readableValues.has(key))
34
34
  return;
35
35
  if (isControlled) {
36
- props.onChange?.(isComplex ? _value : key);
36
+ props.onChange?.((isComplex ? _value : key));
37
37
  return;
38
38
  }
39
39
  setValue(_value);
@@ -46,12 +46,12 @@ const useValue = ({ mode, close, isComplex, ...props }) => {
46
46
  const isRemoved = prev.has(key) && prev.delete(key);
47
47
  const next = isRemoved ? prev : prev.set(key, _value.label);
48
48
  if (isControlled) {
49
- props.onChange?.(isComplex
49
+ props.onChange?.((isComplex
50
50
  ? Array.from(next.entries()).map(([value, label]) => ({
51
51
  value,
52
52
  label,
53
53
  }))
54
- : Array.from(next.keys()));
54
+ : Array.from(next.keys())));
55
55
  return;
56
56
  }
57
57
  setValue(Array.from(next.entries()).map(([value, label]) => ({
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { SelectProps } from "./types";
3
- declare const Select: ({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps) => React.JSX.Element;
2
+ import type { SelectProps, ValueOrValues } from "./types";
3
+ declare const Select: <T extends ValueOrValues = ValueOrValues>({ mode, searchable, onSearch, className, style, options, onFilter, complex, value, onChange: _onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;
@@ -43,7 +43,6 @@ const Select = ({
43
43
  mode,
44
44
  close,
45
45
  reset,
46
- // @ts-ignore
47
46
  onChange: _onChange,
48
47
  isComplex: complex
49
48
  });
@@ -6,14 +6,13 @@ import type { RequiredIn } from "@aiszlab/relax/types";
6
6
  export type Mode = "multiple";
7
7
  export type Value = Key | Pick<Option, "value" | "label">;
8
8
  export type ValueOrValues = Value[] | Value;
9
- type ChangeHandler = ((value: string) => void) | ((value: number) => void) | ((value: bigint) => void) | ((values: Value[]) => void);
10
9
  /**
11
10
  * @author murukal
12
11
  *
13
12
  * @description
14
13
  * select props
15
14
  */
16
- export type SelectProps = ComponentProps & {
15
+ export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & {
17
16
  /**
18
17
  * @description
19
18
  * options
@@ -61,7 +60,7 @@ export type SelectProps = ComponentProps & {
61
60
  * on value change, toggle
62
61
  * @default void 0
63
62
  */
64
- onChange?: ChangeHandler;
63
+ onChange?: (value: T) => void;
65
64
  };
66
65
  /**
67
66
  * @description
@@ -122,4 +121,3 @@ export type SelectionsProps = {
122
121
  */
123
122
  selectedKeys: MenuProps["selectedKeys"];
124
123
  };
125
- export {};
@@ -10,21 +10,25 @@ export type TransferProps = ComponentProps & {
10
10
  /**
11
11
  * @description
12
12
  * options
13
+ * @requires
13
14
  */
14
15
  options: TransferOption[];
15
16
  /**
16
17
  * @description
17
18
  * value
19
+ * @default void 0
18
20
  */
19
21
  value?: Key[];
20
22
  /**
21
23
  * @description
22
24
  * titles
25
+ * @default [null, null]
23
26
  */
24
27
  titles?: [ReactNode, ReactNode];
25
28
  /**
26
29
  * @description
27
30
  * disabled
31
+ * @default false
28
32
  */
29
33
  disabled?: boolean;
30
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",
@@ -37,7 +37,6 @@
37
37
  "deepmerge": "^4.3.1",
38
38
  "framer-motion": "^11.2.11",
39
39
  "react-hook-form": "^7.47.0",
40
- "rrweb": "2.0.0-alpha.4",
41
40
  "rxjs": "^7.8.1"
42
41
  },
43
42
  "devDependencies": {