@canlooks/can-ui 0.0.44 → 0.0.46
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/cjs/components/button/button.js +2 -2
- package/dist/cjs/components/button/button.style.js +2 -0
- package/dist/cjs/components/calendar/calendar.d.ts +32 -0
- package/dist/cjs/components/calendar/calendar.js +51 -0
- package/dist/cjs/components/calendar/calendar.style.d.ts +15 -0
- package/dist/cjs/components/{dateTimePicker → calendar}/calendar.style.js +131 -91
- package/dist/cjs/components/calendar/index.d.ts +1 -0
- package/dist/cjs/components/calendar/index.js +4 -0
- package/dist/cjs/components/calendar/panelDates.d.ts +2 -0
- package/dist/cjs/components/{dateTimePicker/calendarDates.js → calendar/panelDates.js} +11 -19
- package/dist/cjs/components/calendar/panelMonth.d.ts +2 -0
- package/dist/cjs/components/calendar/panelMonth.js +29 -0
- package/dist/cjs/components/calendar/panelYear.d.ts +2 -0
- package/dist/cjs/components/calendar/panelYear.js +36 -0
- package/dist/cjs/components/card/card.style.js +2 -2
- package/dist/cjs/components/checkboxBase/checkboxBase.js +2 -2
- package/dist/cjs/components/colorPicker/colorPicker.js +2 -2
- package/dist/cjs/components/colorPicker/colorPicker.style.js +1 -1
- package/dist/cjs/components/dateTimePicker/dateTimePicker.d.ts +1 -1
- package/dist/cjs/components/dateTimePicker/dateTimePicker.js +10 -13
- package/dist/cjs/components/dateTimePicker/dateTimePicker.style.d.ts +4 -4
- package/dist/cjs/components/dateTimePicker/dateTimePicker.style.js +1 -1
- package/dist/cjs/components/dateTimePicker/index.d.ts +1 -1
- package/dist/cjs/components/dateTimePicker/index.js +1 -1
- package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +1 -0
- package/dist/cjs/components/form/form.d.ts +1 -1
- package/dist/cjs/components/icon/icon.d.ts +6 -0
- package/dist/cjs/components/icon/icon.js +9 -0
- package/dist/cjs/components/icon/index.d.ts +1 -0
- package/dist/cjs/components/icon/index.js +4 -0
- package/dist/cjs/components/pinchable/pinchable.style.js +1 -1
- package/dist/cjs/components/placeholder/placeholder.js +3 -3
- package/dist/cjs/components/popper/popper.js +1 -1
- package/dist/cjs/components/segmented/segmented.d.ts +3 -1
- package/dist/cjs/components/segmented/segmented.js +2 -2
- package/dist/cjs/components/segmented/segmented.style.d.ts +4 -1
- package/dist/cjs/components/segmented/segmented.style.js +94 -90
- package/dist/cjs/components/slider/slider.d.ts +0 -1
- package/dist/cjs/components/tooltip/tooltip.style.js +1 -0
- package/dist/cjs/components/waterfall/waterfall.style.js +1 -1
- package/dist/cjs/components/waterfall/waterfallItem.js +1 -1
- package/dist/cjs/extensions/documentViewer/documentViewer.js +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/utils/style.d.ts +2 -2
- package/dist/cjs/utils/style.js +8 -4
- package/dist/esm/components/button/button.js +3 -3
- package/dist/esm/components/button/button.style.js +2 -0
- package/dist/esm/components/calendar/calendar.d.ts +32 -0
- package/dist/esm/components/calendar/calendar.js +46 -0
- package/dist/esm/components/calendar/calendar.style.d.ts +15 -0
- package/dist/esm/components/{dateTimePicker → calendar}/calendar.style.js +131 -91
- package/dist/esm/components/calendar/index.d.ts +1 -0
- package/dist/esm/components/calendar/index.js +1 -0
- package/dist/esm/components/calendar/panelDates.d.ts +2 -0
- package/dist/esm/components/{dateTimePicker/calendarDates.js → calendar/panelDates.js} +11 -19
- package/dist/esm/components/calendar/panelMonth.d.ts +2 -0
- package/dist/esm/components/calendar/panelMonth.js +26 -0
- package/dist/esm/components/calendar/panelYear.d.ts +2 -0
- package/dist/esm/components/calendar/panelYear.js +33 -0
- package/dist/esm/components/card/card.style.js +2 -2
- package/dist/esm/components/checkboxBase/checkboxBase.js +3 -3
- package/dist/esm/components/colorPicker/colorPicker.js +3 -3
- package/dist/esm/components/colorPicker/colorPicker.style.js +1 -1
- package/dist/esm/components/dateTimePicker/dateTimePicker.d.ts +1 -1
- package/dist/esm/components/dateTimePicker/dateTimePicker.js +11 -14
- package/dist/esm/components/dateTimePicker/dateTimePicker.style.d.ts +4 -4
- package/dist/esm/components/dateTimePicker/dateTimePicker.style.js +1 -1
- package/dist/esm/components/dateTimePicker/index.d.ts +1 -1
- package/dist/esm/components/dateTimePicker/index.js +1 -1
- package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +1 -0
- package/dist/esm/components/form/form.d.ts +1 -1
- package/dist/esm/components/icon/icon.d.ts +6 -0
- package/dist/esm/components/icon/icon.js +6 -0
- package/dist/esm/components/icon/index.d.ts +1 -0
- package/dist/esm/components/icon/index.js +1 -0
- package/dist/esm/components/pinchable/pinchable.style.js +2 -2
- package/dist/esm/components/placeholder/placeholder.js +3 -3
- package/dist/esm/components/popper/popper.js +1 -1
- package/dist/esm/components/segmented/segmented.d.ts +3 -1
- package/dist/esm/components/segmented/segmented.js +3 -3
- package/dist/esm/components/segmented/segmented.style.d.ts +4 -1
- package/dist/esm/components/segmented/segmented.style.js +93 -90
- package/dist/esm/components/slider/slider.d.ts +0 -1
- package/dist/esm/components/tooltip/tooltip.style.js +1 -0
- package/dist/esm/components/waterfall/waterfall.style.js +2 -2
- package/dist/esm/components/waterfall/waterfallItem.js +1 -1
- package/dist/esm/extensions/documentViewer/documentViewer.js +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/utils/style.d.ts +2 -2
- package/dist/esm/utils/style.js +7 -3
- package/documentation/dist/assets/{index-DD484MoK.js → index-gntHdyKP.js} +1766 -1723
- package/documentation/dist/components/segmented.md +14 -13
- package/documentation/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/dateTimePicker/calendar.d.ts +0 -18
- package/dist/cjs/components/dateTimePicker/calendar.js +0 -29
- package/dist/cjs/components/dateTimePicker/calendar.style.d.ts +0 -15
- package/dist/cjs/components/dateTimePicker/calendarDates.d.ts +0 -2
- package/dist/cjs/components/dateTimePicker/calendarMonths.d.ts +0 -2
- package/dist/cjs/components/dateTimePicker/calendarMonths.js +0 -22
- package/dist/cjs/components/dateTimePicker/calendarYears.d.ts +0 -2
- package/dist/cjs/components/dateTimePicker/calendarYears.js +0 -29
- package/dist/esm/components/dateTimePicker/calendar.d.ts +0 -18
- package/dist/esm/components/dateTimePicker/calendar.js +0 -25
- package/dist/esm/components/dateTimePicker/calendar.style.d.ts +0 -15
- package/dist/esm/components/dateTimePicker/calendarDates.d.ts +0 -2
- package/dist/esm/components/dateTimePicker/calendarMonths.d.ts +0 -2
- package/dist/esm/components/dateTimePicker/calendarMonths.js +0 -19
- package/dist/esm/components/dateTimePicker/calendarYears.d.ts +0 -2
- package/dist/esm/components/dateTimePicker/calendarYears.js +0 -26
|
@@ -11,7 +11,7 @@ const utils_1 = require("../../utils");
|
|
|
11
11
|
const dateTimePicker_style_1 = require("./dateTimePicker.style");
|
|
12
12
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
13
13
|
const customParseFormat_1 = tslib_1.__importDefault(require("dayjs/plugin/customParseFormat"));
|
|
14
|
-
const calendar_1 = require("
|
|
14
|
+
const calendar_1 = require("../calendar");
|
|
15
15
|
const timer_1 = require("./timer");
|
|
16
16
|
const __1 = require("../..");
|
|
17
17
|
const faCalendar_1 = require("@fortawesome/free-regular-svg-icons/faCalendar");
|
|
@@ -81,11 +81,11 @@ exports.DateTimePicker = (0, react_1.memo)(({ inputProps, popperProps, min, max,
|
|
|
81
81
|
}
|
|
82
82
|
selectFn();
|
|
83
83
|
};
|
|
84
|
-
const focusHandler = (
|
|
84
|
+
const focusHandler = () => {
|
|
85
85
|
focused.current = true;
|
|
86
86
|
selectFn();
|
|
87
87
|
};
|
|
88
|
-
const blurHandler = (
|
|
88
|
+
const blurHandler = () => {
|
|
89
89
|
resetContinue();
|
|
90
90
|
focused.current = false;
|
|
91
91
|
_setInnerOpen(false);
|
|
@@ -207,21 +207,18 @@ exports.DateTimePicker = (0, react_1.memo)(({ inputProps, popperProps, min, max,
|
|
|
207
207
|
input.setSelectionRange(nextRange.start, nextRange.end);
|
|
208
208
|
};
|
|
209
209
|
const contextValue = (0, react_1.useMemo)(() => ({
|
|
210
|
-
min, max,
|
|
211
|
-
disabledHours, disabledMinutes, disabledSeconds
|
|
210
|
+
min, max, disabledHours, disabledMinutes, disabledSeconds
|
|
212
211
|
}), [
|
|
213
|
-
min, max,
|
|
214
|
-
disabledHours, disabledMinutes, disabledSeconds
|
|
212
|
+
min, max, disabledHours, disabledMinutes, disabledSeconds
|
|
215
213
|
]);
|
|
216
214
|
const showCalendar = /[YMD]/.test(format);
|
|
217
215
|
const showTimer = /[Hms]/.test(format);
|
|
218
216
|
const _dateVal = dateValue.current || (0, dayjs_1.default)();
|
|
219
|
-
return ((0, jsx_runtime_1.jsx)(popper_1.Popper, { css: dateTimePicker_style_1.datePickerPopperStyle, open: innerOpen.current, placement: "bottomLeft", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, content: (0, jsx_runtime_1.jsxs)(
|
|
220
|
-
(0, jsx_runtime_1.jsx)(calendar_1.Calendar, {
|
|
221
|
-
: format.includes('M') ? '
|
|
222
|
-
:
|
|
223
|
-
|
|
224
|
-
(0, jsx_runtime_1.jsx)(timer_1.Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value: _dateVal, onChange: setDateValue })] }), ...popperProps, onOpenChange: setInnerOpen, onPointerDown: e => {
|
|
217
|
+
return ((0, jsx_runtime_1.jsx)(popper_1.Popper, { css: dateTimePicker_style_1.datePickerPopperStyle, open: innerOpen.current, placement: "bottomLeft", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, content: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showCalendar &&
|
|
218
|
+
(0, jsx_runtime_1.jsx)(calendar_1.Calendar, { viewLevel: format.includes('D') ? 'date'
|
|
219
|
+
: format.includes('M') ? 'month'
|
|
220
|
+
: 'year', _defaultNull: !dateValue.current, value: _dateVal, onChange: setDateValue, min: min, max: max, disabledDates: disabledDates }), showTimer &&
|
|
221
|
+
(0, jsx_runtime_1.jsx)(DateTimePickerContext, { value: contextValue, children: (0, jsx_runtime_1.jsx)(timer_1.Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value: _dateVal, onChange: setDateValue }) })] }), ...popperProps, onOpenChange: setInnerOpen, onPointerDown: e => {
|
|
225
222
|
popperProps?.onPointerDown?.(e);
|
|
226
223
|
e.preventDefault();
|
|
227
224
|
}, children: (0, jsx_runtime_1.jsx)(inputBase_1.InputBase, { ...props, css: dateTimePicker_style_1.style, className: (0, utils_1.clsx)(dateTimePicker_style_1.classes.root, props.className), "data-focused": innerOpen.current, value: dateValue.current, onClear: clearHandler, onSelect: selectHandler, onFocus: focusHandler, onBlur: blurHandler, onKeyDown: keydownHandler, children: ({ ref, value, onChange, ...rest }) => (0, jsx_runtime_1.jsxs)("div", { className: dateTimePicker_style_1.classes.container, children: [(0, jsx_runtime_1.jsx)("input", { ...rest, ...inputProps, ref: (0, utils_1.cloneRef)(ref, inputProps?.ref, innerInputRef), className: (0, utils_1.clsx)(dateTimePicker_style_1.classes.input, inputProps?.className) }), (0, jsx_runtime_1.jsx)("div", { className: dateTimePicker_style_1.classes.dateTimeIcon, children: showTimer && !showCalendar
|
|
@@ -2,16 +2,16 @@ export declare const classes: {
|
|
|
2
2
|
input: string;
|
|
3
3
|
container: string;
|
|
4
4
|
calendar: string;
|
|
5
|
+
dateItem: string;
|
|
6
|
+
inputGroup: string;
|
|
7
|
+
inputUnit: string;
|
|
8
|
+
dateTimeIcon: string;
|
|
5
9
|
calendarHead: string;
|
|
6
10
|
calendarHeadSide: string;
|
|
7
11
|
calendarHeadControl: string;
|
|
8
12
|
calendarHeadCenter: string;
|
|
9
13
|
calendarHeadButton: string;
|
|
10
14
|
calendarBody: string;
|
|
11
|
-
dateItem: string;
|
|
12
|
-
inputGroup: string;
|
|
13
|
-
inputUnit: string;
|
|
14
|
-
dateTimeIcon: string;
|
|
15
15
|
calendarDays: string;
|
|
16
16
|
} & {
|
|
17
17
|
root: string;
|
|
@@ -4,7 +4,7 @@ exports.datePickerPopperStyle = exports.style = exports.classes = void 0;
|
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const input_style_1 = require("../input/input.style");
|
|
7
|
-
const calendar_style_1 = require("
|
|
7
|
+
const calendar_style_1 = require("../calendar/calendar.style");
|
|
8
8
|
const timer_style_1 = require("./timer.style");
|
|
9
9
|
const popper_style_1 = require("../popper/popper.style");
|
|
10
10
|
exports.classes = (0, utils_1.defineInnerClasses)('date-time-picker', [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("
|
|
4
|
+
tslib_1.__exportStar(require("../calendar/calendar"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./dateTimePicker"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./timer"), exports);
|
|
@@ -15,6 +15,7 @@ export interface DateTimeRangePickerProps extends DatePickerSharedProps, Omit<Di
|
|
|
15
15
|
onOpenPickerChange?(openPicker?: 'start' | 'end' | 'closed'): void;
|
|
16
16
|
autoClose?: boolean;
|
|
17
17
|
separator?: ReactNode;
|
|
18
|
+
disabledDates?: (date: Dayjs) => any;
|
|
18
19
|
variant?: 'outlined' | 'underlined' | 'plain';
|
|
19
20
|
size?: Size;
|
|
20
21
|
color?: ColorPropsValue;
|
|
@@ -49,7 +49,7 @@ export type FormRef<V extends FormValue = FormValue> = {
|
|
|
49
49
|
isFieldTouched(field: FieldPath): boolean;
|
|
50
50
|
};
|
|
51
51
|
export declare const Form: {
|
|
52
|
-
<V extends FormValue, C extends ElementType>(props: FormProps<V, C>): ReactElement;
|
|
52
|
+
<V extends FormValue, C extends ElementType = "form">(props: FormProps<V, C>): ReactElement;
|
|
53
53
|
Item: typeof FormItem;
|
|
54
54
|
Relatable: typeof FormRelatable;
|
|
55
55
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
2
|
+
import { ColorPropsValue } from '../../types';
|
|
3
|
+
export interface IconProps extends Omit<FontAwesomeIconProps, 'color'> {
|
|
4
|
+
color?: ColorPropsValue;
|
|
5
|
+
}
|
|
6
|
+
export declare function Icon({ color, ...props }: IconProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = Icon;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
function Icon({ color, ...props }) {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { ...props, color: (0, utils_1.useColor)(color) });
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon';
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.style = exports.classes = void 0;
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
5
|
const react_1 = require("@emotion/react");
|
|
6
|
-
exports.classes = (0, utils_1.
|
|
6
|
+
exports.classes = (0, utils_1.defineInnerClasses)('pinchable', [
|
|
7
7
|
'content'
|
|
8
8
|
]);
|
|
9
9
|
exports.style = (0, utils_1.defineCss)(({ easing }) => (0, react_1.css) `
|
|
@@ -15,15 +15,15 @@ exports.imagePreset = {
|
|
|
15
15
|
info: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG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huF5zgIAsARgm6H+EZLHinIAAM/VAUCe6/3hGn0zQeo5WmD0/QdhW6UB5LjeH6750csicp/B+PuLNn7UlhWS11UZQNb1/rCHHo6rLwiCe0meTFHeN9Edgtd0ZEVXnE6k+P5HlQZQtpJ8K6H3HhORPTHlTCS99ioiN3sAWO14dQedwGjT62e5MaMoJijvqAeAf9Pdswk8/8gAUOcNZZ5tt9tXOp+CSB42ADhl6sBjBhN/GSDsdB4ADNebROTtDP3LJwa4U04DILmJ5IrBS8cylP+CoexPnQaglNpqytN6XShDHWOGCDjuNAAR2VHk2dFoPhMH+MfG7wdIzAW9IAhGTRFgeNZQrJLcY2jfnAv7AdsNRjptALh3UAB658wA+Ejj9wOCIDDdhFkwGOlQhgj4wtC+F11Yjp4w1Pm+4fsrOioH+B1Pm9qmlNpSuQe35g0AwBtx9YmI0VAA5lL2BTtJ/mIo90yn07mkco8uLmA/oG2oT6/v/JygnM+T7CWLyEMkv0/SrlZFH96d634AgFMJTkAcSFjeyahjHe1h+B161pwygscLBxC9psrqfgCApwx1jiilfkpR5hmSX+mjKnq5IerIB93AH3f6BQ6IVCmlIcUunhWoxULodrs32jYwkulLlgBo3Vv0i9vurICBhxLoTCMhkLy0DqkIqyOjqRwf3pdWJwp9n0xdICilntEjqMZFQrfbvawu6UhEtgJ4Rz8I3AKEBwuDMD8/f2G73b5eROoSDfcDeF3PiA3bjPrm/YzeZwDwZEYAeqZ8VavoIaquxObrbJEehr4joGe7T+gjKkopvadwu1LqWpIXrP19AB7PCOH5QgG4IMgGoWu7/a5D+M52252GUMqmvUuClBB0R267zc5CAPBrKfsFLgrJR6NbM/2Mr19AdIvtdjZaSN5B8usextcnezfabp8TEobh+dHLrvXVqM2dTuea9f/0D/kpCFxyBQcLAAAAAElFTkSuQmCC'
|
|
17
17
|
};
|
|
18
|
-
exports.Placeholder = (0, react_1.memo)(({ slots
|
|
18
|
+
exports.Placeholder = (0, react_1.memo)(({ slots, slotProps, status = 'empty', image, title = status === 'warning' ? '警告'
|
|
19
19
|
: status === 'error' ? '出错啦'
|
|
20
20
|
: status === 'success' ? '成功'
|
|
21
21
|
: void 0, description = status === 'empty' ? '暂无数据'
|
|
22
22
|
: status === 'searching' ? '搜索中...'
|
|
23
23
|
: void 0, extra, ...props }) => {
|
|
24
24
|
const { mode } = (0, theme_1.useTheme)();
|
|
25
|
-
const { title: Title = 'div', description: Description = 'div', extra: Extra = 'div' } = slots;
|
|
26
|
-
const { title: titleProps, description: descriptionProps, extra: extraProps } = slotProps;
|
|
25
|
+
const { title: Title = 'div', description: Description = 'div', extra: Extra = 'div' } = slots || {};
|
|
26
|
+
const { title: titleProps, description: descriptionProps, extra: extraProps } = slotProps || {};
|
|
27
27
|
return ((0, jsx_runtime_1.jsxs)("div", { ...props, css: placeholder_style_1.style, className: (0, utils_1.clsx)(placeholder_style_1.classes.root, props.className), children: [image ??
|
|
28
28
|
(0, jsx_runtime_1.jsx)("img", { className: placeholder_style_1.classes.image, src: status === 'empty'
|
|
29
29
|
? (mode === 'light' ? exports.imagePreset.emptyLight : exports.imagePreset.emptyDark)
|
|
@@ -484,7 +484,7 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, cont
|
|
|
484
484
|
onChildrenOpenChange,
|
|
485
485
|
beforeOpenCallbacks: beforeOpenCallbacks.current
|
|
486
486
|
}), [innerOpen.current, autoClose]);
|
|
487
|
-
const childRef = (0, react_1.useCallback)((0, utils_1.cloneRef)(children?.props.ref, anchorRef, ref), [children?.props.ref]);
|
|
487
|
+
const childRef = (0, react_1.useCallback)((0, utils_1.cloneRef)(children?.props.ref, anchorRef, ref), [children?.props.ref, ref]);
|
|
488
488
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, react_1.isValidElement)(children)
|
|
489
489
|
? (0, react_1.cloneElement)(children, { ref: childRef })
|
|
490
490
|
: children, renderedOnce.current && (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(clickAway_1.ClickAway, { disabled: !clickable && !enterable && !contextMenuable,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { DivProps, Id, Obj, Size } from '../../types';
|
|
2
|
+
import { ColorPropsValue, DivProps, Id, Obj, Size } from '../../types';
|
|
3
3
|
import { SegmentedOption, SegmentedOptionProps } from './SegmentedOption';
|
|
4
4
|
export type ISegmentedOption = SegmentedOptionProps & Obj;
|
|
5
5
|
export interface SegmentedProps<O extends ISegmentedOption, V extends Id = Id> extends Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
@@ -9,6 +9,8 @@ export interface SegmentedProps<O extends ISegmentedOption, V extends Id = Id> e
|
|
|
9
9
|
labelKey?: keyof O;
|
|
10
10
|
primaryKey?: keyof O;
|
|
11
11
|
fullWidth?: boolean;
|
|
12
|
+
/** 指示器的颜色,默认为`background.content` */
|
|
13
|
+
indicatorColor?: ColorPropsValue;
|
|
12
14
|
defaultValue?: V;
|
|
13
15
|
value?: V;
|
|
14
16
|
onChange?(value: V): void;
|
|
@@ -7,7 +7,7 @@ const segmented_style_1 = require("./segmented.style");
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const SegmentedOption_1 = require("./SegmentedOption");
|
|
9
9
|
const theme_1 = require("../theme");
|
|
10
|
-
exports.Segmented = (0, react_1.memo)(({ options, orientation = 'horizontal', size, labelKey = 'label', primaryKey = 'value', fullWidth, defaultValue, value, onChange, readOnly, disabled, ...props }) => {
|
|
10
|
+
exports.Segmented = (0, react_1.memo)(({ options, orientation = 'horizontal', size, labelKey = 'label', primaryKey = 'value', fullWidth, indicatorColor = 'background.content', defaultValue, value, onChange, readOnly, disabled, ...props }) => {
|
|
11
11
|
const theme = (0, theme_1.useTheme)();
|
|
12
12
|
size ??= theme.size;
|
|
13
13
|
const [animating, setAnimating] = (0, react_1.useState)(false);
|
|
@@ -77,6 +77,6 @@ exports.Segmented = (0, react_1.memo)(({ options, orientation = 'horizontal', si
|
|
|
77
77
|
return c;
|
|
78
78
|
});
|
|
79
79
|
};
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ...props, css: segmented_style_1.
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ...props, css: (0, segmented_style_1.useStyle)({ indicatorColor }), className: (0, utils_1.clsx)(segmented_style_1.classes.root, props.className), "data-full-width": fullWidth, "data-animating": animating, "data-orientation": orientation, "data-size": size, "data-read-only": readOnly, "data-disabled": disabled, children: [(0, jsx_runtime_1.jsx)("div", { className: segmented_style_1.classes.indicator, onTransitionEnd: () => setAnimating(false), style: indicatorRect.current }), renderOptions()] }));
|
|
81
81
|
});
|
|
82
82
|
exports.Segmented.Option = SegmentedOption_1.SegmentedOption;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ColorPropsValue } from '../../types';
|
|
1
2
|
export declare const classes: {
|
|
2
3
|
label: string;
|
|
3
4
|
option: string;
|
|
@@ -7,4 +8,6 @@ export declare const classes: {
|
|
|
7
8
|
} & {
|
|
8
9
|
root: string;
|
|
9
10
|
};
|
|
10
|
-
export declare
|
|
11
|
+
export declare function useStyle({ indicatorColor }: {
|
|
12
|
+
indicatorColor: ColorPropsValue;
|
|
13
|
+
}): import("@emotion/react").SerializedStyles;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.classes = void 0;
|
|
4
|
+
exports.useStyle = useStyle;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const react_1 = require("@emotion/react");
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
@@ -12,115 +13,118 @@ exports.classes = (0, utils_1.defineInnerClasses)('segmented', [
|
|
|
12
13
|
'suffix',
|
|
13
14
|
'indicator'
|
|
14
15
|
]);
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
position: relative;
|
|
25
|
-
|
|
26
|
-
.${exports.classes.option} {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
gap: 6px;
|
|
31
|
-
padding: 4px 12px;
|
|
16
|
+
function useStyle({ indicatorColor }) {
|
|
17
|
+
const indicatorColorValue = (0, utils_1.useColor)(indicatorColor);
|
|
18
|
+
return (0, utils_1.useCss)(({ mode, background, borderRadius, easing, text }) => {
|
|
19
|
+
const bgColor = (0, color_1.default)(background.body);
|
|
20
|
+
const hoverBg = bgColor.darken(mode === 'light' ? .04 : .12).hex();
|
|
21
|
+
const activeBg = bgColor.darken(mode === 'light' ? .08 : .24).hex();
|
|
22
|
+
return (0, react_1.css) `
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
background-color: ${background.body};
|
|
32
25
|
border-radius: ${borderRadius}px;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
z-index: 1;
|
|
37
|
-
transition: background-color .3s ${easing.easeOut};
|
|
38
|
-
-webkit-tap-highlight-color: transparent;
|
|
39
|
-
|
|
40
|
-
&[data-active=true] {
|
|
41
|
-
transition: background-color 0s;
|
|
42
|
-
}
|
|
26
|
+
padding: 2px;
|
|
27
|
+
position: relative;
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
.${exports.classes.option} {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
gap: 6px;
|
|
34
|
+
padding: 4px 12px;
|
|
35
|
+
border-radius: ${borderRadius}px;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
z-index: 1;
|
|
40
|
+
transition: background-color .3s ${easing.easeOut};
|
|
41
|
+
-webkit-tap-highlight-color: transparent;
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
43
|
+
&[data-active=true] {
|
|
44
|
+
transition: background-color 0s;
|
|
45
|
+
}
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
47
|
+
&[data-orientation=vertical] {
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
}
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
&[data-disabled=true] {
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
color: ${text.disabled};
|
|
54
|
+
}
|
|
63
55
|
}
|
|
64
|
-
}
|
|
65
56
|
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
&[data-size=small] {
|
|
58
|
+
.${exports.classes.option} {
|
|
59
|
+
padding: 3px 12px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
&[data-size=large] {
|
|
64
|
+
.${exports.classes.option} {
|
|
65
|
+
padding: 11px 12px;
|
|
66
|
+
}
|
|
71
67
|
}
|
|
72
|
-
}
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
69
|
+
&[data-full-width=true] {
|
|
70
|
+
display: flex;
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
position: absolute;
|
|
83
|
-
transition: all .3s ${easing.bounce};
|
|
84
|
-
}
|
|
72
|
+
.${exports.classes.option} {
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
85
76
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
transition: background-color 0s;
|
|
77
|
+
&[data-orientation=vertical] {
|
|
78
|
+
flex-direction: column;
|
|
89
79
|
}
|
|
90
|
-
}
|
|
91
80
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
background-color: ${
|
|
81
|
+
.${exports.classes.indicator} {
|
|
82
|
+
border-radius: ${borderRadius}px;
|
|
83
|
+
background-color: ${indicatorColorValue};
|
|
95
84
|
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
|
|
85
|
+
position: absolute;
|
|
86
|
+
transition: all .3s ${easing.bounce};
|
|
96
87
|
}
|
|
97
|
-
}
|
|
98
88
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
&[data-animating=true] {
|
|
90
|
+
.${exports.classes.option} {
|
|
91
|
+
transition: background-color 0s;
|
|
92
|
+
}
|
|
102
93
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
&:not([data-active=true]):hover {
|
|
110
|
-
background-color: ${hoverBg};
|
|
94
|
+
|
|
95
|
+
&:not([data-animating=true]) {
|
|
96
|
+
.${exports.classes.option}[data-active=true] {
|
|
97
|
+
background-color: ${indicatorColorValue};
|
|
98
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
|
|
111
99
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:not(:has([data-active=true])) {
|
|
103
|
+
.${exports.classes.indicator} {
|
|
104
|
+
display: none;
|
|
116
105
|
}
|
|
117
106
|
}
|
|
118
|
-
}
|
|
119
107
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
&:not([data-read-only=true]):not([data-disabled=true]) {
|
|
109
|
+
.${exports.classes.option}:not([data-disabled=true]) {
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
|
|
112
|
+
&:not([data-active=true]):hover {
|
|
113
|
+
background-color: ${hoverBg};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:not([data-active=true]):active {
|
|
117
|
+
transition: background-color 0s;
|
|
118
|
+
background-color: ${activeBg};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&[data-disabled=true] {
|
|
124
|
+
.${exports.classes.option} {
|
|
125
|
+
cursor: not-allowed;
|
|
126
|
+
}
|
|
123
127
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
128
|
+
`;
|
|
129
|
+
}, [indicatorColorValue]);
|
|
130
|
+
}
|
|
@@ -15,6 +15,7 @@ function useStyle({ color }) {
|
|
|
15
15
|
let colorValue = (0, utils_1.useColor)(color);
|
|
16
16
|
colorValue = (0, color_1.default)(colorValue).alpha(.7).string();
|
|
17
17
|
return (0, utils_1.useCss)(({ spacing, borderRadius, boxShadow }) => (0, react_1.css) `
|
|
18
|
+
pointer-events: none;
|
|
18
19
|
z-index: ${theme_1.zIndex.tooltip};
|
|
19
20
|
|
|
20
21
|
.${exports.classes.title} {
|
|
@@ -4,7 +4,7 @@ exports.classes = void 0;
|
|
|
4
4
|
exports.useStyle = useStyle;
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const react_1 = require("@emotion/react");
|
|
7
|
-
exports.classes = (0, utils_1.
|
|
7
|
+
exports.classes = (0, utils_1.defineInnerClasses)('waterfall', [
|
|
8
8
|
'item'
|
|
9
9
|
]);
|
|
10
10
|
function useStyle({ columnCount, columnGap, rowGap }) {
|
|
@@ -24,7 +24,7 @@ const WaterfallItem = ({ ref, onLoad, child }) => {
|
|
|
24
24
|
}
|
|
25
25
|
})).then(() => onLoad());
|
|
26
26
|
});
|
|
27
|
-
const clonedRef = (0, react_1.useCallback)((0, utils_1.cloneRef)(child.props.ref, innerRef, ref), [child.props.ref]);
|
|
27
|
+
const clonedRef = (0, react_1.useCallback)((0, utils_1.cloneRef)(child.props.ref, innerRef, ref), [child.props.ref, ref]);
|
|
28
28
|
return (0, react_1.cloneElement)(child, {
|
|
29
29
|
ref: clonedRef,
|
|
30
30
|
className: (0, utils_1.clsx)(waterfall_style_1.classes.item, child.props.className),
|
|
@@ -31,7 +31,7 @@ exports.DocumentViewer = (0, react_1.memo)(({ src, filename, onError, type, exte
|
|
|
31
31
|
return ext && mime_1.default.getType(ext);
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
|
-
}, [src, type, extension]);
|
|
34
|
+
}, [src, type, extension, filename]);
|
|
35
35
|
const downloadHandler = () => {
|
|
36
36
|
if (src) {
|
|
37
37
|
const a = document.createElement('a');
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './utils';
|
|
2
|
-
export { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
3
2
|
export * from './components/accordion';
|
|
4
3
|
export * from './components/actionSheet';
|
|
5
4
|
export * from './components/alert';
|
|
@@ -15,6 +14,7 @@ export * from './components/breadcrumb';
|
|
|
15
14
|
export * from './components/bubble';
|
|
16
15
|
export * from './components/bubbleConfirm';
|
|
17
16
|
export * from './components/button';
|
|
17
|
+
export * from './components/calendar';
|
|
18
18
|
export * from './components/card';
|
|
19
19
|
export * from './components/cascade';
|
|
20
20
|
export * from './components/checkbox';
|
|
@@ -40,6 +40,7 @@ export * from './components/formDialog';
|
|
|
40
40
|
export * from './components/gallery';
|
|
41
41
|
export * from './components/grid';
|
|
42
42
|
export * from './components/highlight';
|
|
43
|
+
export * from './components/icon';
|
|
43
44
|
export * from './components/image';
|
|
44
45
|
export * from './components/input';
|
|
45
46
|
export * from './components/inputBase';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Icon = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
4
|
tslib_1.__exportStar(require("./utils"), exports);
|
|
6
|
-
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
7
|
-
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return react_fontawesome_1.FontAwesomeIcon; } });
|
|
8
5
|
tslib_1.__exportStar(require("./components/accordion"), exports);
|
|
9
6
|
tslib_1.__exportStar(require("./components/actionSheet"), exports);
|
|
10
7
|
tslib_1.__exportStar(require("./components/alert"), exports);
|
|
@@ -20,6 +17,7 @@ tslib_1.__exportStar(require("./components/breadcrumb"), exports);
|
|
|
20
17
|
tslib_1.__exportStar(require("./components/bubble"), exports);
|
|
21
18
|
tslib_1.__exportStar(require("./components/bubbleConfirm"), exports);
|
|
22
19
|
tslib_1.__exportStar(require("./components/button"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./components/calendar"), exports);
|
|
23
21
|
tslib_1.__exportStar(require("./components/card"), exports);
|
|
24
22
|
tslib_1.__exportStar(require("./components/cascade"), exports);
|
|
25
23
|
tslib_1.__exportStar(require("./components/checkbox"), exports);
|
|
@@ -45,6 +43,7 @@ tslib_1.__exportStar(require("./components/formDialog"), exports);
|
|
|
45
43
|
tslib_1.__exportStar(require("./components/gallery"), exports);
|
|
46
44
|
tslib_1.__exportStar(require("./components/grid"), exports);
|
|
47
45
|
tslib_1.__exportStar(require("./components/highlight"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./components/icon"), exports);
|
|
48
47
|
tslib_1.__exportStar(require("./components/image"), exports);
|
|
49
48
|
tslib_1.__exportStar(require("./components/input"), exports);
|
|
50
49
|
tslib_1.__exportStar(require("./components/inputBase"), exports);
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -51,12 +51,12 @@ export declare function colorTransfer(colorPropsValue: ColorPropsValue, theme: T
|
|
|
51
51
|
* 将useCss()与colorTransfer()方法结合封装
|
|
52
52
|
* @param colorPropsValue
|
|
53
53
|
*/
|
|
54
|
-
export declare function useColor(colorPropsValue: ColorPropsValue): string;
|
|
54
|
+
export declare function useColor(colorPropsValue: ColorPropsValue | undefined): string | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* 点击的波纹效果
|
|
57
57
|
* @param colorPropsValue
|
|
58
58
|
*/
|
|
59
|
-
export declare function
|
|
59
|
+
export declare function useTouchSpread(colorPropsValue: ColorPropsValue): (element: Animatable) => void;
|
|
60
60
|
/**
|
|
61
61
|
* 生成响应式样式,与{@link responsiveStyles}的区别在于,本方法会遍历{@link Theme}中的所有`breakpoints`,触发回调函数
|
|
62
62
|
* @param breakpoints 传入{@link Theme}中的断点,或自定义断点
|
package/dist/cjs/utils/style.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.defineCss = defineCss;
|
|
|
7
7
|
exports.useCss = useCss;
|
|
8
8
|
exports.colorTransfer = colorTransfer;
|
|
9
9
|
exports.useColor = useColor;
|
|
10
|
-
exports.
|
|
10
|
+
exports.useTouchSpread = useTouchSpread;
|
|
11
11
|
exports.responsiveVariables = responsiveVariables;
|
|
12
12
|
exports.responsiveStyles = responsiveStyles;
|
|
13
13
|
exports.toResponsiveValue = toResponsiveValue;
|
|
@@ -71,7 +71,7 @@ function useCss(callback, deps) {
|
|
|
71
71
|
* @param theme
|
|
72
72
|
*/
|
|
73
73
|
function colorTransfer(colorPropsValue, theme) {
|
|
74
|
-
const { colors, text } = theme;
|
|
74
|
+
const { colors, text, background } = theme;
|
|
75
75
|
if (colorPropsValue in colors) {
|
|
76
76
|
return colors[colorPropsValue].main;
|
|
77
77
|
}
|
|
@@ -84,6 +84,10 @@ function colorTransfer(colorPropsValue, theme) {
|
|
|
84
84
|
return text[member];
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
if (colorPropsValue.startsWith('background')) {
|
|
88
|
+
const [, member] = colorPropsValue.split('.');
|
|
89
|
+
return background[member];
|
|
90
|
+
}
|
|
87
91
|
return colorPropsValue;
|
|
88
92
|
}
|
|
89
93
|
/**
|
|
@@ -92,14 +96,14 @@ function colorTransfer(colorPropsValue, theme) {
|
|
|
92
96
|
*/
|
|
93
97
|
function useColor(colorPropsValue) {
|
|
94
98
|
return useCss(theme => {
|
|
95
|
-
return colorTransfer(colorPropsValue, theme);
|
|
99
|
+
return colorPropsValue && colorTransfer(colorPropsValue, theme);
|
|
96
100
|
}, [colorPropsValue]);
|
|
97
101
|
}
|
|
98
102
|
/**
|
|
99
103
|
* 点击的波纹效果
|
|
100
104
|
* @param colorPropsValue
|
|
101
105
|
*/
|
|
102
|
-
function
|
|
106
|
+
function useTouchSpread(colorPropsValue) {
|
|
103
107
|
const theme = (0, theme_1.useTheme)();
|
|
104
108
|
const outlineColor = (0, react_1.useMemo)(() => {
|
|
105
109
|
return (0, color_1.default)(colorTransfer(colorPropsValue, theme)).alpha(.6).string();
|