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,4 +1,10 @@
|
|
|
1
1
|
import Star from "./star";
|
|
2
2
|
import StarHalf from "./star-half";
|
|
3
3
|
import StarOutline from "./star-outline";
|
|
4
|
+
declare const _: {
|
|
5
|
+
Star: (props: Omit<import("../..").IconProps, "as">) => import("react").FunctionComponentElement<import("../..").IconProps>;
|
|
6
|
+
StarHalf: (props: Omit<import("../..").IconProps, "as">) => import("react").FunctionComponentElement<import("../..").IconProps>;
|
|
7
|
+
StarOutline: (props: Omit<import("../..").IconProps, "as">) => import("react").FunctionComponentElement<import("../..").IconProps>;
|
|
8
|
+
};
|
|
9
|
+
export default _;
|
|
4
10
|
export { Star, StarHalf, StarOutline };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Star from './star.mjs';
|
|
2
|
+
import StarHalf from './star-half.mjs';
|
|
3
|
+
import StarOutline from './star-outline.mjs';
|
|
4
|
+
|
|
5
|
+
var _ = {
|
|
6
|
+
Star: Star,
|
|
7
|
+
StarHalf: StarHalf,
|
|
8
|
+
StarOutline: StarOutline
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { Star, StarHalf, StarOutline, _ as default };
|
|
@@ -2,7 +2,6 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
|
2
2
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
3
3
|
var relax = require('@aiszlab/relax');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var types = require('./types.cjs');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @author murukal
|
|
@@ -14,22 +13,27 @@ var usePagiantion = function usePagiantion(_ref) {
|
|
|
14
13
|
var total = _ref.total,
|
|
15
14
|
siblings = _ref.siblings,
|
|
16
15
|
boundaries = _ref.boundaries,
|
|
17
|
-
_pageSize = _ref.pageSize
|
|
16
|
+
_pageSize = _ref.pageSize,
|
|
17
|
+
_at = _ref.at,
|
|
18
|
+
_onChange = _ref.onChange,
|
|
19
|
+
_onPageSizeChange = _ref.onPageSizeChange;
|
|
18
20
|
var _useControlledState = relax.useControlledState(_pageSize, {
|
|
19
21
|
defaultState: 10
|
|
20
22
|
}),
|
|
21
23
|
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
22
24
|
pageSize = _useControlledState2[0],
|
|
23
25
|
setPageSize = _useControlledState2[1];
|
|
26
|
+
// convert total into page count
|
|
27
|
+
// at least 1 page
|
|
24
28
|
var pages = React.useMemo(function () {
|
|
25
|
-
return Math.ceil(total / Math.max(1, pageSize));
|
|
29
|
+
return Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
26
30
|
}, [total, pageSize]);
|
|
27
|
-
var _useCounter = relax.useCounter(
|
|
31
|
+
var _useCounter = relax.useCounter(_at, {
|
|
28
32
|
min: 1,
|
|
29
33
|
max: pages
|
|
30
34
|
}),
|
|
31
35
|
_useCounter2 = _slicedToArray(_useCounter, 2),
|
|
32
|
-
|
|
36
|
+
at = _useCounter2[0],
|
|
33
37
|
_useCounter2$ = _useCounter2[1],
|
|
34
38
|
add = _useCounter2$.add,
|
|
35
39
|
subtract = _useCounter2$.subtract,
|
|
@@ -38,28 +42,33 @@ var usePagiantion = function usePagiantion(_ref) {
|
|
|
38
42
|
// max renderable pages
|
|
39
43
|
var renderable = siblings * 2 + 3 + boundaries * 2;
|
|
40
44
|
if (renderable > pages) {
|
|
41
|
-
return [
|
|
45
|
+
return ["prev"].concat(_toConsumableArray(relax.range(1, pages)), ["next"]);
|
|
42
46
|
}
|
|
43
|
-
var focusedAt = relax.clamp(
|
|
47
|
+
var focusedAt = relax.clamp(at, boundaries + 3, pages - (boundaries + 2));
|
|
44
48
|
var from = Math.max(focusedAt - siblings, boundaries);
|
|
45
49
|
var to = Math.min(focusedAt + siblings, pages - (boundaries - 1));
|
|
46
50
|
var hasPrevMore = from > boundaries + 2;
|
|
47
51
|
var hasNextMore = to < pages - (boundaries + 1);
|
|
48
|
-
return [
|
|
49
|
-
}, [boundaries,
|
|
52
|
+
return ["prev"].concat(_toConsumableArray(relax.range(1, boundaries)), _toConsumableArray(hasPrevMore ? ["more-prev"] : [boundaries + 1]), _toConsumableArray(relax.range(from, to)), _toConsumableArray(hasNextMore ? ["more-next"] : [pages - boundaries]), _toConsumableArray(relax.range(pages - (boundaries - 1), pages)), ["next"]);
|
|
53
|
+
}, [boundaries, at, pages, siblings]);
|
|
50
54
|
// whether prev button is usable
|
|
51
|
-
var hasPrev =
|
|
55
|
+
var hasPrev = at > 1;
|
|
52
56
|
// whether next button is usable
|
|
53
|
-
var hasNext =
|
|
54
|
-
var
|
|
57
|
+
var hasNext = at < pages;
|
|
58
|
+
var onChange = relax.useEvent(function (at) {
|
|
59
|
+
_onChange === null || _onChange === void 0 || _onChange(at);
|
|
60
|
+
setCount(at);
|
|
61
|
+
});
|
|
62
|
+
var onPageSizeChange = relax.useEvent(function (pageSize) {
|
|
63
|
+
_onPageSizeChange === null || _onPageSizeChange === void 0 || _onPageSizeChange(pageSize);
|
|
55
64
|
setPageSize(pageSize);
|
|
56
|
-
};
|
|
65
|
+
});
|
|
57
66
|
return {
|
|
58
67
|
paginationItems: paginationItems,
|
|
59
68
|
add: add,
|
|
60
69
|
subtract: subtract,
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
onChange: onChange,
|
|
71
|
+
at: at,
|
|
63
72
|
hasPrev: hasPrev,
|
|
64
73
|
hasNext: hasNext,
|
|
65
74
|
pageSize: pageSize,
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PaginationItems } from "musae/types/pagination";
|
|
2
2
|
/**
|
|
3
3
|
* @author murukal
|
|
4
4
|
*
|
|
5
5
|
* @description
|
|
6
6
|
* use pagination
|
|
7
7
|
*/
|
|
8
|
-
export declare const usePagiantion: ({ total, siblings, boundaries, pageSize: _pageSize, }: {
|
|
8
|
+
export declare const usePagiantion: ({ total, siblings, boundaries, pageSize: _pageSize, at: _at, onChange: _onChange, onPageSizeChange: _onPageSizeChange, }: {
|
|
9
9
|
total: number;
|
|
10
10
|
siblings: number;
|
|
11
11
|
boundaries: number;
|
|
12
12
|
pageSize?: number;
|
|
13
|
+
at?: number;
|
|
14
|
+
onChange?: (at: number) => void;
|
|
15
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
13
16
|
}) => {
|
|
14
17
|
paginationItems: PaginationItems;
|
|
15
18
|
add: (step?: number) => void;
|
|
16
19
|
subtract: (step?: number) => void;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
onChange: (at: number) => void;
|
|
21
|
+
at: number;
|
|
19
22
|
hasPrev: boolean;
|
|
20
23
|
hasNext: boolean;
|
|
21
24
|
pageSize: number;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import { useControlledState, useCounter, range, clamp } from '@aiszlab/relax';
|
|
3
|
+
import { useControlledState, useCounter, range, clamp, useEvent } from '@aiszlab/relax';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { PaginationItemType } from './types.mjs';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @author murukal
|
|
@@ -14,22 +13,27 @@ var usePagiantion = function usePagiantion(_ref) {
|
|
|
14
13
|
var total = _ref.total,
|
|
15
14
|
siblings = _ref.siblings,
|
|
16
15
|
boundaries = _ref.boundaries,
|
|
17
|
-
_pageSize = _ref.pageSize
|
|
16
|
+
_pageSize = _ref.pageSize,
|
|
17
|
+
_at = _ref.at,
|
|
18
|
+
_onChange = _ref.onChange,
|
|
19
|
+
_onPageSizeChange = _ref.onPageSizeChange;
|
|
18
20
|
var _useControlledState = useControlledState(_pageSize, {
|
|
19
21
|
defaultState: 10
|
|
20
22
|
}),
|
|
21
23
|
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
22
24
|
pageSize = _useControlledState2[0],
|
|
23
25
|
setPageSize = _useControlledState2[1];
|
|
26
|
+
// convert total into page count
|
|
27
|
+
// at least 1 page
|
|
24
28
|
var pages = useMemo(function () {
|
|
25
|
-
return Math.ceil(total / Math.max(1, pageSize));
|
|
29
|
+
return Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
26
30
|
}, [total, pageSize]);
|
|
27
|
-
var _useCounter = useCounter(
|
|
31
|
+
var _useCounter = useCounter(_at, {
|
|
28
32
|
min: 1,
|
|
29
33
|
max: pages
|
|
30
34
|
}),
|
|
31
35
|
_useCounter2 = _slicedToArray(_useCounter, 2),
|
|
32
|
-
|
|
36
|
+
at = _useCounter2[0],
|
|
33
37
|
_useCounter2$ = _useCounter2[1],
|
|
34
38
|
add = _useCounter2$.add,
|
|
35
39
|
subtract = _useCounter2$.subtract,
|
|
@@ -38,28 +42,33 @@ var usePagiantion = function usePagiantion(_ref) {
|
|
|
38
42
|
// max renderable pages
|
|
39
43
|
var renderable = siblings * 2 + 3 + boundaries * 2;
|
|
40
44
|
if (renderable > pages) {
|
|
41
|
-
return [
|
|
45
|
+
return ["prev"].concat(_toConsumableArray(range(1, pages)), ["next"]);
|
|
42
46
|
}
|
|
43
|
-
var focusedAt = clamp(
|
|
47
|
+
var focusedAt = clamp(at, boundaries + 3, pages - (boundaries + 2));
|
|
44
48
|
var from = Math.max(focusedAt - siblings, boundaries);
|
|
45
49
|
var to = Math.min(focusedAt + siblings, pages - (boundaries - 1));
|
|
46
50
|
var hasPrevMore = from > boundaries + 2;
|
|
47
51
|
var hasNextMore = to < pages - (boundaries + 1);
|
|
48
|
-
return [
|
|
49
|
-
}, [boundaries,
|
|
52
|
+
return ["prev"].concat(_toConsumableArray(range(1, boundaries)), _toConsumableArray(hasPrevMore ? ["more-prev"] : [boundaries + 1]), _toConsumableArray(range(from, to)), _toConsumableArray(hasNextMore ? ["more-next"] : [pages - boundaries]), _toConsumableArray(range(pages - (boundaries - 1), pages)), ["next"]);
|
|
53
|
+
}, [boundaries, at, pages, siblings]);
|
|
50
54
|
// whether prev button is usable
|
|
51
|
-
var hasPrev =
|
|
55
|
+
var hasPrev = at > 1;
|
|
52
56
|
// whether next button is usable
|
|
53
|
-
var hasNext =
|
|
54
|
-
var
|
|
57
|
+
var hasNext = at < pages;
|
|
58
|
+
var onChange = useEvent(function (at) {
|
|
59
|
+
_onChange === null || _onChange === void 0 || _onChange(at);
|
|
60
|
+
setCount(at);
|
|
61
|
+
});
|
|
62
|
+
var onPageSizeChange = useEvent(function (pageSize) {
|
|
63
|
+
_onPageSizeChange === null || _onPageSizeChange === void 0 || _onPageSizeChange(pageSize);
|
|
55
64
|
setPageSize(pageSize);
|
|
56
|
-
};
|
|
65
|
+
});
|
|
57
66
|
return {
|
|
58
67
|
paginationItems: paginationItems,
|
|
59
68
|
add: add,
|
|
60
69
|
subtract: subtract,
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
onChange: onChange,
|
|
71
|
+
at: at,
|
|
63
72
|
hasPrev: hasPrev,
|
|
64
73
|
hasNext: hasNext,
|
|
65
74
|
pageSize: pageSize,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var types = require('./types.cjs');
|
|
5
4
|
var button = require('../button/button.cjs');
|
|
6
5
|
var keyboardArrowLeft = require('../icon/icons/hardware/keyboard-arrow-left.cjs');
|
|
7
6
|
var keyboardArrowRight = require('../icon/icons/hardware/keyboard-arrow-right.cjs');
|
|
@@ -11,13 +10,13 @@ var keyboardDoubleArrowRight = require('../icon/icons/hardware/keyboard-double-a
|
|
|
11
10
|
|
|
12
11
|
var Item = function Item(_ref) {
|
|
13
12
|
var value = _ref.value,
|
|
14
|
-
|
|
13
|
+
_onClick = _ref.onClick,
|
|
15
14
|
add = _ref.add,
|
|
16
15
|
subtract = _ref.subtract,
|
|
17
16
|
checked = _ref.checked,
|
|
18
17
|
hasNext = _ref.hasNext,
|
|
19
18
|
hasPrev = _ref.hasPrev;
|
|
20
|
-
if (value ===
|
|
19
|
+
if (value === "prev") {
|
|
21
20
|
return /*#__PURE__*/React.createElement(button.Button, {
|
|
22
21
|
onClick: function onClick() {
|
|
23
22
|
return subtract();
|
|
@@ -28,7 +27,7 @@ var Item = function Item(_ref) {
|
|
|
28
27
|
disabled: !hasPrev
|
|
29
28
|
}, /*#__PURE__*/React.createElement(keyboardArrowLeft.default, null));
|
|
30
29
|
}
|
|
31
|
-
if (value ===
|
|
30
|
+
if (value === "next") {
|
|
32
31
|
return /*#__PURE__*/React.createElement(button.Button, {
|
|
33
32
|
onClick: function onClick() {
|
|
34
33
|
return add();
|
|
@@ -39,13 +38,14 @@ var Item = function Item(_ref) {
|
|
|
39
38
|
disabled: !hasNext
|
|
40
39
|
}, /*#__PURE__*/React.createElement(keyboardArrowRight.default, null));
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
var isMorePrev = value === "more-prev";
|
|
42
|
+
var isMoreNext = value === "more-next";
|
|
43
|
+
if (isMorePrev || isMoreNext) {
|
|
43
44
|
var styled = {
|
|
44
45
|
more: {
|
|
45
46
|
className: "musaex-1aldg33 musaex-1oew0n0"
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
var isNegative = value === types.PaginationItemType.MorePrev;
|
|
49
49
|
return /*#__PURE__*/React.createElement(button.Button, {
|
|
50
50
|
shape: "circular",
|
|
51
51
|
variant: "text",
|
|
@@ -53,11 +53,11 @@ var Item = function Item(_ref) {
|
|
|
53
53
|
className: styled.more.className,
|
|
54
54
|
style: styled.more.style,
|
|
55
55
|
onClick: function onClick() {
|
|
56
|
-
|
|
56
|
+
isMorePrev ? subtract(5) : add(5);
|
|
57
57
|
}
|
|
58
58
|
}, /*#__PURE__*/React.createElement(moreHoriz.default, {
|
|
59
59
|
role: "separator"
|
|
60
|
-
}), /*#__PURE__*/React.createElement(
|
|
60
|
+
}), /*#__PURE__*/React.createElement(isMorePrev ? keyboardDoubleArrowLeft.default : keyboardDoubleArrowRight.default, {
|
|
61
61
|
role: "button"
|
|
62
62
|
}));
|
|
63
63
|
}
|
|
@@ -66,7 +66,7 @@ var Item = function Item(_ref) {
|
|
|
66
66
|
color: checked ? "primary" : "secondary",
|
|
67
67
|
variant: checked ? "filled" : "text",
|
|
68
68
|
onClick: function onClick() {
|
|
69
|
-
|
|
69
|
+
_onClick(value);
|
|
70
70
|
}
|
|
71
71
|
}, value);
|
|
72
72
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
declare const Item: ({ value,
|
|
2
|
+
import type { PaginationItemProps } from "musae/types/pagination";
|
|
3
|
+
declare const Item: ({ value, onClick, add, subtract, checked, hasNext, hasPrev, }: PaginationItemProps) => React.JSX.Element;
|
|
4
4
|
export default Item;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import { PaginationItemType } from './types.mjs';
|
|
3
2
|
import { Button } from '../button/button.mjs';
|
|
4
3
|
import KeyboardArrowLeft from '../icon/icons/hardware/keyboard-arrow-left.mjs';
|
|
5
4
|
import KeyboardArrowRight from '../icon/icons/hardware/keyboard-arrow-right.mjs';
|
|
@@ -9,13 +8,13 @@ import KeyboardDoubleArrowRight from '../icon/icons/hardware/keyboard-double-arr
|
|
|
9
8
|
|
|
10
9
|
var Item = function Item(_ref) {
|
|
11
10
|
var value = _ref.value,
|
|
12
|
-
|
|
11
|
+
_onClick = _ref.onClick,
|
|
13
12
|
add = _ref.add,
|
|
14
13
|
subtract = _ref.subtract,
|
|
15
14
|
checked = _ref.checked,
|
|
16
15
|
hasNext = _ref.hasNext,
|
|
17
16
|
hasPrev = _ref.hasPrev;
|
|
18
|
-
if (value ===
|
|
17
|
+
if (value === "prev") {
|
|
19
18
|
return /*#__PURE__*/React.createElement(Button, {
|
|
20
19
|
onClick: function onClick() {
|
|
21
20
|
return subtract();
|
|
@@ -26,7 +25,7 @@ var Item = function Item(_ref) {
|
|
|
26
25
|
disabled: !hasPrev
|
|
27
26
|
}, /*#__PURE__*/React.createElement(KeyboardArrowLeft, null));
|
|
28
27
|
}
|
|
29
|
-
if (value ===
|
|
28
|
+
if (value === "next") {
|
|
30
29
|
return /*#__PURE__*/React.createElement(Button, {
|
|
31
30
|
onClick: function onClick() {
|
|
32
31
|
return add();
|
|
@@ -37,13 +36,14 @@ var Item = function Item(_ref) {
|
|
|
37
36
|
disabled: !hasNext
|
|
38
37
|
}, /*#__PURE__*/React.createElement(KeyboardArrowRight, null));
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
var isMorePrev = value === "more-prev";
|
|
40
|
+
var isMoreNext = value === "more-next";
|
|
41
|
+
if (isMorePrev || isMoreNext) {
|
|
41
42
|
var styled = {
|
|
42
43
|
more: {
|
|
43
44
|
className: "musaex-1aldg33 musaex-1oew0n0"
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
|
-
var isNegative = value === PaginationItemType.MorePrev;
|
|
47
47
|
return /*#__PURE__*/React.createElement(Button, {
|
|
48
48
|
shape: "circular",
|
|
49
49
|
variant: "text",
|
|
@@ -51,11 +51,11 @@ var Item = function Item(_ref) {
|
|
|
51
51
|
className: styled.more.className,
|
|
52
52
|
style: styled.more.style,
|
|
53
53
|
onClick: function onClick() {
|
|
54
|
-
|
|
54
|
+
isMorePrev ? subtract(5) : add(5);
|
|
55
55
|
}
|
|
56
56
|
}, /*#__PURE__*/React.createElement(MoreHoriz, {
|
|
57
57
|
role: "separator"
|
|
58
|
-
}), /*#__PURE__*/createElement(
|
|
58
|
+
}), /*#__PURE__*/createElement(isMorePrev ? KeyboardDoubleArrowLeft : KeyboardDoubleArrowRight, {
|
|
59
59
|
role: "button"
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
@@ -64,7 +64,7 @@ var Item = function Item(_ref) {
|
|
|
64
64
|
color: checked ? "primary" : "secondary",
|
|
65
65
|
variant: checked ? "filled" : "text",
|
|
66
66
|
onClick: function onClick() {
|
|
67
|
-
|
|
67
|
+
_onClick(value);
|
|
68
68
|
}
|
|
69
69
|
}, value);
|
|
70
70
|
};
|
|
@@ -20,18 +20,28 @@ var Pagination = function Pagination(_ref) {
|
|
|
20
20
|
boundaries = _ref$boundaries === void 0 ? 1 : _ref$boundaries,
|
|
21
21
|
_pageSize = _ref.pageSize,
|
|
22
22
|
_ref$pageSizes = _ref.pageSizes,
|
|
23
|
-
pageSizes = _ref$pageSizes === void 0 ? [10, 20, 50, 100] : _ref$pageSizes
|
|
23
|
+
pageSizes = _ref$pageSizes === void 0 ? [10, 20, 50, 100] : _ref$pageSizes,
|
|
24
|
+
_at = _ref.at,
|
|
25
|
+
_onChange = _ref.onChange,
|
|
26
|
+
_onPageSizeChange = _ref.onPageSizeChange;
|
|
27
|
+
var classNames = useClassNames.useClassNames(componentToken.ComponentToken.Pagination);
|
|
28
|
+
var _useLocale = useLocale.useLocale(componentToken.ComponentToken.Pagination),
|
|
29
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
30
|
+
locale = _useLocale2[0];
|
|
24
31
|
var _usePagiantion = hooks.usePagiantion({
|
|
25
32
|
boundaries: boundaries,
|
|
26
33
|
pageSize: _pageSize,
|
|
27
34
|
siblings: siblings,
|
|
28
|
-
total: total
|
|
35
|
+
total: total,
|
|
36
|
+
at: _at,
|
|
37
|
+
onChange: _onChange,
|
|
38
|
+
onPageSizeChange: _onPageSizeChange
|
|
29
39
|
}),
|
|
30
40
|
paginationItems = _usePagiantion.paginationItems,
|
|
31
41
|
add = _usePagiantion.add,
|
|
32
42
|
subtract = _usePagiantion.subtract,
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
onChange = _usePagiantion.onChange,
|
|
44
|
+
at = _usePagiantion.at,
|
|
35
45
|
hasNext = _usePagiantion.hasNext,
|
|
36
46
|
hasPrev = _usePagiantion.hasPrev,
|
|
37
47
|
pageSize = _usePagiantion.pageSize,
|
|
@@ -44,10 +54,6 @@ var Pagination = function Pagination(_ref) {
|
|
|
44
54
|
className: "musaex-78zum5 musaex-6s0dn4"
|
|
45
55
|
}
|
|
46
56
|
};
|
|
47
|
-
var classNames = useClassNames.useClassNames(componentToken.ComponentToken.Pagination);
|
|
48
|
-
var _useLocale = useLocale.useLocale(componentToken.ComponentToken.Pagination),
|
|
49
|
-
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
50
|
-
locale = _useLocale2[0];
|
|
51
57
|
var sizeOptions = React.useMemo(function () {
|
|
52
58
|
return Array.from(new Set(pageSizes)).map(function (size) {
|
|
53
59
|
return {
|
|
@@ -69,8 +75,8 @@ var Pagination = function Pagination(_ref) {
|
|
|
69
75
|
value: item$1,
|
|
70
76
|
add: add,
|
|
71
77
|
subtract: subtract,
|
|
72
|
-
|
|
73
|
-
checked:
|
|
78
|
+
onClick: onChange,
|
|
79
|
+
checked: at === item$1,
|
|
74
80
|
hasNext: hasNext,
|
|
75
81
|
hasPrev: hasPrev
|
|
76
82
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { PagiantionProps } from "
|
|
3
|
-
declare const Pagination: ({ total, siblings, boundaries, pageSize: _pageSize, pageSizes, }: PagiantionProps) => React.JSX.Element;
|
|
2
|
+
import type { PagiantionProps } from "musae/types/pagination";
|
|
3
|
+
declare const Pagination: ({ total, siblings, boundaries, pageSize: _pageSize, pageSizes, at: _at, onChange: _onChange, onPageSizeChange: _onPageSizeChange, }: PagiantionProps) => React.JSX.Element;
|
|
4
4
|
export default Pagination;
|
|
@@ -18,18 +18,28 @@ var Pagination = function Pagination(_ref) {
|
|
|
18
18
|
boundaries = _ref$boundaries === void 0 ? 1 : _ref$boundaries,
|
|
19
19
|
_pageSize = _ref.pageSize,
|
|
20
20
|
_ref$pageSizes = _ref.pageSizes,
|
|
21
|
-
pageSizes = _ref$pageSizes === void 0 ? [10, 20, 50, 100] : _ref$pageSizes
|
|
21
|
+
pageSizes = _ref$pageSizes === void 0 ? [10, 20, 50, 100] : _ref$pageSizes,
|
|
22
|
+
_at = _ref.at,
|
|
23
|
+
_onChange = _ref.onChange,
|
|
24
|
+
_onPageSizeChange = _ref.onPageSizeChange;
|
|
25
|
+
var classNames = useClassNames(ComponentToken.Pagination);
|
|
26
|
+
var _useLocale = useLocale(ComponentToken.Pagination),
|
|
27
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
28
|
+
locale = _useLocale2[0];
|
|
22
29
|
var _usePagiantion = usePagiantion({
|
|
23
30
|
boundaries: boundaries,
|
|
24
31
|
pageSize: _pageSize,
|
|
25
32
|
siblings: siblings,
|
|
26
|
-
total: total
|
|
33
|
+
total: total,
|
|
34
|
+
at: _at,
|
|
35
|
+
onChange: _onChange,
|
|
36
|
+
onPageSizeChange: _onPageSizeChange
|
|
27
37
|
}),
|
|
28
38
|
paginationItems = _usePagiantion.paginationItems,
|
|
29
39
|
add = _usePagiantion.add,
|
|
30
40
|
subtract = _usePagiantion.subtract,
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
onChange = _usePagiantion.onChange,
|
|
42
|
+
at = _usePagiantion.at,
|
|
33
43
|
hasNext = _usePagiantion.hasNext,
|
|
34
44
|
hasPrev = _usePagiantion.hasPrev,
|
|
35
45
|
pageSize = _usePagiantion.pageSize,
|
|
@@ -42,10 +52,6 @@ var Pagination = function Pagination(_ref) {
|
|
|
42
52
|
className: "musaex-78zum5 musaex-6s0dn4"
|
|
43
53
|
}
|
|
44
54
|
};
|
|
45
|
-
var classNames = useClassNames(ComponentToken.Pagination);
|
|
46
|
-
var _useLocale = useLocale(ComponentToken.Pagination),
|
|
47
|
-
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
48
|
-
locale = _useLocale2[0];
|
|
49
55
|
var sizeOptions = useMemo(function () {
|
|
50
56
|
return Array.from(new Set(pageSizes)).map(function (size) {
|
|
51
57
|
return {
|
|
@@ -67,8 +73,8 @@ var Pagination = function Pagination(_ref) {
|
|
|
67
73
|
value: item,
|
|
68
74
|
add: add,
|
|
69
75
|
subtract: subtract,
|
|
70
|
-
|
|
71
|
-
checked:
|
|
76
|
+
onClick: onChange,
|
|
77
|
+
checked: at === item,
|
|
72
78
|
hasNext: hasNext,
|
|
73
79
|
hasPrev: hasPrev
|
|
74
80
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ContextValue } from "
|
|
1
|
+
import { ContextValue } from "../../types/picker";
|
|
2
2
|
export declare const Context: import("react").Context<ContextValue>;
|
|
@@ -40,7 +40,8 @@ var Picker = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
40
40
|
pickableStyle = _ref.pickableStyle,
|
|
41
41
|
onPopperEntered = _ref.onPopperEntered,
|
|
42
42
|
onPopperExited = _ref.onPopperExited,
|
|
43
|
-
onPopperExite = _ref.onPopperExite
|
|
43
|
+
onPopperExite = _ref.onPopperExite,
|
|
44
|
+
_onBlur = _ref.onBlur;
|
|
44
45
|
var trigger = React.useRef(null);
|
|
45
46
|
var _useBoolean = relax.useBoolean(),
|
|
46
47
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
@@ -64,11 +65,12 @@ var Picker = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
64
65
|
});
|
|
65
66
|
var click = relax.useEvent(function (event) {
|
|
66
67
|
event.stopPropagation();
|
|
67
|
-
toggle();
|
|
68
68
|
onClick === null || onClick === void 0 || onClick(event);
|
|
69
|
+
toggle();
|
|
69
70
|
});
|
|
70
71
|
var onBlur = relax.useEvent(function (e) {
|
|
71
72
|
e.stopPropagation();
|
|
73
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(e);
|
|
72
74
|
close();
|
|
73
75
|
});
|
|
74
76
|
var _useFocus = relax.useFocus({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { PickerProps, PickerRef } from "
|
|
2
|
+
import type { PickerProps, PickerRef } from "../../types/picker";
|
|
3
3
|
declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<PickerRef>>;
|
|
4
4
|
export default Picker;
|
|
@@ -38,7 +38,8 @@ var Picker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
38
38
|
pickableStyle = _ref.pickableStyle,
|
|
39
39
|
onPopperEntered = _ref.onPopperEntered,
|
|
40
40
|
onPopperExited = _ref.onPopperExited,
|
|
41
|
-
onPopperExite = _ref.onPopperExite
|
|
41
|
+
onPopperExite = _ref.onPopperExite,
|
|
42
|
+
_onBlur = _ref.onBlur;
|
|
42
43
|
var trigger = useRef(null);
|
|
43
44
|
var _useBoolean = useBoolean(),
|
|
44
45
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
@@ -62,11 +63,12 @@ var Picker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
62
63
|
});
|
|
63
64
|
var click = useEvent(function (event) {
|
|
64
65
|
event.stopPropagation();
|
|
65
|
-
toggle();
|
|
66
66
|
onClick === null || onClick === void 0 || onClick(event);
|
|
67
|
+
toggle();
|
|
67
68
|
});
|
|
68
69
|
var onBlur = useEvent(function (e) {
|
|
69
70
|
e.stopPropagation();
|
|
71
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(e);
|
|
70
72
|
close();
|
|
71
73
|
});
|
|
72
74
|
var _useFocus = useFocus({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React, { type Key } from "react";
|
|
2
|
-
import { DropdownProps } from "
|
|
2
|
+
import { DropdownProps } from "../../types/rich-text-editor";
|
|
3
3
|
declare const Dropdown: <T extends Key = React.Key>({ items: _items, value: _value, onChange, children, }: DropdownProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Dropdown;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
1
2
|
var React = require('react');
|
|
2
3
|
|
|
3
4
|
var _RichTextEditor = /*#__PURE__*/React.lazy(function () {
|
|
4
5
|
return Promise.resolve().then(function () { return require('./rich-text-editor.cjs'); });
|
|
5
6
|
});
|
|
6
|
-
var RichTextEditor = function
|
|
7
|
+
var RichTextEditor = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
8
|
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
8
9
|
fallback: /*#__PURE__*/React.createElement("div", null, "Loading...")
|
|
9
|
-
}, /*#__PURE__*/React.createElement(_RichTextEditor, props)
|
|
10
|
-
|
|
10
|
+
}, /*#__PURE__*/React.createElement(_RichTextEditor, _objectSpread(_objectSpread({}, props), {}, {
|
|
11
|
+
ref: ref
|
|
12
|
+
})));
|
|
13
|
+
});
|
|
11
14
|
|
|
12
15
|
exports.RichTextEditor = RichTextEditor;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
declare const RichTextEditor:
|
|
2
|
+
import type { RichTextEditorRef } from "musae/types/rich-text-editor";
|
|
3
|
+
declare const RichTextEditor: React.ForwardRefExoticComponent<Pick<React.HTMLAttributes<HTMLDivElement>, "aria-placeholder"> & {
|
|
4
|
+
placeholder?: import("@lexical/react/LexicalContentEditable").Props["placeholder"];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
use?: import("musae/types/rich-text-editor").Use;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
} & React.RefAttributes<RichTextEditorRef>>;
|
|
4
11
|
export { RichTextEditor };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import React, { forwardRef, Suspense, createElement, lazy } from 'react';
|
|
2
3
|
|
|
3
4
|
var _RichTextEditor = /*#__PURE__*/lazy(function () {
|
|
4
5
|
return import('./rich-text-editor.mjs');
|
|
5
6
|
});
|
|
6
|
-
var RichTextEditor = function
|
|
7
|
+
var RichTextEditor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7
8
|
return /*#__PURE__*/React.createElement(Suspense, {
|
|
8
9
|
fallback: /*#__PURE__*/React.createElement("div", null, "Loading...")
|
|
9
|
-
}, /*#__PURE__*/createElement(_RichTextEditor, props)
|
|
10
|
-
|
|
10
|
+
}, /*#__PURE__*/createElement(_RichTextEditor, _objectSpread(_objectSpread({}, props), {}, {
|
|
11
|
+
ref: ref
|
|
12
|
+
})));
|
|
13
|
+
});
|
|
11
14
|
|
|
12
15
|
export { RichTextEditor };
|