musae 0.3.0 → 0.3.2
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/dist/components/date-picker/hooks.d.ts +1 -1
- package/dist/components/date-range-picker/hooks.d.ts +1 -1
- package/dist/components/form/hooks.d.ts +3 -2
- package/dist/components/icon/icons/action/index.cjs +18 -1
- package/dist/components/icon/icons/action/index.d.ts +16 -0
- package/dist/components/icon/icons/action/index.mjs +31 -13
- package/dist/components/icon/icons/alert/index.cjs +12 -1
- package/dist/components/icon/icons/alert/index.d.ts +10 -0
- package/dist/components/icon/icons/alert/index.mjs +19 -7
- package/dist/components/icon/icons/content/index.cjs +10 -1
- package/dist/components/icon/icons/content/index.d.ts +8 -0
- package/dist/components/icon/icons/content/index.mjs +15 -5
- package/dist/components/icon/icons/editor/index.cjs +14 -1
- package/dist/components/icon/icons/editor/index.d.ts +12 -0
- package/dist/components/icon/icons/editor/index.mjs +23 -9
- package/dist/components/icon/icons/hardware/index.cjs +11 -1
- package/dist/components/icon/icons/hardware/index.d.ts +9 -0
- package/dist/components/icon/icons/hardware/index.mjs +17 -6
- package/dist/components/icon/icons/image/index.cjs +16 -1
- package/dist/components/icon/icons/image/index.d.ts +14 -0
- package/dist/components/icon/icons/image/index.mjs +27 -11
- package/dist/components/icon/icons/mock/index.cjs +7 -1
- package/dist/components/icon/icons/mock/index.d.ts +5 -0
- package/dist/components/icon/icons/mock/index.mjs +9 -2
- package/dist/components/icon/icons/navigation/index.cjs +10 -1
- package/dist/components/icon/icons/navigation/index.d.ts +8 -0
- package/dist/components/icon/icons/navigation/index.mjs +15 -5
- package/dist/components/icon/icons/toggle/index.cjs +8 -1
- package/dist/components/icon/icons/toggle/index.d.ts +6 -0
- package/dist/components/icon/icons/toggle/index.mjs +11 -3
- package/dist/components/pagination/hooks.cjs +24 -15
- package/dist/components/pagination/hooks.d.ts +7 -4
- package/dist/components/pagination/hooks.mjs +25 -16
- package/dist/components/pagination/item.cjs +9 -9
- package/dist/components/pagination/item.d.ts +2 -2
- package/dist/components/pagination/item.mjs +9 -9
- package/dist/components/pagination/pagination.cjs +16 -10
- package/dist/components/pagination/pagination.d.ts +2 -2
- package/dist/components/pagination/pagination.mjs +16 -10
- package/dist/components/picker/context.d.ts +1 -1
- package/dist/components/picker/index.d.ts +1 -2
- package/dist/components/picker/picker.cjs +4 -2
- package/dist/components/picker/picker.d.ts +1 -1
- package/dist/components/picker/picker.mjs +4 -2
- package/dist/components/rich-text-editor/dropdown.d.ts +1 -1
- package/dist/components/rich-text-editor/index.cjs +6 -3
- package/dist/components/rich-text-editor/index.d.ts +9 -2
- package/dist/components/rich-text-editor/index.mjs +7 -4
- package/dist/components/rich-text-editor/plugins/controlled-state/index.cjs +13 -5
- package/dist/components/rich-text-editor/plugins/controlled-state/index.d.ts +6 -3
- package/dist/components/rich-text-editor/plugins/controlled-state/index.mjs +14 -6
- package/dist/components/rich-text-editor/rich-text-editor.cjs +16 -5
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +9 -2
- package/dist/components/rich-text-editor/rich-text-editor.mjs +17 -6
- package/dist/components/select/hooks.cjs +25 -50
- package/dist/components/select/hooks.d.ts +3 -3
- package/dist/components/select/hooks.mjs +26 -51
- package/dist/components/select/select.cjs +11 -5
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.mjs +11 -5
- package/dist/components/select/selections.d.ts +1 -1
- package/dist/components/select/selector.cjs +25 -13
- package/dist/components/select/selector.d.ts +1 -1
- package/dist/components/select/selector.mjs +25 -13
- package/dist/components/select/utils.d.ts +1 -1
- package/dist/components/table/header/cell.cjs +6 -7
- package/dist/components/table/header/cell.mjs +7 -8
- package/dist/components/table/hooks.cjs +3 -2
- package/dist/components/table/hooks.d.ts +2 -2
- package/dist/components/table/hooks.mjs +3 -2
- package/dist/components/time-picker/hooks.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/form.d.ts +5 -0
- package/dist/{components/pagination/types.d.ts → types/pagination.d.ts} +20 -9
- package/dist/{components/picker/types.d.ts → types/picker.d.ts} +2 -2
- package/dist/{components/rich-text-editor/types.d.ts → types/rich-text-editor.d.ts} +15 -0
- package/dist/{components/select/types.d.ts → types/select.d.ts} +9 -3
- package/dist/types/table.d.ts +9 -4
- package/package.json +3 -3
- package/dist/components/pagination/types.cjs +0 -11
- package/dist/components/pagination/types.mjs +0 -13
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var tag = require('../tag/tag.cjs');
|
|
7
6
|
var input = require('../input/input.cjs');
|
|
@@ -26,7 +25,9 @@ var Selector = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
26
25
|
searchable = _ref.searchable,
|
|
27
26
|
value = _ref.value,
|
|
28
27
|
onSearch = _ref.onSearch,
|
|
29
|
-
searched = _ref.searched
|
|
28
|
+
searched = _ref.searched,
|
|
29
|
+
onChange = _ref.onChange,
|
|
30
|
+
onBlur = _ref.onBlur;
|
|
30
31
|
var inputRef = React.useRef(null);
|
|
31
32
|
var _useContext = React.useContext(context.Context),
|
|
32
33
|
isFocused = _useContext.isFocused,
|
|
@@ -40,28 +41,38 @@ var Selector = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
});
|
|
44
|
+
// on user search input, trigger the search callback
|
|
43
45
|
var search = function search(e) {
|
|
44
46
|
open === null || open === void 0 || open();
|
|
45
|
-
// on user search input, trigger the search callback
|
|
46
47
|
onSearch(e.target.value);
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
+
var styled = stylex.default.props(input.styles.input, styles.input({
|
|
50
|
+
color: isFocused && searchable && theme$1.colors[colors.ColorToken.OnSurface] || void 0
|
|
51
|
+
}), theme.typography.body.small);
|
|
52
|
+
// multiple mode render
|
|
49
53
|
if (mode === "multiple") {
|
|
50
|
-
return
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(value.entries()).map(function (_ref2) {
|
|
51
55
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
52
56
|
key = _ref3[0],
|
|
53
57
|
label = _ref3[1];
|
|
54
58
|
return /*#__PURE__*/React.createElement(tag.default, {
|
|
55
59
|
key: key,
|
|
56
|
-
size: "small"
|
|
60
|
+
size: "small",
|
|
61
|
+
closable: true,
|
|
62
|
+
onClose: function onClose() {
|
|
63
|
+
return onChange(key);
|
|
64
|
+
}
|
|
57
65
|
}, label);
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
}), searchable && (/*#__PURE__*/React.createElement("input", {
|
|
67
|
+
key: "select-selector",
|
|
68
|
+
ref: inputRef,
|
|
69
|
+
value: searched,
|
|
70
|
+
className: styled.className,
|
|
71
|
+
style: styled.style,
|
|
72
|
+
onChange: search,
|
|
73
|
+
onBlur: onBlur
|
|
74
|
+
})));
|
|
61
75
|
}
|
|
62
|
-
var styled = stylex.default.props(input.styles.input, styles.input({
|
|
63
|
-
color: isFocused && searchable && theme$1.colors[colors.ColorToken.OnSurface] || void 0
|
|
64
|
-
}), theme.typography.body.small);
|
|
65
76
|
// single mode render
|
|
66
77
|
if (!searchable) {
|
|
67
78
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -75,7 +86,8 @@ var Selector = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
75
86
|
placeholder: Array.from(value.values()).join(","),
|
|
76
87
|
className: styled.className,
|
|
77
88
|
style: styled.style,
|
|
78
|
-
onChange: search
|
|
89
|
+
onChange: search,
|
|
90
|
+
onBlur: onBlur
|
|
79
91
|
});
|
|
80
92
|
});
|
|
81
93
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ForwardRefExoticComponent, type PropsWithoutRef, type RefAttributes } from "react";
|
|
2
|
-
import type { SelectorProps, SelectorRef } from "
|
|
2
|
+
import type { SelectorProps, SelectorRef } from "../../types/select";
|
|
3
3
|
declare const Selector: ForwardRefExoticComponent<PropsWithoutRef<SelectorProps> & RefAttributes<SelectorRef>>;
|
|
4
4
|
export default Selector;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
2
|
import React, { forwardRef, useRef, useContext, useImperativeHandle } from 'react';
|
|
4
3
|
import Tag from '../tag/tag.mjs';
|
|
5
4
|
import { styles as styles$1 } from '../input/input.mjs';
|
|
@@ -24,7 +23,9 @@ var Selector = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
24
23
|
searchable = _ref.searchable,
|
|
25
24
|
value = _ref.value,
|
|
26
25
|
onSearch = _ref.onSearch,
|
|
27
|
-
searched = _ref.searched
|
|
26
|
+
searched = _ref.searched,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
onBlur = _ref.onBlur;
|
|
28
29
|
var inputRef = useRef(null);
|
|
29
30
|
var _useContext = useContext(Context),
|
|
30
31
|
isFocused = _useContext.isFocused,
|
|
@@ -38,28 +39,38 @@ var Selector = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
});
|
|
42
|
+
// on user search input, trigger the search callback
|
|
41
43
|
var search = function search(e) {
|
|
42
44
|
open === null || open === void 0 || open();
|
|
43
|
-
// on user search input, trigger the search callback
|
|
44
45
|
onSearch(e.target.value);
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
+
var styled = _stylex.props(styles$1.input, styles.input({
|
|
48
|
+
color: isFocused && searchable && theme.colors[ColorToken.OnSurface] || void 0
|
|
49
|
+
}), typography.body.small);
|
|
50
|
+
// multiple mode render
|
|
47
51
|
if (mode === "multiple") {
|
|
48
|
-
return
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(value.entries()).map(function (_ref2) {
|
|
49
53
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
50
54
|
key = _ref3[0],
|
|
51
55
|
label = _ref3[1];
|
|
52
56
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
53
57
|
key: key,
|
|
54
|
-
size: "small"
|
|
58
|
+
size: "small",
|
|
59
|
+
closable: true,
|
|
60
|
+
onClose: function onClose() {
|
|
61
|
+
return onChange(key);
|
|
62
|
+
}
|
|
55
63
|
}, label);
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
}), searchable && (/*#__PURE__*/React.createElement("input", {
|
|
65
|
+
key: "select-selector",
|
|
66
|
+
ref: inputRef,
|
|
67
|
+
value: searched,
|
|
68
|
+
className: styled.className,
|
|
69
|
+
style: styled.style,
|
|
70
|
+
onChange: search,
|
|
71
|
+
onBlur: onBlur
|
|
72
|
+
})));
|
|
59
73
|
}
|
|
60
|
-
var styled = _stylex.props(styles$1.input, styles.input({
|
|
61
|
-
color: isFocused && searchable && theme.colors[ColorToken.OnSurface] || void 0
|
|
62
|
-
}), typography.body.small);
|
|
63
74
|
// single mode render
|
|
64
75
|
if (!searchable) {
|
|
65
76
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -73,7 +84,8 @@ var Selector = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
73
84
|
placeholder: Array.from(value.values()).join(","),
|
|
74
85
|
className: styled.className,
|
|
75
86
|
style: styled.style,
|
|
76
|
-
onChange: search
|
|
87
|
+
onChange: search,
|
|
88
|
+
onBlur: onBlur
|
|
77
89
|
});
|
|
78
90
|
});
|
|
79
91
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Filter, ReadableOptions, ToMenuItem, Value, ValueOrValues } from "
|
|
1
|
+
import type { Filter, ReadableOptions, ToMenuItem, Value, ValueOrValues } from "../../types/select";
|
|
2
2
|
import type { Option } from "musae/types/option";
|
|
3
3
|
import type { MenuItem } from "musae/types/menu";
|
|
4
4
|
/**
|
|
@@ -78,18 +78,17 @@ var Cell = function Cell(_ref) {
|
|
|
78
78
|
}, new Map());
|
|
79
79
|
}, [_sortDirections]);
|
|
80
80
|
var sort = React.useMemo(function () {
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return null;
|
|
81
|
+
if (!sortDescriptor) return null;
|
|
82
|
+
if (sortDescriptor.key !== value) return null;
|
|
83
|
+
return sortDescriptor.direction;
|
|
85
84
|
}, [sortDescriptor, value]);
|
|
86
85
|
// sort handler
|
|
87
86
|
var onSort = relax.useEvent(function () {
|
|
88
|
-
var
|
|
89
|
-
|
|
87
|
+
var _sortDirections$get;
|
|
88
|
+
if (!value) return;
|
|
90
89
|
onSortChange === null || onSortChange === void 0 || onSortChange({
|
|
91
90
|
key: value,
|
|
92
|
-
direction:
|
|
91
|
+
direction: (_sortDirections$get = sortDirections.get(sort)) !== null && _sortDirections$get !== void 0 ? _sortDirections$get : "ascending"
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
94
|
// only children, render directly
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import { toFunction, useEvent
|
|
2
|
+
import { toFunction, useEvent } from '@aiszlab/relax';
|
|
3
3
|
import _stylex from '../../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
4
4
|
import { useTheme } from '../../theme/hooks.mjs';
|
|
5
5
|
import { ColorToken } from '../../../utils/colors.mjs';
|
|
@@ -76,18 +76,17 @@ var Cell = function Cell(_ref) {
|
|
|
76
76
|
}, new Map());
|
|
77
77
|
}, [_sortDirections]);
|
|
78
78
|
var sort = useMemo(function () {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return null;
|
|
79
|
+
if (!sortDescriptor) return null;
|
|
80
|
+
if (sortDescriptor.key !== value) return null;
|
|
81
|
+
return sortDescriptor.direction;
|
|
83
82
|
}, [sortDescriptor, value]);
|
|
84
83
|
// sort handler
|
|
85
84
|
var onSort = useEvent(function () {
|
|
86
|
-
var
|
|
87
|
-
|
|
85
|
+
var _sortDirections$get;
|
|
86
|
+
if (!value) return;
|
|
88
87
|
onSortChange === null || onSortChange === void 0 || onSortChange({
|
|
89
88
|
key: value,
|
|
90
|
-
direction:
|
|
89
|
+
direction: (_sortDirections$get = sortDirections.get(sort)) !== null && _sortDirections$get !== void 0 ? _sortDirections$get : "ascending"
|
|
91
90
|
});
|
|
92
91
|
});
|
|
93
92
|
// only children, render directly
|
|
@@ -19,9 +19,10 @@ var useColumns = function useColumns(_ref) {
|
|
|
19
19
|
_ref2$sortable = _ref2.sortable,
|
|
20
20
|
sortable = _ref2$sortable === void 0 ? false : _ref2$sortable,
|
|
21
21
|
_ref2$sortDirections = _ref2.sortDirections,
|
|
22
|
-
sortDirections = _ref2$sortDirections === void 0 ? ["ascending", "descending"] : _ref2$sortDirections
|
|
22
|
+
sortDirections = _ref2$sortDirections === void 0 ? ["ascending", "descending"] : _ref2$sortDirections,
|
|
23
|
+
valueAt = _ref2.valueAt;
|
|
23
24
|
// @ts-ignore
|
|
24
|
-
return helper.current.accessor(key, {
|
|
25
|
+
return helper.current.accessor(valueAt !== null && valueAt !== void 0 ? valueAt : key, {
|
|
25
26
|
header: /*#__PURE__*/React.createElement(cell.default, {
|
|
26
27
|
children: title,
|
|
27
28
|
sortable: sortable,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColumnDef } from "@tanstack/react-table";
|
|
1
|
+
import { type ColumnDef, DeepValue, DeepKeys } from "@tanstack/react-table";
|
|
2
2
|
import type { Column, ContextValue, SortDescriptor } from "musae/types/table";
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
@@ -6,7 +6,7 @@ import type { Column, ContextValue, SortDescriptor } from "musae/types/table";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const useColumns: <T>({ columns }: {
|
|
8
8
|
columns: Column<T>[];
|
|
9
|
-
}) => ColumnDef<T,
|
|
9
|
+
}) => ColumnDef<T, DeepValue<T, DeepKeys<T>>>[];
|
|
10
10
|
/**
|
|
11
11
|
* @author murukal
|
|
12
12
|
* @description
|
|
@@ -19,9 +19,10 @@ var useColumns = function useColumns(_ref) {
|
|
|
19
19
|
_ref2$sortable = _ref2.sortable,
|
|
20
20
|
sortable = _ref2$sortable === void 0 ? false : _ref2$sortable,
|
|
21
21
|
_ref2$sortDirections = _ref2.sortDirections,
|
|
22
|
-
sortDirections = _ref2$sortDirections === void 0 ? ["ascending", "descending"] : _ref2$sortDirections
|
|
22
|
+
sortDirections = _ref2$sortDirections === void 0 ? ["ascending", "descending"] : _ref2$sortDirections,
|
|
23
|
+
valueAt = _ref2.valueAt;
|
|
23
24
|
// @ts-ignore
|
|
24
|
-
return helper.current.accessor(key, {
|
|
25
|
+
return helper.current.accessor(valueAt !== null && valueAt !== void 0 ? valueAt : key, {
|
|
25
26
|
header: /*#__PURE__*/createElement(Cell, {
|
|
26
27
|
children: title,
|
|
27
28
|
sortable: sortable,
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/types/form.d.ts
CHANGED
|
@@ -119,3 +119,8 @@ export interface TypedForm {
|
|
|
119
119
|
* form ref
|
|
120
120
|
*/
|
|
121
121
|
export type FormRef<T extends FieldValues = FieldValues> = UseFormReturn<T>;
|
|
122
|
+
/**
|
|
123
|
+
* @description
|
|
124
|
+
* form instance
|
|
125
|
+
*/
|
|
126
|
+
export type UsedForm<T extends FieldValues = FieldValues> = UseFormReturn<T>;
|
|
@@ -4,12 +4,7 @@ type UsedCounter = ReturnType<typeof useCounter>;
|
|
|
4
4
|
* @description
|
|
5
5
|
* pagiantion item type
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
Prev = "prev",
|
|
9
|
-
Next = "next",
|
|
10
|
-
MorePrev = "more-prev",
|
|
11
|
-
MoreNext = "more-next"
|
|
12
|
-
}
|
|
7
|
+
export type PaginationItemType = "prev" | "next" | "more-prev" | "more-next";
|
|
13
8
|
/**
|
|
14
9
|
* @author murukal
|
|
15
10
|
*
|
|
@@ -47,8 +42,24 @@ export type PagiantionProps = {
|
|
|
47
42
|
* @default [10, 20, 50, 100]
|
|
48
43
|
*/
|
|
49
44
|
pageSizes?: number[];
|
|
45
|
+
/**
|
|
46
|
+
* @description
|
|
47
|
+
* current page at
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
at?: number;
|
|
51
|
+
/**
|
|
52
|
+
* @description
|
|
53
|
+
* change handler when current page `at` changed
|
|
54
|
+
*/
|
|
55
|
+
onChange?: (at: number) => void;
|
|
56
|
+
/**
|
|
57
|
+
* @description
|
|
58
|
+
* change handler when `pageSize` changed
|
|
59
|
+
*/
|
|
60
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
50
61
|
};
|
|
51
|
-
export type PaginationItems =
|
|
62
|
+
export type PaginationItems = (PaginationItemType | number)[];
|
|
52
63
|
/**
|
|
53
64
|
* @description
|
|
54
65
|
* pagination item props
|
|
@@ -71,9 +82,9 @@ export type PaginationItemProps = {
|
|
|
71
82
|
subtract: UsedCounter[1]["subtract"];
|
|
72
83
|
/**
|
|
73
84
|
* @description
|
|
74
|
-
*
|
|
85
|
+
* click handler
|
|
75
86
|
*/
|
|
76
|
-
|
|
87
|
+
onClick: (page: number) => void;
|
|
77
88
|
/**
|
|
78
89
|
* @description
|
|
79
90
|
* checked
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CSSProperties, MouseEventHandler, ReactNode } from "react";
|
|
1
|
+
import type { CSSProperties, HTMLAttributes, MouseEventHandler, ReactNode } from "react";
|
|
2
2
|
import type { ComponentProps } from "musae/types/element";
|
|
3
3
|
import type { Nullable } from "@aiszlab/relax/types";
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
6
6
|
* picker props
|
|
7
7
|
*/
|
|
8
|
-
export interface PickerProps extends ComponentProps {
|
|
8
|
+
export interface PickerProps extends ComponentProps, Pick<HTMLAttributes<HTMLSpanElement>, "onBlur"> {
|
|
9
9
|
/**
|
|
10
10
|
* @description
|
|
11
11
|
* children
|
|
@@ -34,6 +34,11 @@ export type RichTextEditorProps = Pick<HTMLAttributes<HTMLDivElement>, "aria-pla
|
|
|
34
34
|
* change handler
|
|
35
35
|
*/
|
|
36
36
|
onChange?: (value: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* @description
|
|
39
|
+
* value
|
|
40
|
+
*/
|
|
41
|
+
value?: string;
|
|
37
42
|
};
|
|
38
43
|
/**
|
|
39
44
|
* @description
|
|
@@ -61,3 +66,13 @@ export type DropdownProps<T> = {
|
|
|
61
66
|
onChange: (value: T) => void;
|
|
62
67
|
children?: ReactNode;
|
|
63
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* @description
|
|
71
|
+
* editor ref
|
|
72
|
+
*/
|
|
73
|
+
export type RichTextEditorRef = {
|
|
74
|
+
/**
|
|
75
|
+
* value setter
|
|
76
|
+
*/
|
|
77
|
+
setValue: (value: string) => void;
|
|
78
|
+
};
|
|
@@ -3,6 +3,7 @@ import type { Option } from "musae/types/option";
|
|
|
3
3
|
import type { MenuItem, MenuProps } from "musae/types/menu";
|
|
4
4
|
import type { ComponentProps } from "musae/types/element";
|
|
5
5
|
import type { RequiredIn } from "@aiszlab/relax/types";
|
|
6
|
+
import type { PickerProps } from "musae/types/picker";
|
|
6
7
|
export type Mode = "multiple";
|
|
7
8
|
export type Value = Key | Pick<Option, "value" | "label">;
|
|
8
9
|
export type ValueOrValues = Value[] | Value;
|
|
@@ -12,7 +13,7 @@ export type ValueOrValues = Value[] | Value;
|
|
|
12
13
|
* @description
|
|
13
14
|
* select props
|
|
14
15
|
*/
|
|
15
|
-
export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & {
|
|
16
|
+
export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & Pick<PickerProps, "onBlur"> & {
|
|
16
17
|
/**
|
|
17
18
|
* @description
|
|
18
19
|
* options
|
|
@@ -77,7 +78,7 @@ export type Filter = (option: Option) => boolean;
|
|
|
77
78
|
* @description
|
|
78
79
|
* selected props
|
|
79
80
|
*/
|
|
80
|
-
export type SelectorProps = Pick<RequiredIn<SelectProps, "searchable" | "onSearch">, "searchable" | "mode" | "onSearch"> & {
|
|
81
|
+
export type SelectorProps = Pick<RequiredIn<SelectProps, "searchable" | "onSearch">, "searchable" | "mode" | "onSearch" | "onBlur"> & {
|
|
81
82
|
/**
|
|
82
83
|
* @description
|
|
83
84
|
* value
|
|
@@ -88,6 +89,11 @@ export type SelectorProps = Pick<RequiredIn<SelectProps, "searchable" | "onSearc
|
|
|
88
89
|
* searched value
|
|
89
90
|
*/
|
|
90
91
|
searched: string;
|
|
92
|
+
/**
|
|
93
|
+
* @description
|
|
94
|
+
* change
|
|
95
|
+
*/
|
|
96
|
+
onChange: (key: Key) => void;
|
|
91
97
|
};
|
|
92
98
|
/**
|
|
93
99
|
* @description
|
|
@@ -114,7 +120,7 @@ export type SelectionsProps = {
|
|
|
114
120
|
* @description
|
|
115
121
|
* select menu item handler
|
|
116
122
|
*/
|
|
117
|
-
onSelect:
|
|
123
|
+
onSelect: (key: Key) => void;
|
|
118
124
|
/**
|
|
119
125
|
* @description
|
|
120
126
|
* selected keys
|
package/dist/types/table.d.ts
CHANGED
|
@@ -11,12 +11,17 @@ export type SortDescriptor = {
|
|
|
11
11
|
* @description
|
|
12
12
|
* column def
|
|
13
13
|
*/
|
|
14
|
-
export type Column<T
|
|
14
|
+
export type Column<T> = {
|
|
15
15
|
/**
|
|
16
16
|
* @description
|
|
17
17
|
* key
|
|
18
18
|
*/
|
|
19
|
-
key
|
|
19
|
+
key?: Key;
|
|
20
|
+
/**
|
|
21
|
+
* @description
|
|
22
|
+
* value at
|
|
23
|
+
*/
|
|
24
|
+
valueAt?: DeepKeys<T>;
|
|
20
25
|
/**
|
|
21
26
|
* @description
|
|
22
27
|
* title
|
|
@@ -26,7 +31,7 @@ export type Column<T, V = unknown> = {
|
|
|
26
31
|
* @description
|
|
27
32
|
* custom render, render is not provided, just render value
|
|
28
33
|
*/
|
|
29
|
-
render?: (value:
|
|
34
|
+
render?: (value: any, record: T, index: number) => ReactNode | unknown;
|
|
30
35
|
/**
|
|
31
36
|
* @description
|
|
32
37
|
* enable sort
|
|
@@ -113,6 +118,6 @@ export type HeaderProps = ComponentProps;
|
|
|
113
118
|
export type HeaderCellProps = {
|
|
114
119
|
sortable?: boolean;
|
|
115
120
|
children: ReactNode | (() => ReactNode);
|
|
116
|
-
value
|
|
121
|
+
value?: Key;
|
|
117
122
|
sortDirections: SortDirection[];
|
|
118
123
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musae",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "musae-ui",
|
|
5
5
|
"author": "tutu@fantufantu.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"import": "./dist/index.mjs",
|
|
25
25
|
"default": "./dist/index.mjs"
|
|
26
26
|
},
|
|
27
|
-
"./styles
|
|
27
|
+
"./styles": "./dist/styles.css",
|
|
28
28
|
"./locales": {
|
|
29
29
|
"types": "./dist/locale/locales/index.d.ts",
|
|
30
30
|
"require": "./dist/locale/locales/index.cjs",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"pnpm": ">=9"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@aiszlab/relax": "^1.3.
|
|
56
|
+
"@aiszlab/relax": "^1.3.15",
|
|
57
57
|
"@babel/runtime": "^7.25.6",
|
|
58
58
|
"@dnd-kit/core": "^6.1.0",
|
|
59
59
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* pagiantion item type
|
|
4
|
-
*/
|
|
5
|
-
exports.PaginationItemType = void 0;
|
|
6
|
-
(function (PaginationItemType) {
|
|
7
|
-
PaginationItemType["Prev"] = "prev";
|
|
8
|
-
PaginationItemType["Next"] = "next";
|
|
9
|
-
PaginationItemType["MorePrev"] = "more-prev";
|
|
10
|
-
PaginationItemType["MoreNext"] = "more-next";
|
|
11
|
-
})(exports.PaginationItemType || (exports.PaginationItemType = {}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* pagiantion item type
|
|
4
|
-
*/
|
|
5
|
-
var PaginationItemType;
|
|
6
|
-
(function (PaginationItemType) {
|
|
7
|
-
PaginationItemType["Prev"] = "prev";
|
|
8
|
-
PaginationItemType["Next"] = "next";
|
|
9
|
-
PaginationItemType["MorePrev"] = "more-prev";
|
|
10
|
-
PaginationItemType["MoreNext"] = "more-next";
|
|
11
|
-
})(PaginationItemType || (PaginationItemType = {}));
|
|
12
|
-
|
|
13
|
-
export { PaginationItemType };
|