musae 1.3.0 → 1.3.1-beta.2

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 (79) hide show
  1. package/dist/__test__/table.test.d.ts +1 -0
  2. package/dist/components/search/search.cjs +3 -1
  3. package/dist/components/search/search.d.ts +1 -0
  4. package/dist/components/search/search.mjs +3 -1
  5. package/dist/components/sheet/sheet.cjs +13 -3
  6. package/dist/components/sheet/sheet.d.ts +1 -1
  7. package/dist/components/sheet/sheet.mjs +13 -3
  8. package/dist/components/side-sheet/__test__/index.test.d.ts +1 -0
  9. package/dist/components/side-sheet/context.cjs +15 -0
  10. package/dist/components/side-sheet/context.d.ts +11 -0
  11. package/dist/components/side-sheet/context.mjs +13 -0
  12. package/dist/components/side-sheet/index.d.ts +2 -0
  13. package/dist/components/side-sheet/side-sheet.cjs +140 -0
  14. package/dist/components/side-sheet/side-sheet.d.ts +16 -0
  15. package/dist/components/side-sheet/side-sheet.mjs +136 -0
  16. package/dist/components/side-sheet/styles.cjs +106 -0
  17. package/dist/components/side-sheet/styles.d.ts +83 -0
  18. package/dist/components/side-sheet/styles.mjs +104 -0
  19. package/dist/components/table/body.cjs +11 -20
  20. package/dist/components/table/body.mjs +12 -21
  21. package/dist/components/table/context.cjs +6 -1
  22. package/dist/components/table/context.d.ts +4 -0
  23. package/dist/components/table/context.mjs +6 -2
  24. package/dist/components/table/header/cell.cjs +7 -23
  25. package/dist/components/table/header/cell.mjs +7 -23
  26. package/dist/components/table/header/header.cjs +3 -31
  27. package/dist/components/table/header/header.mjs +4 -32
  28. package/dist/components/table/hooks.cjs +31 -9
  29. package/dist/components/table/hooks.d.ts +3 -2
  30. package/dist/components/table/hooks.mjs +31 -9
  31. package/dist/components/table/styles.cjs +99 -0
  32. package/dist/components/table/styles.d.ts +84 -0
  33. package/dist/components/table/styles.mjs +95 -0
  34. package/dist/components/table/table.cjs +49 -7
  35. package/dist/components/table/table.d.ts +1 -1
  36. package/dist/components/table/table.mjs +51 -9
  37. package/dist/components/theme/theme.cjs +31 -0
  38. package/dist/components/theme/theme.mjs +31 -1
  39. package/dist/components/theme/tokens.stylex.d.ts +7 -0
  40. package/dist/components/typography/body.cjs +31 -0
  41. package/dist/components/typography/body.d.ts +8 -0
  42. package/dist/components/typography/body.mjs +27 -0
  43. package/dist/components/typography/context.cjs +15 -0
  44. package/dist/components/typography/context.d.ts +11 -0
  45. package/dist/components/typography/context.mjs +13 -0
  46. package/dist/components/typography/display.cjs +31 -0
  47. package/dist/components/typography/display.d.ts +8 -0
  48. package/dist/components/typography/display.mjs +27 -0
  49. package/dist/components/typography/headline.cjs +31 -0
  50. package/dist/components/typography/headline.d.ts +8 -0
  51. package/dist/components/typography/headline.mjs +27 -0
  52. package/dist/components/typography/index.d.ts +2 -0
  53. package/dist/components/typography/label.cjs +31 -0
  54. package/dist/components/typography/label.d.ts +8 -0
  55. package/dist/components/typography/label.mjs +27 -0
  56. package/dist/components/typography/title.cjs +31 -0
  57. package/dist/components/typography/title.d.ts +8 -0
  58. package/dist/components/typography/title.mjs +27 -0
  59. package/dist/components/typography/typography.cjs +24 -0
  60. package/dist/components/typography/typography.d.ts +14 -0
  61. package/dist/components/typography/typography.mjs +15 -0
  62. package/dist/index.cjs +4 -2
  63. package/dist/index.d.ts +2 -1
  64. package/dist/index.mjs +2 -1
  65. package/dist/styles.css +54 -0
  66. package/dist/types/search.d.ts +6 -0
  67. package/dist/types/sheet.d.ts +6 -0
  68. package/dist/types/side-sheet.d.ts +90 -0
  69. package/dist/types/table.d.ts +17 -0
  70. package/dist/types/typography.d.ts +15 -0
  71. package/package.json +2 -2
  72. package/dist/components/drawer/context.cjs +0 -14
  73. package/dist/components/drawer/context.d.ts +0 -10
  74. package/dist/components/drawer/context.mjs +0 -12
  75. package/dist/components/drawer/drawer.cjs +0 -92
  76. package/dist/components/drawer/drawer.d.ts +0 -9
  77. package/dist/components/drawer/drawer.mjs +0 -88
  78. package/dist/components/drawer/index.d.ts +0 -2
  79. package/dist/types/drawer.d.ts +0 -74
