@laser-ui/components 1.6.1 → 2.0.0
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/CHANGELOG.md +10 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +13 -25
- package/accordion/types.d.ts +1 -0
- package/affix/Affix.d.ts +2 -2
- package/affix/Affix.js +27 -32
- package/affix/types.d.ts +7 -2
- package/alert/Alert.d.ts +1 -1
- package/alert/Alert.js +12 -21
- package/anchor/Anchor.d.ts +2 -4
- package/anchor/Anchor.js +34 -26
- package/anchor/types.d.ts +1 -0
- package/avatar/Avatar.d.ts +1 -1
- package/avatar/Avatar.js +9 -3
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +22 -41
- package/badge/BadgeText.js +12 -26
- package/badge/internal/BadgeNumber.d.ts +2 -2
- package/badge/internal/BadgeNumber.js +34 -24
- package/base-input/BaseInput.d.ts +1 -2
- package/base-input/BaseInput.js +4 -4
- package/base-input/types.d.ts +1 -0
- package/breadcrumb/Breadcrumb.d.ts +1 -1
- package/button/Button.d.ts +1 -2
- package/button/Button.js +18 -22
- package/button/types.d.ts +1 -0
- package/card/Card.d.ts +1 -1
- package/card/CardAction.d.ts +1 -1
- package/card/CardAction.js +3 -4
- package/card/CardActions.d.ts +1 -1
- package/card/CardActions.js +7 -3
- package/card/CardContent.d.ts +1 -1
- package/card/CardHeader.d.ts +1 -1
- package/card/types.d.ts +5 -1
- package/cascader/Cascader.d.ts +2 -4
- package/cascader/Cascader.js +217 -214
- package/cascader/internal/CascaderPanel.d.ts +2 -2
- package/cascader/internal/CascaderPanel.js +21 -7
- package/cascader/internal/CascaderSearchPanel.d.ts +2 -2
- package/cascader/internal/CascaderSearchPanel.js +15 -6
- package/cascader/types.d.ts +3 -3
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +4 -5
- package/checkbox/CheckboxGroup.d.ts +1 -1
- package/checkbox/CheckboxGroup.js +8 -7
- package/checkbox/types.d.ts +14 -4
- package/{internal/circular-progress → circular-progress}/CircularProgress.d.ts +1 -1
- package/{internal/circular-progress → circular-progress}/CircularProgress.js +2 -2
- package/compose/Compose.d.ts +1 -1
- package/compose/ComposeItem.d.ts +1 -1
- package/config-provider/ConfigProvider.d.ts +1 -1
- package/config-provider/ConfigProvider.js +3 -3
- package/date-picker/DatePicker.d.ts +2 -2
- package/date-picker/DatePicker.js +116 -98
- package/date-picker/internal/DatePickerPanel.d.ts +2 -1
- package/date-picker/internal/DatePickerPanel.js +4 -4
- package/date-picker/types.d.ts +3 -3
- package/dialog-service.d.ts +9 -6
- package/dialog-service.js +50 -26
- package/drawer/Drawer.d.ts +1 -1
- package/drawer/Drawer.js +83 -92
- package/drawer/DrawerFooter.d.ts +1 -1
- package/drawer/DrawerFooter.js +12 -9
- package/drawer/DrawerHeader.d.ts +1 -1
- package/drawer/DrawerHeader.js +10 -7
- package/drawer/types.d.ts +9 -2
- package/drawer/vars.d.ts +5 -1
- package/drawer/vars.js +1 -1
- package/dropdown/Dropdown.d.ts +2 -4
- package/dropdown/Dropdown.js +83 -104
- package/dropdown/internal/DropdownGroup.d.ts +1 -1
- package/dropdown/internal/DropdownItem.d.ts +1 -1
- package/dropdown/internal/DropdownSub.d.ts +2 -1
- package/dropdown/internal/DropdownSub.js +26 -49
- package/dropdown/types.d.ts +15 -2
- package/empty/Empty.d.ts +1 -1
- package/fab/Fab.d.ts +1 -1
- package/fab/Fab.js +19 -14
- package/fab/FabBacktop.d.ts +1 -1
- package/fab/FabBacktop.js +24 -31
- package/fab/FabButton.d.ts +1 -1
- package/fab/FabButton.js +37 -10
- package/fab/types.d.ts +6 -2
- package/fab/vars.d.ts +14 -0
- package/fab/vars.js +4 -0
- package/form/Form.d.ts +1 -1
- package/form/Form.js +7 -2
- package/form/FormItem.d.ts +1 -1
- package/form/FormItem.js +35 -24
- package/form/internal/FormError.d.ts +3 -2
- package/form/internal/FormError.js +10 -19
- package/hooks/index.d.ts +0 -2
- package/hooks/index.js +0 -2
- package/hooks/useComponentProps.js +2 -2
- package/hooks/useFocusVisible.d.ts +9 -2
- package/hooks/useFocusVisible.js +5 -11
- package/hooks/useLayout.d.ts +2 -2
- package/hooks/useLayout.js +2 -2
- package/hooks/useNamespace.js +2 -2
- package/hooks/useNestedPopup.d.ts +1 -1
- package/hooks/useScopedProps.js +2 -2
- package/hooks/useStyled.js +2 -2
- package/hooks/useTranslation.js +2 -2
- package/icon/Icon.d.ts +1 -1
- package/icon/Icon.js +7 -4
- package/image/Image.d.ts +1 -1
- package/image/Image.js +6 -2
- package/image/ImageAction.d.ts +1 -1
- package/image/ImageAction.js +3 -4
- package/image/ImageLoader.d.ts +1 -1
- package/image/ImagePreview.d.ts +1 -1
- package/image/ImagePreview.js +94 -109
- package/image/types.d.ts +6 -2
- package/input/Input.d.ts +1 -1
- package/input/Input.js +12 -8
- package/input/InputNumber.js +49 -40
- package/input/types.d.ts +3 -5
- package/internal/lazy-loading/LazyLoading.d.ts +3 -0
- package/internal/lazy-loading/LazyLoading.js +9 -0
- package/internal/lazy-loading/index.d.ts +2 -0
- package/internal/lazy-loading/index.js +1 -0
- package/internal/lazy-loading/types.d.ts +7 -0
- package/internal/popup/Popup.d.ts +1 -1
- package/internal/popup/Popup.js +40 -68
- package/internal/popup/types.d.ts +13 -6
- package/internal/portal/Portal.d.ts +1 -1
- package/internal/portal/Portal.js +12 -6
- package/internal/portal/types.d.ts +3 -2
- package/mask/Mask.d.ts +3 -0
- package/mask/Mask.js +31 -0
- package/menu/Menu.d.ts +2 -4
- package/menu/Menu.js +37 -42
- package/menu/internal/MenuGroup.d.ts +1 -1
- package/menu/internal/MenuItem.d.ts +1 -1
- package/menu/internal/MenuItem.js +14 -10
- package/menu/internal/MenuSub.d.ts +2 -1
- package/menu/internal/MenuSub.js +43 -70
- package/menu/types.d.ts +1 -0
- package/modal/Modal.d.ts +1 -1
- package/modal/Modal.js +77 -80
- package/modal/ModalAlert.d.ts +1 -1
- package/modal/ModalFooter.d.ts +1 -1
- package/modal/ModalFooter.js +12 -9
- package/modal/ModalHeader.d.ts +1 -1
- package/modal/ModalHeader.js +10 -7
- package/modal/types.d.ts +9 -2
- package/modal/vars.d.ts +5 -0
- package/modal/vars.js +2 -0
- package/notification/Notification.d.ts +1 -1
- package/notification/Notification.js +44 -71
- package/notification/types.d.ts +1 -0
- package/package.json +2 -2
- package/pagination/Pagination.d.ts +1 -1
- package/pagination/Pagination.js +9 -6
- package/popover/Popover.d.ts +2 -2
- package/popover/Popover.js +82 -118
- package/popover/PopoverFooter.d.ts +1 -1
- package/popover/PopoverFooter.js +12 -9
- package/popover/PopoverHeader.d.ts +1 -1
- package/popover/PopoverHeader.js +10 -7
- package/popover/types.d.ts +18 -4
- package/popover/vars.d.ts +5 -0
- package/popover/vars.js +2 -0
- package/progress/Progress.d.ts +1 -1
- package/radio/Radio.d.ts +1 -1
- package/radio/Radio.js +18 -13
- package/radio/RadioGroup.d.ts +1 -1
- package/radio/RadioGroup.js +12 -7
- package/radio/types.d.ts +16 -4
- package/radio/vars.d.ts +6 -0
- package/radio/vars.js +2 -0
- package/rating/Rating.d.ts +1 -1
- package/rating/internal/RatingStar.d.ts +1 -1
- package/rating/internal/RatingStar.js +23 -21
- package/root/Root.d.ts +1 -1
- package/root/Root.js +1 -1
- package/select/Select.d.ts +2 -4
- package/select/Select.js +245 -243
- package/select/types.d.ts +3 -3
- package/separator/Separator.d.ts +1 -1
- package/skeleton/Skeleton.d.ts +1 -1
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +54 -34
- package/slider/types.d.ts +2 -3
- package/slides/Slides.d.ts +1 -1
- package/slides/Slides.js +8 -3
- package/spinner/Spinner.d.ts +1 -1
- package/spinner/Spinner.js +27 -29
- package/stepper/Stepper.d.ts +1 -1
- package/stepper/Stepper.js +9 -16
- package/switch/Switch.js +33 -24
- package/switch/types.d.ts +2 -3
- package/table/Table.d.ts +1 -1
- package/table/Table.js +14 -10
- package/table/TableEmpty.d.ts +1 -1
- package/table/TableEmpty.js +9 -3
- package/table/TableExpand.d.ts +1 -1
- package/table/TableFilter.d.ts +1 -1
- package/table/TableFilter.js +1 -1
- package/table/TableTd.d.ts +1 -1
- package/table/TableTh.d.ts +1 -1
- package/table/TableThAction.d.ts +1 -1
- package/table/TableThAction.js +3 -4
- package/table/internal/TableCell.d.ts +1 -1
- package/table/internal/TableCell.js +13 -5
- package/table/types.d.ts +9 -2
- package/tabs/Tabs.d.ts +2 -4
- package/tabs/Tabs.js +41 -25
- package/tabs/types.d.ts +1 -0
- package/tag/Tag.d.ts +1 -1
- package/textarea/Textarea.d.ts +1 -1
- package/textarea/Textarea.js +15 -8
- package/textarea/types.d.ts +1 -0
- package/time-picker/TimePicker.d.ts +2 -2
- package/time-picker/TimePicker.js +89 -75
- package/time-picker/internal/TimePickerPanel.d.ts +2 -1
- package/time-picker/internal/TimePickerPanel.js +22 -7
- package/time-picker/types.d.ts +3 -3
- package/timeline/Timeline.d.ts +1 -1
- package/toast/Toast.d.ts +1 -1
- package/toast/Toast.js +44 -72
- package/toast/types.d.ts +1 -0
- package/tooltip/Tooltip.d.ts +2 -2
- package/tooltip/Tooltip.js +50 -74
- package/tooltip/types.d.ts +10 -2
- package/transfer/Transfer.d.ts +1 -1
- package/transfer/internal/TransferPanel.d.ts +1 -1
- package/transfer/internal/TransferPanel.js +7 -2
- package/{internal/transition → transition}/CollapseTransition.d.ts +1 -1
- package/transition/CollapseTransition.js +65 -0
- package/transition/Transition.d.ts +3 -0
- package/transition/Transition.js +148 -0
- package/transition/types.d.ts +29 -0
- package/tree/Tree.d.ts +1 -1
- package/tree/Tree.js +19 -7
- package/tree/internal/TreePanel.d.ts +2 -2
- package/tree/internal/TreePanel.js +32 -26
- package/tree-select/TreeSelect.d.ts +2 -4
- package/tree-select/TreeSelect.js +216 -213
- package/tree-select/internal/TreeSelectSearchPanel.d.ts +2 -2
- package/tree-select/internal/TreeSelectSearchPanel.js +15 -6
- package/tree-select/types.d.ts +3 -3
- package/types.d.ts +1 -1
- package/upload/Upload.d.ts +1 -3
- package/upload/Upload.js +41 -50
- package/upload/UploadAction.d.ts +1 -1
- package/upload/UploadAction.js +19 -16
- package/upload/UploadButton.d.ts +1 -1
- package/upload/UploadButton.js +16 -12
- package/upload/UploadList.d.ts +1 -1
- package/upload/UploadList.js +52 -47
- package/upload/UploadPicture.d.ts +1 -1
- package/upload/UploadPicture.js +47 -53
- package/upload/UploadPictureList.d.ts +1 -1
- package/upload/UploadPictureList.js +52 -47
- package/upload/UploadPreviewAction.d.ts +1 -1
- package/upload/UploadPreviewAction.js +15 -14
- package/upload/hooks.d.ts +2 -0
- package/upload/types.d.ts +27 -6
- package/upload/vars.d.ts +11 -0
- package/upload/vars.js +3 -0
- package/virtual-scroll/VirtualScroll.d.ts +2 -4
- package/virtual-scroll/VirtualScroll.js +13 -21
- package/virtual-scroll/types.d.ts +2 -1
- package/wave/Wave.d.ts +3 -0
- package/{internal/wave → wave}/Wave.js +6 -6
- package/{internal/wave → wave}/types.d.ts +1 -0
- package/wave/types.js +1 -0
- package/LICENSE +0 -21
- package/hooks/useJSS.d.ts +0 -1
- package/hooks/useJSS.js +0 -15
- package/hooks/useNextTick.d.ts +0 -2
- package/internal/mask/Mask.d.ts +0 -3
- package/internal/mask/Mask.js +0 -36
- package/internal/transition/CollapseTransition.js +0 -101
- package/internal/transition/Transition.d.ts +0 -3
- package/internal/transition/Transition.js +0 -87
- package/internal/transition/types.d.ts +0 -33
- package/internal/wave/Wave.d.ts +0 -3
- /package/{internal/circular-progress → circular-progress}/index.d.ts +0 -0
- /package/{internal/circular-progress → circular-progress}/index.js +0 -0
- /package/{internal/circular-progress → circular-progress}/vars.d.ts +0 -0
- /package/{internal/circular-progress → circular-progress}/vars.js +0 -0
- /package/internal/{mask → lazy-loading}/types.js +0 -0
- /package/{internal/mask → mask}/index.d.ts +0 -0
- /package/{internal/mask → mask}/index.js +0 -0
- /package/{internal/mask → mask}/types.d.ts +0 -0
- /package/{internal/transition → mask}/types.js +0 -0
- /package/{internal/mask → mask}/vars.d.ts +0 -0
- /package/{internal/mask → mask}/vars.js +0 -0
- /package/{internal/transition → transition}/index.d.ts +0 -0
- /package/{internal/transition → transition}/index.js +0 -0
- /package/{internal/wave → transition}/types.js +0 -0
- /package/{hooks/useNextTick.js → upload/hooks.js} +0 -0
- /package/{internal/wave → wave}/index.d.ts +0 -0
- /package/{internal/wave → wave}/index.js +0 -0
- /package/{internal/wave → wave}/vars.d.ts +0 -0
- /package/{internal/wave → wave}/vars.js +0 -0
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useAsync, useIsomorphicLayoutEffect } from '@laser-ui/hooks';
|
|
4
|
+
import { useRef, useState } from 'react';
|
|
4
5
|
export function BadgeNumber(props) {
|
|
5
|
-
const { styled, value,
|
|
6
|
+
const { styled, value, num } = props;
|
|
7
|
+
const async = useAsync();
|
|
6
8
|
const containerRef = useRef(null);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
});
|
|
9
|
+
const prevValue = useRef(value);
|
|
10
|
+
const prevNum = useRef(num);
|
|
10
11
|
const [nums, setNums] = useState([value]);
|
|
11
|
-
|
|
12
|
-
if (containerRef.current &&
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
if (containerRef.current && num !== prevNum.current) {
|
|
14
|
+
let prevNums = Array.from({ length: 10 }).map((_, i) => i);
|
|
15
|
+
if (num < prevNum.current) {
|
|
16
|
+
prevNums = prevNums.concat(Array.from({ length: prevValue.current + 1 }).map((_, i) => i));
|
|
17
|
+
prevNums = prevNums.slice(prevNums.length - 10, prevNums.length);
|
|
17
18
|
containerRef.current.style.cssText = 'transform:translateY(-900%);transition:none;';
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
|
-
|
|
21
|
-
.map((_, i) =>
|
|
22
|
-
.concat(
|
|
23
|
-
|
|
21
|
+
prevNums = Array.from({ length: 10 - prevValue.current })
|
|
22
|
+
.map((_, i) => prevValue.current + i)
|
|
23
|
+
.concat(prevNums);
|
|
24
|
+
prevNums = prevNums.slice(0, 10);
|
|
24
25
|
containerRef.current.style.cssText = 'transform:translateY(0);transition:none;';
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
containerRef.current.style.cssText = `transform:translateY(-${nums.findIndex((n) => n === value) * 100}%); `;
|
|
27
|
+
async.setAfterPainted(() => {
|
|
28
|
+
if (containerRef.current) {
|
|
29
|
+
containerRef.current.style.cssText = `transform:translateY(-${prevNums.findIndex((n) => n === value) * 100}%); `;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
setNums(prevNums);
|
|
33
33
|
}
|
|
34
|
+
prevValue.current = value;
|
|
35
|
+
prevNum.current = num;
|
|
36
|
+
return () => {
|
|
37
|
+
async.clearAll();
|
|
38
|
+
};
|
|
34
39
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, [
|
|
36
|
-
return (_jsx("div", Object.assign({}, styled('badge__number-container'), { ref:
|
|
40
|
+
}, [num]);
|
|
41
|
+
return (_jsx("div", Object.assign({}, styled('badge__number-container'), { ref: (instance) => {
|
|
42
|
+
containerRef.current = instance;
|
|
43
|
+
return () => {
|
|
44
|
+
containerRef.current = null;
|
|
45
|
+
};
|
|
46
|
+
}, children: nums.map((n, i) => (_createElement("span", Object.assign({}, styled('badge__number'), { key: i }), n))) })));
|
|
37
47
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { BaseInputProps } from './types';
|
|
3
|
-
export declare
|
|
2
|
+
export declare function BaseInput(props: BaseInputProps): import("react/jsx-runtime").JSX.Element;
|
package/base-input/BaseInput.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { isString } from 'lodash';
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
6
|
-
const { value, onValueChange } = props, restProps = __rest(props, ["value", "onValueChange"]);
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
export function BaseInput(props) {
|
|
6
|
+
const { ref, value, onValueChange } = props, restProps = __rest(props, ["ref", "value", "onValueChange"]);
|
|
7
7
|
const [composing, setComposing] = useState();
|
|
8
8
|
return (_jsx("input", Object.assign({}, restProps, { ref: ref, value: isString(composing) ? composing : value, onCompositionStart: (e) => {
|
|
9
9
|
var _a;
|
|
@@ -24,4 +24,4 @@ export const BaseInput = forwardRef((props, ref) => {
|
|
|
24
24
|
onValueChange(e.currentTarget.value);
|
|
25
25
|
}
|
|
26
26
|
} })));
|
|
27
|
-
}
|
|
27
|
+
}
|
package/base-input/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BreadcrumbItem, BreadcrumbProps } from './types';
|
|
3
|
-
export declare function Breadcrumb<ID extends React.Key, T extends BreadcrumbItem<ID>>(props: BreadcrumbProps<ID, T>):
|
|
3
|
+
export declare function Breadcrumb<ID extends React.Key, T extends BreadcrumbItem<ID>>(props: BreadcrumbProps<ID, T>): React.ReactElement | null;
|
package/button/Button.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ButtonProps } from './types';
|
|
3
|
-
export declare
|
|
2
|
+
export declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
package/button/Button.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { useRef } from 'react';
|
|
5
5
|
import { CLASSES } from './vars';
|
|
6
|
+
import { CircularProgress } from '../circular-progress';
|
|
6
7
|
import { useComponentProps, useDesign, useScopedProps, useStyled } from '../hooks';
|
|
7
8
|
import { Icon } from '../icon';
|
|
8
|
-
import {
|
|
9
|
-
import { CollapseTransition } from '../internal/transition';
|
|
10
|
-
import { Wave } from '../internal/wave';
|
|
9
|
+
import { CollapseTransition } from '../transition';
|
|
11
10
|
import { mergeCS } from '../utils';
|
|
12
11
|
import { TTANSITION_DURING_SLOW } from '../vars';
|
|
13
|
-
|
|
12
|
+
import { Wave } from '../wave';
|
|
13
|
+
export function Button(props) {
|
|
14
14
|
var _a;
|
|
15
|
-
const _b = useComponentProps('Button', props), { children, styleOverrides, styleProvider, pattern = 'primary', theme = 'primary', loading = false, shape, block = false, size: sizeProp, icon, iconRight = false } = _b, restProps = __rest(_b, ["children", "styleOverrides", "styleProvider", "pattern", "theme", "loading", "shape", "block", "size", "icon", "iconRight"]);
|
|
15
|
+
const _b = useComponentProps('Button', props), { ref, children, styleOverrides, styleProvider, pattern = 'primary', theme = 'primary', loading = false, shape, block = false, size: sizeProp, icon, iconRight = false } = _b, restProps = __rest(_b, ["ref", "children", "styleOverrides", "styleProvider", "pattern", "theme", "loading", "shape", "block", "size", "icon", "iconRight"]);
|
|
16
16
|
const styled = useStyled(CLASSES, { button: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.button }, styleOverrides);
|
|
17
17
|
const waveRef = useRef(null);
|
|
18
18
|
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: restProps.disabled || loading });
|
|
@@ -32,19 +32,15 @@ export const Button = forwardRef((props, ref) => {
|
|
|
32
32
|
if (['primary', 'secondary', 'outline', 'dashed'].includes(pattern)) {
|
|
33
33
|
(_b = waveRef.current) === null || _b === void 0 ? void 0 : _b.call(waveRef);
|
|
34
34
|
}
|
|
35
|
-
}, children: [_jsx(Wave, { ref:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
}, destroyWhenLeaved: true, children: (loadingRef, collapseStyle) => (_jsx("div", Object.assign({}, mergeCS(styled('button__icon'), {
|
|
48
|
-
style: collapseStyle,
|
|
49
|
-
}), { ref: loadingRef, children: _jsx(Icon, { children: _jsx(CircularProgress, {}) }) }))) })), _jsx("div", { children: children })] })));
|
|
50
|
-
});
|
|
35
|
+
}, children: [_jsx(Wave, { ref: (instance) => {
|
|
36
|
+
waveRef.current = instance;
|
|
37
|
+
return () => {
|
|
38
|
+
waveRef.current = null;
|
|
39
|
+
};
|
|
40
|
+
}, color: "var(--color)" }), checkNodeExist(icon) ? (_jsx("div", Object.assign({}, styled('button__icon'), { children: loading ? (_jsx(Icon, { children: _jsx(CircularProgress, {}) })) : (icon) }))) : (_jsx(CollapseTransition, { enter: loading, duration: TTANSITION_DURING_SLOW, children: (transitionRef, leaved) => leaved ? null : (_jsx("div", { ref: (instance) => {
|
|
41
|
+
transitionRef(instance);
|
|
42
|
+
return () => {
|
|
43
|
+
transitionRef(null);
|
|
44
|
+
};
|
|
45
|
+
}, style: { '--collapse-duration': TTANSITION_DURING_SLOW + 'ms' }, children: _jsx("div", Object.assign({}, styled('button__icon'), { children: _jsx(Icon, { children: _jsx(CircularProgress, {}) }) })) })) })), _jsx("div", { children: children })] })));
|
|
46
|
+
}
|
package/button/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { CLASSES } from './vars';
|
|
|
3
3
|
import type { BaseProps, Size } from '../types';
|
|
4
4
|
export {};
|
|
5
5
|
export interface ButtonProps extends BaseProps<'button', typeof CLASSES>, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
6
7
|
pattern?: 'primary' | 'secondary' | 'outline' | 'dashed' | 'text' | 'link';
|
|
7
8
|
theme?: 'primary' | 'success' | 'warning' | 'danger';
|
|
8
9
|
loading?: boolean;
|
package/card/Card.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { CardActions } from './CardActions';
|
|
|
5
5
|
import { CardContent } from './CardContent';
|
|
6
6
|
import { CardHeader } from './CardHeader';
|
|
7
7
|
export declare const Card: {
|
|
8
|
-
(props: CardProps):
|
|
8
|
+
(props: CardProps): React.ReactElement | null;
|
|
9
9
|
Header: typeof CardHeader;
|
|
10
10
|
Content: typeof CardContent;
|
|
11
11
|
Actions: typeof CardActions;
|
package/card/CardAction.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CardActionProps } from './types';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function CardAction(props: CardActionProps): React.ReactElement | null;
|
package/card/CardAction.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
3
|
import { CLASSES } from './vars';
|
|
5
4
|
import { useComponentProps, useStyled } from '../hooks';
|
|
6
5
|
import { mergeCS } from '../utils';
|
|
7
|
-
export
|
|
6
|
+
export function CardAction(props) {
|
|
8
7
|
var _a, _b;
|
|
9
|
-
const _c = useComponentProps('CardAction', props), { styleOverrides, styleProvider, children, disabled = false } = _c, restProps = __rest(_c, ["styleOverrides", "styleProvider", "children", "disabled"]);
|
|
8
|
+
const _c = useComponentProps('CardAction', props), { ref, styleOverrides, styleProvider, children, disabled = false } = _c, restProps = __rest(_c, ["ref", "styleOverrides", "styleProvider", "children", "disabled"]);
|
|
10
9
|
const styled = useStyled(CLASSES, { card: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.card }, styleOverrides);
|
|
11
10
|
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('card__action', {
|
|
12
11
|
'card__action.is-disabled': disabled,
|
|
@@ -14,4 +13,4 @@ export const CardAction = forwardRef((props, ref) => {
|
|
|
14
13
|
className: restProps.className,
|
|
15
14
|
style: restProps.style,
|
|
16
15
|
}), { ref: ref, role: (_a = restProps['role']) !== null && _a !== void 0 ? _a : 'button', tabIndex: (_b = restProps['tabIndex']) !== null && _b !== void 0 ? _b : (disabled ? -1 : 0), children: children })));
|
|
17
|
-
}
|
|
16
|
+
}
|
package/card/CardActions.d.ts
CHANGED
package/card/CardActions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx,
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { has } from 'lodash';
|
|
4
|
+
import { Fragment } from 'react';
|
|
4
5
|
import { CLASSES } from './vars';
|
|
5
6
|
import { useComponentProps, useStyled } from '../hooks';
|
|
6
7
|
import { Separator } from '../separator';
|
|
@@ -11,5 +12,8 @@ export function CardActions(props) {
|
|
|
11
12
|
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('card__actions'), {
|
|
12
13
|
className: restProps.className,
|
|
13
14
|
style: restProps.style,
|
|
14
|
-
}), { children:
|
|
15
|
+
}), { children: actions.map((node, index) => {
|
|
16
|
+
const { id, action } = (has(node, ['id', 'action']) ? node : { id: index, action: node });
|
|
17
|
+
return (_jsxs(Fragment, { children: [action, index !== actions.length - 1 && _jsx(Separator, { style: { margin: 8 }, vertical: true })] }, id));
|
|
18
|
+
}) })));
|
|
15
19
|
}
|
package/card/CardContent.d.ts
CHANGED
package/card/CardHeader.d.ts
CHANGED
package/card/types.d.ts
CHANGED
|
@@ -11,8 +11,12 @@ export interface CardHeaderProps extends BaseProps<'card', typeof CLASSES>, Reac
|
|
|
11
11
|
export interface CardContentProps extends BaseProps<'card', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
12
12
|
}
|
|
13
13
|
export interface CardActionsProps extends BaseProps<'card', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
14
|
-
actions: React.ReactNode
|
|
14
|
+
actions: (React.ReactNode | {
|
|
15
|
+
id: React.Key;
|
|
16
|
+
action: React.ReactNode;
|
|
17
|
+
})[];
|
|
15
18
|
}
|
|
16
19
|
export interface CardActionProps extends BaseProps<'card', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
17
21
|
disabled?: boolean;
|
|
18
22
|
}
|
package/cascader/Cascader.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CascaderItem, CascaderProps
|
|
3
|
-
declare function
|
|
4
|
-
export declare const Cascader: <ID extends React.Key, T extends CascaderItem<ID>>(props: CascaderProps<ID, T> & React.RefAttributes<CascaderRef>) => ReturnType<typeof CascaderFC>;
|
|
5
|
-
export {};
|
|
2
|
+
import type { CascaderItem, CascaderProps } from './types';
|
|
3
|
+
export declare function Cascader<V extends React.Key, T extends CascaderItem<V>>(props: CascaderProps<V, T>): React.ReactElement | null;
|