@alveole/components 1.9.0 → 1.10.0

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/generated/version.d.ts +1 -1
  2. package/dist/generated/version.d.ts.map +1 -1
  3. package/dist/generated/version.js +1 -1
  4. package/dist/stories/index.d.ts +1 -0
  5. package/dist/stories/index.d.ts.map +1 -1
  6. package/dist/stories/index.js +1 -0
  7. package/dist/ui/ActionMenu/ActionMenu.stories.d.ts +1 -0
  8. package/dist/ui/ActionMenu/ActionMenu.stories.d.ts.map +1 -1
  9. package/dist/ui/ActionMenu/ActionMenu.stories.js +2 -1
  10. package/dist/ui/Button/Button.d.ts +4 -2
  11. package/dist/ui/Button/Button.d.ts.map +1 -1
  12. package/dist/ui/Button/Button.js +19 -10
  13. package/dist/ui/Button/Button.stories.d.ts +6 -1
  14. package/dist/ui/Button/Button.stories.d.ts.map +1 -1
  15. package/dist/ui/Button/Button.stories.js +2 -0
  16. package/dist/ui/Button/Button.stories.sources.d.ts +2 -0
  17. package/dist/ui/Button/Button.stories.sources.d.ts.map +1 -1
  18. package/dist/ui/Button/Button.stories.sources.js +3 -0
  19. package/dist/ui/Button/Button.styles.d.ts +3 -0
  20. package/dist/ui/Button/Button.styles.d.ts.map +1 -1
  21. package/dist/ui/Button/Button.styles.js +3 -0
  22. package/dist/ui/Checkbox/Checkbox.d.ts +2 -1
  23. package/dist/ui/Checkbox/Checkbox.d.ts.map +1 -1
  24. package/dist/ui/Checkbox/Checkbox.js +3 -4
  25. package/dist/ui/Checkbox/Checkbox.stories.d.ts +3 -2
  26. package/dist/ui/Checkbox/Checkbox.stories.d.ts.map +1 -1
  27. package/dist/ui/Checkbox/Checkbox.stories.js +1 -1
  28. package/dist/ui/Checkbox/Checkbox.stories.sources.d.ts +2 -2
  29. package/dist/ui/Checkbox/Checkbox.stories.sources.d.ts.map +1 -1
  30. package/dist/ui/Checkbox/Checkbox.stories.sources.js +2 -2
  31. package/dist/ui/Checkbox/Checkbox.utils.d.ts +5 -0
  32. package/dist/ui/Checkbox/Checkbox.utils.d.ts.map +1 -0
  33. package/dist/ui/Checkbox/Checkbox.utils.js +7 -0
  34. package/dist/ui/Checkbox/CheckboxContainer.d.ts +7 -2
  35. package/dist/ui/Checkbox/CheckboxContainer.d.ts.map +1 -1
  36. package/dist/ui/Checkbox/CheckboxContainer.js +4 -2
  37. package/dist/ui/Checkbox/CheckboxIndicator.d.ts +4 -1
  38. package/dist/ui/Checkbox/CheckboxIndicator.d.ts.map +1 -1
  39. package/dist/ui/Checkbox/CheckboxIndicator.js +5 -3
  40. package/dist/ui/Checkbox/CheckboxLabel.d.ts +4 -1
  41. package/dist/ui/Checkbox/CheckboxLabel.d.ts.map +1 -1
  42. package/dist/ui/Checkbox/CheckboxLabel.js +4 -2
  43. package/dist/ui/DataTable/DataTable.d.ts +27 -0
  44. package/dist/ui/DataTable/DataTable.d.ts.map +1 -0
  45. package/dist/ui/DataTable/DataTable.js +58 -0
  46. package/dist/ui/DataTable/DataTable.stories.d.ts +205 -0
  47. package/dist/ui/DataTable/DataTable.stories.d.ts.map +1 -0
  48. package/dist/ui/DataTable/DataTable.stories.js +499 -0
  49. package/dist/ui/DataTable/DataTable.stories.sources.d.ts +25 -0
  50. package/dist/ui/DataTable/DataTable.stories.sources.d.ts.map +1 -0
  51. package/dist/ui/DataTable/DataTable.stories.sources.js +27 -0
  52. package/dist/ui/DataTable/DataTable.styles.d.ts +175 -0
  53. package/dist/ui/DataTable/DataTable.styles.d.ts.map +1 -0
  54. package/dist/ui/DataTable/DataTable.styles.js +163 -0
  55. package/dist/ui/DataTable/DataTable.types.d.ts +20 -0
  56. package/dist/ui/DataTable/DataTable.types.d.ts.map +1 -0
  57. package/dist/ui/DataTable/DataTable.types.js +1 -0
  58. package/dist/ui/DataTable/DataTableCell.d.ts +12 -0
  59. package/dist/ui/DataTable/DataTableCell.d.ts.map +1 -0
  60. package/dist/ui/DataTable/DataTableCell.js +18 -0
  61. package/dist/ui/DataTable/DataTableFooter.d.ts +8 -0
  62. package/dist/ui/DataTable/DataTableFooter.d.ts.map +1 -0
  63. package/dist/ui/DataTable/DataTableFooter.js +26 -0
  64. package/dist/ui/DataTable/DataTableHeaderCell.d.ts +9 -0
  65. package/dist/ui/DataTable/DataTableHeaderCell.d.ts.map +1 -0
  66. package/dist/ui/DataTable/DataTableHeaderCell.js +12 -0
  67. package/dist/ui/DataTable/DataTablePagination.d.ts +12 -0
  68. package/dist/ui/DataTable/DataTablePagination.d.ts.map +1 -0
  69. package/dist/ui/DataTable/DataTablePagination.js +78 -0
  70. package/dist/ui/DataTable/DataTableRow.d.ts +16 -0
  71. package/dist/ui/DataTable/DataTableRow.d.ts.map +1 -0
  72. package/dist/ui/DataTable/DataTableRow.js +26 -0
  73. package/dist/ui/DataTable/index.d.ts +5 -0
  74. package/dist/ui/DataTable/index.d.ts.map +1 -0
  75. package/dist/ui/DataTable/index.js +4 -0
  76. package/dist/ui/index.d.ts +1 -0
  77. package/dist/ui/index.d.ts.map +1 -1
  78. package/dist/ui/index.js +1 -0
  79. package/package.json +7 -7