@@ -0,0 +1,83 @@
1
+ export declare const styles: {
2
+ panel: Readonly<{
3
+ readonly default: Readonly<{
4
+ readonly backgroundColor: import("@stylexjs/stylex").StyleXClassNameFor<"backgroundColor", "var(--color-surface-container-low)">;
5
+ readonly paddingBottom: import("@stylexjs/stylex").StyleXClassNameFor<"paddingBottom", string>;
6
+ }>;
7
+ }>;
8
+ standard: Readonly<{
9
+ readonly default: Readonly<{
10
+ readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
11
+ readonly flexDirection: import("@stylexjs/stylex").StyleXClassNameFor<"flexDirection", "column">;
12
+ readonly width: import("@stylexjs/stylex").StyleXClassNameFor<"width", "var(--size)">;
13
+ readonly height: import("@stylexjs/stylex").StyleXClassNameFor<"height", string>;
14
+ readonly flexShrink: import("@stylexjs/stylex").StyleXClassNameFor<"flexShrink", 0>;
15
+ readonly backgroundColor: import("@stylexjs/stylex").StyleXClassNameFor<"backgroundColor", "var(--color-surface)">;
16
+ readonly paddingBottom: import("@stylexjs/stylex").StyleXClassNameFor<"paddingBottom", string>;
17
+ }>;
18
+ readonly right: Readonly<{
19
+ readonly borderLeftWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderLeftWidth", string>;
20
+ readonly borderLeftStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderLeftStyle", "solid">;
21
+ readonly borderLeftColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderLeftColor", "var(--color-outline-variant)">;
22
+ }>;
23
+ readonly left: Readonly<{
24
+ readonly borderRightWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderRightWidth", string>;
25
+ readonly borderRightStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderRightStyle", "solid">;
26
+ readonly borderRightColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderRightColor", "var(--color-outline-variant)">;
27
+ }>;
28
+ readonly top: Readonly<{
29
+ readonly borderBottomWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderBottomWidth", string>;
30
+ readonly borderBottomStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderBottomStyle", "solid">;
31
+ readonly borderBottomColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderBottomColor", "var(--color-outline-variant)">;
32
+ }>;
33
+ readonly bottom: Readonly<{
34
+ readonly borderTopWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderTopWidth", string>;
35
+ readonly borderTopStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderTopStyle", "solid">;
36
+ readonly borderTopColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderTopColor", "var(--color-outline-variant)">;
37
+ }>;
38
+ }>;
39
+ header: Readonly<{
40
+ readonly default: Readonly<{
41
+ readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
42
+ readonly alignItems: import("@stylexjs/stylex").StyleXClassNameFor<"alignItems", "flex-start">;
43
+ readonly paddingTop: import("@stylexjs/stylex").StyleXClassNameFor<"paddingTop", string>;
44
+ readonly paddingBottom: import("@stylexjs/stylex").StyleXClassNameFor<"paddingBottom", string>;
45
+ readonly paddingInlineEnd: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInlineEnd", string>;
46
+ }>;
47
+ readonly withTitle: Readonly<{
48
+ readonly paddingInlineStart: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInlineStart", string>;
49
+ }>;
50
+ readonly withBack: Readonly<{
51
+ readonly paddingInlineStart: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInlineStart", string>;
52
+ }>;
53
+ }>;
54
+ title: Readonly<{
55
+ readonly default: Readonly<{
56
+ readonly flex: import("@stylexjs/stylex").StyleXClassNameFor<"flex", 1>;
57
+ readonly minWidth: import("@stylexjs/stylex").StyleXClassNameFor<"minWidth", 0>;
58
+ readonly paddingTop: import("@stylexjs/stylex").StyleXClassNameFor<"paddingTop", string>;
59
+ readonly color: import("@stylexjs/stylex").StyleXClassNameFor<"color", "var(--color-on-surface-variant)">;
60
+ }>;
61
+ }>;
62
+ content: Readonly<{
63
+ readonly default: Readonly<{
64
+ readonly flex: import("@stylexjs/stylex").StyleXClassNameFor<"flex", 1>;
65
+ readonly minHeight: import("@stylexjs/stylex").StyleXClassNameFor<"minHeight", 0>;
66
+ readonly overflow: import("@stylexjs/stylex").StyleXClassNameFor<"overflow", "auto">;
67
+ readonly overscrollBehavior: import("@stylexjs/stylex").StyleXClassNameFor<"overscrollBehavior", "contain">;
68
+ }>;
69
+ }>;
70
+ actions: Readonly<{
71
+ readonly default: Readonly<{
72
+ readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
73
+ readonly flexDirection: import("@stylexjs/stylex").StyleXClassNameFor<"flexDirection", "column">;
74
+ }>;
75
+ readonly row: Readonly<{
76
+ readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
77
+ readonly alignItems: import("@stylexjs/stylex").StyleXClassNameFor<"alignItems", "center">;
78
+ readonly gap: import("@stylexjs/stylex").StyleXClassNameFor<"gap", string>;
79
+ readonly paddingTop: import("@stylexjs/stylex").StyleXClassNameFor<"paddingTop", string>;
80
+ readonly paddingInline: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInline", string>;
81
+ }>;
82
+ }>;
83
+ };
@@ -0,0 +1,104 @@
1
+ var panel = {
2
+ "default": {
3
+ kWkggS: "musaex-1eai1fy",
4
+ kGO01o: "musaex-1oxn6w8",
5
+ $$css: true
6
+ }
7
+ };
8
+ var standard = {
9
+ "default": {
10
+ k1xSpc: "musaex-78zum5",
11
+ kXwgrk: "musaex-dt5ytf",
12
+ kzqmXN: "musaex-1fjlwjz",
13
+ kZKoxP: "musaex-qg7gut",
14
+ kmuXW: "musaex-2lah0s",
15
+ kWkggS: "musaex-k7eln3",
16
+ kGO01o: "musaex-1oxn6w8",
17
+ $$css: true
18
+ },
19
+ right: {
20
+ kZ1KPB: "musaex-6vwjc",
21
+ k4WBpm: "musaex-19ypqd9",
22
+ kaZRDh: "musaex-svd4c5",
23
+ $$css: true
24
+ },
25
+ left: {
26
+ kWqL5O: "musaex-a640vs",
27
+ kSWEuD: "musaex-32b0ac",
28
+ k26BEO: "musaex-imfbgf",
29
+ $$css: true
30
+ },
31
+ top: {
32
+ kt9PQ7: "musaex-d1xpcx",
33
+ kfdmCh: "musaex-1q0q8m5",
34
+ kL6WhQ: "musaex-quqrak",
35
+ $$css: true
36
+ },
37
+ bottom: {
38
+ kEafiO: "musaex-uvson1",
39
+ kPef9Z: "musaex-13fuv20",
40
+ kLZC3w: "musaex-6ogecl",
41
+ $$css: true
42
+ }
43
+ };
44
+ var header = {
45
+ "default": {
46
+ k1xSpc: "musaex-78zum5",
47
+ kGNEyG: "musaex-1cy8zhl",
48
+ kLKAdn: "musaex-h1u3e4",
49
+ kGO01o: "musaex-5ynjmo",
50
+ kwRFfy: "musaex-1max5gj",
51
+ $$css: true
52
+ },
53
+ withTitle: {
54
+ kZCmMZ: "musaex-150i2hq",
55
+ $$css: true
56
+ },
57
+ withBack: {
58
+ kZCmMZ: "musaex-1rl4tsp",
59
+ $$css: true
60
+ }
61
+ };
62
+ var content = {
63
+ "default": {
64
+ kUk6DE: "musaex-98rzlu",
65
+ kAzted: "musaex-2lwn1j",
66
+ kVQacm: "musaex-ysyzu8",
67
+ kZeWKH: "musaex-ish69e",
68
+ $$css: true
69
+ }
70
+ };
71
+ var title = {
72
+ "default": {
73
+ kUk6DE: "musaex-98rzlu",
74
+ k7Eaqz: "musaex-euugli",
75
+ kLKAdn: "musaex-h1u3e4",
76
+ kMwMTN: "musaex-bq1wot",
77
+ $$css: true
78
+ }
79
+ };
80
+ var actions = {
81
+ "default": {
82
+ k1xSpc: "musaex-78zum5",
83
+ kXwgrk: "musaex-dt5ytf",
84
+ $$css: true
85
+ },
86
+ row: {
87
+ k1xSpc: "musaex-78zum5",
88
+ kGNEyG: "musaex-6s0dn4",
89
+ kOIVth: "musaex-1wm2zkp",
90
+ kLKAdn: "musaex-1oop6c3",
91
+ kg3NbH: "musaex-1pyhihf",
92
+ $$css: true
93
+ }
94
+ };
95
+ var styles = {
96
+ panel: panel,
97
+ standard: standard,
98
+ header: header,
99
+ title: title,
100
+ content: content,
101
+ actions: actions
102
+ };
103
+
104
+ export { styles };
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
5
6
  var React = require('react');
