musae 0.2.2 → 0.2.4
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/README.md +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/context.d.ts +0 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/breadcrumb/item.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/button-toggle/context.d.ts +0 -1
- package/dist/components/calendar/calendar.js +1 -1
- package/dist/components/calendar/hooks.js +1 -1
- package/dist/components/cascader/hooks.d.ts +1 -8
- package/dist/components/cascader/utils.d.ts +0 -1
- package/dist/components/checkbox/checkbox.js +4 -3
- package/dist/components/checkbox/context.d.ts +0 -1
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/clock/column.js +1 -1
- package/dist/components/collapse/collapse.d.ts +4 -0
- package/dist/components/collapse/collapse.js +97 -0
- package/dist/components/collapse/context.d.ts +6 -0
- package/dist/components/collapse/context.js +12 -0
- package/dist/components/collapse/hooks.d.ts +12 -0
- package/dist/components/collapse/hooks.js +43 -0
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/collapse/item.d.ts +4 -0
- package/dist/components/collapse/item.js +144 -0
- package/dist/components/collapse/types.d.ts +87 -0
- package/dist/components/config/context.d.ts +0 -1
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/date-picker/hooks.d.ts +1 -5
- package/dist/components/date-range-picker/hooks.d.ts +1 -5
- package/dist/components/dialog/hooks.d.ts +1 -5
- package/dist/components/dialog/popup.js +2 -2
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/popup.js +2 -2
- package/dist/components/empty/empty.js +1 -1
- package/dist/components/form/context.d.ts +0 -1
- package/dist/components/form/field/field.d.ts +1 -1
- package/dist/components/form/field/field.js +8 -7
- package/dist/components/form/field/layout.js +1 -1
- package/dist/components/grid/col.js +1 -1
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/grid/row.js +1 -1
- package/dist/components/icon/icon.js +2 -2
- package/dist/components/icon/icons/index.js +1 -0
- package/dist/components/icon/icons/navigation/index.d.ts +2 -1
- package/dist/components/icon/icons/navigation/index.js +1 -0
- package/dist/components/icon/icons/navigation/unfold-more.d.ts +3 -0
- package/dist/components/icon/icons/navigation/unfold-more.js +10 -0
- package/dist/components/image/index.d.ts +0 -1
- package/dist/components/image/preview/context.d.ts +0 -1
- package/dist/components/image/preview/operations.js +1 -1
- package/dist/components/image/preview/preview.js +1 -1
- package/dist/components/input/input.d.ts +20 -20
- package/dist/components/input/input.js +3 -11
- package/dist/components/layout/header.js +1 -1
- package/dist/components/layout/layout.js +1 -1
- package/dist/components/layout/main.d.ts +0 -1
- package/dist/components/loading/loading.d.ts +1 -1
- package/dist/components/loading/loading.js +70 -5
- package/dist/components/loading/types.d.ts +13 -0
- package/dist/components/menu/context.d.ts +0 -1
- package/dist/components/menu/group.d.ts +2 -2
- package/dist/components/menu/group.js +1 -1
- package/dist/components/menu/hooks.js +1 -1
- package/dist/components/menu/item.d.ts +1 -1
- package/dist/components/menu/item.js +1 -1
- package/dist/components/notification/holder.js +1 -1
- package/dist/components/notification/notification.js +1 -1
- package/dist/components/pagination/hooks.d.ts +2 -3
- package/dist/components/picker/context.d.ts +0 -1
- package/dist/components/picker/picker.js +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/popper/dropdown.js +1 -1
- package/dist/components/popper/hooks.d.ts +3 -3
- package/dist/components/progress/circular.js +1 -1
- package/dist/components/progress/hooks.d.ts +0 -1
- package/dist/components/progress/linear.js +1 -1
- package/dist/components/radio/context.d.ts +0 -1
- package/dist/components/radio/radio.js +22 -13
- package/dist/components/rate/rate.js +1 -1
- package/dist/components/rate/star.js +12 -14
- package/dist/components/ripple/hooks.js +4 -1
- package/dist/components/ripple/ripple.js +1 -1
- package/dist/components/select/selector.js +1 -1
- package/dist/components/select/utils.d.ts +0 -1
- package/dist/components/space/space.js +1 -1
- package/dist/components/steps/context.d.ts +0 -1
- package/dist/components/steps/item.js +1 -1
- package/dist/components/steps/steps.js +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table/body.js +36 -4
- package/dist/components/table/context.d.ts +6 -1
- package/dist/components/table/context.js +10 -2
- package/dist/components/table/header/cell.d.ts +3 -0
- package/dist/components/table/header/cell.js +129 -0
- package/dist/components/table/{header.d.ts → header/header.d.ts} +1 -1
- package/dist/components/table/{header.js → header/header.js} +37 -10
- package/dist/components/table/hooks.d.ts +8 -21
- package/dist/components/table/hooks.js +36 -58
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +12 -6
- package/dist/components/table/types.d.ts +72 -4
- package/dist/components/tabs/context.d.ts +0 -1
- package/dist/components/tabs/item.js +3 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/theme/hooks.d.ts +1 -2
- package/dist/components/time-picker/panel.js +1 -1
- package/dist/components/time-picker/time-picker.js +1 -1
- package/dist/components/timeline/context.d.ts +0 -1
- package/dist/components/timeline/item.js +1 -1
- package/dist/components/tour/tour.js +1 -1
- package/dist/components/tree/context.d.ts +0 -1
- package/dist/components/tree/hooks.d.ts +0 -1
- package/dist/components/tree/list.js +1 -1
- package/dist/components/tree/node.js +1 -1
- package/dist/components/upload/types.d.ts +8 -6
- package/dist/components/upload/upload.d.ts +1 -1
- package/dist/components/upload/upload.js +11 -4
- package/dist/components/upload/uploadeds.js +8 -3
- package/dist/components/waterfall/hooks.d.ts +1 -3
- package/dist/components/waterfall/hooks.js +2 -8
- package/dist/components/waterfall/sequential.js +1 -1
- package/dist/components/waterfall/waterfall.js +10 -6
- package/dist/components/watermark/types.d.ts +1 -1
- package/dist/components/watermark/watermark.js +1 -1
- package/dist/hooks/use-class-names.d.ts +15 -0
- package/dist/hooks/use-expand-effect.d.ts +1 -1
- package/dist/hooks/use-expand-effect.js +12 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/stylex.css +22 -7
- package/dist/utils/class-name.d.ts +42 -184
- package/dist/utils/class-name.js +39 -5
- package/dist/utils/styles.d.ts +1 -1
- package/package.json +15 -15
- /package/dist/node_modules/{@aiszlab → .pnpm/@aiszlab_relax@1.2.55_react-dom@18.3.1_react@18.3.1/node_modules/@aiszlab}/relax/dist/dom/contains.js +0 -0
- /package/dist/node_modules/{@stylexjs → .pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs}/stylex/lib/es/stylex.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useTheme } from '../theme/hooks.js';
|
|
4
4
|
import { ColorToken } from '../../utils/colors.js';
|
|
5
5
|
import { sizes } from '../theme/tokens.stylex.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, ProgressClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -3,7 +3,7 @@ import Context from './context.js';
|
|
|
3
3
|
import { useControlledState } from '@aiszlab/relax';
|
|
4
4
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
5
5
|
import { ComponentToken, RadioClassToken } from '../../utils/class-name.js';
|
|
6
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
9
9
|
import { typography } from '../theme/theme.js';
|
|
@@ -104,15 +104,24 @@ const styles = {
|
|
|
104
104
|
"--joftei": props.borderColor != null ? props.borderColor : "initial"
|
|
105
105
|
}],
|
|
106
106
|
disabled: props => [{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
"::after_borderWidth": "musae-1jxe9zw",
|
|
108
|
+
"::after_borderInlineWidth": null,
|
|
109
|
+
"::after_borderInlineStartWidth": null,
|
|
110
|
+
"::after_borderLeftWidth": null,
|
|
111
|
+
"::after_borderInlineEndWidth": null,
|
|
112
|
+
"::after_borderRightWidth": null,
|
|
113
|
+
"::after_borderBlockWidth": null,
|
|
114
|
+
"::after_borderTopWidth": null,
|
|
115
|
+
"::after_borderBottomWidth": null,
|
|
116
|
+
"::after_borderColor": "musae-3yd8hb",
|
|
117
|
+
"::after_borderInlineColor": null,
|
|
118
|
+
"::after_borderInlineStartColor": null,
|
|
119
|
+
"::after_borderLeftColor": null,
|
|
120
|
+
"::after_borderInlineEndColor": null,
|
|
121
|
+
"::after_borderRightColor": null,
|
|
122
|
+
"::after_borderBlockColor": null,
|
|
123
|
+
"::after_borderTopColor": null,
|
|
124
|
+
"::after_borderBottomColor": null,
|
|
116
125
|
"::before_content": "musae-1cpjm7i",
|
|
117
126
|
"::before_position": "musae-1hmns74",
|
|
118
127
|
"::before_visibility": "musae-11srvyv",
|
|
@@ -130,11 +139,11 @@ const styles = {
|
|
|
130
139
|
"::before_borderBottomRightRadius": null,
|
|
131
140
|
$$css: true
|
|
132
141
|
}, {
|
|
133
|
-
"--
|
|
142
|
+
"--joftei": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
134
143
|
"--1lrm08k": props.backgroundColor != null ? props.backgroundColor : "initial"
|
|
135
144
|
}],
|
|
136
145
|
unckecked: {
|
|
137
|
-
"::
|
|
146
|
+
"::before_display": "musae-15ozc13",
|
|
138
147
|
$$css: true
|
|
139
148
|
}
|
|
140
149
|
},
|
|
@@ -197,7 +206,7 @@ const Radio = ({
|
|
|
197
206
|
label: props(typography.body.medium, styles.label.default)
|
|
198
207
|
};
|
|
199
208
|
return React.createElement("label", {
|
|
200
|
-
className: clsx(
|
|
209
|
+
className: clsx(classNames[RadioClassToken.Radio], props$1.className, styled.radio.className)
|
|
201
210
|
}, React.createElement("input", {
|
|
202
211
|
type: "radio",
|
|
203
212
|
"aria-checked": isChecked,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, RateClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
2
|
import { useEvent, useHover } from '@aiszlab/relax';
|
|
3
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
6
6
|
import { ComponentToken, RateClassToken } from '../../utils/class-name.js';
|
|
@@ -31,8 +31,8 @@ const styles = {
|
|
|
31
31
|
$$css: true
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
default:
|
|
34
|
+
half: {
|
|
35
|
+
default: {
|
|
36
36
|
position: "musae-10l6tqk",
|
|
37
37
|
width: "musae-1gn8jaj",
|
|
38
38
|
height: "musae-b27hse",
|
|
@@ -46,7 +46,7 @@ const styles = {
|
|
|
46
46
|
overflowX: null,
|
|
47
47
|
overflowY: null,
|
|
48
48
|
$$css: true
|
|
49
|
-
},
|
|
49
|
+
},
|
|
50
50
|
checked: props => [{
|
|
51
51
|
opacity: "musae-1hc1fzr",
|
|
52
52
|
color: "musae-19dipnz",
|
|
@@ -55,12 +55,12 @@ const styles = {
|
|
|
55
55
|
"--color": props.color != null ? props.color : "initial"
|
|
56
56
|
}]
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
full: {
|
|
59
59
|
default: {
|
|
60
60
|
userSelect: "musae-87ps6o",
|
|
61
61
|
$$css: true
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
checked: props => [{
|
|
64
64
|
color: "musae-19dipnz",
|
|
65
65
|
$$css: true
|
|
66
66
|
}, {
|
|
@@ -104,12 +104,10 @@ const Star = ({
|
|
|
104
104
|
star: _stylex.props(styles.star.default({
|
|
105
105
|
color: theme.colors[ColorToken.SurfaceContainerHighest]
|
|
106
106
|
}), disabled && styles.star.disabled),
|
|
107
|
-
|
|
108
|
-
hoveredColor: theme.colors[ColorToken.Primary]
|
|
109
|
-
}), isHalf && styles.leading.checked({
|
|
107
|
+
half: _stylex.props(styles.half.default, isHalf && styles.half.checked({
|
|
110
108
|
color: theme.colors[ColorToken.Primary]
|
|
111
109
|
})),
|
|
112
|
-
|
|
110
|
+
full: _stylex.props(styles.full.default, isFull && styles.full.checked({
|
|
113
111
|
color: theme.colors[ColorToken.Primary]
|
|
114
112
|
}))
|
|
115
113
|
};
|
|
@@ -117,8 +115,8 @@ const Star = ({
|
|
|
117
115
|
className: clsx(classNames[RateClassToken.Star], styled.star.className),
|
|
118
116
|
style: styled.star.style
|
|
119
117
|
}, React.createElement("div", {
|
|
120
|
-
className: clsx(classNames[RateClassToken.
|
|
121
|
-
style: styled.
|
|
118
|
+
className: clsx(classNames[RateClassToken.Half], styled.half.className),
|
|
119
|
+
style: styled.half.style,
|
|
122
120
|
...(!disabled && {
|
|
123
121
|
...halfHoverProps,
|
|
124
122
|
onClick: half
|
|
@@ -126,8 +124,8 @@ const Star = ({
|
|
|
126
124
|
}, createElement(_Star, {
|
|
127
125
|
size: "large"
|
|
128
126
|
})), React.createElement("div", {
|
|
129
|
-
className: clsx(classNames[RateClassToken.
|
|
130
|
-
style: styled.
|
|
127
|
+
className: clsx(classNames[RateClassToken.Full], styled.full.className),
|
|
128
|
+
style: styled.full.style,
|
|
131
129
|
...(!disabled && {
|
|
132
130
|
...fullHoverProps,
|
|
133
131
|
onClick: full
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useIdentity } from '@aiszlab/relax';
|
|
2
3
|
|
|
3
4
|
function useRipple() {
|
|
4
5
|
const [_ripples, _setRipples] = useState(new Map());
|
|
6
|
+
const [, unique] = useIdentity();
|
|
5
7
|
const add = useCallback((event) => {
|
|
6
8
|
const trigger = event.currentTarget;
|
|
7
9
|
const size = Math.max(trigger.clientWidth, trigger.clientHeight);
|
|
8
10
|
const { x, y } = trigger.getBoundingClientRect();
|
|
9
11
|
_setRipples((prev) => {
|
|
10
|
-
return new Map(prev).set(
|
|
12
|
+
return new Map(prev).set(unique(), {
|
|
11
13
|
size,
|
|
12
14
|
x: event.clientX - x - size / 2,
|
|
13
15
|
y: event.clientY - y - size / 2,
|
|
14
16
|
});
|
|
15
17
|
});
|
|
18
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
19
|
}, []);
|
|
17
20
|
const clear = useCallback((key) => {
|
|
18
21
|
_setRipples((prev) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
|
|
5
5
|
const styles = {
|
|
6
6
|
ripple: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, useRef, useContext, useImperativeHandle } from 'react';
|
|
2
2
|
import Tag from '../tag/tag.js';
|
|
3
3
|
import { styles as styles$1 } from '../input/input.js';
|
|
4
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import { Context } from '../picker/context.js';
|
|
6
6
|
import { useTheme } from '../theme/hooks.js';
|
|
7
7
|
import { ColorToken } from '../../utils/colors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useGutters } from '../../hooks/use-gutters.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
2
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, StepsClassToken } from '../../utils/class-name.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import Item from './item.js';
|
|
3
3
|
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
4
|
import { ComponentToken, StepsClassToken } from '../../utils/class-name.js';
|
|
5
|
-
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { Context } from './context.js';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useControlledState } from '@aiszlab/relax';
|
|
3
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
3
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
4
|
import { useTheme } from '../theme/hooks.js';
|
|
5
5
|
import { ColorToken } from '../../utils/colors.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -1,13 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTable
|
|
2
|
+
import { useTable } from './context.js';
|
|
3
3
|
import { flexRender } from '@tanstack/react-table';
|
|
4
|
-
import { props } from '../../node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { typography } from '../theme/theme.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
9
9
|
|
|
10
10
|
const styles = {
|
|
11
|
+
cell: props => [{
|
|
12
|
+
paddingInline: "musae-iujutg",
|
|
13
|
+
paddingStart: null,
|
|
14
|
+
paddingLeft: null,
|
|
15
|
+
paddingEnd: null,
|
|
16
|
+
paddingRight: null,
|
|
17
|
+
paddingBlock: "musae-avjae4",
|
|
18
|
+
paddingTop: null,
|
|
19
|
+
paddingBottom: null,
|
|
20
|
+
borderColor: "musae-eqt46j",
|
|
21
|
+
borderInlineColor: null,
|
|
22
|
+
borderInlineStartColor: null,
|
|
23
|
+
borderLeftColor: null,
|
|
24
|
+
borderInlineEndColor: null,
|
|
25
|
+
borderRightColor: null,
|
|
26
|
+
borderBlockColor: null,
|
|
27
|
+
borderTopColor: null,
|
|
28
|
+
borderBottomColor: null,
|
|
29
|
+
borderStyle: "musae-1y0btm7",
|
|
30
|
+
borderInlineStyle: null,
|
|
31
|
+
borderInlineStartStyle: null,
|
|
32
|
+
borderLeftStyle: null,
|
|
33
|
+
borderInlineEndStyle: null,
|
|
34
|
+
borderRightStyle: null,
|
|
35
|
+
borderBlockStyle: null,
|
|
36
|
+
borderTopStyle: null,
|
|
37
|
+
borderBottomStyle: null,
|
|
38
|
+
borderBottomWidth: "musae-lntmim",
|
|
39
|
+
$$css: true
|
|
40
|
+
}, {
|
|
41
|
+
"--borderColor": props.borderColor != null ? props.borderColor : "initial"
|
|
42
|
+
}],
|
|
11
43
|
bordered: {
|
|
12
44
|
borderInline: "musae-10htjfm",
|
|
13
45
|
$$css: true
|
|
@@ -20,8 +52,8 @@ const Body = props$1 => {
|
|
|
20
52
|
} = useTable();
|
|
21
53
|
const theme = useTheme();
|
|
22
54
|
if (!table) return null;
|
|
23
|
-
const styled = props(bordered && styles.bordered, typography.body.small, styles
|
|
24
|
-
|
|
55
|
+
const styled = props(bordered && styles.bordered, typography.body.small, styles.cell({
|
|
56
|
+
borderColor: theme.colors[ColorToken.OutlineVariant]
|
|
25
57
|
}));
|
|
26
58
|
return React.createElement("tbody", null, table.getRowModel().rows.map(row => React.createElement("tr", {
|
|
27
59
|
key: row.id
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ContextValue } from "./types";
|
|
3
2
|
declare const Context: import("react").Context<ContextValue<unknown>>;
|
|
4
3
|
export default Context;
|
|
4
|
+
/**
|
|
5
|
+
* @author murukal
|
|
6
|
+
* @description
|
|
7
|
+
* use table context hook
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTable: <T>() => ContextValue<T>;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
const Context = createContext({
|
|
4
4
|
bordered: false,
|
|
5
5
|
});
|
|
6
|
+
/**
|
|
7
|
+
* @author murukal
|
|
8
|
+
* @description
|
|
9
|
+
* use table context hook
|
|
10
|
+
*/
|
|
11
|
+
const useTable = () => {
|
|
12
|
+
return useContext(Context);
|
|
13
|
+
};
|
|
6
14
|
|
|
7
|
-
export { Context as default };
|
|
15
|
+
export { Context as default, useTable };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { toFunction, useEvent, isUndefined } from '@aiszlab/relax';
|
|
3
|
+
import _stylex from '../../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
4
|
+
import { useTheme } from '../../theme/hooks.js';
|
|
5
|
+
import { ColorToken } from '../../../utils/colors.js';
|
|
6
|
+
import Context from '../context.js';
|
|
7
|
+
import UnfoldMore from '../../icon/icons/navigation/unfold-more.js';
|
|
8
|
+
|
|
9
|
+
const styles = {
|
|
10
|
+
cell: {
|
|
11
|
+
default: {
|
|
12
|
+
display: "musae-78zum5",
|
|
13
|
+
justifyContent: "musae-1qughib",
|
|
14
|
+
alignItems: "musae-6s0dn4",
|
|
15
|
+
$$css: true
|
|
16
|
+
},
|
|
17
|
+
handlers: props => [{
|
|
18
|
+
display: "musae-3nfvp2",
|
|
19
|
+
flexDirection: "musae-1q0g3np",
|
|
20
|
+
gap: "musae-29tp26",
|
|
21
|
+
rowGap: null,
|
|
22
|
+
columnGap: null,
|
|
23
|
+
color: "musae-19dipnz",
|
|
24
|
+
userSelect: "musae-87ps6o",
|
|
25
|
+
$$css: true
|
|
26
|
+
}, {
|
|
27
|
+
"--color": props.color != null ? props.color : "initial"
|
|
28
|
+
}]
|
|
29
|
+
},
|
|
30
|
+
sort: {
|
|
31
|
+
default: {
|
|
32
|
+
position: "musae-1n2onr6",
|
|
33
|
+
cursor: "musae-1ypdohk",
|
|
34
|
+
$$css: true
|
|
35
|
+
},
|
|
36
|
+
half: {
|
|
37
|
+
position: "musae-10l6tqk",
|
|
38
|
+
top: "musae-9oc6z4",
|
|
39
|
+
insetInlineStart: "musae-1at4hj2",
|
|
40
|
+
left: null,
|
|
41
|
+
right: null,
|
|
42
|
+
height: "musae-1cj5796",
|
|
43
|
+
overflow: "musae-b3r6kr",
|
|
44
|
+
overflowX: null,
|
|
45
|
+
overflowY: null,
|
|
46
|
+
$$css: true
|
|
47
|
+
},
|
|
48
|
+
checked: props => [{
|
|
49
|
+
color: "musae-19dipnz",
|
|
50
|
+
$$css: true
|
|
51
|
+
}, {
|
|
52
|
+
"--color": props.color != null ? props.color : "initial"
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const Cell = ({
|
|
57
|
+
sortable = false,
|
|
58
|
+
children: _children,
|
|
59
|
+
value,
|
|
60
|
+
sortDirections: _sortDirections
|
|
61
|
+
}) => {
|
|
62
|
+
const {
|
|
63
|
+
sortDescriptor,
|
|
64
|
+
onSortChange
|
|
65
|
+
} = useContext(Context);
|
|
66
|
+
const children = toFunction(_children)();
|
|
67
|
+
const theme = useTheme();
|
|
68
|
+
// convert sort directions to usable
|
|
69
|
+
const sortDirections = useMemo(() => {
|
|
70
|
+
return _sortDirections.reduce((prev, item, index) => {
|
|
71
|
+
return prev.set(item, _sortDirections[index + 1] ?? null);
|
|
72
|
+
}, new Map());
|
|
73
|
+
}, [_sortDirections]);
|
|
74
|
+
const sort = useMemo(() => {
|
|
75
|
+
if (sortDescriptor?.key === value) {
|
|
76
|
+
return sortDescriptor.direction;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}, [sortDescriptor, value]);
|
|
80
|
+
// sort handler
|
|
81
|
+
const onSort = useEvent(() => {
|
|
82
|
+
const _direction = sortDirections.get(sort);
|
|
83
|
+
const __direction = isUndefined(_direction) ? "ascending" : _direction;
|
|
84
|
+
onSortChange?.({
|
|
85
|
+
key: value,
|
|
86
|
+
direction: __direction
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
// only children, render directly
|
|
90
|
+
if (!sortable) {
|
|
91
|
+
return children;
|
|
92
|
+
}
|
|
93
|
+
const styled = {
|
|
94
|
+
cell: _stylex.props(styles.cell.default),
|
|
95
|
+
handlers: _stylex.props(styles.cell.handlers({
|
|
96
|
+
color: theme.colors[ColorToken.SurfaceContainerHighest]
|
|
97
|
+
})),
|
|
98
|
+
sort: _stylex.props(styles.sort.default),
|
|
99
|
+
fullSort: _stylex.props(sort === "descending" && styles.sort.checked({
|
|
100
|
+
color: theme.colors[ColorToken.Primary]
|
|
101
|
+
})),
|
|
102
|
+
halfSort: _stylex.props(styles.sort.half, sort === "ascending" && styles.sort.checked({
|
|
103
|
+
color: theme.colors[ColorToken.Primary]
|
|
104
|
+
}))
|
|
105
|
+
};
|
|
106
|
+
return React.createElement("div", {
|
|
107
|
+
className: styled.cell.className,
|
|
108
|
+
style: styled.cell.style
|
|
109
|
+
}, children, React.createElement("span", {
|
|
110
|
+
className: styled.handlers.className,
|
|
111
|
+
style: styled.handlers.style
|
|
112
|
+
}, React.createElement("span", {
|
|
113
|
+
className: styled.sort.className,
|
|
114
|
+
style: styled.sort.style,
|
|
115
|
+
onClick: onSort
|
|
116
|
+
}, React.createElement("div", {
|
|
117
|
+
className: styled.fullSort.className,
|
|
118
|
+
style: styled.fullSort.style
|
|
119
|
+
}, React.createElement(UnfoldMore, {
|
|
120
|
+
size: "medium"
|
|
121
|
+
})), !!sort && React.createElement("div", {
|
|
122
|
+
className: styled.halfSort.className,
|
|
123
|
+
style: styled.halfSort.style
|
|
124
|
+
}, React.createElement(UnfoldMore, {
|
|
125
|
+
size: "medium"
|
|
126
|
+
})))));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { Cell as default };
|
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTable
|
|
2
|
+
import { useTable } from '../context.js';
|
|
3
3
|
import { flexRender } from '@tanstack/react-table';
|
|
4
|
-
import { props } from '
|
|
5
|
-
import { useTheme } from '
|
|
4
|
+
import { props } from '../../../node_modules/.pnpm/@stylexjs_stylex@0.6.1/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import { useTheme } from '../../theme/hooks.js';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { ColorToken } from '
|
|
8
|
-
import { typography } from '
|
|
7
|
+
import { ColorToken } from '../../../utils/colors.js';
|
|
8
|
+
import { typography } from '../../theme/theme.js';
|
|
9
9
|
|
|
10
10
|
const styles = {
|
|
11
11
|
cell: props => [{
|
|
12
12
|
backgroundColor: "musae-q1mx2j",
|
|
13
13
|
textAlign: "musae-1yc453h",
|
|
14
14
|
position: "musae-1n2onr6",
|
|
15
|
+
paddingInline: "musae-iujutg",
|
|
16
|
+
paddingStart: null,
|
|
17
|
+
paddingLeft: null,
|
|
18
|
+
paddingEnd: null,
|
|
19
|
+
paddingRight: null,
|
|
20
|
+
paddingBlock: "musae-avjae4",
|
|
21
|
+
paddingTop: null,
|
|
22
|
+
paddingBottom: null,
|
|
23
|
+
borderColor: "musae-eqt46j",
|
|
24
|
+
borderInlineColor: null,
|
|
25
|
+
borderInlineStartColor: null,
|
|
26
|
+
borderLeftColor: null,
|
|
27
|
+
borderInlineEndColor: null,
|
|
28
|
+
borderRightColor: null,
|
|
29
|
+
borderBlockColor: null,
|
|
30
|
+
borderTopColor: null,
|
|
31
|
+
borderBottomColor: null,
|
|
32
|
+
borderStyle: "musae-1y0btm7",
|
|
33
|
+
borderInlineStyle: null,
|
|
34
|
+
borderInlineStartStyle: null,
|
|
35
|
+
borderLeftStyle: null,
|
|
36
|
+
borderInlineEndStyle: null,
|
|
37
|
+
borderRightStyle: null,
|
|
38
|
+
borderBlockStyle: null,
|
|
39
|
+
borderTopStyle: null,
|
|
40
|
+
borderBottomStyle: null,
|
|
41
|
+
borderBottomWidth: "musae-lntmim",
|
|
15
42
|
$$css: true
|
|
16
43
|
}, {
|
|
17
|
-
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial"
|
|
44
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
45
|
+
"--borderColor": props.borderColor != null ? props.borderColor : "initial"
|
|
18
46
|
}],
|
|
19
47
|
unbordered: props => [{
|
|
20
48
|
":not(:last-of-type)::after_content": "musae-x7gz8e",
|
|
@@ -53,11 +81,10 @@ const Header = props$1 => {
|
|
|
53
81
|
if (!table) return null;
|
|
54
82
|
const headerGroups = table.getHeaderGroups();
|
|
55
83
|
const styled = props(styles.cell({
|
|
56
|
-
backgroundColor: theme.colors[ColorToken.Surface]
|
|
57
|
-
|
|
84
|
+
backgroundColor: theme.colors[ColorToken.Surface],
|
|
85
|
+
borderColor: theme.colors[ColorToken.OutlineVariant]
|
|
86
|
+
}), typography.label.small, bordered && styles.bordered, !bordered && styles.unbordered({
|
|
58
87
|
backgroundColor: theme.colors[ColorToken.OutlineVariant]
|
|
59
|
-
}), styles$1.cell({
|
|
60
|
-
outlineColor: theme.colors[ColorToken.OutlineVariant]
|
|
61
88
|
}));
|
|
62
89
|
return React.createElement("thead", {
|
|
63
90
|
className: props$1.className
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ContextValue,
|
|
3
|
-
export declare const styles: Readonly<{
|
|
4
|
-
readonly cell: (props: {
|
|
5
|
-
outlineColor: CSSProperties["borderColor"];
|
|
6
|
-
}) => readonly [Readonly<{
|
|
7
|
-
paddingInline: import("@stylexjs/stylex/lib/StyleXTypes").StyleXClassNameFor<"paddingInline", string>;
|
|
8
|
-
paddingBlock: import("@stylexjs/stylex/lib/StyleXTypes").StyleXClassNameFor<"paddingBlock", string>;
|
|
9
|
-
borderColor: import("@stylexjs/stylex/lib/StyleXTypes").StyleXClassNameFor<"borderColor", import("csstype").Property.BorderColor | undefined>;
|
|
10
|
-
borderStyle: import("@stylexjs/stylex/lib/StyleXTypes").StyleXClassNameFor<"borderStyle", "solid">;
|
|
11
|
-
borderBottomWidth: import("@stylexjs/stylex/lib/StyleXTypes").StyleXClassNameFor<"borderBottomWidth", string>;
|
|
12
|
-
}>, typeof import("@stylexjs/stylex/lib/StyleXTypes").StyleXInlineStylesTag];
|
|
13
|
-
}>;
|
|
1
|
+
import { type ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import type { Column, ContextValue, SortDescriptor } from "./types";
|
|
14
3
|
/**
|
|
15
4
|
* @description
|
|
16
5
|
* use columns
|
|
17
6
|
*/
|
|
18
|
-
export declare const useColumns: <T>(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @description
|
|
22
|
-
* use table context hook
|
|
23
|
-
*/
|
|
24
|
-
export declare const useTable: <T>() => ContextValue<T>;
|
|
7
|
+
export declare const useColumns: <T>({ columns }: {
|
|
8
|
+
columns: Column<T>[];
|
|
9
|
+
}) => ColumnDef<T, any>[];
|
|
25
10
|
/**
|
|
26
11
|
* @author murukal
|
|
27
12
|
* @description
|
|
28
13
|
* for context value
|
|
29
14
|
*/
|
|
30
|
-
export declare const useContextValue: <T>({ table: _table, bordered, }: {
|
|
15
|
+
export declare const useContextValue: <T>({ table: _table, bordered, sortDescriptor: _sortDescriptor, onSortChange: _onSortChange, }: {
|
|
31
16
|
table: ContextValue<T>["table"];
|
|
32
17
|
bordered: boolean;
|
|
18
|
+
sortDescriptor?: SortDescriptor;
|
|
19
|
+
onSortChange?: (sortDescriptor: SortDescriptor) => void;
|
|
33
20
|
}) => ContextValue<unknown>;
|