@canlooks/can-ui 0.0.46 → 0.0.48

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.
@@ -13,128 +13,128 @@ export const classes = defineInnerClasses('calendar', [
13
13
  'yearItem',
14
14
  'foot'
15
15
  ]);
16
- export const style = defineCss(({ divider, text, spacing }) => css `
17
- .${classes.head} {
18
- height: 40px;
19
- display: flex;
20
- align-items: center;
21
- justify-content: space-between;
22
- border-bottom: 1px solid ${divider};
23
- padding: 0 ${menuListPadding}px;
24
- position: relative;
25
-
26
- .${classes.headSide} {
27
- z-index: 1;
28
- }
29
-
30
- .${classes.headControl} {
31
- color: ${text.placeholder};
32
- }
33
-
34
- .${classes.headCenter} {
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- position: absolute;
39
- inset: 0;
40
-
41
- .${classes.headButton} {
42
- font-weight: bold;
43
- color: ${text.primary};
44
- }
45
- }
46
- }
47
-
48
- .${classes.body} {
49
- padding: ${spacing[3]}px ${spacing[4]}px;
50
- display: grid;
51
- place-items: center;
52
-
53
- &[data-view-type=date] {
54
- font-size: ${13 / 14}em;
55
- grid-template-columns: repeat(7, 36px);
56
- grid-template-rows: repeat(7, 36px);
57
-
58
- .${classes.dateItem} {
59
- width: 24px;
60
- height: 24px;
61
-
62
- &:not([data-variant=filled]) {
63
- color: ${text.primary};
64
- border-color: ${text.disabled};
65
-
66
- &[data-other-month=true] {
67
- color: ${text.placeholder};
68
- }
69
- }
70
-
71
- &:disabled {
72
- width: 100%;
73
- border-radius: 0;
74
- }
75
- }
76
- }
77
-
78
- &[data-view-type=month], &[data-view-type=year] {
79
- grid-template-columns: repeat(3, 84px);
80
- grid-template-rows: repeat(4, 63px);
81
-
82
- .${classes.monthItem},
83
- .${classes.yearItem} {
84
- width: 72px;
85
- padding-inline: 0;
86
-
87
- &:not([data-variant=filled]) {
88
- color: ${text.primary};
89
- }
90
- }
91
- }
92
- }
93
-
94
- &[data-size=small] {
95
- .${classes.body} {
96
- &[data-view-type=date] {
97
- grid-template-columns: repeat(7, 30px);
98
- grid-template-rows: repeat(7, 30px);
99
- }
100
-
101
- &[data-view-type=month], &[data-view-type=year] {
102
- grid-template-columns: repeat(3, 70px);
103
- grid-template-rows: repeat(4, 52.5px);
104
-
105
- .${classes.monthItem},
106
- .${classes.yearItem} {
107
- width: 60px;
108
- }
109
- }
110
- }
111
- }
112
-
113
- &[data-size=large] {
114
- .${classes.body} {
115
- &[data-view-type=date] {
116
- font-size: 1em;
117
- grid-template-columns: repeat(7, 42px);
118
- grid-template-rows: repeat(7, 42px);
119
-
120
- .${classes.dateItem} {
121
- width: 32px;
122
- height: 32px;
123
- }
124
- }
125
-
126
- &[data-view-type=month], &[data-view-type=year] {
127
- grid-template-columns: repeat(3, 98px);
128
- grid-template-rows: repeat(4, 73.5px);
129
- }
130
- }
131
- }
132
-
133
- .${classes.foot} {
134
- height: 41px;
135
- display: flex;
136
- align-items: center;
137
- justify-content: center;
138
- border-top: 1px solid ${divider};
139
- }
16
+ export const style = defineCss(({ divider, text, spacing }) => css `
17
+ .${classes.head} {
18
+ height: 40px;
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: space-between;
22
+ border-bottom: 1px solid ${divider};
23
+ padding: 0 ${menuListPadding}px;
24
+ position: relative;
25
+
26
+ .${classes.headSide} {
27
+ z-index: 1;
28
+ }
29
+
30
+ .${classes.headControl} {
31
+ color: ${text.placeholder};
32
+ }
33
+
34
+ .${classes.headCenter} {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ position: absolute;
39
+ inset: 0;
40
+
41
+ .${classes.headButton} {
42
+ font-weight: bold;
43
+ color: ${text.primary};
44
+ }
45
+ }
46
+ }
47
+
48
+ .${classes.body} {
49
+ padding: ${spacing[3]}px ${spacing[4]}px;
50
+ display: grid;
51
+ place-items: center;
52
+
53
+ &[data-view-type=date] {
54
+ font-size: ${13 / 14}em;
55
+ grid-template-columns: repeat(7, 36px);
56
+ grid-template-rows: repeat(7, 36px);
57
+
58
+ .${classes.dateItem} {
59
+ width: 24px;
60
+ height: 24px;
61
+
62
+ &:not([data-variant=filled]) {
63
+ color: ${text.primary};
64
+ border-color: ${text.disabled};
65
+
66
+ &[data-other-month=true] {
67
+ color: ${text.placeholder};
68
+ }
69
+ }
70
+
71
+ &:disabled {
72
+ width: 100%;
73
+ border-radius: 0;
74
+ }
75
+ }
76
+ }
77
+
78
+ &[data-view-type=month], &[data-view-type=year] {
79
+ grid-template-columns: repeat(3, 84px);
80
+ grid-template-rows: repeat(4, 63px);
81
+
82
+ .${classes.monthItem},
83
+ .${classes.yearItem} {
84
+ width: 72px;
85
+ padding-inline: 0;
86
+
87
+ &:not([data-variant=filled]) {
88
+ color: ${text.primary};
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ &[data-size=small] {
95
+ .${classes.body} {
96
+ &[data-view-type=date] {
97
+ grid-template-columns: repeat(7, 30px);
98
+ grid-template-rows: repeat(7, 30px);
99
+ }
100
+
101
+ &[data-view-type=month], &[data-view-type=year] {
102
+ grid-template-columns: repeat(3, 70px);
103
+ grid-template-rows: repeat(4, 52.5px);
104
+
105
+ .${classes.monthItem},
106
+ .${classes.yearItem} {
107
+ width: 60px;
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ &[data-size=large] {
114
+ .${classes.body} {
115
+ &[data-view-type=date] {
116
+ font-size: 1em;
117
+ grid-template-columns: repeat(7, 42px);
118
+ grid-template-rows: repeat(7, 42px);
119
+
120
+ .${classes.dateItem} {
121
+ width: 32px;
122
+ height: 32px;
123
+ }
124
+ }
125
+
126
+ &[data-view-type=month], &[data-view-type=year] {
127
+ grid-template-columns: repeat(3, 98px);
128
+ grid-template-rows: repeat(4, 73.5px);
129
+ }
130
+ }
131
+ }
132
+
133
+ .${classes.foot} {
134
+ height: 41px;
135
+ display: flex;
136
+ align-items: center;
137
+ justify-content: center;
138
+ border-top: 1px solid ${divider};
139
+ }
140
140
  `);
@@ -142,7 +142,7 @@ export declare function ClickAway({ ref, container, eventType, onClickAway, disa
142
142
  onBlurCapture: import("react").FocusEventHandler<HTMLDivElement>;
143
143
  onChange: import("react").FormEventHandler<HTMLDivElement>;
144
144
  onChangeCapture: import("react").FormEventHandler<HTMLDivElement>;
145
- onBeforeInput: import("react").FormEventHandler<HTMLDivElement>;
145
+ onBeforeInput: import("react").InputEventHandler<HTMLDivElement>;
146
146
  onBeforeInputCapture: import("react").FormEventHandler<HTMLDivElement>;
147
147
  onInput: import("react").FormEventHandler<HTMLDivElement>;
148
148
  onInputCapture: import("react").FormEventHandler<HTMLDivElement>;
@@ -192,8 +192,6 @@ export declare function ClickAway({ ref, container, eventType, onClickAway, disa
192
192
  onProgressCapture: import("react").ReactEventHandler<HTMLDivElement>;
193
193
  onRateChange: import("react").ReactEventHandler<HTMLDivElement>;
194
194
  onRateChangeCapture: import("react").ReactEventHandler<HTMLDivElement>;
195
- onResize: import("react").ReactEventHandler<HTMLDivElement>;
196
- onResizeCapture: import("react").ReactEventHandler<HTMLDivElement>;
197
195
  onSeeked: import("react").ReactEventHandler<HTMLDivElement>;
198
196
  onSeekedCapture: import("react").ReactEventHandler<HTMLDivElement>;
199
197
  onSeeking: import("react").ReactEventHandler<HTMLDivElement>;
@@ -19,7 +19,7 @@ size, labelWidth, colon, labelPlacement, disableMargin, disablePadding, span = {
19
19
  const spanNum = useResponsiveValue(span, variant === 'grid');
20
20
  return variant === 'grid'
21
21
  ? _jsxs(GridItem, { ...props, css: gridItemStyle, className: clsx(classes.item, props.className), span: span, "data-size": size, "data-label-placement": labelPlacement, "data-disable-margin": disableMargin, children: [!!label &&
22
- _jsxs("div", { className: classes.label, style: { width: labelWidth }, children: [label, !!colon && (labelPlacement === 'left' || labelPlacement === 'right') &&
22
+ _jsxs("div", { className: classes.label, style: { width: labelWidth }, children: [label, !!colon && labelPlacement === 'left' &&
23
23
  _jsx("div", { className: classes.colon, children: colon })] }), _jsx("div", { className: classes.content, children: content ?? props.children })] })
24
24
  : labelPlacement === 'top'
25
25
  ? _jsx("td", { className: classes.vertical, colSpan: spanNum.current, children: _jsxs("div", { className: classes.verticalColWrap, children: [_jsx("div", { className: `${classes.col} ${classes.labelCol}`, "data-size": size, children: label }), _jsx("div", { className: `${classes.col} ${classes.contentCol}`, "data-size": size, "data-disable-padding": disablePadding, children: content ?? props.children })] }) })
@@ -133,18 +133,21 @@ export const gridItemStyle = defineCss(({ spacing, text }) => css `
133
133
  .${classes.label} {
134
134
  text-align: right;
135
135
  justify-content: flex-end;
136
- }
137
-
138
- .${classes.content} {
139
- margin-left: ${spacing[3]}px;
136
+
137
+ + .${classes.content} {
138
+ margin-left: ${spacing[3]}px;
139
+ }
140
140
  }
141
141
  }
142
142
 
143
143
  &[data-label-placement=right] {
144
144
  .${classes.content} {
145
145
  text-align: right;
146
- margin-right: ${spacing[2]}px;
147
146
  justify-content: flex-end;
148
147
  }
148
+
149
+ .${classes.label} + .${classes.content} {
150
+ margin-right: ${spacing[3]}px;
151
+ }
149
152
  }
150
153
  `);
@@ -39,6 +39,7 @@ inline, columnCount = 1, gap, columnGap, rowGap, ...props }) => {
39
39
  */
40
40
  const itemsContainer = useRef(new Map());
41
41
  const submitHandler = async (e) => {
42
+ console.log(e);
42
43
  e?.preventDefault();
43
44
  try {
44
45
  await Promise.all([...itemsContainer.current].map(async ([, item]) => {
@@ -156,6 +156,7 @@ export const FormItem = ({ ref, wrapperRef, field, initialValue, label = '', rul
156
156
  if (noStyle || variant === 'plain') {
157
157
  return renderedChildren;
158
158
  }
159
- return (_jsxs(DescriptionItem, { flex: void 0, ...props, ref: wrapperRef, className: clsx(classes.item, props.className), label: _jsxs(_Fragment, { children: [isRequired && !!requiredMark &&
160
- _jsx("span", { className: classes.requiredMark, children: requiredMark }), label] }), children: [renderedChildren, _jsx(Collapse, { in: innerError.current || !!helperText, children: _jsx("div", { className: classes.helperText, children: innerHelperText.current }) })] }));
159
+ return (_jsxs(DescriptionItem, { flex: void 0, ...props, ref: wrapperRef, className: clsx(classes.item, props.className), label: !!label &&
160
+ _jsxs(_Fragment, { children: [isRequired && !!requiredMark &&
161
+ _jsx("span", { className: classes.requiredMark, children: requiredMark }), label] }), children: [renderedChildren, _jsx(Collapse, { in: innerError.current || !!helperText, children: _jsx("div", { className: classes.helperText, children: innerHelperText.current }) })] }));
161
162
  };
@@ -9,7 +9,7 @@ import { Icon } from '../..';
9
9
  import { faCircleXmark } from '@fortawesome/free-solid-svg-icons/faCircleXmark';
10
10
  export const InputBase = (({ variant = 'outlined', size, shape, color = 'primary', children, prefix, suffix, onClear, loading, type, clearable = type !== 'number',
11
11
  // 以下属性传递给<input/>
12
- min = -Infinity, max = Infinity, step, precision, placeholder, disabled, readOnly, autoFocus, defaultValue, value, onChange, ...props }) => {
12
+ min, max, step, precision, placeholder, disabled, readOnly, autoFocus, defaultValue, value, onChange, ...props }) => {
13
13
  const theme = useTheme();
14
14
  size ??= theme.size;
15
15
  const innerInputRef = useRef(null);
@@ -23,6 +23,7 @@ export function useStyle({ color }) {
23
23
  const c = Color(colorValue);
24
24
  const selectedBg = c.alpha(.1).string();
25
25
  const selectedAndFocused = c.alpha(.15).string();
26
+ const selectedActive = c.alpha(.08).string();
26
27
  const focusedBg = gray(mode === 'light' ? .05 : .23);
27
28
  const disabledOrActive = gray(mode === 'light' ? .1 : .17);
28
29
  return css `
@@ -33,6 +34,7 @@ export function useStyle({ color }) {
33
34
  cursor: pointer;
34
35
  color: ${text.primary};
35
36
  padding: ${paddingHorizontal.medium}px 12px;
37
+ position: relative;
36
38
  -webkit-tap-highlight-color: transparent;
37
39
 
38
40
  &[data-size=small] {
@@ -47,8 +49,7 @@ export function useStyle({ color }) {
47
49
 
48
50
  transition: background-color .25s ${easing.easeOut};
49
51
 
50
- &:hover,
51
- &[data-focused=true] {
52
+ &:hover, &[data-focused=true] {
52
53
  background-color: ${focusedBg};
53
54
  }
54
55
 
@@ -64,7 +65,7 @@ export function useStyle({ color }) {
64
65
  &[data-selected=true] {
65
66
  background-color: ${selectedBg};
66
67
 
67
- &[data-focused=true] {
68
+ &:hover, &[data-focused=true] {
68
69
  background-color: ${selectedAndFocused};
69
70
  }
70
71
 
@@ -72,6 +73,10 @@ export function useStyle({ color }) {
72
73
  font-weight: bold;
73
74
  color: ${colorValue};
74
75
  }
76
+
77
+ &:active {
78
+ background-color: ${selectedActive};
79
+ }
75
80
  }
76
81
 
77
82
  &[data-disabled=true] {
@@ -17,10 +17,6 @@ export const Ripple = memo(({ ref, color = 'primary', ...props }) => {
17
17
  useLayoutEffect(() => {
18
18
  const wrapper = rippleRef.current?.parentElement;
19
19
  if (wrapper) {
20
- const { position } = getComputedStyle(wrapper);
21
- if (position === 'static') {
22
- wrapper.style.position = 'relative';
23
- }
24
20
  const pointerDown = (e) => {
25
21
  setRipples(o => [
26
22
  ...o,