@cdx-ui/components 0.0.1-beta.184 → 0.0.1-beta.186
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage.svg +1 -1
- package/lib/commonjs/components/Chip/styles.js +1 -1
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/Table/index.js +389 -0
- package/lib/commonjs/components/Table/index.js.map +1 -0
- package/lib/commonjs/components/Table/index.web.js +329 -0
- package/lib/commonjs/components/Table/index.web.js.map +1 -0
- package/lib/commonjs/components/Table/styles.js +111 -0
- package/lib/commonjs/components/Table/styles.js.map +1 -0
- package/lib/commonjs/components/Table/types.js +6 -0
- package/lib/commonjs/components/Table/types.js.map +1 -0
- package/lib/commonjs/components/Table/useTableStyleContext.js +28 -0
- package/lib/commonjs/components/Table/useTableStyleContext.js.map +1 -0
- package/lib/commonjs/components/TablePagination/TablePaginationContext.js +31 -0
- package/lib/commonjs/components/TablePagination/TablePaginationContext.js.map +1 -0
- package/lib/commonjs/components/TablePagination/getTablePaginationItems.js +50 -0
- package/lib/commonjs/components/TablePagination/getTablePaginationItems.js.map +1 -0
- package/lib/commonjs/components/TablePagination/index.js +395 -0
- package/lib/commonjs/components/TablePagination/index.js.map +1 -0
- package/lib/commonjs/components/TablePagination/styles.js +13 -0
- package/lib/commonjs/components/TablePagination/styles.js.map +1 -0
- package/lib/commonjs/components/index.js +24 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/styles.css +1 -0
- package/lib/module/components/Chip/styles.js +1 -1
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/Table/index.js +385 -0
- package/lib/module/components/Table/index.js.map +1 -0
- package/lib/module/components/Table/index.web.js +325 -0
- package/lib/module/components/Table/index.web.js.map +1 -0
- package/lib/module/components/Table/styles.js +107 -0
- package/lib/module/components/Table/styles.js.map +1 -0
- package/lib/module/components/Table/types.js +4 -0
- package/lib/module/components/Table/types.js.map +1 -0
- package/lib/module/components/Table/useTableStyleContext.js +17 -0
- package/lib/module/components/Table/useTableStyleContext.js.map +1 -0
- package/lib/module/components/TablePagination/TablePaginationContext.js +25 -0
- package/lib/module/components/TablePagination/TablePaginationContext.js.map +1 -0
- package/lib/module/components/TablePagination/getTablePaginationItems.js +46 -0
- package/lib/module/components/TablePagination/getTablePaginationItems.js.map +1 -0
- package/lib/module/components/TablePagination/index.js +386 -0
- package/lib/module/components/TablePagination/index.js.map +1 -0
- package/lib/module/components/TablePagination/styles.js +9 -0
- package/lib/module/components/TablePagination/styles.js.map +1 -0
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/styles.css +1 -0
- package/lib/typescript/components/Table/index.d.ts +23 -0
- package/lib/typescript/components/Table/index.d.ts.map +1 -0
- package/lib/typescript/components/Table/index.web.d.ts +22 -0
- package/lib/typescript/components/Table/index.web.d.ts.map +1 -0
- package/lib/typescript/components/Table/styles.d.ts +36 -0
- package/lib/typescript/components/Table/styles.d.ts.map +1 -0
- package/lib/typescript/components/Table/types.d.ts +51 -0
- package/lib/typescript/components/Table/types.d.ts.map +1 -0
- package/lib/typescript/components/Table/useTableStyleContext.d.ts +11 -0
- package/lib/typescript/components/Table/useTableStyleContext.d.ts.map +1 -0
- package/lib/typescript/components/TablePagination/TablePaginationContext.d.ts +20 -0
- package/lib/typescript/components/TablePagination/TablePaginationContext.d.ts.map +1 -0
- package/lib/typescript/components/TablePagination/getTablePaginationItems.d.ts +7 -0
- package/lib/typescript/components/TablePagination/getTablePaginationItems.d.ts.map +1 -0
- package/lib/typescript/components/TablePagination/index.d.ts +74 -0
- package/lib/typescript/components/TablePagination/index.d.ts.map +1 -0
- package/lib/typescript/components/TablePagination/styles.d.ts +8 -0
- package/lib/typescript/components/TablePagination/styles.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +2 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Chip/styles.ts +1 -1
- package/src/components/Table/index.tsx +459 -0
- package/src/components/Table/index.web.tsx +395 -0
- package/src/components/Table/styles.ts +143 -0
- package/src/components/Table/types.ts +57 -0
- package/src/components/Table/useTableStyleContext.ts +14 -0
- package/src/components/TablePagination/TablePaginationContext.tsx +37 -0
- package/src/components/TablePagination/getTablePaginationItems.ts +62 -0
- package/src/components/TablePagination/index.tsx +498 -0
- package/src/components/TablePagination/styles.ts +15 -0
- package/src/components/index.ts +2 -0
- package/src/styles.css +1 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Slot, dataAttributes, mapViewPropsToDom, mergeDataAttributes, mergeDomDataAttributes, domDataAttributes } from '@cdx-ui/primitives';
|
|
5
|
+
import { cn } from '@cdx-ui/utils';
|
|
6
|
+
import { tableBodyVariants, tableCaptionVariants, tableCellVariants, tableContainerVariants, tableFooterVariants, tableHeadVariants, tableHeaderVariants, tableRootVariants, tableRowVariants } from './styles';
|
|
7
|
+
import { ParentContext, useTableStyleContext, useTableVariantContext } from './useTableStyleContext';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const tableHostProps = (props, slot) => {
|
|
10
|
+
const mapped = mapViewPropsToDom(props);
|
|
11
|
+
return {
|
|
12
|
+
...mapped,
|
|
13
|
+
...mergeDomDataAttributes(props, mapped, domDataAttributes({
|
|
14
|
+
slot
|
|
15
|
+
}))
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const TableRoot = /*#__PURE__*/forwardRef(({
|
|
19
|
+
asChild,
|
|
20
|
+
className,
|
|
21
|
+
containerStyle,
|
|
22
|
+
children,
|
|
23
|
+
style,
|
|
24
|
+
fullBleed = false,
|
|
25
|
+
...props
|
|
26
|
+
}, ref) => {
|
|
27
|
+
const ctx = useTableVariantContext(fullBleed);
|
|
28
|
+
if (asChild) {
|
|
29
|
+
const Comp = Slot;
|
|
30
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
31
|
+
value: ctx,
|
|
32
|
+
children: /*#__PURE__*/_jsx(Comp, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
className: cn(tableContainerVariants(), tableRootVariants(), className),
|
|
35
|
+
style: style,
|
|
36
|
+
...props,
|
|
37
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
38
|
+
slot: 'table'
|
|
39
|
+
})),
|
|
40
|
+
children: children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
45
|
+
value: ctx,
|
|
46
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: tableContainerVariants(),
|
|
48
|
+
style: containerStyle,
|
|
49
|
+
children: /*#__PURE__*/_jsx("table", {
|
|
50
|
+
ref: ref,
|
|
51
|
+
className: cn(tableRootVariants(), className),
|
|
52
|
+
style: style,
|
|
53
|
+
...tableHostProps(props, 'table'),
|
|
54
|
+
children: children
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
TableRoot.displayName = 'Table';
|
|
60
|
+
const TableCaption = /*#__PURE__*/forwardRef(({
|
|
61
|
+
asChild,
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
style,
|
|
65
|
+
...props
|
|
66
|
+
}, ref) => {
|
|
67
|
+
const computedClassName = cn(tableCaptionVariants(), className);
|
|
68
|
+
if (asChild) {
|
|
69
|
+
const Comp = Slot;
|
|
70
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
71
|
+
ref: ref,
|
|
72
|
+
className: computedClassName,
|
|
73
|
+
style: style,
|
|
74
|
+
...props,
|
|
75
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
76
|
+
slot: 'table-caption'
|
|
77
|
+
})),
|
|
78
|
+
children: children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return /*#__PURE__*/_jsx("caption", {
|
|
82
|
+
ref: ref,
|
|
83
|
+
className: computedClassName,
|
|
84
|
+
style: style,
|
|
85
|
+
...tableHostProps(props, 'table-caption'),
|
|
86
|
+
children: children
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
TableCaption.displayName = 'Table.Caption';
|
|
90
|
+
const TableHeader = /*#__PURE__*/forwardRef(({
|
|
91
|
+
asChild,
|
|
92
|
+
className,
|
|
93
|
+
children,
|
|
94
|
+
style,
|
|
95
|
+
...props
|
|
96
|
+
}, ref) => {
|
|
97
|
+
const computedClassName = cn(tableHeaderVariants(), className);
|
|
98
|
+
if (asChild) {
|
|
99
|
+
const Comp = Slot;
|
|
100
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
101
|
+
ref: ref,
|
|
102
|
+
className: computedClassName,
|
|
103
|
+
style: style,
|
|
104
|
+
...props,
|
|
105
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
106
|
+
slot: 'table-header'
|
|
107
|
+
})),
|
|
108
|
+
children: children
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return /*#__PURE__*/_jsx("thead", {
|
|
112
|
+
ref: ref,
|
|
113
|
+
className: computedClassName,
|
|
114
|
+
style: style,
|
|
115
|
+
...tableHostProps(props, 'table-header'),
|
|
116
|
+
children: children
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
TableHeader.displayName = 'Table.Header';
|
|
120
|
+
const TableBody = /*#__PURE__*/forwardRef(({
|
|
121
|
+
asChild,
|
|
122
|
+
className,
|
|
123
|
+
children,
|
|
124
|
+
style,
|
|
125
|
+
...props
|
|
126
|
+
}, ref) => {
|
|
127
|
+
const computedClassName = cn(tableBodyVariants(), className);
|
|
128
|
+
if (asChild) {
|
|
129
|
+
const Comp = Slot;
|
|
130
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
131
|
+
ref: ref,
|
|
132
|
+
className: computedClassName,
|
|
133
|
+
style: style,
|
|
134
|
+
...props,
|
|
135
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
136
|
+
slot: 'table-body'
|
|
137
|
+
})),
|
|
138
|
+
children: children
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return /*#__PURE__*/_jsx("tbody", {
|
|
142
|
+
ref: ref,
|
|
143
|
+
className: computedClassName,
|
|
144
|
+
style: style,
|
|
145
|
+
...tableHostProps(props, 'table-body'),
|
|
146
|
+
children: children
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
TableBody.displayName = 'Table.Body';
|
|
150
|
+
const TableFooter = /*#__PURE__*/forwardRef(({
|
|
151
|
+
asChild,
|
|
152
|
+
className,
|
|
153
|
+
children,
|
|
154
|
+
style,
|
|
155
|
+
...props
|
|
156
|
+
}, ref) => {
|
|
157
|
+
const computedClassName = cn(tableFooterVariants(), className);
|
|
158
|
+
if (asChild) {
|
|
159
|
+
const Comp = Slot;
|
|
160
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
161
|
+
ref: ref,
|
|
162
|
+
className: computedClassName,
|
|
163
|
+
style: style,
|
|
164
|
+
...props,
|
|
165
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
166
|
+
slot: 'table-footer'
|
|
167
|
+
})),
|
|
168
|
+
children: children
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return /*#__PURE__*/_jsx("tfoot", {
|
|
172
|
+
ref: ref,
|
|
173
|
+
className: computedClassName,
|
|
174
|
+
style: style,
|
|
175
|
+
...tableHostProps(props, 'table-footer'),
|
|
176
|
+
children: children
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
TableFooter.displayName = 'Table.Footer';
|
|
180
|
+
const TableRow = /*#__PURE__*/forwardRef(({
|
|
181
|
+
asChild,
|
|
182
|
+
className,
|
|
183
|
+
children,
|
|
184
|
+
style,
|
|
185
|
+
...props
|
|
186
|
+
}, ref) => {
|
|
187
|
+
const computedClassName = cn(tableRowVariants(), className);
|
|
188
|
+
if (asChild) {
|
|
189
|
+
const Comp = Slot;
|
|
190
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
191
|
+
ref: ref,
|
|
192
|
+
className: computedClassName,
|
|
193
|
+
style: style,
|
|
194
|
+
...props,
|
|
195
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
196
|
+
slot: 'table-row'
|
|
197
|
+
})),
|
|
198
|
+
children: children
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
202
|
+
ref: ref,
|
|
203
|
+
className: computedClassName,
|
|
204
|
+
style: style,
|
|
205
|
+
...tableHostProps(props, 'table-row'),
|
|
206
|
+
children: children
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
TableRow.displayName = 'Table.Row';
|
|
210
|
+
const tableWebContentStyles = {
|
|
211
|
+
start: {
|
|
212
|
+
display: 'flex',
|
|
213
|
+
width: '100%',
|
|
214
|
+
flexDirection: 'row',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
justifyContent: 'flex-start'
|
|
217
|
+
},
|
|
218
|
+
center: {
|
|
219
|
+
display: 'flex',
|
|
220
|
+
width: '100%',
|
|
221
|
+
flexDirection: 'row',
|
|
222
|
+
alignItems: 'center',
|
|
223
|
+
justifyContent: 'center'
|
|
224
|
+
},
|
|
225
|
+
end: {
|
|
226
|
+
display: 'flex',
|
|
227
|
+
width: '100%',
|
|
228
|
+
flexDirection: 'row',
|
|
229
|
+
alignItems: 'center',
|
|
230
|
+
justifyContent: 'flex-end'
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const TableHead = /*#__PURE__*/forwardRef(({
|
|
234
|
+
asChild,
|
|
235
|
+
align = 'start',
|
|
236
|
+
className,
|
|
237
|
+
children,
|
|
238
|
+
style,
|
|
239
|
+
scope = 'col',
|
|
240
|
+
...props
|
|
241
|
+
}, ref) => {
|
|
242
|
+
const {
|
|
243
|
+
fullBleed
|
|
244
|
+
} = useTableStyleContext();
|
|
245
|
+
const computedClassName = cn(tableHeadVariants({
|
|
246
|
+
fullBleed,
|
|
247
|
+
align
|
|
248
|
+
}), className);
|
|
249
|
+
if (asChild) {
|
|
250
|
+
const Comp = Slot;
|
|
251
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
252
|
+
ref: ref,
|
|
253
|
+
className: computedClassName,
|
|
254
|
+
style: style,
|
|
255
|
+
scope: scope,
|
|
256
|
+
...props,
|
|
257
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
258
|
+
slot: 'table-head'
|
|
259
|
+
})),
|
|
260
|
+
children: children
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return /*#__PURE__*/_jsx("th", {
|
|
264
|
+
ref: ref,
|
|
265
|
+
className: computedClassName,
|
|
266
|
+
scope: scope,
|
|
267
|
+
style: style,
|
|
268
|
+
...tableHostProps(props, 'table-head'),
|
|
269
|
+
children: align === 'start' ? children : /*#__PURE__*/_jsx("div", {
|
|
270
|
+
style: tableWebContentStyles[align],
|
|
271
|
+
children: children
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
TableHead.displayName = 'Table.Head';
|
|
276
|
+
const TableCell = /*#__PURE__*/forwardRef(({
|
|
277
|
+
asChild,
|
|
278
|
+
align = 'start',
|
|
279
|
+
className,
|
|
280
|
+
children,
|
|
281
|
+
style,
|
|
282
|
+
...props
|
|
283
|
+
}, ref) => {
|
|
284
|
+
const {
|
|
285
|
+
fullBleed
|
|
286
|
+
} = useTableStyleContext();
|
|
287
|
+
const computedClassName = cn(tableCellVariants({
|
|
288
|
+
fullBleed,
|
|
289
|
+
align
|
|
290
|
+
}), className);
|
|
291
|
+
if (asChild) {
|
|
292
|
+
const Comp = Slot;
|
|
293
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
294
|
+
ref: ref,
|
|
295
|
+
className: computedClassName,
|
|
296
|
+
style: style,
|
|
297
|
+
...props,
|
|
298
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
299
|
+
slot: 'table-cell'
|
|
300
|
+
})),
|
|
301
|
+
children: children
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
return /*#__PURE__*/_jsx("td", {
|
|
305
|
+
ref: ref,
|
|
306
|
+
className: computedClassName,
|
|
307
|
+
style: style,
|
|
308
|
+
...tableHostProps(props, 'table-cell'),
|
|
309
|
+
children: align === 'start' ? children : /*#__PURE__*/_jsx("div", {
|
|
310
|
+
style: tableWebContentStyles[align],
|
|
311
|
+
children: children
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
TableCell.displayName = 'Table.Cell';
|
|
316
|
+
export const Table = Object.assign(TableRoot, {
|
|
317
|
+
Caption: TableCaption,
|
|
318
|
+
Header: TableHeader,
|
|
319
|
+
Body: TableBody,
|
|
320
|
+
Footer: TableFooter,
|
|
321
|
+
Row: TableRow,
|
|
322
|
+
Head: TableHead,
|
|
323
|
+
Cell: TableCell
|
|
324
|
+
});
|
|
325
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","Slot","dataAttributes","mapViewPropsToDom","mergeDataAttributes","mergeDomDataAttributes","domDataAttributes","cn","tableBodyVariants","tableCaptionVariants","tableCellVariants","tableContainerVariants","tableFooterVariants","tableHeadVariants","tableHeaderVariants","tableRootVariants","tableRowVariants","ParentContext","useTableStyleContext","useTableVariantContext","jsx","_jsx","tableHostProps","props","slot","mapped","TableRoot","asChild","className","containerStyle","children","style","fullBleed","ref","ctx","Comp","Provider","value","displayName","TableCaption","computedClassName","TableHeader","TableBody","TableFooter","TableRow","tableWebContentStyles","start","display","width","flexDirection","alignItems","justifyContent","center","end","TableHead","align","scope","TableCell","Table","Object","assign","Caption","Header","Body","Footer","Row","Head","Cell"],"sourceRoot":"../../../../src","sources":["components/Table/index.web.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2D,OAAO;AACrF,SACEC,IAAI,EACJC,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,EACnBC,sBAAsB,E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C5CmC,OAAO,EAAEtB,YAAY;EACrBuB,MAAM,EAAErB,WAAW;EACnBsB,IAAI,EAAErB,SAAS;EACfsB,MAAM,EAAErB,WAAW;EACnBsB,GAAG,EAAErB,QAAQ;EACbsB,IAAI,EAAEZ,SAAS;EACfa,IAAI,EAAEV;AACR,CAAC,CAA2B","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { cva } from '@cdx-ui/utils';
|
|
4
|
+
export const tableContainerVariants = cva('relative w-full min-w-0 max-w-full overflow-auto');
|
|
5
|
+
export const tableRootVariants = cva('w-full caption-bottom body-md text-content-primary');
|
|
6
|
+
export const tableNativeRootVariants = cva('min-w-full flex-col caption-bottom body-md text-content-primary');
|
|
7
|
+
export const tableCaptionVariants = cva('mt-4 body-sm text-content-secondary');
|
|
8
|
+
export const tableNativeCaptionVariants = cva('mt-4 body-sm text-content-secondary');
|
|
9
|
+
export const tableHeaderVariants = cva('border-stroke-secondary [&_tr]:border-b');
|
|
10
|
+
export const tableBodyVariants = cva('[&_tr:last-child]:border-0');
|
|
11
|
+
export const tableFooterVariants = cva('border-t border-stroke-secondary bg-surface-secondary body-md font-medium [&>tr]:last:border-b-0');
|
|
12
|
+
export const tableRowVariants = cva('border-b border-stroke-secondary web:transition-colors web:hover:bg-surface-secondary/50');
|
|
13
|
+
export const tableHeadVariants = cva('h-11 bg-surface-primary px-2 align-middle font-medium text-content-secondary body-md', {
|
|
14
|
+
variants: {
|
|
15
|
+
fullBleed: {
|
|
16
|
+
true: 'first:pl-0 last:pr-0',
|
|
17
|
+
false: ''
|
|
18
|
+
},
|
|
19
|
+
align: {
|
|
20
|
+
start: 'text-start',
|
|
21
|
+
center: 'text-center',
|
|
22
|
+
end: 'text-end'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
fullBleed: false,
|
|
27
|
+
align: 'start'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export const tableCellVariants = cva('p-2 align-middle body-md text-content-primary', {
|
|
31
|
+
variants: {
|
|
32
|
+
fullBleed: {
|
|
33
|
+
true: 'first:pl-0 last:pr-0',
|
|
34
|
+
false: ''
|
|
35
|
+
},
|
|
36
|
+
align: {
|
|
37
|
+
start: 'text-start',
|
|
38
|
+
center: 'text-center',
|
|
39
|
+
end: 'text-end'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
fullBleed: false,
|
|
44
|
+
align: 'start'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export const tableNativeRowVariants = cva('min-w-full flex-row flex-nowrap border-b border-stroke-secondary');
|
|
48
|
+
export const tableNativeHeadVariants = cva('min-h-11 overflow-hidden px-2 items-start justify-center font-medium text-content-secondary body-md', {
|
|
49
|
+
variants: {
|
|
50
|
+
fullBleed: {
|
|
51
|
+
true: 'first:pl-0 last:pr-0',
|
|
52
|
+
false: ''
|
|
53
|
+
},
|
|
54
|
+
align: {
|
|
55
|
+
start: 'items-start',
|
|
56
|
+
center: 'items-center',
|
|
57
|
+
end: 'items-end'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
fullBleed: false,
|
|
62
|
+
align: 'start'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export const tableNativeCellVariants = cva('overflow-hidden p-2 items-start justify-center body-md text-content-primary', {
|
|
66
|
+
variants: {
|
|
67
|
+
fullBleed: {
|
|
68
|
+
true: 'first:pl-0 last:pr-0',
|
|
69
|
+
false: ''
|
|
70
|
+
},
|
|
71
|
+
align: {
|
|
72
|
+
start: 'items-start',
|
|
73
|
+
center: 'items-center',
|
|
74
|
+
end: 'items-end'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
fullBleed: false,
|
|
79
|
+
align: 'start'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
export const tableNativeHeadTextVariants = cva('w-full font-medium text-content-secondary body-md', {
|
|
83
|
+
variants: {
|
|
84
|
+
align: {
|
|
85
|
+
start: 'ltr:text-left rtl:text-right',
|
|
86
|
+
center: 'text-center',
|
|
87
|
+
end: 'ltr:text-right rtl:text-left'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
align: 'start'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export const tableNativeCellTextVariants = cva('w-full body-md text-content-primary', {
|
|
95
|
+
variants: {
|
|
96
|
+
align: {
|
|
97
|
+
start: 'ltr:text-left rtl:text-right',
|
|
98
|
+
center: 'text-center',
|
|
99
|
+
end: 'ltr:text-right rtl:text-left'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
defaultVariants: {
|
|
103
|
+
align: 'start'
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
export const tableNativeFooterVariants = cva('bg-surface-secondary');
|
|
107
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cva","tableContainerVariants","tableRootVariants","tableNativeRootVariants","tableCaptionVariants","tableNativeCaptionVariants","tableHeaderVariants","tableBodyVariants","tableFooterVariants","tableRowVariants","tableHeadVariants","variants","fullBleed","true","false","align","start","center","end","defaultVariants","tableCellVariants","tableNativeRowVariants","tableNativeHeadVariants","tableNativeCellVariants","tableNativeHeadTextVariants","tableNativeCellTextVariants","tableNativeFooterVariants"],"sourceRoot":"../../../../src","sources":["components/Table/styles.ts"],"mappings":";;AAAA,SAASA,GAAG,QAA2B,eAAe;AAEtD,OAAO,MAAMC,sBAAsB,GAAGD,GAAG,CAAC,kDAAkD,CAAC;AAE7F,OAAO,MAAME,iBAAiB,GAAGF,GAAG,CAAC,oDAAoD,CAAC;AAE1F,OAAO,MAAMG,uBAAuB,GAAGH,GAAG,CACxC,iEACF,CAAC;AAED,OAAO,MAAMI,oBAAoB,GAAG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AC;IACDC,KAAK,EAAE;MACLC,KAAK,EAAE,aAAa;MACpBC,MAAM,EAAE,cAAc;MACtBC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IACfP,SAAS,EAAE,KAAK;IAChBG,KAAK,EAAE;EACT;AACF,CACF,CAAC;AAED,OAAO,MAAMQ,uBAAuB,GAAGvB,GAAG,CACxC,6EAA6E,EAC7E;EACEW,QAAQ,EAAE;IACRC,SAAS,EAAE;MACTC,IAAI,EAAE,sBAAsB;MAC5BC,KAAK,EAAE;IACT,CAAC;IACDC,KAAK,EAAE;MACLC,KAAK,EAAE,aAAa;MACpBC,MAAM,EAAE,cAAc;MACtBC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IACfP,SAAS,EAAE,KAAK;IAChBG,KAAK,EAAE;EACT;AACF,CACF,CAAC;AAED,OAAO,MAAMS,2BAA2B,GAAGxB,GAAG,CAC5C,mDAAmD,EACnD;EACEW,QAAQ,EAAE;IACRI,KAAK,EAAE;MACLC,KAAK,EAAE,8BAA8B;MACrCC,MAAM,EAAE,aAAa;MACrBC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IACfJ,KAAK,EAAE;EACT;AACF,CACF,CAAC;AAED,OAAO,MAAMU,2BAA2B,GAAGzB,GAAG,CAAC,qCAAqC,EAAE;EACpFW,QAAQ,EAAE;IACRI,KAAK,EAAE;MACLC,KAAK,EAAE,8BAA8B;MACrCC,MAAM,EAAE,aAAa;MACrBC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IACfJ,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,OAAO,MAAMW,yBAAyB,GAAG1B,GAAG,CAAC,sBAAsB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Table/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
5
|
+
export const TABLE_SCOPE = 'TABLE';
|
|
6
|
+
export const useTableStyleContext = () => useStyleContext(TABLE_SCOPE);
|
|
7
|
+
export const useTableVariantContext = (fullBleed = false) => {
|
|
8
|
+
const parent = useParentContext();
|
|
9
|
+
return useMemo(() => ({
|
|
10
|
+
...parent,
|
|
11
|
+
[TABLE_SCOPE]: {
|
|
12
|
+
fullBleed
|
|
13
|
+
}
|
|
14
|
+
}), [parent, fullBleed]);
|
|
15
|
+
};
|
|
16
|
+
export { ParentContext };
|
|
17
|
+
//# sourceMappingURL=useTableStyleContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","ParentContext","useParentContext","useStyleContext","TABLE_SCOPE","useTableStyleContext","useTableVariantContext","fullBleed","parent"],"sourceRoot":"../../../../src","sources":["components/Table/useTableStyleContext.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,eAAe;AAGhF,OAAO,MAAMC,WAAW,GAAG,OAAO;AAElC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAMF,eAAe,CAACC,WAAW,CAAsB;AAE3F,OAAO,MAAME,sBAAsB,GAAGA,CAACC,SAAyC,GAAG,KAAK,KAAK;EAC3F,MAAMC,MAAM,GAAGN,gBAAgB,CAAC,CAAC;EACjC,OAAOF,OAAO,CAAC,OAAO;IAAE,GAAGQ,MAAM;IAAE,CAACJ,WAAW,GAAG;MAAEG;IAAU;EAAE,CAAC,CAAC,EAAE,CAACC,MAAM,EAAED,SAAS,CAAC,CAAC;AAC1F,CAAC;AAED,SAASN,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const TablePaginationContext = /*#__PURE__*/createContext(null);
|
|
6
|
+
export function TablePaginationProvider({
|
|
7
|
+
value,
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
return /*#__PURE__*/_jsx(TablePaginationContext.Provider, {
|
|
11
|
+
value: value,
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function useTablePaginationContext() {
|
|
16
|
+
return useContext(TablePaginationContext);
|
|
17
|
+
}
|
|
18
|
+
export function useRequiredTablePaginationContext() {
|
|
19
|
+
const context = useTablePaginationContext();
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('TablePagination compound slots must be rendered inside <TablePagination>.');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=TablePaginationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","jsx","_jsx","TablePaginationContext","TablePaginationProvider","value","children","Provider","useTablePaginationContext","useRequiredTablePaginationContext","context","Error"],"sourceRoot":"../../../../src","sources":["components/TablePagination/TablePaginationContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAwB,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAYlE,MAAMC,sBAAsB,gBAAGJ,aAAa,CAAqC,IAAI,CAAC;AAEtF,OAAO,SAASK,uBAAuBA,CAAC;EACtCC,KAAK;EACLC;AAIF,CAAC,EAAE;EACD,oBACEJ,IAAA,CAACC,sBAAsB,CAACI,QAAQ;IAACF,KAAK,EAAEA,KAAM;IAAAC,QAAA,EAAEA;EAAQ,CAAkC,CAAC;AAE/F;AAEA,OAAO,SAASE,yBAAyBA,CAAA,EAAuC;EAC9E,OAAOR,UAAU,CAACG,sBAAsB,CAAC;AAC3C;AAEA,OAAO,SAASM,iCAAiCA,CAAA,EAAgC;EAC/E,MAAMC,OAAO,GAAGF,yBAAyB,CAAC,CAAC;EAC3C,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,2EAA2E,CAAC;EAC9F;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function range(start, end) {
|
|
4
|
+
if (end < start) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
return Array.from({
|
|
8
|
+
length: end - start + 1
|
|
9
|
+
}, (_, index) => start + index);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Compact pager window: first, last, current ± siblings, with ellipses in the gaps.
|
|
14
|
+
* Matches the common MUI / HeroUI compact algorithm (`siblingCount` default 1).
|
|
15
|
+
*/
|
|
16
|
+
export function getTablePaginationItems(page, count, siblingCount = 1) {
|
|
17
|
+
if (count <= 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const current = Math.min(Math.max(page, 1), count);
|
|
21
|
+
const siblings = Math.max(siblingCount, 0);
|
|
22
|
+
const boundaryCount = 1;
|
|
23
|
+
const totalNumbers = siblings * 2 + 5;
|
|
24
|
+
if (count <= totalNumbers) {
|
|
25
|
+
return range(1, count);
|
|
26
|
+
}
|
|
27
|
+
const startPages = range(1, Math.min(boundaryCount, count));
|
|
28
|
+
const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
|
|
29
|
+
const siblingsStart = Math.max(Math.min(current - siblings, count - boundaryCount - siblings * 2 - 1), boundaryCount + 2);
|
|
30
|
+
const siblingsEnd = Math.min(Math.max(current + siblings, boundaryCount + siblings * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : count - 1);
|
|
31
|
+
const items = [...startPages];
|
|
32
|
+
if (siblingsStart > boundaryCount + 2) {
|
|
33
|
+
items.push('ellipsis');
|
|
34
|
+
} else if (boundaryCount + 1 < count - boundaryCount) {
|
|
35
|
+
items.push(boundaryCount + 1);
|
|
36
|
+
}
|
|
37
|
+
items.push(...range(siblingsStart, siblingsEnd));
|
|
38
|
+
if (siblingsEnd < count - boundaryCount - 1) {
|
|
39
|
+
items.push('ellipsis');
|
|
40
|
+
} else if (count - boundaryCount > boundaryCount) {
|
|
41
|
+
items.push(count - boundaryCount);
|
|
42
|
+
}
|
|
43
|
+
items.push(...endPages);
|
|
44
|
+
return items;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=getTablePaginationItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["range","start","end","Array","from","length","_","index","getTablePaginationItems","page","count","siblingCount","current","Math","min","max","siblings","boundaryCount","totalNumbers","startPages","endPages","siblingsStart","siblingsEnd","items","push"],"sourceRoot":"../../../../src","sources":["components/TablePagination/getTablePaginationItems.ts"],"mappings":";;AAEA,SAASA,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAY;EACnD,IAAIA,GAAG,GAAGD,KAAK,EAAE;IACf,OAAO,EAAE;EACX;EACA,OAAOE,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEH,GAAG,GAAGD,KAAK,GAAG;EAAE,CAAC,EAAE,CAACK,CAAC,EAAEC,KAAK,KAAKN,KAAK,GAAGM,KAAK,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,IAAY,EACZC,KAAa,EACbC,YAAY,GAAG,CAAC,EACY;EAC5B,IAAID,KAAK,IAAI,CAAC,EAAE;IACd,OAAO,EAAE;EACX;EAEA,MAAME,OAAO,GAAGC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACN,IAAI,EAAE,CAAC,CAAC,EAAEC,KAAK,CAAC;EAClD,MAAMM,QAAQ,GAAGH,IAAI,CAACE,GAAG,CAACJ,YAAY,EAAE,CAAC,CAAC;EAC1C,MAAMM,aAAa,GAAG,CAAC;EACvB,MAAM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