@@ -0,0 +1,175 @@
1
+ export declare const useStyles: () => {
2
+ table: {
3
+ display: "flex";
4
+ flexDirection: "column";
5
+ borderWidth: number;
6
+ borderColor: string;
7
+ borderRadius: import("@alveole/theme").Radius;
8
+ overflow: "hidden";
9
+ backgroundColor: string;
10
+ };
11
+ scrollContent: {
12
+ display: "flex";
13
+ flexDirection: "column";
14
+ flexGrow: number;
15
+ minWidth: string;
16
+ };
17
+ headerRow: {
18
+ display: "flex";
19
+ flexDirection: "row";
20
+ alignItems: "stretch";
21
+ backgroundColor: string;
22
+ borderBottomWidth: number;
23
+ borderBottomColor: string;
24
+ };
25
+ headerRowSm: {
26
+ minHeight: number;
27
+ };
28
+ headerRowMd: {
29
+ minHeight: number;
30
+ };
31
+ headerRowLg: {
32
+ minHeight: number;
33
+ };
34
+ headerCell: {
35
+ display: "flex";
36
+ flexDirection: "row";
37
+ alignItems: "center";
38
+ gap: string | number;
39
+ };
40
+ headerCellSm: {
41
+ paddingLeft: string | number;
42
+ paddingRight: string | number;
43
+ };
44
+ headerCellMd: {
45
+ paddingLeft: string | number;
46
+ paddingRight: string | number;
47
+ };
48
+ headerCellLg: {
49
+ paddingLeft: string | number;
50
+ paddingRight: string | number;
51
+ };
52
+ headerLabel: {
53
+ color: string;
54
+ fontSize: 12;
55
+ lineHeight: 20;
56
+ letterSpacing: 0;
57
+ fontFamily: string;
58
+ fontWeight?: import("react-native").TextStyle["fontWeight"];
59
+ };
60
+ headerLabelActive: {
61
+ color: string;
62
+ };
63
+ headerSelectionCell: {
64
+ display: "flex";
65
+ flexDirection: "row";
66
+ alignItems: "center";
67
+ justifyContent: "center";
68
+ };
69
+ headerSelectionCellSm: {
70
+ width: number;
71
+ paddingLeft: string | number;
72
+ paddingRight: string | number;
73
+ };
74
+ headerSelectionCellMd: {
75
+ width: number;
76
+ paddingLeft: string | number;
77
+ paddingRight: string | number;
78
+ };
79
+ headerSelectionCellLg: {
80
+ width: number;
81
+ paddingLeft: string | number;
82
+ paddingRight: string | number;
83
+ };
84
+ row: {
85
+ display: "flex";
86
+ flexDirection: "row";
87
+ alignItems: "stretch";
88
+ backgroundColor: string;
89
+ borderBottomWidth: number;
90
+ borderBottomColor: string;
91
+ };
92
+ rowSm: {
93
+ minHeight: number;
94
+ };
95
+ rowMd: {
96
+ minHeight: number;
97
+ };
98
+ rowLg: {
99
+ minHeight: number;
100
+ };
101
+ rowHoverable: {
102
+ cursor: "pointer";
103
+ };
104
+ rowHover: {
105
+ backgroundColor: string;
106
+ };
107
+ rowSelected: {
108
+ backgroundColor: string;
109
+ };
110
+ cell: {
111
+ display: "flex";
112
+ flexDirection: "row";
113
+ alignItems: "center";
114
+ minWidth: number;
115
+ };
116
+ cellSm: {
117
+ paddingLeft: string | number;
118
+ paddingRight: string | number;
119
+ };
120
+ cellMd: {
121
+ paddingLeft: string | number;
122
+ paddingRight: string | number;
123
+ };
124
+ cellLg: {
125
+ paddingLeft: string | number;
126
+ paddingRight: string | number;
127
+ };
128
+ cellAlignEnd: {
129
+ justifyContent: "flex-end";
130
+ };
131
+ cellText: {
132
+ color: string;
133
+ fontSize: 14;
134
+ lineHeight: 20;
135
+ letterSpacing: 0;
136
+ fontFamily: string;
137
+ fontWeight?: import("react-native").TextStyle["fontWeight"];
138
+ };
139
+ selectionCell: {
140
+ display: "flex";
141
+ flexDirection: "row";
142
+ alignItems: "center";
143
+ justifyContent: "center";
144
+ };
145
+ selectionCellSm: {
146
+ width: number;
147
+ paddingLeft: string | number;
148
+ paddingRight: string | number;
149
+ };
150
+ selectionCellMd: {
151
+ width: number;
152
+ paddingLeft: string | number;
153
+ paddingRight: string | number;
154
+ };
155
+ selectionCellLg: {
156
+ width: number;
157
+ paddingLeft: string | number;
158
+ paddingRight: string | number;
159
+ };
160
+ emptyState: {
161
+ display: "flex";
162
+ alignItems: "center";
163
+ justifyContent: "center";
164
+ padding: string | number;
165
+ };
166
+ emptyStateLabel: {
167
+ color: string;
168
+ fontSize: 14;
169
+ lineHeight: 20;
170
+ letterSpacing: 0;
171
+ fontFamily: string;
172
+ fontWeight?: import("react-native").TextStyle["fontWeight"];
173
+ };
174
+ };
175
+ //# sourceMappingURL=DataTable.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTable.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTable.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKnB,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { makeStyles } from '@alveole/theme';
2
+ export const useStyles = makeStyles(({ color, text, radius, spacing }) => ({
3
+ table: {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ borderWidth: 1,
7
+ borderColor: color.light.border['default-grey'],
8
+ borderRadius: radius('md'),
9
+ overflow: 'hidden',
10
+ backgroundColor: color.light.background['default-grey'],
11
+ },
12
+ scrollContent: {
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ flexGrow: 1,
16
+ minWidth: '100%',
17
+ },
18
+ headerRow: {
19
+ display: 'flex',
20
+ flexDirection: 'row',
21
+ alignItems: 'stretch',
22
+ backgroundColor: color.light.background['alt-grey'],
23
+ borderBottomWidth: 1,
24
+ borderBottomColor: color.light.border['default-grey'],
25
+ },
26
+ headerRowSm: {
27
+ minHeight: 28,
28
+ },
29
+ headerRowMd: {
30
+ minHeight: 32,
31
+ },
32
+ headerRowLg: {
33
+ minHeight: 36,
34
+ },
35
+ headerCell: {
36
+ display: 'flex',
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ gap: spacing('1V'),
40
+ },
41
+ headerCellSm: {
42
+ paddingLeft: spacing('1W'),
43
+ paddingRight: spacing('1W'),
44
+ },
45
+ headerCellMd: {
46
+ paddingLeft: spacing('2W'),
47
+ paddingRight: spacing('2W'),
48
+ },
49
+ headerCellLg: {
50
+ paddingLeft: spacing('3W'),
51
+ paddingRight: spacing('3W'),
52
+ },
53
+ headerLabel: {
54
+ ...text['Corps de texte'].XS.SemiBold,
55
+ color: color.light.text['mention-grey'],
56
+ },
57
+ headerLabelActive: {
58
+ color: color.light.text['default-grey'],
59
+ },
60
+ headerSelectionCell: {
61
+ display: 'flex',
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ },
66
+ headerSelectionCellSm: {
67
+ width: 40,
68
+ paddingLeft: spacing('3V'),
69
+ paddingRight: spacing('3V'),
70
+ },
71
+ headerSelectionCellMd: {
72
+ width: 44,
73
+ paddingLeft: spacing('2W'),
74
+ paddingRight: spacing('2W'),
75
+ },
76
+ headerSelectionCellLg: {
77
+ width: 48,
78
+ paddingLeft: spacing('3W'),
79
+ paddingRight: spacing('3W'),
80
+ },
81
+ row: {
82
+ display: 'flex',
83
+ flexDirection: 'row',
84
+ alignItems: 'stretch',
85
+ backgroundColor: color.light.background['default-grey'],
86
+ borderBottomWidth: 1,
87
+ borderBottomColor: color.light.border['default-grey'],
88
+ },
89
+ rowSm: {
90
+ minHeight: 28,
91
+ },
92
+ rowMd: {
93
+ minHeight: 44,
94
+ },
95
+ rowLg: {
96
+ minHeight: 52,
97
+ },
98
+ rowHoverable: {
99
+ cursor: 'pointer',
100
+ },
101
+ rowHover: {
102
+ backgroundColor: color.light.background['alt-grey'],
103
+ },
104
+ rowSelected: {
105
+ backgroundColor: color.light.background['action-low-primary'],
106
+ },
107
+ cell: {
108
+ display: 'flex',
109
+ flexDirection: 'row',
110
+ alignItems: 'center',
111
+ minWidth: 0,
112
+ },
113
+ cellSm: {
114
+ paddingLeft: spacing('1W'),
115
+ paddingRight: spacing('1W'),
116
+ },
117
+ cellMd: {
118
+ paddingLeft: spacing('2W'),
119
+ paddingRight: spacing('2W'),
120
+ },
121
+ cellLg: {
122
+ paddingLeft: spacing('3W'),
123
+ paddingRight: spacing('3W'),
124
+ },
125
+ cellAlignEnd: {
126
+ justifyContent: 'flex-end',
127
+ },
128
+ cellText: {
129
+ ...text['Corps de texte'].SM.Regular,
130
+ color: color.light.text['default-grey'],
131
+ },
132
+ selectionCell: {
133
+ display: 'flex',
134
+ flexDirection: 'row',
135
+ alignItems: 'center',
136
+ justifyContent: 'center',
137
+ },
138
+ selectionCellSm: {
139
+ width: 40,
140
+ paddingLeft: spacing('3V'),
141
+ paddingRight: spacing('3V'),
142
+ },
143
+ selectionCellMd: {
144
+ width: 44,
145
+ paddingLeft: spacing('2W'),
146
+ paddingRight: spacing('2W'),
147
+ },
148
+ selectionCellLg: {
149
+ width: 48,
150
+ paddingLeft: spacing('3W'),
151
+ paddingRight: spacing('3W'),
152
+ },
153
+ emptyState: {
154
+ display: 'flex',
155
+ alignItems: 'center',
156
+ justifyContent: 'center',
157
+ padding: spacing('6W'),
158
+ },
159
+ emptyStateLabel: {
160
+ ...text['Corps de texte'].SM.Regular,
161
+ color: color.light.text['mention-grey'],
162
+ },
163
+ }));
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export type DataTableAlign = 'start' | 'end';
3
+ /** Densité du tableau : influence les paddings des cellules (en-têtes, corps, colonne de sélection). */
4
+ export type DataTableSize = 'sm' | 'md' | 'lg';
5
+ export type DataTableSortDirection = 'asc' | 'desc';
6
+ export type DataTableSort = {
7
+ columnId: string;
8
+ direction: DataTableSortDirection;
9
+ };
10
+ export type DataTableColumn<Row> = {
11
+ /** Identifiant unique de la colonne, utilisé pour le tri. */
12
+ id: string;
13
+ header: React.ReactNode;
14
+ renderCell: (row: Row, rowIndex: number) => React.ReactNode;
15
+ align?: DataTableAlign;
16
+ sortable?: boolean;
17
+ /** Largeur fixe en px. Sans valeur, la colonne se répartit l'espace disponible (flex: 1). */
18
+ width?: number;
19
+ };
20
+ //# sourceMappingURL=DataTable.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTable.types.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTable.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7C,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,sBAAsB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,GAAG,IAAI;IACjC,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5D,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { DataTableAlign, DataTableSize } from './DataTable.types';
3
+ export type DataTableCellProps = {
4
+ align?: DataTableAlign;
5
+ width?: number;
6
+ children: React.ReactNode;
7
+ variant?: 'header' | 'body';
8
+ size?: DataTableSize;
9
+ onPress?: () => void;
10
+ };
11
+ export declare const DataTableCell: (props: DataTableCellProps) => React.JSX.Element;
12
+ //# sourceMappingURL=DataTableCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCell.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,sBAyBtD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from '../../core';
3
+ import { useStyles } from './DataTable.styles';
4
+ export const DataTableCell = (props) => {
5
+ const { align = 'start', width, children, variant = 'body', size = 'sm', onPress } = props;
6
+ const styles = useStyles();
7
+ const paddingStyles = {
8
+ header: { sm: styles.headerCellSm, md: styles.headerCellMd, lg: styles.headerCellLg },
9
+ body: { sm: styles.cellSm, md: styles.cellMd, lg: styles.cellLg },
10
+ }[variant][size];
11
+ return (_jsx(Box, { tag: variant === 'header' ? 'data-table-header-cell' : 'data-table-cell', onPress: onPress, hoverStyle: onPress ? { opacity: 0.8 } : undefined, style: [
12
+ variant === 'header' ? styles.headerCell : styles.cell,
13
+ paddingStyles,
14
+ align === 'end' ? styles.cellAlignEnd : {},
15
+ width !== undefined ? { width, flex: 'none' } : { flex: 1 },
16
+ onPress ? { cursor: 'pointer' } : {},
17
+ ], children: children }));
18
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export type DataTableFooterProps = {
3
+ /** Ex : "21-40 sur 70" */
4
+ counter?: React.ReactNode;
5
+ children?: React.ReactNode;
6
+ };
7
+ export declare const DataTableFooter: (props: DataTableFooterProps) => React.JSX.Element;
8
+ //# sourceMappingURL=DataTableFooter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableFooter.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTableFooter.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAsB1B,MAAM,MAAM,oBAAoB,GAAG;IACjC,0BAA0B;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,sBAU1D,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { makeStyles } from '@alveole/theme';
3
+ import { Box, Typography } from '../../core';
4
+ const useFooterStyles = makeStyles(({ color, text, spacing }) => ({
5
+ footer: {
6
+ display: 'flex',
7
+ flexDirection: 'row',
8
+ alignItems: 'center',
9
+ justifyContent: 'space-between',
10
+ gap: spacing('2W'),
11
+ paddingLeft: spacing('2W'),
12
+ paddingRight: spacing('2W'),
13
+ paddingTop: spacing('1W'),
14
+ paddingBottom: spacing('1W'),
15
+ backgroundColor: color.light.background['default-grey'],
16
+ },
17
+ counter: {
18
+ ...text['Corps de texte'].XS.Regular,
19
+ color: color.light.text['mention-grey'],
20
+ },
21
+ }));
22
+ export const DataTableFooter = (props) => {
23
+ const { counter, children } = props;
24
+ const styles = useFooterStyles();
25
+ return (_jsxs(Box, { tag: "data-table-footer", style: styles.footer, children: [_jsx(Box, { children: typeof counter === 'string' ? _jsx(Typography, { style: styles.counter, children: counter }) : counter }), _jsx(Box, { children: children })] }));
26
+ };
@@ -0,0 +1,9 @@
1
+ import { DataTableColumn, DataTableSize, DataTableSortDirection } from './DataTable.types';
2
+ export type DataTableHeaderCellProps<Row> = {
3
+ column: DataTableColumn<Row>;
4
+ sortDirection?: DataTableSortDirection;
5
+ size?: DataTableSize;
6
+ onPress?: () => void;
7
+ };
8
+ export declare const DataTableHeaderCell: <Row>(props: DataTableHeaderCellProps<Row>) => import("react").JSX.Element;
9
+ //# sourceMappingURL=DataTableHeaderCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableHeaderCell.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTableHeaderCell.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3F,MAAM,MAAM,wBAAwB,CAAC,GAAG,IAAI;IAC1C,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,GAAG,EAAG,OAAO,wBAAwB,CAAC,GAAG,CAAC,gCA2B7E,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Typography } from '../../core';
3
+ import { LucideIcon } from '../LucideIcon';
4
+ import { useStyles } from './DataTable.styles';
5
+ import { DataTableCell } from './DataTableCell';
6
+ export const DataTableHeaderCell = (props) => {
7
+ const { column, sortDirection, size, onPress } = props;
8
+ const styles = useStyles();
9
+ const isSortable = column.sortable === true;
10
+ const isActive = sortDirection !== undefined;
11
+ return (_jsxs(DataTableCell, { variant: "header", align: column.align, width: column.width, size: size, onPress: isSortable ? onPress : undefined, children: [_jsx(Typography, { tag: "data-table-header-label", style: [styles.headerLabel, isActive ? styles.headerLabelActive : {}], children: column.header }), isSortable && isActive && (_jsx(LucideIcon, { name: sortDirection === 'asc' ? 'ArrowUp' : 'ArrowDown', size: "xs", color: styles.headerLabelActive.color }))] }));
12
+ };
@@ -0,0 +1,12 @@
1
+ export type DataTablePaginationProps = {
2
+ /** Page courante, 1-indexée. */
3
+ page: number;
4
+ pageCount: number;
5
+ onPageChange: (page: number) => void;
6
+ previousLabel?: string;
7
+ nextLabel?: string;
8
+ /** Nombre maximum de numéros de page affichés simultanément. */
9
+ maxVisiblePages?: number;
10
+ };
11
+ export declare const DataTablePagination: (props: DataTablePaginationProps) => import("react").JSX.Element;
12
+ //# sourceMappingURL=DataTablePagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTablePagination.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTablePagination.tsx"],"names":[],"mappings":"AA2DA,MAAM,MAAM,wBAAwB,GAAG;IACrC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAaF,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,gCAiDlE,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { makeStyles } from '@alveole/theme';
3
+ import { Box, Typography } from '../../core';
4
+ import { LucideIcon } from '../LucideIcon';
5
+ const useStyles = makeStyles(({ color, text, radius, spacing }) => ({
6
+ pagination: {
7
+ display: 'flex',
8
+ flexDirection: 'row',
9
+ alignItems: 'center',
10
+ gap: spacing('1W'),
11
+ },
12
+ navButton: {
13
+ display: 'flex',
14
+ flexDirection: 'row',
15
+ alignItems: 'center',
16
+ gap: spacing('1W'),
17
+ paddingLeft: spacing('3V'),
18
+ paddingRight: spacing('3V'),
19
+ paddingTop: spacing('1,5V'),
20
+ paddingBottom: spacing('1,5V'),
21
+ borderRadius: radius('sm'),
22
+ cursor: 'pointer',
23
+ },
24
+ navButtonDisabled: {
25
+ opacity: 0.4,
26
+ cursor: 'default',
27
+ },
28
+ navLabel: {
29
+ ...text['Corps de texte'].SM.Medium,
30
+ color: color.light.text['default-grey'],
31
+ },
32
+ pages: {
33
+ display: 'flex',
34
+ flexDirection: 'row',
35
+ alignItems: 'center',
36
+ gap: spacing('1,5V'),
37
+ },
38
+ pageButton: {
39
+ display: 'flex',
40
+ alignItems: 'center',
41
+ justifyContent: 'center',
42
+ minWidth: 32,
43
+ paddingTop: spacing('1,5V'),
44
+ paddingBottom: spacing('1,5V'),
45
+ borderRadius: radius('sm'),
46
+ cursor: 'pointer',
47
+ },
48
+ pageButtonActive: {
49
+ backgroundColor: color.light.background['active-primary'],
50
+ },
51
+ pageLabel: {
52
+ ...text['Corps de texte'].SM.Regular,
53
+ color: color.light.text['default-grey'],
54
+ },
55
+ pageLabelActive: {
56
+ color: color.light.text['inverted-grey'],
57
+ },
58
+ }));
59
+ const getVisiblePages = (page, pageCount, maxVisiblePages) => {
60
+ if (pageCount <= maxVisiblePages)
61
+ return Array.from({ length: pageCount }, (_, index) => index + 1);
62
+ const half = Math.floor(maxVisiblePages / 2);
63
+ let start = Math.max(1, page - half);
64
+ const end = Math.min(pageCount, start + maxVisiblePages - 1);
65
+ start = Math.max(1, end - maxVisiblePages + 1);
66
+ return Array.from({ length: end - start + 1 }, (_, index) => start + index);
67
+ };
68
+ export const DataTablePagination = (props) => {
69
+ const { page, pageCount, onPageChange, previousLabel = 'Précédent', nextLabel = 'Suivant', maxVisiblePages = 10, } = props;
70
+ const styles = useStyles();
71
+ const canGoPrevious = page > 1;
72
+ const canGoNext = page < pageCount;
73
+ const visiblePages = getVisiblePages(page, pageCount, maxVisiblePages);
74
+ return (_jsxs(Box, { tag: "data-table-pagination", style: styles.pagination, children: [_jsxs(Box, { onPress: canGoPrevious ? () => onPageChange(page - 1) : undefined, style: [styles.navButton, !canGoPrevious ? styles.navButtonDisabled : {}], children: [_jsx(LucideIcon, { name: "ChevronLeft", size: "sm", color: styles.navLabel.color }), _jsx(Typography, { style: styles.navLabel, children: previousLabel })] }), _jsx(Box, { style: styles.pages, children: visiblePages.map(pageNumber => {
75
+ const isActive = pageNumber === page;
76
+ return (_jsx(Box, { onPress: () => onPageChange(pageNumber), style: [styles.pageButton, isActive ? styles.pageButtonActive : {}], children: _jsx(Typography, { style: [styles.pageLabel, isActive ? styles.pageLabelActive : {}], children: pageNumber }) }, pageNumber));
77
+ }) }), _jsxs(Box, { onPress: canGoNext ? () => onPageChange(page + 1) : undefined, style: [styles.navButton, !canGoNext ? styles.navButtonDisabled : {}], children: [_jsx(Typography, { style: styles.navLabel, children: nextLabel }), _jsx(LucideIcon, { name: "ChevronRight", size: "sm", color: styles.navLabel.color })] })] }));
78
+ };
@@ -0,0 +1,16 @@
1
+ import { DataTableColumn, DataTableSize } from './DataTable.types';
2
+ export type DataTableRowProps<Row> = {
3
+ row: Row;
4
+ rowIndex: number;
5
+ rowKey: string;
6
+ columns: DataTableColumn<Row>[];
7
+ selectable?: boolean;
8
+ selected?: boolean;
9
+ size?: DataTableSize;
10
+ /** Retire la bordure basse (dernière ligne quand le tableau n'a pas de footer, pour éviter un double trait avec la bordure du conteneur). */
11
+ noBorderBottom?: boolean;
12
+ onSelectedChange?: (checked: boolean) => void;
13
+ onPress?: () => void;
14
+ };
15
+ export declare const DataTableRow: <Row>(props: DataTableRowProps<Row>) => import("react").JSX.Element;
16
+ //# sourceMappingURL=DataTableRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableRow.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/DataTableRow.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,MAAM,iBAAiB,CAAC,GAAG,IAAI;IACnC,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,6IAA6I;IAC7I,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAcF,eAAO,MAAM,YAAY,GAAI,GAAG,EAAG,OAAO,iBAAiB,CAAC,GAAG,CAAC,gCAmD/D,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from '../../core';
3
+ import { CheckboxContainer, CheckboxIndicator } from '../Checkbox';
4
+ import { useStyles } from './DataTable.styles';
5
+ import { DataTableCell } from './DataTableCell';
6
+ const selectionCellStyleBySize = {
7
+ sm: 'selectionCellSm',
8
+ md: 'selectionCellMd',
9
+ lg: 'selectionCellLg',
10
+ };
11
+ const rowStyleBySize = {
12
+ sm: 'rowSm',
13
+ md: 'rowMd',
14
+ lg: 'rowLg',
15
+ };
16
+ export const DataTableRow = (props) => {
17
+ const { row, rowIndex, rowKey, columns, selectable, selected, size = 'sm', noBorderBottom, onSelectedChange, onPress, } = props;
18
+ const styles = useStyles();
19
+ return (_jsxs(Box, { tag: "data-table-row", onPress: onPress, hoverStyle: onPress ? styles.rowHover : {}, style: [
20
+ styles.row,
21
+ styles[rowStyleBySize[size]],
22
+ selected ? styles.rowSelected : {},
23
+ onPress ? styles.rowHoverable : {},
24
+ noBorderBottom ? { borderBottomWidth: 0 } : {},
25
+ ], children: [selectable && (_jsx(Box, { tag: "data-table-selection-cell", style: [styles.selectionCell, styles[selectionCellStyleBySize[size]]], onPress: event => event.stopPropagation(), children: _jsx(CheckboxContainer, { id: `${rowKey}--checkbox`, variant: "small", checked: selected, onCheckedChange: checked => onSelectedChange?.(checked === true), children: _jsx(CheckboxIndicator, { variant: "small" }) }) })), columns.map(column => (_jsx(DataTableCell, { align: column.align, width: column.width, size: size, children: column.renderCell(row, rowIndex) }, column.id)))] }));
26
+ };
@@ -0,0 +1,5 @@
1
+ export * from './DataTable';
2
+ export * from './DataTable.types';
3
+ export * from './DataTableFooter';
4
+ export * from './DataTablePagination';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/DataTable/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './DataTable';
2
+ export * from './DataTable.types';
3
+ export * from './DataTableFooter';
4
+ export * from './DataTablePagination';
@@ -10,6 +10,7 @@ export * from './Button';
10
10
  export * from './Card';
11
11
  export * from './Checkbox';
12
12
  export * from './Counter';
13
+ export * from './DataTable';
13
14
  export * from './DateInput';
14
15
  export * from './Divider';
15
16
  export * from './DocumentViewer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
package/dist/ui/index.js CHANGED
@@ -10,6 +10,7 @@ export * from './Button';
10
10
  export * from './Card';
11
11
  export * from './Checkbox';
12
12
  export * from './Counter';
13
+ export * from './DataTable';
13
14
  export * from './DateInput';
14
15
  export * from './Divider';
15
16
  export * from './DocumentViewer';