@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createContext, memo, useContext, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { Popper } from '../popper';
|
|
4
4
|
import { InputBase } from '../inputBase';
|
|
@@ -6,7 +6,7 @@ import { clsx, cloneRef, useControlled } from '../../utils';
|
|
|
6
6
|
import { classes, datePickerPopperStyle, style } from './dateTimePicker.style';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
9
|
-
import { Calendar } from '
|
|
9
|
+
import { Calendar } from '../calendar';
|
|
10
10
|
import { Timer } from './timer';
|
|
11
11
|
import { Icon } from '../..';
|
|
12
12
|
import { faCalendar } from '@fortawesome/free-regular-svg-icons/faCalendar';
|
|
@@ -76,11 +76,11 @@ export const DateTimePicker = memo(({ inputProps, popperProps, min, max, disable
|
|
|
76
76
|
}
|
|
77
77
|
selectFn();
|
|
78
78
|
};
|
|
79
|
-
const focusHandler = (
|
|
79
|
+
const focusHandler = () => {
|
|
80
80
|
focused.current = true;
|
|
81
81
|
selectFn();
|
|
82
82
|
};
|
|
83
|
-
const blurHandler = (
|
|
83
|
+
const blurHandler = () => {
|
|
84
84
|
resetContinue();
|
|
85
85
|
focused.current = false;
|
|
86
86
|
_setInnerOpen(false);
|
|
@@ -202,21 +202,18 @@ export const DateTimePicker = memo(({ inputProps, popperProps, min, max, disable
|
|
|
202
202
|
input.setSelectionRange(nextRange.start, nextRange.end);
|
|
203
203
|
};
|
|
204
204
|
const contextValue = useMemo(() => ({
|
|
205
|
-
min, max,
|
|
206
|
-
disabledHours, disabledMinutes, disabledSeconds
|
|
205
|
+
min, max, disabledHours, disabledMinutes, disabledSeconds
|
|
207
206
|
}), [
|
|
208
|
-
min, max,
|
|
209
|
-
disabledHours, disabledMinutes, disabledSeconds
|
|
207
|
+
min, max, disabledHours, disabledMinutes, disabledSeconds
|
|
210
208
|
]);
|
|
211
209
|
const showCalendar = /[YMD]/.test(format);
|
|
212
210
|
const showTimer = /[Hms]/.test(format);
|
|
213
211
|
const _dateVal = dateValue.current || dayjs();
|
|
214
|
-
return (_jsx(Popper, { css: datePickerPopperStyle, open: innerOpen.current, placement: "bottomLeft", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, content: _jsxs(
|
|
215
|
-
_jsx(Calendar, {
|
|
216
|
-
: format.includes('M') ? '
|
|
217
|
-
:
|
|
218
|
-
|
|
219
|
-
_jsx(Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value: _dateVal, onChange: setDateValue })] }), ...popperProps, onOpenChange: setInnerOpen, onPointerDown: e => {
|
|
212
|
+
return (_jsx(Popper, { css: datePickerPopperStyle, open: innerOpen.current, placement: "bottomLeft", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, content: _jsxs(_Fragment, { children: [showCalendar &&
|
|
213
|
+
_jsx(Calendar, { viewLevel: format.includes('D') ? 'date'
|
|
214
|
+
: format.includes('M') ? 'month'
|
|
215
|
+
: 'year', _defaultNull: !dateValue.current, value: _dateVal, onChange: setDateValue, min: min, max: max, disabledDates: disabledDates }), showTimer &&
|
|
216
|
+
_jsx(DateTimePickerContext, { value: contextValue, children: _jsx(Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value: _dateVal, onChange: setDateValue }) })] }), ...popperProps, onOpenChange: setInnerOpen, onPointerDown: e => {
|
|
220
217
|
popperProps?.onPointerDown?.(e);
|
|
221
218
|
e.preventDefault();
|
|
222
219
|
}, children: _jsx(InputBase, { ...props, css: style, className: clsx(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 }) => _jsxs("div", { className: classes.container, children: [_jsx("input", { ...rest, ...inputProps, ref: cloneRef(ref, inputProps?.ref, innerInputRef), className: clsx(classes.input, inputProps?.className) }), _jsx("div", { className: 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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { defineInnerClasses, defineCss } from '../../utils';
|
|
3
3
|
import { commonNativeInputStyle } from '../input/input.style';
|
|
4
|
-
import { classes as calendarClasses } from '
|
|
4
|
+
import { classes as calendarClasses } from '../calendar/calendar.style';
|
|
5
5
|
import { classes as timerClasses } from './timer.style';
|
|
6
6
|
import { popperStyleCallback } from '../popper/popper.style';
|
|
7
7
|
export const classes = defineInnerClasses('date-time-picker', [
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { useColor } from '../../utils';
|
|
4
|
+
export function Icon({ color, ...props }) {
|
|
5
|
+
return _jsx(FontAwesomeIcon, { ...props, color: useColor(color) });
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineInnerClasses, defineCss } from '../../utils';
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
export const classes =
|
|
3
|
+
export const classes = defineInnerClasses('pinchable', [
|
|
4
4
|
'content'
|
|
5
5
|
]);
|
|
6
6
|
export const style = defineCss(({ easing }) => css `
|
|
@@ -12,15 +12,15 @@ export const imagePreset = {
|
|
|
12
12
|
info: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAF7klEQVR4nO1dS28cRRAeY0GACA5IeYADp9iEEyIPEIcEBdmSY3vt6W5GSYTgyMVckj/g38HJCUg5jKd7RhayxD/AOXHgkt3p6dl1UA4cIzC3QbV+YByv7Xh6pqtn+5NKsrxjb3d9/aiuqq7xPAcHBwcHBwcHBwcHB0T4Ylm9Tnj+ri+eTrAkvUp4+iUT6haNZYvGOaNRdrsv8HMsW/3PEnUTnvWFnAh+Vuen19qnTPfDGgRhMUp4+4Ifp1dAmWwlvcuEKicr6V1fqFuE55eDsDcG32G6n8hQjARh+wzhvWuE51+VVvgRAt/hC/V5ED4Z84pixBtWBGE4SqN0nMbdVtVKHyT9pSxKx5eK4hVvWABLAF1Vl2isfFOKf5EI5dNIXWr88gTTnvBs3rTC2QDxRbawEHfe95qGqV+enaZJ74ZpBbPjzogouzG3+sebXhMAVg2YiaaVyk6wWQer8gPPVsDGtm1OGlcmK0VE75p1mzQcfgjvTplWHtMkNOlOBmHxmmcDgrD3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fkpR5hmSX+mjKnq5IerIB93AH3f6BQ6IVCmlIcUunhWoxULodrs32jYwkulLlgBo3Vv0i9vurICBhxLoTCMhkLy0DqkIqyOjqRwf3pdWJwp9n0xdICilntEjqMZFQrfbvawu6UhEtgJ4Rz8I3AKEBwuDMD8/f2G73b5eROoSDfcDeF3PiA3bjPrm/YzeZwDwZEYAeqZ8VavoIaquxObrbJEehr4joGe7T+gjKkopvadwu1LqWpIXrP19AB7PCOH5QgG4IMgGoWu7/a5D+M52252GUMqmvUuClBB0R267zc5CAPBrKfsFLgrJR6NbM/2Mr19AdIvtdjZaSN5B8usextcnezfabp8TEobh+dHLrvXVqM2dTuea9f/0D/kpCFxyBQcLAAAAAElFTkSuQmCC'
|
|
14
14
|
};
|
|
15
|
-
export const Placeholder = memo(({ slots
|
|
15
|
+
export const Placeholder = memo(({ slots, slotProps, status = 'empty', image, title = status === 'warning' ? '警告'
|
|
16
16
|
: status === 'error' ? '出错啦'
|
|
17
17
|
: status === 'success' ? '成功'
|
|
18
18
|
: void 0, description = status === 'empty' ? '暂无数据'
|
|
19
19
|
: status === 'searching' ? '搜索中...'
|
|
20
20
|
: void 0, extra, ...props }) => {
|
|
21
21
|
const { mode } = useTheme();
|
|
22
|
-
const { title: Title = 'div', description: Description = 'div', extra: Extra = 'div' } = slots;
|
|
23
|
-
const { title: titleProps, description: descriptionProps, extra: extraProps } = slotProps;
|
|
22
|
+
const { title: Title = 'div', description: Description = 'div', extra: Extra = 'div' } = slots || {};
|
|
23
|
+
const { title: titleProps, description: descriptionProps, extra: extraProps } = slotProps || {};
|
|
24
24
|
return (_jsxs("div", { ...props, css: style, className: clsx(classes.root, props.className), children: [image ??
|
|
25
25
|
_jsx("img", { className: classes.image, src: status === 'empty'
|
|
26
26
|
? (mode === 'light' ? imagePreset.emptyLight : imagePreset.emptyDark)
|
|
@@ -481,7 +481,7 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
|
|
|
481
481
|
onChildrenOpenChange,
|
|
482
482
|
beforeOpenCallbacks: beforeOpenCallbacks.current
|
|
483
483
|
}), [innerOpen.current, autoClose]);
|
|
484
|
-
const childRef = useCallback(cloneRef(children?.props.ref, anchorRef, ref), [children?.props.ref]);
|
|
484
|
+
const childRef = useCallback(cloneRef(children?.props.ref, anchorRef, ref), [children?.props.ref, ref]);
|
|
485
485
|
return (_jsxs(_Fragment, { children: [isValidElement(children)
|
|
486
486
|
? cloneElement(children, { ref: childRef })
|
|
487
487
|
: children, renderedOnce.current && createPortal(_jsx(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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, isValidElement, memo, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { classes,
|
|
3
|
+
import { classes, useStyle } from './segmented.style';
|
|
4
4
|
import { clsx, cloneRef, isUnset, useControlled, useDerivedState } from '../../utils';
|
|
5
5
|
import { SegmentedOption } from './SegmentedOption';
|
|
6
6
|
import { useTheme } from '../theme';
|
|
7
|
-
export const Segmented = memo(({ options, orientation = 'horizontal', size, labelKey = 'label', primaryKey = 'value', fullWidth, defaultValue, value, onChange, readOnly, disabled, ...props }) => {
|
|
7
|
+
export const Segmented = memo(({ options, orientation = 'horizontal', size, labelKey = 'label', primaryKey = 'value', fullWidth, indicatorColor = 'background.content', defaultValue, value, onChange, readOnly, disabled, ...props }) => {
|
|
8
8
|
const theme = useTheme();
|
|
9
9
|
size ??= theme.size;
|
|
10
10
|
const [animating, setAnimating] = useState(false);
|
|
@@ -74,6 +74,6 @@ export const Segmented = memo(({ options, orientation = 'horizontal', size, labe
|
|
|
74
74
|
return c;
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
return (_jsxs("div", { ...props, css:
|
|
77
|
+
return (_jsxs("div", { ...props, css: useStyle({ indicatorColor }), className: clsx(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: [_jsx("div", { className: classes.indicator, onTransitionEnd: () => setAnimating(false), style: indicatorRect.current }), renderOptions()] }));
|
|
78
78
|
});
|
|
79
79
|
Segmented.Option = 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,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { defineInnerClasses,
|
|
2
|
+
import { defineInnerClasses, useColor, useCss } from '../../utils';
|
|
3
3
|
import Color from 'color';
|
|
4
4
|
export const classes = defineInnerClasses('segmented', [
|
|
5
5
|
'option',
|
|
@@ -8,115 +8,118 @@ export const classes = defineInnerClasses('segmented', [
|
|
|
8
8
|
'suffix',
|
|
9
9
|
'indicator'
|
|
10
10
|
]);
|
|
11
|
-
export
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
position: relative;
|
|
21
|
-
|
|
22
|
-
.${classes.option} {
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
gap: 6px;
|
|
27
|
-
padding: 4px 12px;
|
|
11
|
+
export function useStyle({ indicatorColor }) {
|
|
12
|
+
const indicatorColorValue = useColor(indicatorColor);
|
|
13
|
+
return useCss(({ mode, background, borderRadius, easing, text }) => {
|
|
14
|
+
const bgColor = Color(background.body);
|
|
15
|
+
const hoverBg = bgColor.darken(mode === 'light' ? .04 : .12).hex();
|
|
16
|
+
const activeBg = bgColor.darken(mode === 'light' ? .08 : .24).hex();
|
|
17
|
+
return css `
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
background-color: ${background.body};
|
|
28
20
|
border-radius: ${borderRadius}px;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
z-index: 1;
|
|
33
|
-
transition: background-color .3s ${easing.easeOut};
|
|
34
|
-
-webkit-tap-highlight-color: transparent;
|
|
35
|
-
|
|
36
|
-
&[data-active=true] {
|
|
37
|
-
transition: background-color 0s;
|
|
38
|
-
}
|
|
21
|
+
padding: 2px;
|
|
22
|
+
position: relative;
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
.${classes.option} {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: 6px;
|
|
29
|
+
padding: 4px 12px;
|
|
30
|
+
border-radius: ${borderRadius}px;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
z-index: 1;
|
|
35
|
+
transition: background-color .3s ${easing.easeOut};
|
|
36
|
+
-webkit-tap-highlight-color: transparent;
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
38
|
+
&[data-active=true] {
|
|
39
|
+
transition: background-color 0s;
|
|
40
|
+
}
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
42
|
+
&[data-orientation=vertical] {
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
}
|
|
55
45
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
&[data-disabled=true] {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
color: ${text.disabled};
|
|
49
|
+
}
|
|
59
50
|
}
|
|
60
|
-
}
|
|
61
51
|
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
&[data-size=small] {
|
|
53
|
+
.${classes.option} {
|
|
54
|
+
padding: 3px 12px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
&[data-size=large] {
|
|
59
|
+
.${classes.option} {
|
|
60
|
+
padding: 11px 12px;
|
|
61
|
+
}
|
|
67
62
|
}
|
|
68
|
-
}
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
64
|
+
&[data-full-width=true] {
|
|
65
|
+
display: flex;
|
|
73
66
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
position: absolute;
|
|
79
|
-
transition: all .3s ${easing.bounce};
|
|
80
|
-
}
|
|
67
|
+
.${classes.option} {
|
|
68
|
+
flex: 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
81
71
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
transition: background-color 0s;
|
|
72
|
+
&[data-orientation=vertical] {
|
|
73
|
+
flex-direction: column;
|
|
85
74
|
}
|
|
86
|
-
}
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
background-color: ${
|
|
76
|
+
.${classes.indicator} {
|
|
77
|
+
border-radius: ${borderRadius}px;
|
|
78
|
+
background-color: ${indicatorColorValue};
|
|
91
79
|
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
|
|
80
|
+
position: absolute;
|
|
81
|
+
transition: all .3s ${easing.bounce};
|
|
92
82
|
}
|
|
93
|
-
}
|
|
94
83
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
&[data-animating=true] {
|
|
85
|
+
.${classes.option} {
|
|
86
|
+
transition: background-color 0s;
|
|
87
|
+
}
|
|
98
88
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
&:not([data-active=true]):hover {
|
|
106
|
-
background-color: ${hoverBg};
|
|
89
|
+
|
|
90
|
+
&:not([data-animating=true]) {
|
|
91
|
+
.${classes.option}[data-active=true] {
|
|
92
|
+
background-color: ${indicatorColorValue};
|
|
93
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
|
|
107
94
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:not(:has([data-active=true])) {
|
|
98
|
+
.${classes.indicator} {
|
|
99
|
+
display: none;
|
|
112
100
|
}
|
|
113
101
|
}
|
|
114
|
-
}
|
|
115
102
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
&:not([data-read-only=true]):not([data-disabled=true]) {
|
|
104
|
+
.${classes.option}:not([data-disabled=true]) {
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
|
|
107
|
+
&:not([data-active=true]):hover {
|
|
108
|
+
background-color: ${hoverBg};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&:not([data-active=true]):active {
|
|
112
|
+
transition: background-color 0s;
|
|
113
|
+
background-color: ${activeBg};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[data-disabled=true] {
|
|
119
|
+
.${classes.option} {
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
+
`;
|
|
124
|
+
}, [indicatorColorValue]);
|
|
125
|
+
}
|
|
@@ -10,6 +10,7 @@ export function useStyle({ color }) {
|
|
|
10
10
|
let colorValue = useColor(color);
|
|
11
11
|
colorValue = Color(colorValue).alpha(.7).string();
|
|
12
12
|
return useCss(({ spacing, borderRadius, boxShadow }) => css `
|
|
13
|
+
pointer-events: none;
|
|
13
14
|
z-index: ${zIndex.tooltip};
|
|
14
15
|
|
|
15
16
|
.${classes.title} {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineInnerClasses, responsiveVariables, useCss } from '../../utils';
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
export const classes =
|
|
3
|
+
export const classes = defineInnerClasses('waterfall', [
|
|
4
4
|
'item'
|
|
5
5
|
]);
|
|
6
6
|
export function useStyle({ columnCount, columnGap, rowGap }) {
|
|
@@ -21,7 +21,7 @@ export const WaterfallItem = ({ ref, onLoad, child }) => {
|
|
|
21
21
|
}
|
|
22
22
|
})).then(() => onLoad());
|
|
23
23
|
});
|
|
24
|
-
const clonedRef = useCallback(cloneRef(child.props.ref, innerRef, ref), [child.props.ref]);
|
|
24
|
+
const clonedRef = useCallback(cloneRef(child.props.ref, innerRef, ref), [child.props.ref, ref]);
|
|
25
25
|
return cloneElement(child, {
|
|
26
26
|
ref: clonedRef,
|
|
27
27
|
className: clsx(classes.item, child.props.className),
|
|
@@ -25,7 +25,7 @@ export const DocumentViewer = memo(({ src, filename, onError, type, extension, s
|
|
|
25
25
|
return ext && mime.getType(ext);
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
|
-
}, [src, type, extension]);
|
|
28
|
+
}, [src, type, extension, filename]);
|
|
29
29
|
const downloadHandler = () => {
|
|
30
30
|
if (src) {
|
|
31
31
|
const a = document.createElement('a');
|
package/dist/esm/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/esm/index.js
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/esm/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/esm/utils/style.js
CHANGED
|
@@ -55,7 +55,7 @@ export function useCss(callback, deps) {
|
|
|
55
55
|
* @param theme
|
|
56
56
|
*/
|
|
57
57
|
export function colorTransfer(colorPropsValue, theme) {
|
|
58
|
-
const { colors, text } = theme;
|
|
58
|
+
const { colors, text, background } = theme;
|
|
59
59
|
if (colorPropsValue in colors) {
|
|
60
60
|
return colors[colorPropsValue].main;
|
|
61
61
|
}
|
|
@@ -68,6 +68,10 @@ export function colorTransfer(colorPropsValue, theme) {
|
|
|
68
68
|
return text[member];
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
if (colorPropsValue.startsWith('background')) {
|
|
72
|
+
const [, member] = colorPropsValue.split('.');
|
|
73
|
+
return background[member];
|
|
74
|
+
}
|
|
71
75
|
return colorPropsValue;
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
@@ -76,14 +80,14 @@ export function colorTransfer(colorPropsValue, theme) {
|
|
|
76
80
|
*/
|
|
77
81
|
export function useColor(colorPropsValue) {
|
|
78
82
|
return useCss(theme => {
|
|
79
|
-
return colorTransfer(colorPropsValue, theme);
|
|
83
|
+
return colorPropsValue && colorTransfer(colorPropsValue, theme);
|
|
80
84
|
}, [colorPropsValue]);
|
|
81
85
|
}
|
|
82
86
|
/**
|
|
83
87
|
* 点击的波纹效果
|
|
84
88
|
* @param colorPropsValue
|
|
85
89
|
*/
|
|
86
|
-
export function
|
|
90
|
+
export function useTouchSpread(colorPropsValue) {
|
|
87
91
|
const theme = useTheme();
|
|
88
92
|
const outlineColor = useMemo(() => {
|
|
89
93
|
return Color(colorTransfer(colorPropsValue, theme)).alpha(.6).string();
|