6
7
  var context = require('./context.cjs');
7
8
  var reactTable = require('@tanstack/react-table');
@@ -11,23 +12,8 @@ var empty = require('../empty/empty.cjs');
11
12
  var className = require('@aiszlab/relax/class-name');
12
13
  var theme = require('../theme/theme.cjs');
13
14
  var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
15
+ var styles = require('./styles.cjs');
14
16
 
15
- var styles = {
16
- cell: {
17
- kjGldf: "musaex-aafj1c",
18
- kEafiO: "musaex-1ndz9a0",
19
- kg3NbH: "musaex-1g3a7fl",
20
- k8WAf4: "musaex-s7sbuz",
21
- kVAM5u: "musaex-axmpxa",
22
- ksu8eU: "musaex-1y0btm7",
23
- kt9PQ7: "musaex-d1xpcx",
24
- $$css: true
25
- },
26
- bordered: {
27
- kjGldf: "musaex-imutj9",
28
- $$css: true
29
- }
30
- };
31
17
  var Body = function Body() {
32
18
  var _useTable = context.useTable(),
33
19
  table = _useTable.table,
@@ -35,7 +21,7 @@ var Body = function Body() {
35
21
  classNames = _useTable.classNames;
36
22
  var _themeColorVars = useThemeColorVars.useThemeColorVars(["outline-variant"]);
37
23
  if (!table) return null;
38
- var styled = stylex.props(styles.cell, bordered && styles.bordered, theme.$body.small);
24
+ var styled = stylex.props(styles.default.bodyCell["default"], bordered && styles.default.bodyCell.bordered, theme.$body.small);
39
25
  var rows = table.getRowModel().rows;
40
26
  var _isEmpty = relax.isEmpty(rows);
41
27
  return /*#__PURE__*/React.createElement("tbody", {
@@ -45,12 +31,17 @@ var Body = function Body() {
45
31
  colSpan: table.getAllColumns().length
46
32
  }, /*#__PURE__*/React.createElement(empty.default, null)))), !_isEmpty && table.getRowModel().rows.map(function (row) {
47
33
  return /*#__PURE__*/React.createElement("tr", {
48
- key: row.id
34
+ key: row.id,
35
+ className: className.stringify(row.getCanExpand() && classNames.expandableRow, row.depth > 0 && classNames.childRow)
49
36
  }, row.getVisibleCells().map(function (cell) {
37
+ var isFirstChildDataCell = row.depth > 0 && cell.column.id !== context.EXPAND_COLUMN_ID && cell.column.getIndex() === 1;
38
+ var cellStyled = stylex.props(isFirstChildDataCell && styles.default.bodyCell.child);
50
39
  return /*#__PURE__*/React.createElement("td", {
51
40
  key: cell.id,
52
- className: className.stringify(styled.className),
53
- style: styled.style
41
+ className: className.stringify(styled.className, cellStyled.className, cell.column.id === context.EXPAND_COLUMN_ID && classNames.expandColumn),
42
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), cellStyled.style), isFirstChildDataCell && {
43
+ "--depth": row.depth
44
+ })
54
45
  }, reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()));
55
46
  }));
