@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.
Files changed (114) hide show
  1. package/dist/cjs/components/button/button.js +2 -2
  2. package/dist/cjs/components/button/button.style.js +2 -0
  3. package/dist/cjs/components/calendar/calendar.d.ts +32 -0
  4. package/dist/cjs/components/calendar/calendar.js +51 -0
  5. package/dist/cjs/components/calendar/calendar.style.d.ts +15 -0
  6. package/dist/cjs/components/{dateTimePicker → calendar}/calendar.style.js +131 -91
  7. package/dist/cjs/components/calendar/index.d.ts +1 -0
  8. package/dist/cjs/components/calendar/index.js +4 -0
  9. package/dist/cjs/components/calendar/panelDates.d.ts +2 -0
  10. package/dist/cjs/components/{dateTimePicker/calendarDates.js → calendar/panelDates.js} +11 -19
  11. package/dist/cjs/components/calendar/panelMonth.d.ts +2 -0
  12. package/dist/cjs/components/calendar/panelMonth.js +29 -0
  13. package/dist/cjs/components/calendar/panelYear.d.ts +2 -0
  14. package/dist/cjs/components/calendar/panelYear.js +36 -0
  15. package/dist/cjs/components/card/card.style.js +2 -2
  16. package/dist/cjs/components/checkboxBase/checkboxBase.js +2 -2
  17. package/dist/cjs/components/colorPicker/colorPicker.js +2 -2
  18. package/dist/cjs/components/colorPicker/colorPicker.style.js +1 -1
  19. package/dist/cjs/components/dateTimePicker/dateTimePicker.d.ts +1 -1
  20. package/dist/cjs/components/dateTimePicker/dateTimePicker.js +10 -13
  21. package/dist/cjs/components/dateTimePicker/dateTimePicker.style.d.ts +4 -4
  22. package/dist/cjs/components/dateTimePicker/dateTimePicker.style.js +1 -1
  23. package/dist/cjs/components/dateTimePicker/index.d.ts +1 -1
  24. package/dist/cjs/components/dateTimePicker/index.js +1 -1
  25. package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +1 -0
  26. package/dist/cjs/components/form/form.d.ts +1 -1
  27. package/dist/cjs/components/icon/icon.d.ts +6 -0
  28. package/dist/cjs/components/icon/icon.js +9 -0
  29. package/dist/cjs/components/icon/index.d.ts +1 -0
  30. package/dist/cjs/components/icon/index.js +4 -0
  31. package/dist/cjs/components/pinchable/pinchable.style.js +1 -1
  32. package/dist/cjs/components/placeholder/placeholder.js +3 -3
  33. package/dist/cjs/components/popper/popper.js +1 -1
  34. package/dist/cjs/components/segmented/segmented.d.ts +3 -1
  35. package/dist/cjs/components/segmented/segmented.js +2 -2
  36. package/dist/cjs/components/segmented/segmented.style.d.ts +4 -1
  37. package/dist/cjs/components/segmented/segmented.style.js +94 -90
  38. package/dist/cjs/components/slider/slider.d.ts +0 -1
  39. package/dist/cjs/components/tooltip/tooltip.style.js +1 -0
  40. package/dist/cjs/components/waterfall/waterfall.style.js +1 -1
  41. package/dist/cjs/components/waterfall/waterfallItem.js +1 -1
  42. package/dist/cjs/extensions/documentViewer/documentViewer.js +1 -1
  43. package/dist/cjs/index.d.ts +2 -1
  44. package/dist/cjs/index.js +2 -3
  45. package/dist/cjs/types.d.ts +1 -1
  46. package/dist/cjs/utils/style.d.ts +2 -2
  47. package/dist/cjs/utils/style.js +8 -4
  48. package/dist/esm/components/button/button.js +3 -3
  49. package/dist/esm/components/button/button.style.js +2 -0
  50. package/dist/esm/components/calendar/calendar.d.ts +32 -0
  51. package/dist/esm/components/calendar/calendar.js +46 -0
  52. package/dist/esm/components/calendar/calendar.style.d.ts +15 -0
  53. package/dist/esm/components/{dateTimePicker → calendar}/calendar.style.js +131 -91
  54. package/dist/esm/components/calendar/index.d.ts +1 -0
  55. package/dist/esm/components/calendar/index.js +1 -0
  56. package/dist/esm/components/calendar/panelDates.d.ts +2 -0
  57. package/dist/esm/components/{dateTimePicker/calendarDates.js → calendar/panelDates.js} +11 -19
  58. package/dist/esm/components/calendar/panelMonth.d.ts +2 -0
  59. package/dist/esm/components/calendar/panelMonth.js +26 -0
  60. package/dist/esm/components/calendar/panelYear.d.ts +2 -0
  61. package/dist/esm/components/calendar/panelYear.js +33 -0
  62. package/dist/esm/components/card/card.style.js +2 -2
  63. package/dist/esm/components/checkboxBase/checkboxBase.js +3 -3
  64. package/dist/esm/components/colorPicker/colorPicker.js +3 -3
  65. package/dist/esm/components/colorPicker/colorPicker.style.js +1 -1
  66. package/dist/esm/components/dateTimePicker/dateTimePicker.d.ts +1 -1
  67. package/dist/esm/components/dateTimePicker/dateTimePicker.js +11 -14
  68. package/dist/esm/components/dateTimePicker/dateTimePicker.style.d.ts +4 -4
  69. package/dist/esm/components/dateTimePicker/dateTimePicker.style.js +1 -1
  70. package/dist/esm/components/dateTimePicker/index.d.ts +1 -1
  71. package/dist/esm/components/dateTimePicker/index.js +1 -1
  72. package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +1 -0
  73. package/dist/esm/components/form/form.d.ts +1 -1
  74. package/dist/esm/components/icon/icon.d.ts +6 -0
  75. package/dist/esm/components/icon/icon.js +6 -0
  76. package/dist/esm/components/icon/index.d.ts +1 -0
  77. package/dist/esm/components/icon/index.js +1 -0
  78. package/dist/esm/components/pinchable/pinchable.style.js +2 -2
  79. package/dist/esm/components/placeholder/placeholder.js +3 -3
  80. package/dist/esm/components/popper/popper.js +1 -1
  81. package/dist/esm/components/segmented/segmented.d.ts +3 -1
  82. package/dist/esm/components/segmented/segmented.js +3 -3
  83. package/dist/esm/components/segmented/segmented.style.d.ts +4 -1
  84. package/dist/esm/components/segmented/segmented.style.js +93 -90
  85. package/dist/esm/components/slider/slider.d.ts +0 -1
  86. package/dist/esm/components/tooltip/tooltip.style.js +1 -0
  87. package/dist/esm/components/waterfall/waterfall.style.js +2 -2
  88. package/dist/esm/components/waterfall/waterfallItem.js +1 -1
  89. package/dist/esm/extensions/documentViewer/documentViewer.js +1 -1
  90. package/dist/esm/index.d.ts +2 -1
  91. package/dist/esm/index.js +2 -1
  92. package/dist/esm/types.d.ts +1 -1
  93. package/dist/esm/utils/style.d.ts +2 -2
  94. package/dist/esm/utils/style.js +7 -3
  95. package/documentation/dist/assets/{index-DD484MoK.js → index-gntHdyKP.js} +1766 -1723
  96. package/documentation/dist/components/segmented.md +14 -13
  97. package/documentation/dist/index.html +1 -1
  98. package/package.json +1 -1
  99. package/dist/cjs/components/dateTimePicker/calendar.d.ts +0 -18
  100. package/dist/cjs/components/dateTimePicker/calendar.js +0 -29
  101. package/dist/cjs/components/dateTimePicker/calendar.style.d.ts +0 -15
  102. package/dist/cjs/components/dateTimePicker/calendarDates.d.ts +0 -2
  103. package/dist/cjs/components/dateTimePicker/calendarMonths.d.ts +0 -2
  104. package/dist/cjs/components/dateTimePicker/calendarMonths.js +0 -22
  105. package/dist/cjs/components/dateTimePicker/calendarYears.d.ts +0 -2
  106. package/dist/cjs/components/dateTimePicker/calendarYears.js +0 -29
  107. package/dist/esm/components/dateTimePicker/calendar.d.ts +0 -18
  108. package/dist/esm/components/dateTimePicker/calendar.js +0 -25
  109. package/dist/esm/components/dateTimePicker/calendar.style.d.ts +0 -15
  110. package/dist/esm/components/dateTimePicker/calendarDates.d.ts +0 -2
  111. package/dist/esm/components/dateTimePicker/calendarMonths.d.ts +0 -2
  112. package/dist/esm/components/dateTimePicker/calendarMonths.js +0 -19
  113. package/dist/esm/components/dateTimePicker/calendarYears.d.ts +0 -2
  114. 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 './calendar';
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 = (e) => {
79
+ const focusHandler = () => {
80
80
  focused.current = true;
81
81
  selectFn();
82
82
  };
83
- const blurHandler = (e) => {
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, disabledDates,
206
- disabledHours, disabledMinutes, disabledSeconds
205
+ min, max, disabledHours, disabledMinutes, disabledSeconds
207
206
  }), [
208
- min, max, disabledDates,
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(DateTimePickerContext, { value: contextValue, children: [showCalendar &&
215
- _jsx(Calendar, { type: format.includes('D') ? 'dates'
216
- : format.includes('M') ? 'months'
217
- : format.includes('Y') ? 'years'
218
- : 'dates', defaultNull: !dateValue.current, value: _dateVal, onChange: setDateValue }), showTimer &&
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 './calendar.style';
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', [
@@ -1,3 +1,3 @@
1
- export * from './calendar';
1
+ export * from '../calendar/calendar';
2
2
  export * from './dateTimePicker';
3
3
  export * from './timer';
@@ -1,3 +1,3 @@
1
- export * from './calendar';
1
+ export * from '../calendar/calendar';
2
2
  export * from './dateTimePicker';
3
3
  export * from './timer';
@@ -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 { defineClasses, defineCss } from '../../utils';
1
+ import { defineInnerClasses, defineCss } from '../../utils';
2
2
  import { css } from '@emotion/react';
3
- export const classes = defineClasses('pinchable', [
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+sebXhMAVg2YiaaVyk6wWQer8gPPVsDGtm1OGlcmK0VE75p1mzQcfgjvTplWHtMkNOlOBmHxmmcDgrD3Rv8QhUBxTOtMkLPo94Wvf2q/DZaEaWWxigT6Bn30sI58zCYm0yQLUcef+vG30x6+NV/OmlYOq0lorGbQ7AlgITRpw2XHFMLlFArriK2kV00rgxkSMLONKh+O7fWPvOxbX8iHhKsO4dk/W6I6lKsH8Fnd7THmugD3AuGycvcx2ys8XyRC5VSo4iAhXOXwTJ1tglO+kU0Z/CV1j3x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r4joGe7T+gjKkopvadwu1LqWpIXrP19AB7PCOH5QgG4IMgGoWu7/a5D+M52252GUMqmvUuClBB0R267zc5CAPBrKfsFLgrJR6NbM/2Mr19AdIvtdjZaSN5B8usextcnezfabp8TEobh+dHLrvXVqM2dTuea9f/0D/kpCFxyBQcLAAAAAElFTkSuQmCC'
14
14
  };
15
- export const Placeholder = memo(({ slots = {}, slotProps = {}, status = 'empty', image, title = status === 'warning' ? '警告'
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, style } from './segmented.style';
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: style, 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()] }));
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 const style: () => import("@emotion/react").SerializedStyles;
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, defineCss } from '../../utils';
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 const style = defineCss(({ mode, background, borderRadius, easing, text }) => {
12
- const bgColor = Color(background.body);
13
- const hoverBg = bgColor.darken(mode === 'light' ? .04 : .12).hex();
14
- const activeBg = bgColor.darken(mode === 'light' ? .08 : .24).hex();
15
- return css `
16
- display: inline-flex;
17
- background-color: ${background.body};
18
- border-radius: ${borderRadius}px;
19
- padding: 2px;
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
- white-space: nowrap;
30
- text-overflow: ellipsis;
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
- &[data-orientation=vertical] {
41
- flex-direction: column;
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
- &[data-disabled=true] {
45
- cursor: not-allowed;
46
- color: ${text.disabled};
47
- }
48
- }
38
+ &[data-active=true] {
39
+ transition: background-color 0s;
40
+ }
49
41
 
50
- &[data-size=small] {
51
- .${classes.option} {
52
- padding: 3px 12px;
53
- }
54
- }
42
+ &[data-orientation=vertical] {
43
+ flex-direction: column;
44
+ }
55
45
 
56
- &[data-size=large] {
57
- .${classes.option} {
58
- padding: 11px 12px;
46
+ &[data-disabled=true] {
47
+ cursor: not-allowed;
48
+ color: ${text.disabled};
49
+ }
59
50
  }
60
- }
61
51
 
62
- &[data-full-width=true] {
63
- display: flex;
52
+ &[data-size=small] {
53
+ .${classes.option} {
54
+ padding: 3px 12px;
55
+ }
56
+ }
64
57
 
65
- .${classes.option} {
66
- flex: 1;
58
+ &[data-size=large] {
59
+ .${classes.option} {
60
+ padding: 11px 12px;
61
+ }
67
62
  }
68
- }
69
63
 
70
- &[data-orientation=vertical] {
71
- flex-direction: column;
72
- }
64
+ &[data-full-width=true] {
65
+ display: flex;
73
66
 
74
- .${classes.indicator} {
75
- border-radius: ${borderRadius}px;
76
- background-color: ${background.content};
77
- box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
78
- position: absolute;
79
- transition: all .3s ${easing.bounce};
80
- }
67
+ .${classes.option} {
68
+ flex: 1;
69
+ }
70
+ }
81
71
 
82
- &[data-animating=true] {
83
- .${classes.option} {
84
- transition: background-color 0s;
72
+ &[data-orientation=vertical] {
73
+ flex-direction: column;
85
74
  }
86
- }
87
75
 
88
- &:not([data-animating=true]) {
89
- .${classes.option}[data-active=true] {
90
- background-color: ${background.content};
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
- &:not(:has([data-active=true])) {
96
- .${classes.indicator} {
97
- display: none;
84
+ &[data-animating=true] {
85
+ .${classes.option} {
86
+ transition: background-color 0s;
87
+ }
98
88
  }
99
- }
100
-
101
- &:not([data-read-only=true]):not([data-disabled=true]) {
102
- .${classes.option}:not([data-disabled=true]) {
103
- cursor: pointer;
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
- &:not([data-active=true]):active {
110
- transition: background-color 0s;
111
- background-color: ${activeBg};
95
+ }
96
+
97
+ &:not(:has([data-active=true])) {
98
+ .${classes.indicator} {
99
+ display: none;
112
100
  }
113
101
  }
114
- }
115
102
 
116
- &[data-disabled=true] {
117
- .${classes.option} {
118
- cursor: not-allowed;
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
+ }
@@ -39,7 +39,6 @@ interface SliderBaseProps extends Omit<DivProps, 'defaultValue' | 'onChange' | '
39
39
  marks?: MarkItem[];
40
40
  /** mark中的标签与滑动轨道的距离,默认为`6` */
41
41
  markLabelOffset?: number;
42
- markSize?: number;
43
42
  disableTrack?: boolean;
44
43
  gestureOptions?: GestureOptions;
45
44
  }
@@ -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 { defineClasses, responsiveVariables, useCss } from '../../utils';
1
+ import { defineInnerClasses, responsiveVariables, useCss } from '../../utils';
2
2
  import { css } from '@emotion/react';
3
- export const classes = defineClasses('waterfall', [
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');
@@ -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';
@@ -46,7 +46,7 @@ export type SlotsAndProps<Default extends Record<string, any>> = {
46
46
  [P in keyof Default]?: ElementType;
47
47
  };
48
48
  slotProps?: {
49
- [P in keyof Default]?: Default[P] & Obj;
49
+ [P in keyof Default]?: Default[P] | Obj;
50
50
  };
51
51
  };
52
52
  /**
@@ -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 useTouchRipple(colorPropsValue: ColorPropsValue): (element: Animatable) => void;
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}中的断点,或自定义断点
@@ -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 useTouchRipple(colorPropsValue) {
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();