@dashforge/tw 1.1.0 → 1.1.1
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 +21 -1
- package/dist/index.esm.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/package.json +8 -3
- package/.swcrc +0 -29
- package/A11Y.md +0 -130
- package/CONSUMER-VALIDATION.md +0 -130
- package/COVERAGE.md +0 -63
- package/PARITY.md +0 -481
- package/PERFORMANCE.md +0 -227
- package/REFINEMENT-NOTES.md +0 -50
- package/THEME-AUDIT.md +0 -174
- package/dashforge-tw-1.0.0.tgz +0 -0
- package/eslint.config.mjs +0 -62
- package/project.json +0 -15
- package/rollup.config.cjs +0 -16
- package/src/components/Accordion/Accordion.test.tsx +0 -95
- package/src/components/Accordion/Accordion.tsx +0 -97
- package/src/components/Accordion/accordion.types.ts +0 -66
- package/src/components/Accordion/accordion.variants.ts +0 -32
- package/src/components/Alert/Alert.test.tsx +0 -302
- package/src/components/Alert/Alert.tsx +0 -186
- package/src/components/Alert/alert.types.ts +0 -144
- package/src/components/Alert/alert.variants.ts +0 -71
- package/src/components/AppShell/AppShell.test.tsx +0 -223
- package/src/components/AppShell/AppShell.tsx +0 -239
- package/src/components/AppShell/appShell.types.ts +0 -49
- package/src/components/AppShell/appShell.variants.ts +0 -54
- package/src/components/AspectRatio/AspectRatio.test.tsx +0 -173
- package/src/components/AspectRatio/AspectRatio.tsx +0 -73
- package/src/components/AspectRatio/aspectRatio.types.ts +0 -54
- package/src/components/Autocomplete/Autocomplete.perf.test.tsx +0 -225
- package/src/components/Autocomplete/Autocomplete.test.tsx +0 -556
- package/src/components/Autocomplete/Autocomplete.tsx +0 -1069
- package/src/components/Autocomplete/autocomplete.types.ts +0 -198
- package/src/components/Autocomplete/autocomplete.variants.ts +0 -141
- package/src/components/Avatar/Avatar.test.tsx +0 -287
- package/src/components/Avatar/Avatar.tsx +0 -304
- package/src/components/Avatar/avatar.types.ts +0 -205
- package/src/components/Avatar/avatar.variants.ts +0 -194
- package/src/components/Badge/Badge.test.tsx +0 -385
- package/src/components/Badge/Badge.tsx +0 -174
- package/src/components/Badge/badge.types.ts +0 -154
- package/src/components/Badge/badge.variants.ts +0 -161
- package/src/components/Box/Box.test.tsx +0 -391
- package/src/components/Box/Box.tsx +0 -112
- package/src/components/Box/box.types.ts +0 -116
- package/src/components/Box/box.variants.ts +0 -230
- package/src/components/Breadcrumbs/Breadcrumbs.perf.test.tsx +0 -128
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -231
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -203
- package/src/components/Breadcrumbs/breadcrumbs.types.ts +0 -87
- package/src/components/Breadcrumbs/breadcrumbs.variants.ts +0 -54
- package/src/components/Button/Button.test.tsx +0 -204
- package/src/components/Button/Button.tsx +0 -151
- package/src/components/Button/button.types.ts +0 -110
- package/src/components/Button/button.variants.ts +0 -159
- package/src/components/Calendar/Calendar.test.tsx +0 -75
- package/src/components/Calendar/Calendar.tsx +0 -264
- package/src/components/Calendar/calendar.types.ts +0 -65
- package/src/components/Calendar/calendar.variants.ts +0 -64
- package/src/components/Card/Card.test.tsx +0 -291
- package/src/components/Card/Card.tsx +0 -241
- package/src/components/Card/card.types.ts +0 -132
- package/src/components/Checkbox/Checkbox.test.tsx +0 -146
- package/src/components/Checkbox/Checkbox.tsx +0 -286
- package/src/components/Checkbox/checkbox.types.ts +0 -88
- package/src/components/Checkbox/checkbox.variants.ts +0 -68
- package/src/components/Chip/Chip.test.tsx +0 -316
- package/src/components/Chip/Chip.tsx +0 -224
- package/src/components/Chip/chip.types.ts +0 -128
- package/src/components/Chip/chip.variants.ts +0 -173
- package/src/components/ConfirmDialog/ConfirmDialog.perf.test.tsx +0 -172
- package/src/components/ConfirmDialog/ConfirmDialog.test.tsx +0 -311
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +0 -252
- package/src/components/ConfirmDialog/confirmDialog.types.ts +0 -70
- package/src/components/ConfirmDialog/confirmDialog.variants.ts +0 -76
- package/src/components/Container/Container.test.tsx +0 -209
- package/src/components/Container/Container.tsx +0 -74
- package/src/components/Container/container.types.ts +0 -45
- package/src/components/Container/container.variants.ts +0 -81
- package/src/components/DataGrid/DataGrid.perf.test.tsx +0 -114
- package/src/components/DataGrid/DataGrid.test.tsx +0 -1153
- package/src/components/DataGrid/DataGrid.tsx +0 -1282
- package/src/components/DataGrid/dataGrid.types.ts +0 -238
- package/src/components/DataGrid/dataGrid.variants.ts +0 -152
- package/src/components/DataGrid/filters/ColumnFilters.test.tsx +0 -330
- package/src/components/DataGrid/filters/ColumnFilters.tsx +0 -456
- package/src/components/DataGrid/reorder/useColumnReorder.test.ts +0 -130
- package/src/components/DataGrid/reorder/useColumnReorder.ts +0 -144
- package/src/components/DataGrid/resize/useColumnResize.test.ts +0 -144
- package/src/components/DataGrid/resize/useColumnResize.ts +0 -135
- package/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx +0 -186
- package/src/components/DatePicker/DatePicker.test.tsx +0 -76
- package/src/components/DatePicker/DatePicker.tsx +0 -305
- package/src/components/DatePicker/datePicker.types.ts +0 -77
- package/src/components/DatePicker/datePicker.variants.ts +0 -50
- package/src/components/DateRangePicker/DateRangePicker.test.tsx +0 -92
- package/src/components/DateRangePicker/DateRangePicker.tsx +0 -510
- package/src/components/DateRangePicker/dateRangePicker.types.ts +0 -74
- package/src/components/DateRangePicker/dateRangePicker.variants.ts +0 -101
- package/src/components/DateTimePicker/DateTimePicker.test.tsx +0 -78
- package/src/components/DateTimePicker/DateTimePicker.tsx +0 -347
- package/src/components/DateTimePicker/dateTimePicker.types.ts +0 -79
- package/src/components/DateTimePicker/dateTimePicker.variants.ts +0 -55
- package/src/components/Dialog/Dialog.test.tsx +0 -96
- package/src/components/Dialog/Dialog.tsx +0 -102
- package/src/components/Dialog/dialog.types.ts +0 -62
- package/src/components/Dialog/dialog.variants.ts +0 -66
- package/src/components/Divider/Divider.test.tsx +0 -243
- package/src/components/Divider/Divider.tsx +0 -140
- package/src/components/Divider/divider.types.ts +0 -52
- package/src/components/Divider/divider.variants.ts +0 -116
- package/src/components/Grid/Grid.test.tsx +0 -321
- package/src/components/Grid/Grid.tsx +0 -148
- package/src/components/Grid/grid.types.ts +0 -112
- package/src/components/Grid/grid.variants.ts +0 -133
- package/src/components/IconButton/IconButton.test.tsx +0 -367
- package/src/components/IconButton/IconButton.tsx +0 -159
- package/src/components/IconButton/iconButton.types.ts +0 -106
- package/src/components/IconButton/iconButton.variants.ts +0 -31
- package/src/components/LeftNav/LeftNav.perf.test.tsx +0 -172
- package/src/components/LeftNav/LeftNav.test.tsx +0 -302
- package/src/components/LeftNav/LeftNav.tsx +0 -330
- package/src/components/LeftNav/leftNav.types.ts +0 -120
- package/src/components/LeftNav/leftNav.variants.ts +0 -107
- package/src/components/Menu/Menu.test.tsx +0 -408
- package/src/components/Menu/Menu.tsx +0 -335
- package/src/components/Menu/menu.types.ts +0 -221
- package/src/components/Menu/menu.variants.ts +0 -132
- package/src/components/NumberField/NumberField.test.tsx +0 -83
- package/src/components/NumberField/NumberField.tsx +0 -321
- package/src/components/NumberField/numberField.types.ts +0 -72
- package/src/components/NumberField/numberField.variants.ts +0 -94
- package/src/components/OTPField/OTPField.test.tsx +0 -121
- package/src/components/OTPField/OTPField.tsx +0 -250
- package/src/components/OTPField/otpField.types.ts +0 -58
- package/src/components/OTPField/otpField.variants.ts +0 -72
- package/src/components/Pagination/Pagination.test.tsx +0 -314
- package/src/components/Pagination/Pagination.tsx +0 -277
- package/src/components/Pagination/pagination.helpers.ts +0 -102
- package/src/components/Pagination/pagination.types.ts +0 -117
- package/src/components/Pagination/pagination.variants.ts +0 -117
- package/src/components/Popover/Popover.test.tsx +0 -72
- package/src/components/Popover/Popover.tsx +0 -55
- package/src/components/Popover/popover.types.ts +0 -42
- package/src/components/Popover/popover.variants.ts +0 -24
- package/src/components/RadioGroup/RadioGroup.test.tsx +0 -140
- package/src/components/RadioGroup/RadioGroup.tsx +0 -283
- package/src/components/RadioGroup/radioGroup.types.ts +0 -85
- package/src/components/RadioGroup/radioGroup.variants.ts +0 -87
- package/src/components/Skeleton/Skeleton.test.tsx +0 -127
- package/src/components/Skeleton/Skeleton.tsx +0 -49
- package/src/components/Skeleton/skeleton.types.ts +0 -59
- package/src/components/Skeleton/skeleton.variants.ts +0 -87
- package/src/components/Snackbar/Snackbar.perf.test.tsx +0 -144
- package/src/components/Snackbar/Snackbar.test.tsx +0 -327
- package/src/components/Snackbar/Snackbar.tsx +0 -316
- package/src/components/Snackbar/snackbar.types.ts +0 -127
- package/src/components/Snackbar/snackbar.variants.ts +0 -81
- package/src/components/Spinner/Spinner.test.tsx +0 -199
- package/src/components/Spinner/Spinner.tsx +0 -158
- package/src/components/Spinner/spinner.types.ts +0 -113
- package/src/components/Spinner/spinner.variants.ts +0 -83
- package/src/components/Stack/Stack.test.tsx +0 -309
- package/src/components/Stack/Stack.tsx +0 -115
- package/src/components/Stack/stack.types.ts +0 -68
- package/src/components/Stack/stack.variants.ts +0 -80
- package/src/components/Switch/Switch.test.tsx +0 -131
- package/src/components/Switch/Switch.tsx +0 -158
- package/src/components/Switch/switch.types.ts +0 -36
- package/src/components/Switch/switch.variants.ts +0 -70
- package/src/components/Table/Table.perf.test.tsx +0 -81
- package/src/components/Table/Table.test.tsx +0 -674
- package/src/components/Table/Table.tsx +0 -863
- package/src/components/Table/cells/RenderButton.tsx +0 -23
- package/src/components/Table/cells/RenderChip.tsx +0 -37
- package/src/components/Table/cells/RenderText.tsx +0 -37
- package/src/components/Table/cells/RenderTwoLine.tsx +0 -34
- package/src/components/Table/cells/RowActionsMenu.tsx +0 -147
- package/src/components/Table/cells/cells.test.tsx +0 -247
- package/src/components/Table/cells/index.ts +0 -14
- package/src/components/Table/table.types.ts +0 -438
- package/src/components/Table/table.variants.ts +0 -207
- package/src/components/Tabs/Tabs.test.tsx +0 -145
- package/src/components/Tabs/Tabs.tsx +0 -77
- package/src/components/Tabs/tabs.types.ts +0 -55
- package/src/components/Tabs/tabs.variants.ts +0 -69
- package/src/components/Tabs/useTabs.ts +0 -167
- package/src/components/TextField/TextField.test.tsx +0 -198
- package/src/components/TextField/TextField.tsx +0 -245
- package/src/components/TextField/textField.types.ts +0 -90
- package/src/components/TextField/textField.variants.ts +0 -105
- package/src/components/Textarea/Textarea.test.tsx +0 -75
- package/src/components/Textarea/Textarea.tsx +0 -190
- package/src/components/Textarea/textarea.types.ts +0 -60
- package/src/components/Textarea/textarea.variants.ts +0 -85
- package/src/components/TimePicker/TimePicker.test.tsx +0 -65
- package/src/components/TimePicker/TimePicker.tsx +0 -274
- package/src/components/TimePicker/timePicker.types.ts +0 -69
- package/src/components/TimePicker/timePicker.variants.ts +0 -53
- package/src/components/Tooltip/Tooltip.test.tsx +0 -73
- package/src/components/Tooltip/Tooltip.tsx +0 -70
- package/src/components/Tooltip/tooltip.types.ts +0 -44
- package/src/components/Tooltip/tooltip.variants.ts +0 -28
- package/src/components/TopBar/TopBar.test.tsx +0 -129
- package/src/components/TopBar/TopBar.tsx +0 -66
- package/src/components/TopBar/topBar.types.ts +0 -42
- package/src/components/TopBar/topBar.variants.ts +0 -38
- package/src/components/Typography/Typography.test.tsx +0 -247
- package/src/components/Typography/Typography.tsx +0 -112
- package/src/components/Typography/typography.types.ts +0 -65
- package/src/components/Typography/typography.variants.ts +0 -130
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +0 -86
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +0 -59
- package/src/components/VisuallyHidden/visuallyHidden.types.ts +0 -45
- package/src/components/_shared/data/getNestedValue.test.ts +0 -50
- package/src/components/_shared/data/getNestedValue.ts +0 -32
- package/src/components/_shared/data/useColumnAutoDetect.test.ts +0 -123
- package/src/components/_shared/data/useColumnAutoDetect.ts +0 -100
- package/src/components/_shared/data/useControllableState.ts +0 -48
- package/src/components/_shared/data/useDebouncedValue.ts +0 -24
- package/src/components/_shared/data/useTableFilter.test.ts +0 -166
- package/src/components/_shared/data/useTableFilter.ts +0 -118
- package/src/components/_shared/data/useTableSearch.test.ts +0 -115
- package/src/components/_shared/data/useTableSearch.ts +0 -66
- package/src/components/_shared/data/useTableSelection.test.ts +0 -100
- package/src/components/_shared/data/useTableSelection.ts +0 -100
- package/src/components/_shared/data/useTableSort.test.ts +0 -150
- package/src/components/_shared/data/useTableSort.ts +0 -141
- package/src/components/_shared/data/useVirtualizer.test.ts +0 -158
- package/src/components/_shared/data/useVirtualizer.ts +0 -199
- package/src/components/_shared/resolveValidationState.ts +0 -60
- package/src/components/_shared/severity/index.ts +0 -33
- package/src/components/_shared/severity/severity.types.ts +0 -50
- package/src/components/_shared/severity/severityIcons.tsx +0 -104
- package/src/components/_shared/severity/severityVariants.test.ts +0 -136
- package/src/components/_shared/severity/severityVariants.ts +0 -115
- package/src/components/_shared/themeIdentity.test.ts +0 -113
- package/src/hooks/useAccessState.spec.tsx +0 -161
- package/src/hooks/useAccessState.ts +0 -81
- package/src/index.ts +0 -550
- package/src/utils/cn.spec.ts +0 -16
- package/src/utils/cn.ts +0 -29
- package/test-output/vitest/coverage/base.css +0 -224
- package/test-output/vitest/coverage/block-navigation.js +0 -87
- package/test-output/vitest/coverage/clover.xml +0 -2418
- package/test-output/vitest/coverage/coverage-final.json +0 -89
- package/test-output/vitest/coverage/favicon.png +0 -0
- package/test-output/vitest/coverage/index.html +0 -746
- package/test-output/vitest/coverage/prettify.css +0 -1
- package/test-output/vitest/coverage/prettify.js +0 -2
- package/test-output/vitest/coverage/sort-arrow-sprite.png +0 -0
- package/test-output/vitest/coverage/sorter.js +0 -210
- package/test-output/vitest/coverage/src/components/Accordion/Accordion.tsx.html +0 -376
- package/test-output/vitest/coverage/src/components/Accordion/accordion.variants.ts.html +0 -181
- package/test-output/vitest/coverage/src/components/Accordion/index.html +0 -131
- package/test-output/vitest/coverage/src/components/AppShell/AppShell.tsx.html +0 -802
- package/test-output/vitest/coverage/src/components/AppShell/appShell.variants.ts.html +0 -247
- package/test-output/vitest/coverage/src/components/AppShell/index.html +0 -131
- package/test-output/vitest/coverage/src/components/AspectRatio/AspectRatio.tsx.html +0 -304
- package/test-output/vitest/coverage/src/components/AspectRatio/index.html +0 -116
- package/test-output/vitest/coverage/src/components/Autocomplete/Autocomplete.tsx.html +0 -3292
- package/test-output/vitest/coverage/src/components/Autocomplete/autocomplete.variants.ts.html +0 -508
- package/test-output/vitest/coverage/src/components/Autocomplete/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Box/Box.tsx.html +0 -334
- package/test-output/vitest/coverage/src/components/Box/box.variants.ts.html +0 -775
- package/test-output/vitest/coverage/src/components/Box/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Breadcrumbs/Breadcrumbs.tsx.html +0 -694
- package/test-output/vitest/coverage/src/components/Breadcrumbs/breadcrumbs.variants.ts.html +0 -247
- package/test-output/vitest/coverage/src/components/Breadcrumbs/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Button/Button.tsx.html +0 -535
- package/test-output/vitest/coverage/src/components/Button/button.variants.ts.html +0 -562
- package/test-output/vitest/coverage/src/components/Button/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Checkbox/Checkbox.tsx.html +0 -943
- package/test-output/vitest/coverage/src/components/Checkbox/checkbox.variants.ts.html +0 -289
- package/test-output/vitest/coverage/src/components/Checkbox/index.html +0 -131
- package/test-output/vitest/coverage/src/components/ConfirmDialog/ConfirmDialog.tsx.html +0 -841
- package/test-output/vitest/coverage/src/components/ConfirmDialog/confirmDialog.variants.ts.html +0 -313
- package/test-output/vitest/coverage/src/components/ConfirmDialog/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Container/Container.tsx.html +0 -307
- package/test-output/vitest/coverage/src/components/Container/container.variants.ts.html +0 -328
- package/test-output/vitest/coverage/src/components/Container/index.html +0 -131
- package/test-output/vitest/coverage/src/components/DataGrid/DataGrid.tsx.html +0 -3937
- package/test-output/vitest/coverage/src/components/DataGrid/dataGrid.variants.ts.html +0 -541
- package/test-output/vitest/coverage/src/components/DataGrid/filters/ColumnFilters.tsx.html +0 -1453
- package/test-output/vitest/coverage/src/components/DataGrid/filters/index.html +0 -116
- package/test-output/vitest/coverage/src/components/DataGrid/index.html +0 -131
- package/test-output/vitest/coverage/src/components/DataGrid/reorder/index.html +0 -116
- package/test-output/vitest/coverage/src/components/DataGrid/reorder/useColumnReorder.ts.html +0 -517
- package/test-output/vitest/coverage/src/components/DataGrid/resize/index.html +0 -116
- package/test-output/vitest/coverage/src/components/DataGrid/resize/useColumnResize.ts.html +0 -490
- package/test-output/vitest/coverage/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx.html +0 -592
- package/test-output/vitest/coverage/src/components/DataGrid/visibility/index.html +0 -116
- package/test-output/vitest/coverage/src/components/DateTimePicker/DateTimePicker.tsx.html +0 -1042
- package/test-output/vitest/coverage/src/components/DateTimePicker/dateTimePicker.variants.ts.html +0 -337
- package/test-output/vitest/coverage/src/components/DateTimePicker/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Dialog/Dialog.tsx.html +0 -391
- package/test-output/vitest/coverage/src/components/Dialog/dialog.variants.ts.html +0 -283
- package/test-output/vitest/coverage/src/components/Dialog/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Divider/Divider.tsx.html +0 -505
- package/test-output/vitest/coverage/src/components/Divider/divider.variants.ts.html +0 -433
- package/test-output/vitest/coverage/src/components/Divider/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Grid/Grid.tsx.html +0 -529
- package/test-output/vitest/coverage/src/components/Grid/grid.variants.ts.html +0 -484
- package/test-output/vitest/coverage/src/components/Grid/index.html +0 -131
- package/test-output/vitest/coverage/src/components/LeftNav/LeftNav.tsx.html +0 -1075
- package/test-output/vitest/coverage/src/components/LeftNav/index.html +0 -131
- package/test-output/vitest/coverage/src/components/LeftNav/leftNav.variants.ts.html +0 -406
- package/test-output/vitest/coverage/src/components/NumberField/NumberField.tsx.html +0 -1048
- package/test-output/vitest/coverage/src/components/NumberField/index.html +0 -131
- package/test-output/vitest/coverage/src/components/NumberField/numberField.variants.ts.html +0 -367
- package/test-output/vitest/coverage/src/components/OTPField/OTPField.tsx.html +0 -835
- package/test-output/vitest/coverage/src/components/OTPField/index.html +0 -131
- package/test-output/vitest/coverage/src/components/OTPField/otpField.variants.ts.html +0 -301
- package/test-output/vitest/coverage/src/components/Pagination/Pagination.tsx.html +0 -916
- package/test-output/vitest/coverage/src/components/Pagination/index.html +0 -146
- package/test-output/vitest/coverage/src/components/Pagination/pagination.helpers.ts.html +0 -391
- package/test-output/vitest/coverage/src/components/Pagination/pagination.variants.ts.html +0 -436
- package/test-output/vitest/coverage/src/components/Popover/Popover.tsx.html +0 -250
- package/test-output/vitest/coverage/src/components/Popover/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Popover/popover.variants.ts.html +0 -157
- package/test-output/vitest/coverage/src/components/RadioGroup/RadioGroup.tsx.html +0 -934
- package/test-output/vitest/coverage/src/components/RadioGroup/index.html +0 -131
- package/test-output/vitest/coverage/src/components/RadioGroup/radioGroup.variants.ts.html +0 -346
- package/test-output/vitest/coverage/src/components/Skeleton/Skeleton.tsx.html +0 -232
- package/test-output/vitest/coverage/src/components/Skeleton/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Skeleton/skeleton.variants.ts.html +0 -346
- package/test-output/vitest/coverage/src/components/Snackbar/Snackbar.tsx.html +0 -979
- package/test-output/vitest/coverage/src/components/Snackbar/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Snackbar/snackbar.variants.ts.html +0 -307
- package/test-output/vitest/coverage/src/components/Stack/Stack.tsx.html +0 -430
- package/test-output/vitest/coverage/src/components/Stack/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Stack/stack.variants.ts.html +0 -325
- package/test-output/vitest/coverage/src/components/Switch/Switch.tsx.html +0 -559
- package/test-output/vitest/coverage/src/components/Switch/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Switch/switch.variants.ts.html +0 -295
- package/test-output/vitest/coverage/src/components/Table/Table.tsx.html +0 -2677
- package/test-output/vitest/coverage/src/components/Table/cells/RenderButton.tsx.html +0 -154
- package/test-output/vitest/coverage/src/components/Table/cells/RenderChip.tsx.html +0 -385
- package/test-output/vitest/coverage/src/components/Table/cells/RenderText.tsx.html +0 -196
- package/test-output/vitest/coverage/src/components/Table/cells/RenderTwoLine.tsx.html +0 -187
- package/test-output/vitest/coverage/src/components/Table/cells/RowActionsMenu.tsx.html +0 -526
- package/test-output/vitest/coverage/src/components/Table/cells/index.html +0 -191
- package/test-output/vitest/coverage/src/components/Table/cells/index.ts.html +0 -127
- package/test-output/vitest/coverage/src/components/Table/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Table/table.variants.ts.html +0 -706
- package/test-output/vitest/coverage/src/components/Tabs/Tabs.tsx.html +0 -283
- package/test-output/vitest/coverage/src/components/Tabs/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Tabs/tabs.variants.ts.html +0 -292
- package/test-output/vitest/coverage/src/components/TextField/TextField.tsx.html +0 -820
- package/test-output/vitest/coverage/src/components/TextField/index.html +0 -131
- package/test-output/vitest/coverage/src/components/TextField/textField.variants.ts.html +0 -400
- package/test-output/vitest/coverage/src/components/Textarea/Textarea.tsx.html +0 -655
- package/test-output/vitest/coverage/src/components/Textarea/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Textarea/textarea.variants.ts.html +0 -340
- package/test-output/vitest/coverage/src/components/Tooltip/Tooltip.tsx.html +0 -295
- package/test-output/vitest/coverage/src/components/Tooltip/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Tooltip/tooltip.variants.ts.html +0 -169
- package/test-output/vitest/coverage/src/components/TopBar/TopBar.tsx.html +0 -283
- package/test-output/vitest/coverage/src/components/TopBar/index.html +0 -131
- package/test-output/vitest/coverage/src/components/TopBar/topBar.variants.ts.html +0 -199
- package/test-output/vitest/coverage/src/components/Typography/Typography.tsx.html +0 -421
- package/test-output/vitest/coverage/src/components/Typography/index.html +0 -131
- package/test-output/vitest/coverage/src/components/Typography/typography.variants.ts.html +0 -436
- package/test-output/vitest/coverage/src/components/VisuallyHidden/VisuallyHidden.tsx.html +0 -262
- package/test-output/vitest/coverage/src/components/VisuallyHidden/index.html +0 -116
- package/test-output/vitest/coverage/src/components/_shared/data/getNestedValue.ts.html +0 -181
- package/test-output/vitest/coverage/src/components/_shared/data/index.html +0 -236
- package/test-output/vitest/coverage/src/components/_shared/data/useColumnAutoDetect.ts.html +0 -385
- package/test-output/vitest/coverage/src/components/_shared/data/useControllableState.ts.html +0 -229
- package/test-output/vitest/coverage/src/components/_shared/data/useDebouncedValue.ts.html +0 -157
- package/test-output/vitest/coverage/src/components/_shared/data/useTableFilter.ts.html +0 -439
- package/test-output/vitest/coverage/src/components/_shared/data/useTableSearch.ts.html +0 -283
- package/test-output/vitest/coverage/src/components/_shared/data/useTableSelection.ts.html +0 -385
- package/test-output/vitest/coverage/src/components/_shared/data/useTableSort.ts.html +0 -508
- package/test-output/vitest/coverage/src/components/_shared/data/useVirtualizer.ts.html +0 -682
- package/test-output/vitest/coverage/src/components/_shared/index.html +0 -116
- package/test-output/vitest/coverage/src/components/_shared/resolveValidationState.ts.html +0 -265
- package/test-output/vitest/coverage/src/hooks/index.html +0 -116
- package/test-output/vitest/coverage/src/hooks/useAccessState.ts.html +0 -328
- package/test-output/vitest/coverage/src/index.html +0 -116
- package/test-output/vitest/coverage/src/index.ts.html +0 -1153
- package/test-output/vitest/coverage/src/utils/cn.ts.html +0 -172
- package/test-output/vitest/coverage/src/utils/index.html +0 -116
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -58
- package/tsconfig.spec.json +0 -34
- package/vite.config.ts +0 -33
- package/vitest.config.mts +0 -29
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tailwind-variants recipe for `<ConfirmDialog>`.
|
|
5
|
-
*
|
|
6
|
-
* Built on the native HTML `<dialog>` element + `showModal()`, which
|
|
7
|
-
* gives us focus-trap, Escape handling, and `::backdrop` pseudo-element
|
|
8
|
-
* for free. The styling here is for the dialog body — the backdrop is
|
|
9
|
-
* styled via the `::backdrop` selector inside the dialog rule.
|
|
10
|
-
*
|
|
11
|
-
* Slots:
|
|
12
|
-
* - `backdrop` — semi-opaque overlay (`::backdrop` pseudo)
|
|
13
|
-
* - `dialog` — the modal box
|
|
14
|
-
* - `title` — modal heading
|
|
15
|
-
* - `body` — message text
|
|
16
|
-
* - `actions` — bottom button row
|
|
17
|
-
* - `confirmButton` — primary action
|
|
18
|
-
* - `cancelButton` — secondary action
|
|
19
|
-
*/
|
|
20
|
-
export const confirmDialogVariants = tv({
|
|
21
|
-
slots: {
|
|
22
|
-
backdrop: 'backdrop:bg-black/40 backdrop:backdrop-blur-sm',
|
|
23
|
-
dialog: [
|
|
24
|
-
'rounded-lg bg-neutral-50 text-neutral-900 shadow-xl',
|
|
25
|
-
'border border-neutral-200',
|
|
26
|
-
'p-0 max-w-md w-[min(28rem,calc(100vw-2rem))]',
|
|
27
|
-
'open:flex open:flex-col',
|
|
28
|
-
// Native <dialog> defaults to centered; reinforce for older browsers.
|
|
29
|
-
'mx-auto my-auto',
|
|
30
|
-
'focus:outline-none',
|
|
31
|
-
],
|
|
32
|
-
title:
|
|
33
|
-
'px-5 pt-5 pb-2 text-lg font-semibold text-neutral-900 leading-tight',
|
|
34
|
-
body: 'px-5 py-2 text-sm text-neutral-700 leading-relaxed',
|
|
35
|
-
actions:
|
|
36
|
-
'px-5 py-4 mt-2 flex justify-end gap-2 border-t border-neutral-200',
|
|
37
|
-
confirmButton: [
|
|
38
|
-
'inline-flex items-center justify-center px-4 h-9',
|
|
39
|
-
'rounded-md text-sm font-medium',
|
|
40
|
-
'outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
41
|
-
'transition-colors',
|
|
42
|
-
],
|
|
43
|
-
cancelButton: [
|
|
44
|
-
'inline-flex items-center justify-center px-4 h-9',
|
|
45
|
-
'rounded-md text-sm font-medium',
|
|
46
|
-
'text-neutral-800 bg-neutral-100 hover:bg-neutral-200',
|
|
47
|
-
'outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50',
|
|
48
|
-
'transition-colors',
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
variants: {
|
|
52
|
-
severity: {
|
|
53
|
-
info: {
|
|
54
|
-
confirmButton:
|
|
55
|
-
'bg-primary-600 hover:bg-primary-700 text-white focus-visible:ring-primary-500',
|
|
56
|
-
},
|
|
57
|
-
warning: {
|
|
58
|
-
confirmButton:
|
|
59
|
-
'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',
|
|
60
|
-
},
|
|
61
|
-
danger: {
|
|
62
|
-
confirmButton:
|
|
63
|
-
'bg-danger-600 hover:bg-danger-700 text-white focus-visible:ring-danger-500',
|
|
64
|
-
},
|
|
65
|
-
success: {
|
|
66
|
-
confirmButton:
|
|
67
|
-
'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
defaultVariants: {
|
|
72
|
-
severity: 'info',
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export type ConfirmDialogVariants = VariantProps<typeof confirmDialogVariants>;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import { Container } from './Container.js';
|
|
5
|
-
|
|
6
|
-
describe('<Container>', () => {
|
|
7
|
-
// ─── Default rendering ──────────────────────────────────────────────
|
|
8
|
-
describe('default rendering', () => {
|
|
9
|
-
it('renders a <div> by default', () => {
|
|
10
|
-
const { container } = render(<Container>x</Container>);
|
|
11
|
-
expect(container.firstElementChild?.tagName).toBe('DIV');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('has mx-auto + w-full baseline', () => {
|
|
15
|
-
const { container } = render(<Container>x</Container>);
|
|
16
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
17
|
-
expect(cls).toContain('mx-auto');
|
|
18
|
-
expect(cls).toContain('w-full');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('default size is xl (max-w-screen-xl)', () => {
|
|
22
|
-
const { container } = render(<Container>x</Container>);
|
|
23
|
-
expect(container.firstElementChild?.className).toContain('max-w-screen-xl');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('default px is true — responsive padding ramp', () => {
|
|
27
|
-
const { container } = render(<Container>x</Container>);
|
|
28
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
29
|
-
expect(cls).toContain('px-4');
|
|
30
|
-
expect(cls).toContain('sm:px-6');
|
|
31
|
-
expect(cls).toContain('lg:px-8');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('default centerContent is false — no flex column', () => {
|
|
35
|
-
const { container } = render(<Container>x</Container>);
|
|
36
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
37
|
-
// baseline doesn't include flex
|
|
38
|
-
expect(cls.split(' ')).not.toContain('flex');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// ─── Size axis ──────────────────────────────────────────────────────
|
|
43
|
-
describe('size', () => {
|
|
44
|
-
it('size="sm"', () => {
|
|
45
|
-
const { container } = render(<Container size="sm">x</Container>);
|
|
46
|
-
expect(container.firstElementChild?.className).toContain('max-w-screen-sm');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('size="lg"', () => {
|
|
50
|
-
const { container } = render(<Container size="lg">x</Container>);
|
|
51
|
-
expect(container.firstElementChild?.className).toContain('max-w-screen-lg');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('size="2xl"', () => {
|
|
55
|
-
const { container } = render(<Container size="2xl">x</Container>);
|
|
56
|
-
expect(container.firstElementChild?.className).toContain('max-w-screen-2xl');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('size="fluid" emits no max-w-* class', () => {
|
|
60
|
-
const { container } = render(<Container size="fluid">x</Container>);
|
|
61
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
62
|
-
expect(cls).not.toContain('max-w-screen');
|
|
63
|
-
// still mx-auto + w-full baseline
|
|
64
|
-
expect(cls).toContain('mx-auto');
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// ─── Padding axis ───────────────────────────────────────────────────
|
|
69
|
-
describe('padding', () => {
|
|
70
|
-
it('px={false} skips the responsive padding ramp', () => {
|
|
71
|
-
const { container } = render(<Container px={false}>x</Container>);
|
|
72
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
73
|
-
expect(cls).not.toContain('px-4');
|
|
74
|
-
expect(cls).not.toContain('sm:px-6');
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// ─── Center content ─────────────────────────────────────────────────
|
|
79
|
-
describe('centerContent', () => {
|
|
80
|
-
it('centerContent turns into flex column items-center', () => {
|
|
81
|
-
const { container } = render(<Container centerContent>x</Container>);
|
|
82
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
83
|
-
expect(cls).toContain('flex');
|
|
84
|
-
expect(cls).toContain('flex-col');
|
|
85
|
-
expect(cls).toContain('items-center');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// ─── Override semantics ─────────────────────────────────────────────
|
|
90
|
-
describe('override', () => {
|
|
91
|
-
it('sx wins over default size via tailwind-merge', () => {
|
|
92
|
-
const { container } = render(
|
|
93
|
-
<Container sx="max-w-3xl">x</Container>,
|
|
94
|
-
);
|
|
95
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
96
|
-
expect(cls).toContain('max-w-3xl');
|
|
97
|
-
// tailwind-merge collapses the conflicting max-w-screen-xl
|
|
98
|
-
expect(cls).not.toContain('max-w-screen-xl');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('sx can add vertical padding (Container does not expose it)', () => {
|
|
102
|
-
const { container } = render(<Container sx="py-12">x</Container>);
|
|
103
|
-
expect(container.firstElementChild?.className).toContain('py-12');
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// ─── Polymorphism ───────────────────────────────────────────────────
|
|
108
|
-
describe('polymorphism', () => {
|
|
109
|
-
it('as="main" renders <main> with Container chrome', () => {
|
|
110
|
-
const { container } = render(<Container as="main">x</Container>);
|
|
111
|
-
const el = container.firstElementChild;
|
|
112
|
-
expect(el?.tagName).toBe('MAIN');
|
|
113
|
-
expect(el?.className).toContain('mx-auto');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('asChild paints onto the child element', () => {
|
|
117
|
-
const { container } = render(
|
|
118
|
-
<Container size="lg" asChild>
|
|
119
|
-
<article>x</article>
|
|
120
|
-
</Container>,
|
|
121
|
-
);
|
|
122
|
-
const el = container.firstElementChild;
|
|
123
|
-
expect(el?.tagName).toBe('ARTICLE');
|
|
124
|
-
expect(el?.className).toContain('max-w-screen-lg');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('asChild wins over as when both are passed', () => {
|
|
128
|
-
const { container } = render(
|
|
129
|
-
<Container as="main" asChild>
|
|
130
|
-
<section>x</section>
|
|
131
|
-
</Container>,
|
|
132
|
-
);
|
|
133
|
-
expect(container.firstElementChild?.tagName).toBe('SECTION');
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// ─── Pass-through ────────────────────────────────────────────────────
|
|
138
|
-
describe('pass-through', () => {
|
|
139
|
-
it('forwards data-* + aria-*', () => {
|
|
140
|
-
const { container } = render(
|
|
141
|
-
<Container data-testid="c" aria-label="page">x</Container>,
|
|
142
|
-
);
|
|
143
|
-
const el = container.firstElementChild;
|
|
144
|
-
expect(el?.getAttribute('data-testid')).toBe('c');
|
|
145
|
-
expect(el?.getAttribute('aria-label')).toBe('page');
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// ─── F11-bis edge cases ─────────────────────────────────────────────
|
|
150
|
-
describe('axis coexistence', () => {
|
|
151
|
-
it('size + centerContent + px=true (all three combine)', () => {
|
|
152
|
-
const { container } = render(
|
|
153
|
-
<Container size="md" centerContent px>x</Container>,
|
|
154
|
-
);
|
|
155
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
156
|
-
expect(cls).toContain('max-w-screen-md');
|
|
157
|
-
expect(cls).toContain('flex');
|
|
158
|
-
expect(cls).toContain('flex-col');
|
|
159
|
-
expect(cls).toContain('items-center');
|
|
160
|
-
expect(cls).toContain('px-4');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('fluid + centerContent (full-bleed centered hero pattern)', () => {
|
|
164
|
-
const { container } = render(
|
|
165
|
-
<Container size="fluid" centerContent>x</Container>,
|
|
166
|
-
);
|
|
167
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
168
|
-
expect(cls).not.toContain('max-w-screen');
|
|
169
|
-
expect(cls).toContain('flex-col');
|
|
170
|
-
expect(cls).toContain('items-center');
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('fluid + px=false (full-bleed edge-to-edge — hero image pattern)', () => {
|
|
174
|
-
const { container } = render(
|
|
175
|
-
<Container size="fluid" px={false}>x</Container>,
|
|
176
|
-
);
|
|
177
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
178
|
-
expect(cls).not.toContain('max-w-screen');
|
|
179
|
-
expect(cls).not.toContain('px-4');
|
|
180
|
-
// still has mx-auto + w-full baseline
|
|
181
|
-
expect(cls).toContain('mx-auto');
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
describe('nested fluid-outer + capped-inner pattern', () => {
|
|
186
|
-
it('outer fluid colored band + inner capped content renders both', () => {
|
|
187
|
-
const { container } = render(
|
|
188
|
-
<Container size="fluid" px={false} sx="bg-primary-50 py-16">
|
|
189
|
-
<Container size="lg">
|
|
190
|
-
<p>inner</p>
|
|
191
|
-
</Container>
|
|
192
|
-
</Container>,
|
|
193
|
-
);
|
|
194
|
-
const outer = container.firstElementChild;
|
|
195
|
-
const inner = outer?.querySelector('div');
|
|
196
|
-
expect(outer?.className).toContain('bg-primary-50');
|
|
197
|
-
expect(outer?.className).not.toContain('max-w-screen');
|
|
198
|
-
expect(inner?.className).toContain('max-w-screen-lg');
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
describe('every size value', () => {
|
|
203
|
-
const SIZES = ['sm', 'md', 'lg', 'xl', '2xl'] as const;
|
|
204
|
-
it.each(SIZES)('size="%s" emits max-w-screen-%s', (s) => {
|
|
205
|
-
const { container } = render(<Container size={s}>x</Container>);
|
|
206
|
-
expect(container.firstElementChild?.className).toContain(`max-w-screen-${s}`);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementType, type ReactElement } from 'react';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import { cn } from '../../utils/cn.js';
|
|
4
|
-
import { containerVariants } from './container.variants.js';
|
|
5
|
-
import type { ContainerProps } from './container.types.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* `<Container>` — centered max-width wrapper for page-level layouts.
|
|
9
|
-
*
|
|
10
|
-
* The pattern is universal: every page-root `<div>` in a non-trivial
|
|
11
|
-
* web app boils down to "mx-auto + max-w-X + responsive horizontal
|
|
12
|
-
* padding". Container collapses that into a typed prop set so the
|
|
13
|
-
* decision lives in ONE place per app section (the Container size),
|
|
14
|
-
* not scattered as utility chains across every page file.
|
|
15
|
-
*
|
|
16
|
-
* Default size is `'xl'` (1280px) — comfortable for full app shells
|
|
17
|
-
* with a left nav + main + optional right rail. Drop to `'lg'` (1024px)
|
|
18
|
-
* for content-heavy docs/marketing, jump to `'2xl'` (1536px) for wide
|
|
19
|
-
* dashboards.
|
|
20
|
-
*
|
|
21
|
-
* Composition pattern — Container at the page root, Stack/Grid inside:
|
|
22
|
-
*
|
|
23
|
-
* <Container size="lg" as="main">
|
|
24
|
-
* <Stack gap={8}>
|
|
25
|
-
* <Typography variant="h1">Page title</Typography>
|
|
26
|
-
* <Grid container spacing={6}>
|
|
27
|
-
* <Grid xs={12} md={6}>...</Grid>
|
|
28
|
-
* </Grid>
|
|
29
|
-
* </Stack>
|
|
30
|
-
* </Container>
|
|
31
|
-
*
|
|
32
|
-
* Container handles the page chrome (centered, padded, capped width);
|
|
33
|
-
* Stack/Grid handle the actual layout of children. Two concerns, two
|
|
34
|
-
* primitives.
|
|
35
|
-
*
|
|
36
|
-
* Polymorphism rule (same as Typography/Box/Stack/Grid): when both
|
|
37
|
-
* `as` and `asChild` are passed, `asChild` wins.
|
|
38
|
-
*/
|
|
39
|
-
export const Container = forwardRef<HTMLElement, ContainerProps>(
|
|
40
|
-
function Container(props, ref) {
|
|
41
|
-
const {
|
|
42
|
-
size,
|
|
43
|
-
px,
|
|
44
|
-
centerContent,
|
|
45
|
-
as,
|
|
46
|
-
asChild = false,
|
|
47
|
-
sx,
|
|
48
|
-
children,
|
|
49
|
-
...rest
|
|
50
|
-
} = props;
|
|
51
|
-
|
|
52
|
-
const classes = cn(
|
|
53
|
-
containerVariants({ size, px, centerContent }),
|
|
54
|
-
sx,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
if (asChild) {
|
|
58
|
-
return (
|
|
59
|
-
<Slot ref={ref} className={classes} {...rest}>
|
|
60
|
-
{children as ReactElement}
|
|
61
|
-
</Slot>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const Tag = (as ?? 'div') as ElementType;
|
|
66
|
-
return (
|
|
67
|
-
<Tag ref={ref as never} className={classes} {...rest}>
|
|
68
|
-
{children}
|
|
69
|
-
</Tag>
|
|
70
|
-
);
|
|
71
|
-
},
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
Container.displayName = 'Container';
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
-
import type { ContainerVariants } from './container.variants.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Props for `<Container>` — page-level centered max-width wrapper.
|
|
6
|
-
*
|
|
7
|
-
* Use at the page-root level (or section-root) to constrain content
|
|
8
|
-
* width and apply the canonical responsive horizontal padding ramp.
|
|
9
|
-
* Compose Stack/Grid INSIDE Container for the actual layout work.
|
|
10
|
-
*
|
|
11
|
-
* Native attribute overrides:
|
|
12
|
-
* • `className` omitted in favour of `sx` (utility string, merged
|
|
13
|
-
* via tailwind-merge — same convention as Box/Stack/Grid/Typography).
|
|
14
|
-
*/
|
|
15
|
-
export interface ContainerProps
|
|
16
|
-
extends Omit<HTMLAttributes<HTMLDivElement>, 'className'>,
|
|
17
|
-
Pick<ContainerVariants, 'size' | 'px' | 'centerContent'> {
|
|
18
|
-
/**
|
|
19
|
-
* Override the rendered HTML tag. Defaults to `'div'`. Use
|
|
20
|
-
* `as="main"` for the primary content region of a page,
|
|
21
|
-
* `as="section"` for a named section, `as="article"` for a
|
|
22
|
-
* self-contained article shell.
|
|
23
|
-
*
|
|
24
|
-
* Ignored when `asChild` is true.
|
|
25
|
-
*/
|
|
26
|
-
as?: ElementType;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Render via Radix `Slot` — the Container styles paint onto the
|
|
30
|
-
* single React child instead of wrapping it. Useful for letting a
|
|
31
|
-
* router `<main>` element receive the Container chrome without
|
|
32
|
-
* adding an intermediate `<div>` in the tree.
|
|
33
|
-
*
|
|
34
|
-
* Mutually exclusive with `as` (when both are passed, `asChild` wins).
|
|
35
|
-
*/
|
|
36
|
-
asChild?: boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Utility classes appended to the variant chain. Resolved via
|
|
40
|
-
* `tailwind-merge` so the consumer's classes always win over the
|
|
41
|
-
* variant defaults — useful for one-off vertical padding (`sx="py-8"`),
|
|
42
|
-
* custom max-width (`sx="max-w-3xl"`), etc.
|
|
43
|
-
*/
|
|
44
|
-
sx?: string;
|
|
45
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* `containerVariants` — centered max-width wrapper for page layouts.
|
|
5
|
-
*
|
|
6
|
-
* Architectural role:
|
|
7
|
-
*
|
|
8
|
-
* Every web app has the same pattern at the page-root level: a div
|
|
9
|
-
* that's `mx-auto`, capped at some `max-w-*`, with responsive
|
|
10
|
-
* horizontal padding. Without Container, every page rewrites:
|
|
11
|
-
*
|
|
12
|
-
* <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
|
13
|
-
*
|
|
14
|
-
* Container collapses that into one typed prop set, with size names
|
|
15
|
-
* that mirror Tailwind's breakpoint vocabulary so the muscle memory
|
|
16
|
-
* carries over (`size="lg"` ↔ `max-w-screen-lg`).
|
|
17
|
-
*
|
|
18
|
-
* Size axis — maps to Tailwind's `max-w-screen-*` aliases:
|
|
19
|
-
* • sm → max-w-screen-sm (640px)
|
|
20
|
-
* • md → max-w-screen-md (768px)
|
|
21
|
-
* • lg → max-w-screen-lg (1024px) — most common doc/content cap
|
|
22
|
-
* • xl → max-w-screen-xl (1280px) — default; comfortable for full apps
|
|
23
|
-
* • 2xl → max-w-screen-2xl (1536px) — wide dashboards
|
|
24
|
-
* • fluid → no max-width at all (full bleed, padding still applies)
|
|
25
|
-
*
|
|
26
|
-
* Padding axis (`px`):
|
|
27
|
-
* • true (default) — responsive horizontal padding (px-4 sm:px-6 lg:px-8)
|
|
28
|
-
* The canonical Tailwind responsive padding ramp. Designed to keep
|
|
29
|
-
* edges from kissing the viewport on mobile and breathing more on
|
|
30
|
-
* larger screens.
|
|
31
|
-
* • false — no padding. Use when the consumer wants full bleed AND
|
|
32
|
-
* handles edge padding inside (e.g. a hero section with its own
|
|
33
|
-
* internal spacing scale).
|
|
34
|
-
*
|
|
35
|
-
* Center content axis (`centerContent`):
|
|
36
|
-
* • true — turns the Container into a flex column with items-center
|
|
37
|
-
* so the page content stacks centered horizontally. Common for
|
|
38
|
-
* marketing pages, sign-in flows, "single artifact" layouts.
|
|
39
|
-
* • false (default) — children flow normally (block stacking).
|
|
40
|
-
*/
|
|
41
|
-
export const containerVariants = tv({
|
|
42
|
-
base: 'mx-auto w-full',
|
|
43
|
-
|
|
44
|
-
variants: {
|
|
45
|
-
size: {
|
|
46
|
-
sm: 'max-w-screen-sm',
|
|
47
|
-
md: 'max-w-screen-md',
|
|
48
|
-
lg: 'max-w-screen-lg',
|
|
49
|
-
xl: 'max-w-screen-xl',
|
|
50
|
-
'2xl': 'max-w-screen-2xl',
|
|
51
|
-
fluid: '',
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
* Responsive padding ramp. `false` skips it entirely so the
|
|
56
|
-
* consumer can supply custom padding via `sx` when needed.
|
|
57
|
-
*/
|
|
58
|
-
px: {
|
|
59
|
-
true: 'px-4 sm:px-6 lg:px-8',
|
|
60
|
-
false: '',
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
* Stacks children centered. Mutually compatible with all sizes —
|
|
65
|
-
* a fluid container with centerContent is the canonical "marketing
|
|
66
|
-
* hero" layout.
|
|
67
|
-
*/
|
|
68
|
-
centerContent: {
|
|
69
|
-
true: 'flex flex-col items-center',
|
|
70
|
-
false: '',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
defaultVariants: {
|
|
75
|
-
size: 'xl',
|
|
76
|
-
px: true,
|
|
77
|
-
centerContent: false,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
export type ContainerVariants = VariantProps<typeof containerVariants>;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
/**
|
|
3
|
-
* Performance guardrails for `<DataGrid>` (virtualized).
|
|
4
|
-
*
|
|
5
|
-
* The whole point of DataGrid is O(window) rendering: mounting 10k or
|
|
6
|
-
* 100k rows must cost roughly the same as mounting a few hundred,
|
|
7
|
-
* because only the visible window (+ overscan + 2 spacer `<tr>`) is
|
|
8
|
-
* ever in the DOM. These tests pin that invariant — a regression that
|
|
9
|
-
* accidentally mounts the full dataset (e.g. a broken `renderedRows`
|
|
10
|
-
* slice) blows the DOM-node-count assertion immediately.
|
|
11
|
-
*
|
|
12
|
-
* Budgets are deliberately generous — order-of-magnitude regressions,
|
|
13
|
-
* not micro-jitter.
|
|
14
|
-
*/
|
|
15
|
-
import * as React from 'react';
|
|
16
|
-
import { describe, it, expect, afterEach, beforeAll } from 'vitest';
|
|
17
|
-
import { render, cleanup } from '@testing-library/react';
|
|
18
|
-
import { DataGrid } from './DataGrid.js';
|
|
19
|
-
import type { TableColumn } from '../Table/table.types.js';
|
|
20
|
-
|
|
21
|
-
void React;
|
|
22
|
-
afterEach(() => cleanup());
|
|
23
|
-
|
|
24
|
-
beforeAll(() => {
|
|
25
|
-
// jsdom ships neither ResizeObserver nor IntersectionObserver — the
|
|
26
|
-
// virtualizer + Radix popovers need them.
|
|
27
|
-
if (typeof globalThis.ResizeObserver === 'undefined') {
|
|
28
|
-
(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver =
|
|
29
|
-
class {
|
|
30
|
-
observe() {}
|
|
31
|
-
unobserve() {}
|
|
32
|
-
disconnect() {}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
interface Row {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
email: string;
|
|
41
|
-
age: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const COLS: TableColumn<Row>[] = [
|
|
45
|
-
{ field: 'name', header: 'Name', sortable: true },
|
|
46
|
-
{ field: 'email', header: 'Email' },
|
|
47
|
-
{ field: 'age', header: 'Age', sortable: true },
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
function makeRows(n: number): Row[] {
|
|
51
|
-
return Array.from({ length: n }).map((_, i) => ({
|
|
52
|
-
id: `r${i}`,
|
|
53
|
-
name: `User ${i}`,
|
|
54
|
-
email: `user${i}@example.com`,
|
|
55
|
-
age: 20 + (i % 50),
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
describe('<DataGrid> virtualization performance', () => {
|
|
60
|
-
it('mounts 10 000 rows under 500ms (render cost is O(window))', () => {
|
|
61
|
-
const rows = makeRows(10_000);
|
|
62
|
-
const t0 = performance.now();
|
|
63
|
-
render(
|
|
64
|
-
<DataGrid
|
|
65
|
-
rows={rows}
|
|
66
|
-
cols={COLS}
|
|
67
|
-
getRowId={(r) => r.id}
|
|
68
|
-
rowHeight={40}
|
|
69
|
-
height="400px"
|
|
70
|
-
/>,
|
|
71
|
-
);
|
|
72
|
-
const t1 = performance.now();
|
|
73
|
-
expect(t1 - t0).toBeLessThan(500);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('mounts only the visible window in the DOM, NOT the full dataset', () => {
|
|
77
|
-
const rows = makeRows(10_000);
|
|
78
|
-
const { container } = render(
|
|
79
|
-
<DataGrid
|
|
80
|
-
rows={rows}
|
|
81
|
-
cols={COLS}
|
|
82
|
-
getRowId={(r) => r.id}
|
|
83
|
-
rowHeight={40}
|
|
84
|
-
height="400px"
|
|
85
|
-
/>,
|
|
86
|
-
);
|
|
87
|
-
// Virtualized: visible window + overscan + up to 2 spacer rows —
|
|
88
|
-
// a few dozen `<tr>`, far below the 10 000 total.
|
|
89
|
-
const trCount = container.querySelectorAll('tbody tr').length;
|
|
90
|
-
expect(trCount).toBeGreaterThan(0);
|
|
91
|
-
expect(trCount).toBeLessThan(100);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('mounts 100 000 rows within the same generous budget (virtualized)', () => {
|
|
95
|
-
const rows = makeRows(100_000);
|
|
96
|
-
const t0 = performance.now();
|
|
97
|
-
const { container } = render(
|
|
98
|
-
<DataGrid
|
|
99
|
-
rows={rows}
|
|
100
|
-
cols={COLS}
|
|
101
|
-
getRowId={(r) => r.id}
|
|
102
|
-
rowHeight={40}
|
|
103
|
-
height="400px"
|
|
104
|
-
/>,
|
|
105
|
-
);
|
|
106
|
-
const t1 = performance.now();
|
|
107
|
-
// 10× the rows — the RENDER stays windowed, so the cost must not
|
|
108
|
-
// scale with the dataset. Generous absolute bound (not a ratio,
|
|
109
|
-
// to stay non-flaky under CI jitter).
|
|
110
|
-
expect(t1 - t0).toBeLessThan(800);
|
|
111
|
-
// And the DOM still holds only the window.
|
|
112
|
-
expect(container.querySelectorAll('tbody tr').length).toBeLessThan(100);
|
|
113
|
-
});
|
|
114
|
-
});
|