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.
Files changed (137) hide show
  1. package/README.md +1 -1
  2. package/dist/components/avatar/avatar.js +1 -1
  3. package/dist/components/avatar/context.d.ts +0 -1
  4. package/dist/components/breadcrumb/breadcrumb.js +1 -1
  5. package/dist/components/breadcrumb/item.js +1 -1
  6. package/dist/components/button/button.js +1 -1
  7. package/dist/components/button-toggle/context.d.ts +0 -1
  8. package/dist/components/calendar/calendar.js +1 -1
  9. package/dist/components/calendar/hooks.js +1 -1
  10. package/dist/components/cascader/hooks.d.ts +1 -8
  11. package/dist/components/cascader/utils.d.ts +0 -1
  12. package/dist/components/checkbox/checkbox.js +4 -3
  13. package/dist/components/checkbox/context.d.ts +0 -1
  14. package/dist/components/checkbox/index.d.ts +0 -1
  15. package/dist/components/clock/column.js +1 -1
  16. package/dist/components/collapse/collapse.d.ts +4 -0
  17. package/dist/components/collapse/collapse.js +97 -0
  18. package/dist/components/collapse/context.d.ts +6 -0
  19. package/dist/components/collapse/context.js +12 -0
  20. package/dist/components/collapse/hooks.d.ts +12 -0
  21. package/dist/components/collapse/hooks.js +43 -0
  22. package/dist/components/collapse/index.d.ts +2 -0
  23. package/dist/components/collapse/item.d.ts +4 -0
  24. package/dist/components/collapse/item.js +144 -0
  25. package/dist/components/collapse/types.d.ts +87 -0
  26. package/dist/components/config/context.d.ts +0 -1
  27. package/dist/components/date-picker/date-picker.js +1 -1
  28. package/dist/components/date-picker/hooks.d.ts +1 -5
  29. package/dist/components/date-range-picker/hooks.d.ts +1 -5
  30. package/dist/components/dialog/hooks.d.ts +1 -5
  31. package/dist/components/dialog/popup.js +2 -2
  32. package/dist/components/divider/divider.js +1 -1
  33. package/dist/components/drawer/popup.js +2 -2
  34. package/dist/components/empty/empty.js +1 -1
  35. package/dist/components/form/context.d.ts +0 -1
  36. package/dist/components/form/field/field.d.ts +1 -1
  37. package/dist/components/form/field/field.js +8 -7
  38. package/dist/components/form/field/layout.js +1 -1
  39. package/dist/components/grid/col.js +1 -1
  40. package/dist/components/grid/index.d.ts +0 -1
  41. package/dist/components/grid/row.js +1 -1
  42. package/dist/components/icon/icon.js +2 -2
  43. package/dist/components/icon/icons/index.js +1 -0
  44. package/dist/components/icon/icons/navigation/index.d.ts +2 -1
  45. package/dist/components/icon/icons/navigation/index.js +1 -0
  46. package/dist/components/icon/icons/navigation/unfold-more.d.ts +3 -0
  47. package/dist/components/icon/icons/navigation/unfold-more.js +10 -0
  48. package/dist/components/image/index.d.ts +0 -1
  49. package/dist/components/image/preview/context.d.ts +0 -1
  50. package/dist/components/image/preview/operations.js +1 -1
  51. package/dist/components/image/preview/preview.js +1 -1
  52. package/dist/components/input/input.d.ts +20 -20
  53. package/dist/components/input/input.js +3 -11
  54. package/dist/components/layout/header.js +1 -1
  55. package/dist/components/layout/layout.js +1 -1
  56. package/dist/components/layout/main.d.ts +0 -1
  57. package/dist/components/loading/loading.d.ts +1 -1
  58. package/dist/components/loading/loading.js +70 -5
  59. package/dist/components/loading/types.d.ts +13 -0
  60. package/dist/components/menu/context.d.ts +0 -1
  61. package/dist/components/menu/group.d.ts +2 -2
  62. package/dist/components/menu/group.js +1 -1
  63. package/dist/components/menu/hooks.js +1 -1
  64. package/dist/components/menu/item.d.ts +1 -1
  65. package/dist/components/menu/item.js +1 -1
  66. package/dist/components/notification/holder.js +1 -1
  67. package/dist/components/notification/notification.js +1 -1
  68. package/dist/components/pagination/hooks.d.ts +2 -3
  69. package/dist/components/picker/context.d.ts +0 -1
  70. package/dist/components/picker/picker.js +1 -1
  71. package/dist/components/popover/popover.js +1 -1
  72. package/dist/components/popper/dropdown.js +1 -1
  73. package/dist/components/popper/hooks.d.ts +3 -3
  74. package/dist/components/progress/circular.js +1 -1
  75. package/dist/components/progress/hooks.d.ts +0 -1
  76. package/dist/components/progress/linear.js +1 -1
  77. package/dist/components/radio/context.d.ts +0 -1
  78. package/dist/components/radio/radio.js +22 -13
  79. package/dist/components/rate/rate.js +1 -1
  80. package/dist/components/rate/star.js +12 -14
  81. package/dist/components/ripple/hooks.js +4 -1
  82. package/dist/components/ripple/ripple.js +1 -1
  83. package/dist/components/select/selector.js +1 -1
  84. package/dist/components/select/utils.d.ts +0 -1
  85. package/dist/components/space/space.js +1 -1
  86. package/dist/components/steps/context.d.ts +0 -1
  87. package/dist/components/steps/item.js +1 -1
  88. package/dist/components/steps/steps.js +1 -1
  89. package/dist/components/switch/switch.js +1 -1
  90. package/dist/components/table/body.js +36 -4
  91. package/dist/components/table/context.d.ts +6 -1
  92. package/dist/components/table/context.js +10 -2
  93. package/dist/components/table/header/cell.d.ts +3 -0
  94. package/dist/components/table/header/cell.js +129 -0
  95. package/dist/components/table/{header.d.ts → header/header.d.ts} +1 -1
  96. package/dist/components/table/{header.js → header/header.js} +37 -10
  97. package/dist/components/table/hooks.d.ts +8 -21
  98. package/dist/components/table/hooks.js +36 -58
  99. package/dist/components/table/table.d.ts +1 -1
  100. package/dist/components/table/table.js +12 -6
  101. package/dist/components/table/types.d.ts +72 -4
  102. package/dist/components/tabs/context.d.ts +0 -1
  103. package/dist/components/tabs/item.js +3 -1
  104. package/dist/components/tabs/tabs.js +1 -1
  105. package/dist/components/tag/tag.js +1 -1
  106. package/dist/components/theme/hooks.d.ts +1 -2
  107. package/dist/components/time-picker/panel.js +1 -1
  108. package/dist/components/time-picker/time-picker.js +1 -1
  109. package/dist/components/timeline/context.d.ts +0 -1
  110. package/dist/components/timeline/item.js +1 -1
  111. package/dist/components/tour/tour.js +1 -1
  112. package/dist/components/tree/context.d.ts +0 -1
  113. package/dist/components/tree/hooks.d.ts +0 -1
  114. package/dist/components/tree/list.js +1 -1
  115. package/dist/components/tree/node.js +1 -1
  116. package/dist/components/upload/types.d.ts +8 -6
  117. package/dist/components/upload/upload.d.ts +1 -1
  118. package/dist/components/upload/upload.js +11 -4
  119. package/dist/components/upload/uploadeds.js +8 -3
  120. package/dist/components/waterfall/hooks.d.ts +1 -3
  121. package/dist/components/waterfall/hooks.js +2 -8
  122. package/dist/components/waterfall/sequential.js +1 -1
  123. package/dist/components/waterfall/waterfall.js +10 -6
  124. package/dist/components/watermark/types.d.ts +1 -1
  125. package/dist/components/watermark/watermark.js +1 -1
  126. package/dist/hooks/use-class-names.d.ts +15 -0
  127. package/dist/hooks/use-expand-effect.d.ts +1 -1
  128. package/dist/hooks/use-expand-effect.js +12 -8
  129. package/dist/index.d.ts +1 -0
  130. package/dist/index.js +1 -0
  131. package/dist/stylex.css +22 -7
  132. package/dist/utils/class-name.d.ts +42 -184
  133. package/dist/utils/class-name.js +39 -5
  134. package/dist/utils/styles.d.ts +1 -1
  135. package/package.json +15 -15
  136. /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
  137. /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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @description