56
47
  }));
@@ -1,5 +1,6 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
2
  import React from 'react';
2
- import { useTable } from './context.mjs';
3
+ import { useTable, EXPAND_COLUMN_ID } from './context.mjs';
3
4
  import { flexRender } from '@tanstack/react-table';
4
5
  import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
5
6
  import { isEmpty } from '@aiszlab/relax';
@@ -7,23 +8,8 @@ import Empty from '../empty/empty.mjs';
7
8
  import { stringify } from '@aiszlab/relax/class-name';
8
9
  import { $body } from '../theme/theme.mjs';
9
10
  import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
11
+ import styles from './styles.mjs';
10
12
 
11
- var styles = {
12
- cell: {
13
- kjGldf: "musaex-aafj1c",
14
- kEafiO: "musaex-1ndz9a0",
15
- kg3NbH: "musaex-1g3a7fl",
16
- k8WAf4: "musaex-s7sbuz",
17
- kVAM5u: "musaex-axmpxa",
18
- ksu8eU: "musaex-1y0btm7",
19
- kt9PQ7: "musaex-d1xpcx",
20
- $$css: true
21
- },
22
- bordered: {
23
- kjGldf: "musaex-imutj9",
24
- $$css: true
25
- }
26
- };
27
13
  var Body = function Body() {
28
14
  var _useTable = useTable(),
29
15
  table = _useTable.table,
@@ -31,7 +17,7 @@ var Body = function Body() {
31
17
  classNames = _useTable.classNames;
32
18
  var _themeColorVars = useThemeColorVars(["outline-variant"]);
33
19
  if (!table) return null;
34
- var styled = props(styles.cell, bordered && styles.bordered, $body.small);
20
+ var styled = props(styles.bodyCell["default"], bordered && styles.bodyCell.bordered, $body.small);
35
21
  var rows = table.getRowModel().rows;
36
22
  var _isEmpty = isEmpty(rows);
37
23
  return /*#__PURE__*/React.createElement("tbody", {
@@ -41,12 +27,17 @@ var Body = function Body() {
41
27
  colSpan: table.getAllColumns().length
42
28
  }, /*#__PURE__*/React.createElement(Empty, null)))), !_isEmpty && table.getRowModel().rows.map(function (row) {
43
29
  return /*#__PURE__*/React.createElement("tr", {
44
- key: row.id
30
+ key: row.id,
31
+ className: stringify(row.getCanExpand() && classNames.expandableRow, row.depth > 0 && classNames.childRow)
45
32
  }, row.getVisibleCells().map(function (cell) {
33
+ var isFirstChildDataCell = row.depth > 0 && cell.column.id !== EXPAND_COLUMN_ID && cell.column.getIndex() === 1;
34
+ var cellStyled = props(isFirstChildDataCell && styles.bodyCell.child);
46
35
  return /*#__PURE__*/React.createElement("td", {
47
36
  key: cell.id,
48
- className: stringify(styled.className),
49
- style: styled.style
37
+ className: stringify(styled.className, cellStyled.className, cell.column.id === EXPAND_COLUMN_ID && classNames.expandColumn),
38
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), cellStyled.style), isFirstChildDataCell && {
39
+ "--depth": row.depth
40
+ })
50
41
  }, flexRender(cell.column.columnDef.cell, cell.getContext()));
51
42
  }));
