@vlrc-fe/components 3.1.0 → 3.3.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.
- package/CHANGELOG.md +30 -0
- package/README.md +34 -22
- package/bin/registry.mjs +48 -0
- package/bin/vlrc.mjs +40 -1
- package/dist/DataTable/DataTable.cjs +8 -4
- package/dist/DataTable/DataTable.d.ts +1 -1
- package/dist/DataTable/DataTable.d.ts.map +1 -1
- package/dist/DataTable/DataTable.js +8 -4
- package/dist/DataTable/components/DataTablePagination.cjs +48 -174
- package/dist/DataTable/components/DataTablePagination.d.ts +2 -1
- package/dist/DataTable/components/DataTablePagination.d.ts.map +1 -1
- package/dist/DataTable/components/DataTablePagination.js +48 -174
- package/dist/DataTable/components/DataTableTable.cjs +43 -79
- package/dist/DataTable/components/DataTableTable.d.ts +2 -1
- package/dist/DataTable/components/DataTableTable.d.ts.map +1 -1
- package/dist/DataTable/components/DataTableTable.js +43 -79
- package/dist/DataTable/components/DataTableToolbar.cjs +25 -29
- package/dist/DataTable/components/DataTableToolbar.d.ts +2 -1
- package/dist/DataTable/components/DataTableToolbar.d.ts.map +1 -1
- package/dist/DataTable/components/DataTableToolbar.js +25 -29
- package/dist/DataTable/types.d.ts +3 -0
- package/dist/DataTable/types.d.ts.map +1 -1
- package/dist/FilterPopup/FilterPopup.cjs +289 -0
- package/dist/FilterPopup/FilterPopup.d.ts +21 -0
- package/dist/FilterPopup/FilterPopup.d.ts.map +1 -0
- package/dist/FilterPopup/FilterPopup.js +287 -0
- package/dist/FilterPopup/assets/Divider.svg.cjs +3 -0
- package/dist/FilterPopup/assets/Divider.svg.js +3 -0
- package/dist/FilterPopup/assets/IconCheck.svg.cjs +3 -0
- package/dist/FilterPopup/assets/IconCheck.svg.js +3 -0
- package/dist/FilterPopup/assets/IconClose.svg.cjs +3 -0
- package/dist/FilterPopup/assets/IconClose.svg.js +3 -0
- package/dist/FilterPopup/assets/IconSearch.svg.cjs +3 -0
- package/dist/FilterPopup/assets/IconSearch.svg.js +3 -0
- package/dist/FilterPopup/index.d.ts +3 -0
- package/dist/FilterPopup/index.d.ts.map +1 -0
- package/dist/FilterPopup/styles.cjs +151 -0
- package/dist/FilterPopup/styles.d.ts +134 -0
- package/dist/FilterPopup/styles.d.ts.map +1 -0
- package/dist/FilterPopup/styles.js +149 -0
- package/dist/FilterPopup/types.d.ts +13 -0
- package/dist/FilterPopup/types.d.ts.map +1 -0
- package/dist/Form/Form.cjs +4 -2
- package/dist/Form/Form.d.ts.map +1 -1
- package/dist/Form/Form.js +4 -2
- package/dist/Icons/Icons.cjs +5 -0
- package/dist/Icons/Icons.d.ts +5 -0
- package/dist/Icons/Icons.d.ts.map +1 -1
- package/dist/Icons/Icons.js +6 -1
- package/dist/Icons/JiraIcons.cjs +99 -0
- package/dist/Icons/JiraIcons.js +100 -2
- package/dist/Icons/index.cjs +11 -0
- package/dist/Icons/index.js +3 -0
- package/dist/Select/BaseSelect.cjs +8 -4
- package/dist/Select/BaseSelect.d.ts.map +1 -1
- package/dist/Select/BaseSelect.js +8 -4
- package/dist/Select/type.d.ts +1 -0
- package/dist/Select/type.d.ts.map +1 -1
- package/dist/assets/stylex.css +174 -12
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/stylex-config.cjs +56 -0
- package/dist/stylex-config.d.ts +14 -0
- package/dist/stylex-config.d.ts.map +1 -0
- package/dist/stylex-config.js +55 -0
- package/dist/theme/tokens.stylex.cjs +24 -23
- package/dist/theme/tokens.stylex.d.ts +48 -48
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +24 -23
- package/dist/theme.css +179 -13
- package/dist/ui/button.cjs +3 -3
- package/dist/ui/button.js +3 -3
- package/dist/ui/checkbox.cjs +2 -2
- package/dist/ui/checkbox.d.ts +3 -2
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +2 -2
- package/dist/ui/popover.cjs +6 -1
- package/dist/ui/popover.d.ts +3 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +6 -1
- package/dist/ui/scroll-area.cjs +4 -2
- package/dist/ui/scroll-area.d.ts.map +1 -1
- package/dist/ui/scroll-area.js +4 -2
- package/package.json +11 -4
- package/src/theme/woodland.css +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -186,6 +186,36 @@
|
|
|
186
186
|
- Fixed `FormCheckbox` vertical alignment when rendered with descriptions or helper text.
|
|
187
187
|
- Replaced all legacy string class concatenations with pure Meta StyleX atomic CSS.
|
|
188
188
|
|
|
189
|
+
## 3.3.0
|
|
190
|
+
|
|
191
|
+
### Minor Changes
|
|
192
|
+
|
|
193
|
+
- **Theme & Styles**: Added `woodland.css` theme stylesheet providing earthy forest green palette variables and exported `./woodland.css` subpath.
|
|
194
|
+
- **Icons**: Added `VolumeX` icon to the unified `Icons` registry.
|
|
195
|
+
- **CLI & Registry**: Added `TrailBanner` and `FoxMascot` component documentation to the VLRC CLI registry (`registry.mjs`) and enabled upstream JSON querying in `bin/vlrc.mjs`.
|
|
196
|
+
|
|
197
|
+
## 3.2.0
|
|
198
|
+
|
|
199
|
+
### Minor Changes
|
|
200
|
+
|
|
201
|
+
- ### @vlrc-fe/http
|
|
202
|
+
- **App API Client (`createAppApiClient`)**: Added standardized cookie-auth HTTP client factory with single-flight refresh token queue, per-request retry options preservation, automatic `FormData` `Content-Type` handling, and `auth:unauthorized` event dispatch.
|
|
203
|
+
- **Error Normalization**: Added `AppApiError`, `normalizeApiErrorResponse`, `isApiErrorResponse`, `getDefaultErrorMessageByStatus`, and `DEFAULT_ERROR_CODE_BY_STATUS`.
|
|
204
|
+
- **Auth Route Utilities**: Added `DEFAULT_AUTH_ROUTE_PATHS`, `DEFAULT_AUTH_API_PATHS`, `isAuthRoutePath`, `shouldRedirectToLogin`, and `subscribeUnauthorized` to prevent login redirect loops.
|
|
205
|
+
|
|
206
|
+
### @vlrc-fe/components
|
|
207
|
+
- **FilterPopup**: Added new `FilterPopup` component.
|
|
208
|
+
- **DataTable, Form, Select, UI & Theme**: Updated `DataTable`, `Form`, `BaseSelect`, `Icons`, `Button`, `Checkbox`, `Popover`, `ScrollArea`, and `theme.css` / `tokens.stylex.ts`.
|
|
209
|
+
|
|
210
|
+
### @vlrc-fe/editor
|
|
211
|
+
- **SlashMenu**: Updated `SlashMenuPlugin`, `slashMenuOptions`, `slashMenu.stylex.ts`, and `editor.css`.
|
|
212
|
+
|
|
213
|
+
### @vlrc-fe/types
|
|
214
|
+
- **Enums**: Updated `enums.ts` and package documentation.
|
|
215
|
+
|
|
216
|
+
### @vlrc-fe/animated-component
|
|
217
|
+
- **Initial Release**: Added optional GSAP motion and StyleX surfaces package.
|
|
218
|
+
|
|
189
219
|
## 3.1.0
|
|
190
220
|
|
|
191
221
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -42,7 +42,6 @@ Accessible, enterprise-grade React UI component library built natively on Meta's
|
|
|
42
42
|
```bash
|
|
43
43
|
# In consumer applications:
|
|
44
44
|
pnpm add @vlrc-fe/components @stylexjs/stylex
|
|
45
|
-
pnpm add -D @astryxdesign/build
|
|
46
45
|
```
|
|
47
46
|
|
|
48
47
|
> [!NOTE]
|
|
@@ -52,18 +51,20 @@ pnpm add -D @astryxdesign/build
|
|
|
52
51
|
|
|
53
52
|
## Subpath Exports
|
|
54
53
|
|
|
55
|
-
| Import Path
|
|
56
|
-
|
|
|
57
|
-
| `@vlrc-fe/components`
|
|
58
|
-
| `@vlrc-fe/components/astryx`
|
|
59
|
-
| `@vlrc-fe/components/theme`
|
|
60
|
-
| `@vlrc-fe/components/DataTable`
|
|
61
|
-
| `@vlrc-fe/components/Dropdown`
|
|
62
|
-
| `@vlrc-fe/components/Icons`
|
|
63
|
-
| `@vlrc-fe/components/Typography`
|
|
64
|
-
| `@vlrc-fe/components/Tag`
|
|
65
|
-
| `@vlrc-fe/components/richtext`
|
|
66
|
-
| `@vlrc-fe/components/
|
|
54
|
+
| Import Path | Contents |
|
|
55
|
+
| :---------------------------------- | :----------------------------------------------------------------------------------------- |
|
|
56
|
+
| `@vlrc-fe/components` | Tree-shakeable enterprise components, layout primitives, typography, forms |
|
|
57
|
+
| `@vlrc-fe/components/astryx` | 100% of Meta's Astryx primitives (447+ components, layout, and hooks) |
|
|
58
|
+
| `@vlrc-fe/components/theme` | Design tokens: `colors`, `radius`, `spacing`, `shadow`, `duration`, `easing` |
|
|
59
|
+
| `@vlrc-fe/components/DataTable` | Virtualized enterprise DataTable powered by TanStack Table & Astryx styles |
|
|
60
|
+
| `@vlrc-fe/components/Dropdown` | Accessible dropdown and action menus |
|
|
61
|
+
| `@vlrc-fe/components/Icons` | Central Lucide icon registry |
|
|
62
|
+
| `@vlrc-fe/components/Typography` | Extended `<Text>`, `<Title>`, `<Paragraph>`, `<Link>`, `<Code>` |
|
|
63
|
+
| `@vlrc-fe/components/Tag` | Compact tag primitive with color tokens, closable actions, and prefix icons |
|
|
64
|
+
| `@vlrc-fe/components/richtext` | Lexical-based rich text editor & headless Markdown serializers |
|
|
65
|
+
| `@vlrc-fe/components/stylex-config` | Shared build options for Vite consumers using StyleX |
|
|
66
|
+
| `@vlrc-fe/components/theme.css` | Unified CSS layer declarations (`reset`, `astryx-base`, `astryx-theme`, `vlrc`, `product`) |
|
|
67
|
+
| `@vlrc-fe/components/woodland.css` | Woodland theme CSS layer overrides (earthy forest green palette) |
|
|
67
68
|
|
|
68
69
|
### Direct Astryx Access (`@vlrc-fe/components/astryx`)
|
|
69
70
|
|
|
@@ -80,24 +81,35 @@ import { AstryxComponent, astryx } from '@vlrc-fe/components/astryx';
|
|
|
80
81
|
|
|
81
82
|
### 1. Configure Bundler Plugin (Vite)
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
If your application compiles StyleX, use the shared configuration in `vite.config.ts`:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
pnpm add -D @stylexjs/unplugin
|
|
88
|
+
```
|
|
84
89
|
|
|
85
90
|
```ts
|
|
86
|
-
import {
|
|
91
|
+
import { vlrcStylexOptions } from '@vlrc-fe/components/stylex-config';
|
|
92
|
+
import stylex from '@stylexjs/unplugin';
|
|
87
93
|
import react from '@vitejs/plugin-react';
|
|
88
|
-
import {
|
|
94
|
+
import { defineConfig } from 'vite';
|
|
89
95
|
|
|
90
|
-
export default defineConfig({
|
|
96
|
+
export default defineConfig(({ command }) => ({
|
|
91
97
|
plugins: [
|
|
92
|
-
stylex({
|
|
93
|
-
|
|
94
|
-
dev:
|
|
98
|
+
stylex.vite({
|
|
99
|
+
...vlrcStylexOptions(import.meta.dirname),
|
|
100
|
+
dev: command === 'serve',
|
|
101
|
+
runtimeInjection: false,
|
|
95
102
|
}),
|
|
96
103
|
react(),
|
|
97
104
|
],
|
|
98
|
-
});
|
|
105
|
+
}));
|
|
99
106
|
```
|
|
100
107
|
|
|
108
|
+
The helper orders application StyleX layers after VLRC's layers and resolves
|
|
109
|
+
imports from `@vlrc-fe/components/theme/tokens.stylex` to the same variable
|
|
110
|
+
names as the precompiled stylesheet. Import those tokens from the `.stylex`
|
|
111
|
+
subpath when using them in `stylex.create()`.
|
|
112
|
+
|
|
101
113
|
### 2. Import Stylesheet Once in App Entry
|
|
102
114
|
|
|
103
115
|
Import `@vlrc-fe/components/theme.css` once at your root entry (e.g. `main.tsx` or `App.tsx`):
|
|
@@ -109,7 +121,7 @@ import '@vlrc-fe/components/theme.css';
|
|
|
109
121
|
This automatically declares native CSS cascade layers in the required order:
|
|
110
122
|
|
|
111
123
|
```css
|
|
112
|
-
@layer reset, astryx-base, astryx-theme, product;
|
|
124
|
+
@layer reset, astryx-base, astryx-theme, vlrc, product;
|
|
113
125
|
```
|
|
114
126
|
|
|
115
127
|
### 3. Do Not Run the StyleX Babel Plugin Over This Package's Dist
|
package/bin/registry.mjs
CHANGED
|
@@ -4,6 +4,54 @@
|
|
|
4
4
|
* Registry of VLRC and Richtext components for the VLRC CLI.
|
|
5
5
|
*/
|
|
6
6
|
export const VLRC_COMPONENTS = {
|
|
7
|
+
TrailBanner: {
|
|
8
|
+
name: 'TrailBanner',
|
|
9
|
+
displayName: 'Trail Banner',
|
|
10
|
+
category: 'Motion',
|
|
11
|
+
package: '@vlrc-fe/animated-component',
|
|
12
|
+
keywords: ['game', 'trail', 'banner', 'responsive'],
|
|
13
|
+
import: "import { TrailBanner } from '@vlrc-fe/animated-component';",
|
|
14
|
+
description:
|
|
15
|
+
'A mobile-first illustrated chapter heading with GSAP entrance and space for actions and a companion. Import @vlrc-fe/animated-component/styles.css once.',
|
|
16
|
+
bestPractices: [],
|
|
17
|
+
props: [
|
|
18
|
+
{ name: 'title', type: 'string', required: true, description: 'Page heading.' },
|
|
19
|
+
{
|
|
20
|
+
name: 'artwork',
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true,
|
|
23
|
+
description: 'URL of decorative landscape artwork.',
|
|
24
|
+
},
|
|
25
|
+
{ name: 'detail', type: 'string', description: 'Supporting description.' },
|
|
26
|
+
{
|
|
27
|
+
name: 'companion',
|
|
28
|
+
type: 'ReactNode',
|
|
29
|
+
description: 'Optional mascot in the illustrated panel.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'children',
|
|
33
|
+
type: 'ReactNode',
|
|
34
|
+
description: 'Optional actions below the description.',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
FoxMascot: {
|
|
39
|
+
name: 'FoxMascot',
|
|
40
|
+
displayName: 'Fox Mascot',
|
|
41
|
+
category: 'Motion',
|
|
42
|
+
package: '@vlrc-fe/animated-component',
|
|
43
|
+
keywords: ['fox', 'game', 'mascot', 'gsap'],
|
|
44
|
+
import: "import { FoxMascot } from '@vlrc-fe/animated-component';",
|
|
45
|
+
description:
|
|
46
|
+
'Interactive paper fox with touch, keyboard and reduced motion support. Import @vlrc-fe/animated-component/styles.css once.',
|
|
47
|
+
bestPractices: [],
|
|
48
|
+
props: [
|
|
49
|
+
{ name: 'label', type: 'string', required: true, description: 'Localized button label.' },
|
|
50
|
+
{ name: 'size', type: "'small' | 'large'", default: 'large', description: 'Display size.' },
|
|
51
|
+
{ name: 'happy', type: 'boolean', default: 'false', description: 'Show celebration face.' },
|
|
52
|
+
{ name: 'onPet', type: '() => void', description: 'Called when activated.' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
7
55
|
// --- Richtext & Editor ---
|
|
8
56
|
RichTextEditor: {
|
|
9
57
|
name: 'RichTextEditor',
|
package/bin/vlrc.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { VLRC_COMPONENTS, formatComponentDoc, formatComponentJson } from './registry.mjs';
|
|
5
5
|
|
|
@@ -17,6 +17,20 @@ function runAstryxCLI(customArgs = args) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function upstreamJson() {
|
|
21
|
+
const result = spawnSync(process.execPath, [cliPath, ...args], {
|
|
22
|
+
encoding: 'utf8',
|
|
23
|
+
stdio: ['inherit', 'pipe', 'inherit'],
|
|
24
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
25
|
+
});
|
|
26
|
+
if (result.error) throw result.error;
|
|
27
|
+
if (result.status !== 0) {
|
|
28
|
+
process.stdout.write(result.stdout ?? '');
|
|
29
|
+
process.exit(result.status ?? 1);
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(result.stdout);
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
// 1. Handle `vlrc component <Name> [--json] [--props]`
|
|
21
35
|
if (args[0] === 'component') {
|
|
22
36
|
const isJson = args.includes('--json');
|
|
@@ -24,6 +38,14 @@ if (args[0] === 'component') {
|
|
|
24
38
|
const isList = args.includes('--list') || args.length === 1;
|
|
25
39
|
|
|
26
40
|
if (isList) {
|
|
41
|
+
if (isJson) {
|
|
42
|
+
const output = upstreamJson();
|
|
43
|
+
for (const { name, package: packageName } of Object.values(VLRC_COMPONENTS)) {
|
|
44
|
+
(output.data.components[name] ??= []).push({ name, package: packageName });
|
|
45
|
+
}
|
|
46
|
+
console.log(JSON.stringify(output, null, 2));
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
27
49
|
// Print combined list
|
|
28
50
|
const child = spawn(process.execPath, [cliPath, 'component', '--list'], {
|
|
29
51
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
@@ -91,6 +113,23 @@ if (args[0] === 'component') {
|
|
|
91
113
|
);
|
|
92
114
|
});
|
|
93
115
|
|
|
116
|
+
if (matches.length && isJson) {
|
|
117
|
+
const output = upstreamJson();
|
|
118
|
+
const local = matches.map((comp) => ({
|
|
119
|
+
domain: 'component',
|
|
120
|
+
name: comp.name,
|
|
121
|
+
package: comp.package,
|
|
122
|
+
description: comp.description,
|
|
123
|
+
score: comp.name.toLowerCase() === query ? 100 : 80,
|
|
124
|
+
reason: 'local registry match',
|
|
125
|
+
import: comp.package,
|
|
126
|
+
command: `vlrc component ${comp.name}`,
|
|
127
|
+
}));
|
|
128
|
+
output.data.results = [...local, ...output.data.results].sort((a, b) => b.score - a.score);
|
|
129
|
+
output.data.matchCount += local.length;
|
|
130
|
+
console.log(JSON.stringify(output, null, 2));
|
|
131
|
+
process.exit(0);
|
|
132
|
+
}
|
|
94
133
|
if (matches.length > 0 && !isJson) {
|
|
95
134
|
console.log(`\nFound ${matches.length} matching VLRC component(s):\n`);
|
|
96
135
|
for (const m of matches) {
|
|
@@ -34,7 +34,7 @@ var DEFAULT_RENDER_TOOLBAR_RIGHT = () => null;
|
|
|
34
34
|
var DEFAULT_GET_ROW_ID = (_originalRow, index) => {
|
|
35
35
|
return String(index);
|
|
36
36
|
};
|
|
37
|
-
var DataTable = ({ data, columns, initialState, empty, search, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight }) => {
|
|
37
|
+
var DataTable = ({ data, columns, initialState, empty, search, showSearch = true, compact = false, enableRowSelection = true, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight }) => {
|
|
38
38
|
const initialConfig = initialState === void 0 ? DEFAULT_INITIAL_STATE : initialState;
|
|
39
39
|
const resolvedEmpty = empty === void 0 ? require_defaults.DEFAULT_EMPTY : empty;
|
|
40
40
|
const resolvedSearch = search === void 0 ? require_defaults.DEFAULT_SEARCH : search;
|
|
@@ -71,7 +71,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
71
71
|
manualPagination: manualMode,
|
|
72
72
|
pageCount,
|
|
73
73
|
meta: { getRowActions: resolvedActions.getRowActions },
|
|
74
|
-
enableRowSelection
|
|
74
|
+
enableRowSelection,
|
|
75
75
|
getRowId: (originalRow, index, parent) => resolvedGetRowId(originalRow, index, parent === void 0 ? null : parent),
|
|
76
76
|
onSortingChange: (updater) => setSorting((current) => (0, _tanstack_react_table.functionalUpdate)(updater, current)),
|
|
77
77
|
onColumnFiltersChange: (updater_0) => setColumnFilters((current_0) => (0, _tanstack_react_table.functionalUpdate)(updater_0, current_0)),
|
|
@@ -117,6 +117,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
117
117
|
pageIndex: (0, lodash_es.clamp)(current_7.pageIndex, 0, maxPageIndex)
|
|
118
118
|
}));
|
|
119
119
|
}, [
|
|
120
|
+
data,
|
|
120
121
|
manualMode,
|
|
121
122
|
paginationState.pageSize,
|
|
122
123
|
table
|
|
@@ -167,6 +168,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
167
168
|
children: [
|
|
168
169
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DataTableToolbar.DataTableToolbar, {
|
|
169
170
|
table,
|
|
171
|
+
showSearch,
|
|
170
172
|
placeholder: resolvedSearch.placeholder,
|
|
171
173
|
debounceMs: resolvedSearch.debounceMs,
|
|
172
174
|
right: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -187,14 +189,16 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
187
189
|
expandedState: expanded,
|
|
188
190
|
expandConfig: resolvedExpand,
|
|
189
191
|
empty: resolvedEmpty,
|
|
190
|
-
columnsCount
|
|
192
|
+
columnsCount,
|
|
193
|
+
compact
|
|
191
194
|
})
|
|
192
195
|
}),
|
|
193
196
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DataTablePagination.DataTablePagination, {
|
|
194
197
|
table,
|
|
195
198
|
tableState: table.getState(),
|
|
196
199
|
pageSizeOptions: resolvedPagination.pageSizeOptions,
|
|
197
|
-
apiConfig: resolvedApi
|
|
200
|
+
apiConfig: resolvedApi,
|
|
201
|
+
showSelection: enableRowSelection
|
|
198
202
|
})
|
|
199
203
|
]
|
|
200
204
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ColumnDef } from '@tanstack/react-table';
|
|
2
2
|
import type { DataTableProps, DataTableValue } from './types';
|
|
3
|
-
export declare const DataTable: <TData>({ data, columns, initialState, empty, search, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight, }: DataTableProps<TData> & {
|
|
3
|
+
export declare const DataTable: <TData>({ data, columns, initialState, empty, search, showSearch, compact, enableRowSelection, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight, }: DataTableProps<TData> & {
|
|
4
4
|
columns: ColumnDef<TData, DataTableValue>[];
|
|
5
5
|
}) => import("react").JSX.Element;
|
|
6
6
|
export default DataTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/DataTable/DataTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,uBAAuB,CAAC;AA6B/B,OAAO,KAAK,EAOV,cAAc,EAGd,cAAc,EACf,MAAM,SAAS,CAAC;AAwBjB,eAAO,MAAM,SAAS,GAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/DataTable/DataTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,uBAAuB,CAAC;AA6B/B,OAAO,KAAK,EAOV,cAAc,EAGd,cAAc,EACf,MAAM,SAAS,CAAC;AAwBjB,eAAO,MAAM,SAAS,GAAI,KAAK,6NAkB5B,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC;CAC7C,gCAiNA,CAAC;eAEa,SAAS"}
|
|
@@ -32,7 +32,7 @@ var DEFAULT_RENDER_TOOLBAR_RIGHT = () => null;
|
|
|
32
32
|
var DEFAULT_GET_ROW_ID = (_originalRow, index) => {
|
|
33
33
|
return String(index);
|
|
34
34
|
};
|
|
35
|
-
var DataTable = ({ data, columns, initialState, empty, search, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight }) => {
|
|
35
|
+
var DataTable = ({ data, columns, initialState, empty, search, showSearch = true, compact = false, enableRowSelection = true, pagination: paginationConfig, actions, api, infiniteScroll, expand, className, containerClassName, getRowId, renderToolbarRight }) => {
|
|
36
36
|
const initialConfig = initialState === void 0 ? DEFAULT_INITIAL_STATE : initialState;
|
|
37
37
|
const resolvedEmpty = empty === void 0 ? DEFAULT_EMPTY : empty;
|
|
38
38
|
const resolvedSearch = search === void 0 ? DEFAULT_SEARCH : search;
|
|
@@ -69,7 +69,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
69
69
|
manualPagination: manualMode,
|
|
70
70
|
pageCount,
|
|
71
71
|
meta: { getRowActions: resolvedActions.getRowActions },
|
|
72
|
-
enableRowSelection
|
|
72
|
+
enableRowSelection,
|
|
73
73
|
getRowId: (originalRow, index, parent) => resolvedGetRowId(originalRow, index, parent === void 0 ? null : parent),
|
|
74
74
|
onSortingChange: (updater) => setSorting((current) => functionalUpdate(updater, current)),
|
|
75
75
|
onColumnFiltersChange: (updater_0) => setColumnFilters((current_0) => functionalUpdate(updater_0, current_0)),
|
|
@@ -115,6 +115,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
115
115
|
pageIndex: clamp(current_7.pageIndex, 0, maxPageIndex)
|
|
116
116
|
}));
|
|
117
117
|
}, [
|
|
118
|
+
data,
|
|
118
119
|
manualMode,
|
|
119
120
|
paginationState.pageSize,
|
|
120
121
|
table
|
|
@@ -165,6 +166,7 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
165
166
|
children: [
|
|
166
167
|
/* @__PURE__ */ jsx(DataTableToolbar, {
|
|
167
168
|
table,
|
|
169
|
+
showSearch,
|
|
168
170
|
placeholder: resolvedSearch.placeholder,
|
|
169
171
|
debounceMs: resolvedSearch.debounceMs,
|
|
170
172
|
right: /* @__PURE__ */ jsxs("div", {
|
|
@@ -185,14 +187,16 @@ var DataTable = ({ data, columns, initialState, empty, search, pagination: pagin
|
|
|
185
187
|
expandedState: expanded,
|
|
186
188
|
expandConfig: resolvedExpand,
|
|
187
189
|
empty: resolvedEmpty,
|
|
188
|
-
columnsCount
|
|
190
|
+
columnsCount,
|
|
191
|
+
compact
|
|
189
192
|
})
|
|
190
193
|
}),
|
|
191
194
|
/* @__PURE__ */ jsx(DataTablePagination, {
|
|
192
195
|
table,
|
|
193
196
|
tableState: table.getState(),
|
|
194
197
|
pageSizeOptions: resolvedPagination.pageSizeOptions,
|
|
195
|
-
apiConfig: resolvedApi
|
|
198
|
+
apiConfig: resolvedApi,
|
|
199
|
+
showSelection: enableRowSelection
|
|
196
200
|
})
|
|
197
201
|
]
|
|
198
202
|
});
|
|
@@ -5,7 +5,6 @@ const require_dropdown_menu = require("../../ui/dropdown-menu.cjs");
|
|
|
5
5
|
let _stylexjs_stylex = require("@stylexjs/stylex");
|
|
6
6
|
_stylexjs_stylex = require_runtime.__toESM(_stylexjs_stylex, 1);
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let react_compiler_runtime = require("react/compiler-runtime");
|
|
9
8
|
let lodash_es = require("lodash-es");
|
|
10
9
|
// src/DataTable/components/DataTablePagination.tsx
|
|
11
10
|
var styles = { pageNumber: {
|
|
@@ -15,185 +14,60 @@ var styles = { pageNumber: {
|
|
|
15
14
|
kMwMTN: "x84br7x",
|
|
16
15
|
$$css: true
|
|
17
16
|
} };
|
|
18
|
-
var DataTablePagination = (
|
|
19
|
-
|
|
20
|
-
const { table, tableState, pageSizeOptions, apiConfig } = t0;
|
|
17
|
+
var DataTablePagination = ({ table, tableState, pageSizeOptions, apiConfig, showSelection }) => {
|
|
18
|
+
"use no memo";
|
|
21
19
|
const pageIndex = tableState.pagination.pageIndex;
|
|
22
20
|
const pageSize = tableState.pagination.pageSize;
|
|
23
|
-
|
|
24
|
-
if ($[0] !== apiConfig.mode || $[1] !== apiConfig.totalRows || $[2] !== table) {
|
|
25
|
-
t1 = apiConfig.mode === "server" ? apiConfig.totalRows : table.getFilteredRowModel().rows.length;
|
|
26
|
-
$[0] = apiConfig.mode;
|
|
27
|
-
$[1] = apiConfig.totalRows;
|
|
28
|
-
$[2] = table;
|
|
29
|
-
$[3] = t1;
|
|
30
|
-
} else t1 = $[3];
|
|
31
|
-
const totalRows = t1;
|
|
21
|
+
const totalRows = apiConfig.mode === "server" ? apiConfig.totalRows : table.getFilteredRowModel().rows.length;
|
|
32
22
|
const pageCount = pageSize > 0 ? Math.ceil(totalRows / pageSize) : 0;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
$[4] = table;
|
|
37
|
-
$[5] = t2;
|
|
38
|
-
} else t2 = $[5];
|
|
39
|
-
let t3;
|
|
40
|
-
if ($[6] !== t2.rows.length || $[7] !== totalRows) {
|
|
41
|
-
t3 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
24
|
+
className: "x78zum5 x6s0dn4 x1qughib x8fetqu xo0yzjp x1a02dak",
|
|
25
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
42
26
|
className: "xw3nh4a x845mor xkpwil5",
|
|
43
|
-
children:
|
|
44
|
-
|
|
45
|
-
" of ",
|
|
46
|
-
totalRows,
|
|
47
|
-
" row(s) selected."
|
|
48
|
-
]
|
|
49
|
-
});
|
|
50
|
-
$[6] = t2.rows.length;
|
|
51
|
-
$[7] = totalRows;
|
|
52
|
-
$[8] = t3;
|
|
53
|
-
} else t3 = $[8];
|
|
54
|
-
let t4;
|
|
55
|
-
if ($[9] !== pageSize) {
|
|
56
|
-
t4 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuTrigger, {
|
|
57
|
-
asChild: true,
|
|
58
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_button.Button, {
|
|
59
|
-
variant: "outline",
|
|
60
|
-
size: "sm",
|
|
61
|
-
children: ["Rows: ", pageSize]
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
$[9] = pageSize;
|
|
65
|
-
$[10] = t4;
|
|
66
|
-
} else t4 = $[10];
|
|
67
|
-
let t5;
|
|
68
|
-
if ($[11] !== pageSize || $[12] !== table) {
|
|
69
|
-
t5 = (opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuItem, {
|
|
70
|
-
onClick: () => table.setPageSize(opt),
|
|
71
|
-
disabled: opt === pageSize,
|
|
72
|
-
children: opt
|
|
73
|
-
}, String(opt));
|
|
74
|
-
$[11] = pageSize;
|
|
75
|
-
$[12] = table;
|
|
76
|
-
$[13] = t5;
|
|
77
|
-
} else t5 = $[13];
|
|
78
|
-
let t6;
|
|
79
|
-
if ($[14] !== pageSizeOptions || $[15] !== t5) {
|
|
80
|
-
t6 = (0, lodash_es.map)(pageSizeOptions, t5);
|
|
81
|
-
$[14] = pageSizeOptions;
|
|
82
|
-
$[15] = t5;
|
|
83
|
-
$[16] = t6;
|
|
84
|
-
} else t6 = $[16];
|
|
85
|
-
let t7;
|
|
86
|
-
if ($[17] !== t6) {
|
|
87
|
-
t7 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuContent, {
|
|
88
|
-
align: "end",
|
|
89
|
-
children: t6
|
|
90
|
-
});
|
|
91
|
-
$[17] = t6;
|
|
92
|
-
$[18] = t7;
|
|
93
|
-
} else t7 = $[18];
|
|
94
|
-
let t8;
|
|
95
|
-
if ($[19] !== t4 || $[20] !== t7) {
|
|
96
|
-
t8 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_dropdown_menu.DropdownMenu, { children: [t4, t7] });
|
|
97
|
-
$[19] = t4;
|
|
98
|
-
$[20] = t7;
|
|
99
|
-
$[21] = t8;
|
|
100
|
-
} else t8 = $[21];
|
|
101
|
-
let t10;
|
|
102
|
-
let t9;
|
|
103
|
-
if ($[22] !== table) {
|
|
104
|
-
t9 = () => table.previousPage();
|
|
105
|
-
t10 = table.getCanPreviousPage();
|
|
106
|
-
$[22] = table;
|
|
107
|
-
$[23] = t10;
|
|
108
|
-
$[24] = t9;
|
|
109
|
-
} else {
|
|
110
|
-
t10 = $[23];
|
|
111
|
-
t9 = $[24];
|
|
112
|
-
}
|
|
113
|
-
const t11 = !t10;
|
|
114
|
-
let t12;
|
|
115
|
-
if ($[25] !== t11 || $[26] !== t9) {
|
|
116
|
-
t12 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
117
|
-
variant: "outline",
|
|
118
|
-
size: "sm",
|
|
119
|
-
onClick: t9,
|
|
120
|
-
disabled: t11,
|
|
121
|
-
children: "Previous"
|
|
122
|
-
});
|
|
123
|
-
$[25] = t11;
|
|
124
|
-
$[26] = t9;
|
|
125
|
-
$[27] = t12;
|
|
126
|
-
} else t12 = $[27];
|
|
127
|
-
const t13 = pageIndex + 1;
|
|
128
|
-
const t14 = Math.max(1, pageCount);
|
|
129
|
-
let t15;
|
|
130
|
-
if ($[28] !== t13 || $[29] !== t14) {
|
|
131
|
-
t15 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Text.Text, {
|
|
132
|
-
size: "sm",
|
|
133
|
-
sx: styles.pageNumber,
|
|
134
|
-
children: [
|
|
135
|
-
t13,
|
|
136
|
-
" / ",
|
|
137
|
-
t14
|
|
138
|
-
]
|
|
139
|
-
});
|
|
140
|
-
$[28] = t13;
|
|
141
|
-
$[29] = t14;
|
|
142
|
-
$[30] = t15;
|
|
143
|
-
} else t15 = $[30];
|
|
144
|
-
let t16;
|
|
145
|
-
let t17;
|
|
146
|
-
if ($[31] !== table) {
|
|
147
|
-
t16 = () => table.nextPage();
|
|
148
|
-
t17 = table.getCanNextPage();
|
|
149
|
-
$[31] = table;
|
|
150
|
-
$[32] = t16;
|
|
151
|
-
$[33] = t17;
|
|
152
|
-
} else {
|
|
153
|
-
t16 = $[32];
|
|
154
|
-
t17 = $[33];
|
|
155
|
-
}
|
|
156
|
-
const t18 = !t17;
|
|
157
|
-
let t19;
|
|
158
|
-
if ($[34] !== t16 || $[35] !== t18) {
|
|
159
|
-
t19 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
160
|
-
variant: "outline",
|
|
161
|
-
size: "sm",
|
|
162
|
-
onClick: t16,
|
|
163
|
-
disabled: t18,
|
|
164
|
-
children: "Next"
|
|
165
|
-
});
|
|
166
|
-
$[34] = t16;
|
|
167
|
-
$[35] = t18;
|
|
168
|
-
$[36] = t19;
|
|
169
|
-
} else t19 = $[36];
|
|
170
|
-
let t20;
|
|
171
|
-
if ($[37] !== t12 || $[38] !== t15 || $[39] !== t19 || $[40] !== t8) {
|
|
172
|
-
t20 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
27
|
+
children: showSelection ? `${table.getFilteredSelectedRowModel().rows.length} of ${totalRows} row(s) selected.` : `${totalRows ? pageIndex * pageSize + 1 : 0}–${Math.min(totalRows, (pageIndex + 1) * pageSize)} / ${totalRows}`
|
|
28
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
173
29
|
className: "x78zum5 x6s0dn4 x13z6uf9",
|
|
174
30
|
children: [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_dropdown_menu.DropdownMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuTrigger, {
|
|
32
|
+
asChild: true,
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_button.Button, {
|
|
34
|
+
variant: "outline",
|
|
35
|
+
size: "sm",
|
|
36
|
+
children: ["Rows: ", pageSize]
|
|
37
|
+
})
|
|
38
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuContent, {
|
|
39
|
+
align: "end",
|
|
40
|
+
children: (0, lodash_es.map)(pageSizeOptions, (opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dropdown_menu.DropdownMenuItem, {
|
|
41
|
+
onClick: () => table.setPageSize(opt),
|
|
42
|
+
disabled: opt === pageSize,
|
|
43
|
+
children: opt
|
|
44
|
+
}, String(opt)))
|
|
45
|
+
})] }),
|
|
46
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
47
|
+
variant: "outline",
|
|
48
|
+
size: "sm",
|
|
49
|
+
onClick: () => table.previousPage(),
|
|
50
|
+
disabled: !table.getCanPreviousPage(),
|
|
51
|
+
children: "Previous"
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Text.Text, {
|
|
54
|
+
size: "sm",
|
|
55
|
+
sx: styles.pageNumber,
|
|
56
|
+
children: [
|
|
57
|
+
pageIndex + 1,
|
|
58
|
+
" / ",
|
|
59
|
+
Math.max(1, pageCount)
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
63
|
+
variant: "outline",
|
|
64
|
+
size: "sm",
|
|
65
|
+
onClick: () => table.nextPage(),
|
|
66
|
+
disabled: !table.getCanNextPage(),
|
|
67
|
+
children: "Next"
|
|
68
|
+
})
|
|
179
69
|
]
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
$[38] = t15;
|
|
183
|
-
$[39] = t19;
|
|
184
|
-
$[40] = t8;
|
|
185
|
-
$[41] = t20;
|
|
186
|
-
} else t20 = $[41];
|
|
187
|
-
let t21;
|
|
188
|
-
if ($[42] !== t20 || $[43] !== t3) {
|
|
189
|
-
t21 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
190
|
-
className: "x78zum5 x6s0dn4 x1qughib x8fetqu xgepmj6",
|
|
191
|
-
children: [t3, t20]
|
|
192
|
-
});
|
|
193
|
-
$[42] = t20;
|
|
194
|
-
$[43] = t3;
|
|
195
|
-
$[44] = t21;
|
|
196
|
-
} else t21 = $[44];
|
|
197
|
-
return t21;
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
198
72
|
};
|
|
199
73
|
exports.DataTablePagination = DataTablePagination;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Table } from '@tanstack/react-table';
|
|
2
2
|
import type { DataTableApiConfig } from '../types';
|
|
3
|
-
export declare const DataTablePagination: <TData>({ table, tableState, pageSizeOptions, apiConfig, }: {
|
|
3
|
+
export declare const DataTablePagination: <TData>({ table, tableState, pageSizeOptions, apiConfig, showSelection, }: {
|
|
4
4
|
table: Table<TData>;
|
|
5
5
|
tableState: Table<TData>['getState'] extends () => infer S ? S : never;
|
|
6
6
|
pageSizeOptions: number[];
|
|
7
7
|
apiConfig: DataTableApiConfig;
|
|
8
|
+
showSelection: boolean;
|
|
8
9
|
}) => import("react").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=DataTablePagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTablePagination.d.ts","sourceRoot":"","sources":["../../../src/DataTable/components/DataTablePagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAWnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTablePagination.d.ts","sourceRoot":"","sources":["../../../src/DataTable/components/DataTablePagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAWnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA6BnD,eAAO,MAAM,mBAAmB,GAAI,KAAK,qEAMtC;IACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;CACxB,gCA+DA,CAAC"}
|