4
3
  * count circle path
@@ -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';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ContextValue } from "./types";
3
2
  declare const Context: import("react").Context<ContextValue | null>;
4
3
  export default Context;
@@ -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
- borderColor: "musae-eqt46j",
108
- borderInlineColor: null,
109
- borderInlineStartColor: null,
110
- borderLeftColor: null,
111
- borderInlineEndColor: null,
112
- borderRightColor: null,
113
- borderBlockColor: null,
114
- borderTopColor: null,
115
- borderBottomColor: null,
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
- "--borderColor": props.backgroundColor != null ? props.backgroundColor : "initial",
142
+ "--joftei": props.backgroundColor != null ? props.backgroundColor : "initial",
134
143
  "--1lrm08k": props.backgroundColor != null ? props.backgroundColor : "initial"
135
144
  }],
136
145
  unckecked: {
137
- "::before": null,
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(styled.radio.className, classNames[RadioClassToken.Radio], props$1.className)
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
- leading: {
35
- default: props => [{
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
- trailing: {
58
+ full: {
59
59
  default: {
60
60
  userSelect: "musae-87ps6o",
61
61
  $$css: true
62
62
  },
63
- checkd: props => [{
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
- leading: _stylex.props(styles.leading.default({
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
- trailing: _stylex.props(styles.trailing.default, isFull && styles.trailing.checkd({
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.Leading], styled.leading.className),
121
- style: styled.leading.style,
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.Trailing], styled.trailing.className),
130
- style: styled.trailing.style,
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(crypto.randomUUID(), {
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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Filter, ReadableOptions, ToMenuItem, Value, ValueOrValues } from "./types";
3
2
  import type { Option } from "../../types/option";
4
3
  import type { MenuItem } from "../menu";
@@ -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,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { ContextValue } from "./types";
3
2
  export declare const Context: import("react").Context<ContextValue>;
@@ -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, styles as styles$1 } from './hooks.js';
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$1.cell({
24
- outlineColor: theme.colors[ColorToken.OutlineVariant]
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,3 @@
1
+ import type { HeaderCellProps } from "../types";
2
+ declare const Cell: ({ sortable, children: _children, value, sortDirections: _sortDirections }: HeaderCellProps) => any;
3
+ export default Cell;
@@ -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,4 +1,4 @@
1
1
  import React from "react";
2
- import { HeaderProps } from "./types";
2
+ import type { HeaderProps } from "../types";
3
3
  declare const Header: <T>(props: HeaderProps) => React.JSX.Element | null;
4
4
  export default Header;
@@ -1,20 +1,48 @@
1
1
  import React from 'react';
2
- import { useTable, styles as styles$1 } from './hooks.js';
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';
5
- import { useTheme } from '../theme/hooks.js';
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 '../../utils/colors.js';
8
- import { typography } from '../theme/theme.js';
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
- }), typography.label.small, bordered ? styles.bordered : styles.unbordered({
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 CSSProperties } from "react";
2
- import type { ContextValue, TableProps } from "./types";
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>([columns]: [TableProps<T>["columns"]]) => import("@tanstack/react-table").ColumnDef<T, any>[];
19
- /**
20
- * @author murukal
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>;