52
43
  }));
@@ -2,10 +2,14 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
+ var EXPAND_COLUMN_ID = "__table_expand";
5
6
  var CLASS_NAMES = {
6
7
  table: "table",
7
8
  header: "table__header",
8
- body: "table__body"
9
+ body: "table__body",
10
+ expandColumn: "table__expand-column",
11
+ expandableRow: "table__row--expandable",
12
+ childRow: "table__row--child"
9
13
  };
10
14
  var Context = /*#__PURE__*/React.createContext({
11
15
  bordered: false,
@@ -22,4 +26,5 @@ var useTable = function useTable() {
22
26
 
23
27
  exports.CLASS_NAMES = CLASS_NAMES;
24
28
  exports.Context = Context;
29
+ exports.EXPAND_COLUMN_ID = EXPAND_COLUMN_ID;
25
30
  exports.useTable = useTable;
@@ -1,8 +1,12 @@
1
1
  import type { ContextValue } from "../../types/table";
2
+ export declare const EXPAND_COLUMN_ID = "__table_expand";
2
3
  export declare const CLASS_NAMES: {
3
4
  readonly table: "table";
4
5
  readonly header: "table__header";
5
6
  readonly body: "table__body";
7
+ readonly expandColumn: "table__expand-column";
8
+ readonly expandableRow: "table__row--expandable";
9
+ readonly childRow: "table__row--child";
6
10
  };
7
11
  declare const Context: import("react").Context<ContextValue<unknown> & {
8
12
  classNames: typeof CLASS_NAMES;
@@ -1,9 +1,13 @@
1
1
  import { createContext, useContext } from 'react';
2
2
 
3
+ var EXPAND_COLUMN_ID = "__table_expand";
3
4
  var CLASS_NAMES = {
4
5
  table: "table",
5
6
  header: "table__header",
6
- body: "table__body"
7
+ body: "table__body",
8
+ expandColumn: "table__expand-column",
9
+ expandableRow: "table__row--expandable",
10
+ childRow: "table__row--child"
7
11
  };
8
12
  var Context = /*#__PURE__*/createContext({
9
13
  bordered: false,
@@ -18,4 +22,4 @@ var useTable = function useTable() {
18
22
  return useContext(Context);
19
23
  };
20
24
 
21
- export { CLASS_NAMES, Context, useTable };
25
+ export { CLASS_NAMES, Context, EXPAND_COLUMN_ID, useTable };
@@ -5,8 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
6
  var React = require('react');
7
7
  var relax = require('@aiszlab/relax');
8
+ var stylex = require('../../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
8
9
  var context = require('../context.cjs');
9
10
  var useThemeColorVars = require('../../../hooks/use-theme-color-vars.cjs');
11
+ var styles = require('../styles.cjs');
10
12
  var unfoldMore = require('../../icon/icons/navigation/unfold-more.cjs');
11
13
 
12
14
  var Cell = function Cell(_ref) {
@@ -45,29 +47,11 @@ var Cell = function Cell(_ref) {
45
47
  return children;
46
48
  }
47
49
  var styled = {
48
- cell: {
49
- className: "musaex-78zum5 musaex-1qughib musaex-6s0dn4"
50
- },
51
- handlers: {
52
- className: "musaex-3nfvp2 musaex-1q0g3np musaex-15wobh7 musaex-14kusyn musaex-87ps6o"
53
- },
54
- sort: {
55
- className: "musaex-1n2onr6 musaex-1ypdohk"
56
- },
57
- fullSort: {
58
- 0: {},
59
- 1: {
60
- className: "musaex-14qql8p"
61
- }
62
- }[!!(sort === "descending") << 0],
63
- halfSort: {
64
- 0: {
65
- className: "musaex-10l6tqk musaex-13vifvy musaex-1o0tod musaex-11g3na9 musaex-b3r6kr"
66
- },
67
- 1: {
68
- className: "musaex-10l6tqk musaex-13vifvy musaex-1o0tod musaex-11g3na9 musaex-b3r6kr musaex-14qql8p"
69
- }
70
- }[!!(sort === "ascending") << 0]
50
+ cell: stylex.props(styles.default.headerContent["default"]),
51
+ handlers: stylex.props(styles.default.headerContent.handlers),
52
+ sort: stylex.props(styles.default.sort["default"]),
53
+ fullSort: stylex.props(sort === "descending" && styles.default.sort.checked),
54
+ halfSort: stylex.props(styles.default.sort.half, sort === "ascending" && styles.default.sort.checked)
71
55
  };
72
56
  return /*#__PURE__*/React.createElement("div", {
73
57
  className: styled.cell.className,
@@ -1,8 +1,10 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import React, { useMemo } from 'react';
3
3
  import { toFunction, useEvent } from '@aiszlab/relax';
4
+ import { props } from '../../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
4
5
  import { useTable } from '../context.mjs';
5
6
  import { useThemeColorVars } from '../../../hooks/use-theme-color-vars.mjs';
7
+ import styles from '../styles.mjs';
6
8
  import IconUnfoldMore from '../../icon/icons/navigation/unfold-more.mjs';
7
9
 
8
10
  var Cell = function Cell(_ref) {
@@ -41,29 +43,11 @@ var Cell = function Cell(_ref) {
41
43
  return children;
42
44
  }
43
45
  var styled = {
44
- cell: {
45
- className: "musaex-78zum5 musaex-1qughib musaex-6s0dn4"
46
- },
47
- handlers: {
48
- className: "musaex-3nfvp2 musaex-1q0g3np musaex-15wobh7 musaex-14kusyn musaex-87ps6o"
49
- },
50
- sort: {
51
- className: "musaex-1n2onr6 musaex-1ypdohk"
52
- },
53
- fullSort: {
54
- 0: {},
55
- 1: {
56
- className: "musaex-14qql8p"
57
- }
58
- }[!!(sort === "descending") << 0],
59
- halfSort: {
60
- 0: {
61
- className: "musaex-10l6tqk musaex-13vifvy musaex-1o0tod musaex-11g3na9 musaex-b3r6kr"
62
- },
63
- 1: {
64
- className: "musaex-10l6tqk musaex-13vifvy musaex-1o0tod musaex-11g3na9 musaex-b3r6kr musaex-14qql8p"
65
- }
66
- }[!!(sort === "ascending") << 0]
46
+ cell: props(styles.headerContent["default"]),
47
+ handlers: props(styles.headerContent.handlers),
48
+ sort: props(styles.sort["default"]),
49
+ fullSort: props(sort === "descending" && styles.sort.checked),
50
+ halfSort: props(styles.sort.half, sort === "ascending" && styles.sort.checked)
67
51
  };
68
52
  return /*#__PURE__*/React.createElement("div", {
69
53
  className: styled.cell.className,
@@ -10,36 +10,8 @@ var stylex = require('../../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_m
10
10
  var className = require('@aiszlab/relax/class-name');
11
11
  var theme = require('../../theme/theme.cjs');
12
12
  var useThemeColorVars = require('../../../hooks/use-theme-color-vars.cjs');
13
+ var styles = require('../styles.cjs');
13
14
 
14
- var styles = {
15
- cell: {
16
- kMzoRj: "musaex-k59kd",
17
- kWkggS: "musaex-k7eln3",
18
- kVAM5u: "musaex-axmpxa",
19
- k9WMMc: "musaex-1yc453h",
20
- kVAEAm: "musaex-1n2onr6",
21
- kg3NbH: "musaex-1g3a7fl",
22
- k8WAf4: "musaex-s7sbuz",
23
- ksu8eU: "musaex-1y0btm7",
24
- kt9PQ7: "musaex-d1xpcx",
25
- $$css: true
26
- },
27
- unbordered: {
28
- kI9HWG: "musaex-x7gz8e",
29
- ko2eyy: "musaex-no41pc",
30
- kqR9dF: "musaex-1o8gf8",
31
- kpPfZE: "musaex-1rvbi93",
32
- kOSWPn: "musaex-8l2ero",
33
- kQUujV: "musaex-11jkr13",
34
- knGBE: "musaex-1kmnipp",
35
- kpnlHG: "musaex-192i3sz",
36
- $$css: true
37
- },
38
- bordered: {
39
- kMzoRj: "musaex-1iyq3db",
40
- $$css: true
41
- }
42
- };
43
15
  var Header = function Header(props) {
44
16
  var _useTable = context.useTable(),
45
17
  table = _useTable.table,
@@ -48,7 +20,7 @@ var Header = function Header(props) {
48
20
  var _themeColorVars = useThemeColorVars.useThemeColorVars(["surface", "outline-variant"]);
49
21
  if (!table) return null;
50
22
  var headerGroups = table.getHeaderGroups();
51
- var styled = stylex.props(styles.cell, theme.$label.small, bordered && styles.bordered, !bordered && styles.unbordered);
23
+ var styled = stylex.props(styles.default.headerCell["default"], theme.$label.small, bordered && styles.default.headerCell.bordered, !bordered && styles.default.headerCell.unbordered);
52
24
  return /*#__PURE__*/React.createElement("thead", {
53
25
  className: className.stringify(classNames.header, props.className),
54
26
  style: _objectSpread(_objectSpread({}, styled.style), _themeColorVars)
@@ -58,7 +30,7 @@ var Header = function Header(props) {
58
30
  }, headerGroup.headers.map(function (header) {
59
31
  return /*#__PURE__*/React.createElement("th", {
60
32
  key: header.id,
61
- className: className.stringify(styled.className),
33
+ className: className.stringify(styled.className, header.column.id === context.EXPAND_COLUMN_ID && classNames.expandColumn),
62
34
  style: styled.style
63
35
  }, header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()));
64
36
  }));
@@ -1,41 +1,13 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import React from 'react';
3
- import { useTable } from '../context.mjs';
3
+ import { useTable, EXPAND_COLUMN_ID } from '../context.mjs';
4
4
  import { flexRender } from '@tanstack/react-table';
5
5
  import { props } from '../../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
6
6
  import { stringify } from '@aiszlab/relax/class-name';
7
7
  import { $label } from '../../theme/theme.mjs';
8
8
  import { useThemeColorVars } from '../../../hooks/use-theme-color-vars.mjs';
9
+ import styles from '../styles.mjs';
9
10
 
10
- var styles = {
11
- cell: {
12
- kMzoRj: "musaex-k59kd",
13
- kWkggS: "musaex-k7eln3",
14
- kVAM5u: "musaex-axmpxa",
15
- k9WMMc: "musaex-1yc453h",
16
- kVAEAm: "musaex-1n2onr6",
17
- kg3NbH: "musaex-1g3a7fl",
18
- k8WAf4: "musaex-s7sbuz",
19
- ksu8eU: "musaex-1y0btm7",
20
- kt9PQ7: "musaex-d1xpcx",
21
- $$css: true
22
- },
23
- unbordered: {
24
- kI9HWG: "musaex-x7gz8e",
25
- ko2eyy: "musaex-no41pc",
26
- kqR9dF: "musaex-1o8gf8",
27
- kpPfZE: "musaex-1rvbi93",
28
- kOSWPn: "musaex-8l2ero",
29
- kQUujV: "musaex-11jkr13",
30
- knGBE: "musaex-1kmnipp",
31
- kpnlHG: "musaex-192i3sz",
32
- $$css: true
33
- },
34
- bordered: {
35
- kMzoRj: "musaex-1iyq3db",
36
- $$css: true
37
- }
38
- };
39
11
  var Header = function Header(props$1) {
40
12
  var _useTable = useTable(),
41
13
  table = _useTable.table,
@@ -44,7 +16,7 @@ var Header = function Header(props$1) {
44
16
  var _themeColorVars = useThemeColorVars(["surface", "outline-variant"]);
45
17
  if (!table) return null;
46
18
  var headerGroups = table.getHeaderGroups();
47
- var styled = props(styles.cell, $label.small, bordered && styles.bordered, !bordered && styles.unbordered);
19
+ var styled = props(styles.headerCell["default"], $label.small, bordered && styles.headerCell.bordered, !bordered && styles.headerCell.unbordered);
48
20
  return /*#__PURE__*/React.createElement("thead", {
49
21
  className: stringify(classNames.header, props$1.className),
50
22
  style: _objectSpread(_objectSpread({}, styled.style), _themeColorVars)
@@ -54,7 +26,7 @@ var Header = function Header(props$1) {
54
26
  }, headerGroup.headers.map(function (header) {
55
27
  return /*#__PURE__*/React.createElement("th", {
56
28
  key: header.id,
57
- className: stringify(styled.className),
29
+ className: stringify(styled.className, header.column.id === EXPAND_COLUMN_ID && classNames.expandColumn),
58
30
  style: styled.style
59
31
  }, header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()));
60
32
  }));
@@ -1,20 +1,27 @@
1
1
  'use strict';
2
2
 
3
3
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
4
5
  var reactTable = require('@tanstack/react-table');
5
6
  var React = require('react');
6
7
  var cell = require('./header/cell.cjs');
7
8
  var relax = require('@aiszlab/relax');
9
+ var context = require('./context.cjs');
10
+ var button = require('../button/button.cjs');
11
+ var expandLess = require('../icon/icons/navigation/expand-less.cjs');
12
+ var expandMore = require('../icon/icons/navigation/expand-more.cjs');
8
13
 
9
14
  /**
10
15
  * @description
11
16
  * use columns
12
17
  */
13
18
  var useColumns = function useColumns(_ref) {
14
- var columns = _ref.columns;
19
+ var columns = _ref.columns,
20
+ _ref$expandable = _ref.expandable,
21
+ expandable = _ref$expandable === void 0 ? false : _ref$expandable;
15
22
  var helper = React.useRef(reactTable.createColumnHelper());
16
23
  return React.useMemo(function () {
17
- return columns.map(function (_ref2, index) {
24
+ var dataColumns = columns.map(function (_ref2, index) {
18
25
  var _ref3;
19
26
  var key = _ref2.key,
20
27
  render = _ref2.render,
@@ -41,19 +48,34 @@ var useColumns = function useColumns(_ref) {
41
48
  }
42
49
  });
43
50
  });
44
- }, [columns]);
51
+ if (!expandable) return dataColumns;
52
+ return [helper.current.display({
53
+ id: context.EXPAND_COLUMN_ID,
54
+ header: null,
55
+ cell: function cell(_ref4) {
56
+ var row = _ref4.row;
57
+ return row.getCanExpand() ? (/*#__PURE__*/React.createElement(button.Button, {
58
+ variant: "text",
59
+ size: "small",
60
+ "aria-label": row.getIsExpanded() ? "收起" : "展开",
61
+ "aria-expanded": row.getIsExpanded(),
62
+ onClick: row.getToggleExpandedHandler()
63
+ }, row.getIsExpanded() ? /*#__PURE__*/React.createElement(expandLess.default, null) : /*#__PURE__*/React.createElement(expandMore.default, null))) : null;
64
+ }
65
+ })].concat(_toConsumableArray(dataColumns));
66
+ }, [columns, expandable]);
45
67
  };
46
68
  /**
47
69
  * @author murukal
48
70
  * @description
49
71
  * for context value
50
72
  */
51
- var useContextValue = function useContextValue(_ref4) {
52
- var _table = _ref4.table,
53
- bordered = _ref4.bordered,
54
- _sortDescriptor = _ref4.sortDescriptor,
55
- _onSortChange = _ref4.onSortChange,
56
- classNames = _ref4.classNames;
73
+ var useContextValue = function useContextValue(_ref5) {
74
+ var _table = _ref5.table,
75
+ bordered = _ref5.bordered,
76
+ _sortDescriptor = _ref5.sortDescriptor,
77
+ _onSortChange = _ref5.onSortChange,
78
+ classNames = _ref5.classNames;
57
79
  var _useControlledState = relax.useControlledState(_sortDescriptor),
58
80
  _useControlledState2 = _slicedToArray(_useControlledState, 2),
59
81
  sortDescriptor = _useControlledState2[0],