@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,87 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tailwind-variants recipe for `<RadioGroup>` with slots.
|
|
5
|
-
*
|
|
6
|
-
* Slots:
|
|
7
|
-
* - `root` — outer wrapper (label + option list + helper/error)
|
|
8
|
-
* - `label` — group-level label (rendered above the option list)
|
|
9
|
-
* - `requiredMark` — red asterisk for required groups
|
|
10
|
-
* - `optionList` — container for the radio options (flex direction
|
|
11
|
-
* decided by the `layout` variant)
|
|
12
|
-
* - `option` — wrapper for a single option (control + label)
|
|
13
|
-
* - `control` — visible circle (Radix `RadioGroup.Item`)
|
|
14
|
-
* - `indicator` — inner dot (Radix `RadioGroup.Indicator`)
|
|
15
|
-
* - `optionLabel` — text label associated with the control
|
|
16
|
-
* - `helperText` — descriptive line below the option list
|
|
17
|
-
* - `errorText` — semantic counterpart of helperText for error mode
|
|
18
|
-
*
|
|
19
|
-
* Variants:
|
|
20
|
-
* - `size` : sm / md / lg — drives control circle + label text size
|
|
21
|
-
* - `layout` : stacked (vertical, default) / row (horizontal)
|
|
22
|
-
* - `error` : bool — swaps borders + helperText color to danger tones
|
|
23
|
-
*/
|
|
24
|
-
export const radioGroupVariants = tv({
|
|
25
|
-
slots: {
|
|
26
|
-
root: 'flex flex-col gap-1.5',
|
|
27
|
-
label: 'block text-sm font-medium text-neutral-900',
|
|
28
|
-
requiredMark: 'text-danger-500 ml-0.5',
|
|
29
|
-
optionList: 'flex gap-3',
|
|
30
|
-
option: 'inline-flex items-center gap-2',
|
|
31
|
-
control: [
|
|
32
|
-
'inline-flex items-center justify-center shrink-0',
|
|
33
|
-
// bg-neutral-50 inverts — dark-mode aware via the dashforge preset.
|
|
34
|
-
'rounded-full border bg-neutral-50',
|
|
35
|
-
'border-neutral-300',
|
|
36
|
-
'transition-colors',
|
|
37
|
-
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-primary-500',
|
|
38
|
-
'data-[state=checked]:border-primary-500',
|
|
39
|
-
'data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed',
|
|
40
|
-
],
|
|
41
|
-
indicator: 'block rounded-full bg-primary-500',
|
|
42
|
-
optionLabel: 'select-none cursor-pointer text-neutral-900',
|
|
43
|
-
helperText: 'text-sm text-neutral-600',
|
|
44
|
-
errorText: 'text-sm text-danger-600',
|
|
45
|
-
},
|
|
46
|
-
variants: {
|
|
47
|
-
size: {
|
|
48
|
-
sm: {
|
|
49
|
-
control: 'h-4 w-4',
|
|
50
|
-
indicator: 'h-2 w-2',
|
|
51
|
-
optionLabel: 'text-sm',
|
|
52
|
-
},
|
|
53
|
-
md: {
|
|
54
|
-
control: 'h-5 w-5',
|
|
55
|
-
indicator: 'h-2.5 w-2.5',
|
|
56
|
-
optionLabel: 'text-base',
|
|
57
|
-
},
|
|
58
|
-
lg: {
|
|
59
|
-
control: 'h-6 w-6',
|
|
60
|
-
indicator: 'h-3 w-3',
|
|
61
|
-
optionLabel: 'text-lg',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
layout: {
|
|
65
|
-
stacked: { optionList: 'flex-col' },
|
|
66
|
-
row: { optionList: 'flex-row flex-wrap' },
|
|
67
|
-
},
|
|
68
|
-
error: {
|
|
69
|
-
true: {
|
|
70
|
-
control: 'border-danger-500 focus-visible:ring-danger-500',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
disabled: {
|
|
74
|
-
true: {
|
|
75
|
-
control: 'opacity-50 cursor-not-allowed',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
size: 'md',
|
|
81
|
-
layout: 'stacked',
|
|
82
|
-
error: false,
|
|
83
|
-
disabled: false,
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export type RadioGroupVariants = VariantProps<typeof radioGroupVariants>;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
4
|
-
import { render, cleanup } from '@testing-library/react';
|
|
5
|
-
import { Skeleton } from './Skeleton.js';
|
|
6
|
-
|
|
7
|
-
void React;
|
|
8
|
-
afterEach(() => cleanup());
|
|
9
|
-
|
|
10
|
-
describe('Skeleton — rendering', () => {
|
|
11
|
-
it('renders a span with aria-hidden', () => {
|
|
12
|
-
const { container } = render(<Skeleton />);
|
|
13
|
-
const el = container.querySelector('span');
|
|
14
|
-
expect(el).not.toBeNull();
|
|
15
|
-
expect(el?.getAttribute('aria-hidden')).toBe('true');
|
|
16
|
-
expect(el?.getAttribute('role')).toBe('presentation');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('defaults to variant=text + animation=pulse', () => {
|
|
20
|
-
const { container } = render(<Skeleton />);
|
|
21
|
-
const cls = container.querySelector('span')!.className;
|
|
22
|
-
expect(cls).toContain('animate-pulse');
|
|
23
|
-
// text variant has a height of 1em
|
|
24
|
-
expect(cls).toContain('h-[1em]');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('Skeleton — variants', () => {
|
|
29
|
-
it.each(['text', 'rectangle', 'circle'] as const)(
|
|
30
|
-
'renders variant=%s without crashing',
|
|
31
|
-
(variant) => {
|
|
32
|
-
const { container } = render(<Skeleton variant={variant} />);
|
|
33
|
-
expect(container.querySelector('span')).not.toBeNull();
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
it('rectangle has rounded-md class', () => {
|
|
38
|
-
const { container } = render(<Skeleton variant="rectangle" />);
|
|
39
|
-
expect(container.querySelector('span')!.className).toContain('rounded-md');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('circle has rounded-full class', () => {
|
|
43
|
-
const { container } = render(<Skeleton variant="circle" />);
|
|
44
|
-
expect(container.querySelector('span')!.className).toContain('rounded-full');
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('Skeleton — animations', () => {
|
|
49
|
-
it('animation=pulse adds animate-pulse', () => {
|
|
50
|
-
const { container } = render(<Skeleton animation="pulse" />);
|
|
51
|
-
expect(container.querySelector('span')!.className).toContain('animate-pulse');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('animation=none does NOT add animate-pulse', () => {
|
|
55
|
-
const { container } = render(<Skeleton animation="none" />);
|
|
56
|
-
expect(container.querySelector('span')!.className).not.toContain('animate-pulse');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('animation=wave adds overflow-hidden + after gradient', () => {
|
|
60
|
-
const { container } = render(<Skeleton animation="wave" />);
|
|
61
|
-
const cls = container.querySelector('span')!.className;
|
|
62
|
-
expect(cls).toContain('overflow-hidden');
|
|
63
|
-
expect(cls).toContain('relative');
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('always carries motion-reduce safety regardless of animation', () => {
|
|
67
|
-
const { container } = render(<Skeleton animation="pulse" />);
|
|
68
|
-
expect(container.querySelector('span')!.className).toContain('motion-reduce:animate-none');
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
describe('Skeleton — dimensions', () => {
|
|
73
|
-
it('passes width as inline style', () => {
|
|
74
|
-
const { container } = render(<Skeleton width="200px" />);
|
|
75
|
-
expect((container.querySelector('span') as HTMLElement).style.width).toBe('200px');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('passes height as inline style', () => {
|
|
79
|
-
const { container } = render(<Skeleton variant="rectangle" height="120px" />);
|
|
80
|
-
expect((container.querySelector('span') as HTMLElement).style.height).toBe('120px');
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('for circle, height defaults to width', () => {
|
|
84
|
-
const { container } = render(<Skeleton variant="circle" width="48px" />);
|
|
85
|
-
const el = container.querySelector('span') as HTMLElement;
|
|
86
|
-
expect(el.style.width).toBe('48px');
|
|
87
|
-
expect(el.style.height).toBe('48px');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('for circle, explicit height wins over width-default', () => {
|
|
91
|
-
const { container } = render(<Skeleton variant="circle" width="48px" height="64px" />);
|
|
92
|
-
const el = container.querySelector('span') as HTMLElement;
|
|
93
|
-
expect(el.style.width).toBe('48px');
|
|
94
|
-
expect(el.style.height).toBe('64px');
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
describe('Skeleton — sx + slotProps', () => {
|
|
99
|
-
it('appends sx to root className', () => {
|
|
100
|
-
const { container } = render(<Skeleton sx="my-custom-sx" />);
|
|
101
|
-
expect(container.querySelector('span')!.className).toContain('my-custom-sx');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('applies slotProps.root.className', () => {
|
|
105
|
-
const { container } = render(
|
|
106
|
-
<Skeleton slotProps={{ root: { className: 'slot-class' } }} />,
|
|
107
|
-
);
|
|
108
|
-
expect(container.querySelector('span')!.className).toContain('slot-class');
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('sx wins over variant default on conflict via tailwind-merge', () => {
|
|
112
|
-
// variant=text emits `bg-neutral-200`; sx forces `bg-red-500`.
|
|
113
|
-
const { container } = render(<Skeleton sx="bg-red-500" />);
|
|
114
|
-
const cls = container.querySelector('span')!.className;
|
|
115
|
-
expect(cls).toContain('bg-red-500');
|
|
116
|
-
expect(cls).not.toContain('bg-neutral-200');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe('Skeleton — accessibility', () => {
|
|
121
|
-
it('does not appear in role-based queries (aria-hidden + role=presentation)', () => {
|
|
122
|
-
const { container } = render(<Skeleton />);
|
|
123
|
-
const el = container.querySelector('span')!;
|
|
124
|
-
expect(el.getAttribute('aria-hidden')).toBe('true');
|
|
125
|
-
expect(el.getAttribute('role')).toBe('presentation');
|
|
126
|
-
});
|
|
127
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
import { cn } from '../../utils/cn.js';
|
|
3
|
-
import { skeletonVariants } from './skeleton.variants.js';
|
|
4
|
-
import type { SkeletonProps } from './skeleton.types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Dashforge TW `<Skeleton>` — loading placeholder primitive.
|
|
8
|
-
*
|
|
9
|
-
* Renders as a non-interactive `<span aria-hidden="true">` so screen
|
|
10
|
-
* readers skip it. The surrounding component is responsible for
|
|
11
|
-
* announcing loading state via `aria-busy` or `aria-live` if needed.
|
|
12
|
-
*
|
|
13
|
-
* Variants:
|
|
14
|
-
* - `variant` — `text` (default, line shape) / `rectangle` / `circle`
|
|
15
|
-
* - `animation` — `pulse` (default) / `wave` / `none`
|
|
16
|
-
*
|
|
17
|
-
* Both animations are gated by `prefers-reduced-motion` (WCAG 2.3.3).
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* <Skeleton variant="text" width="200px" />
|
|
22
|
-
* <Skeleton variant="rectangle" width="100%" height="120px" />
|
|
23
|
-
* <Skeleton variant="circle" width="40px" />
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export function Skeleton(props: SkeletonProps) {
|
|
27
|
-
const { variant = 'text', animation = 'pulse', width, height, sx, slotProps } = props;
|
|
28
|
-
const v = skeletonVariants({ variant, animation });
|
|
29
|
-
|
|
30
|
-
// Width / height come through as inline style — Tailwind doesn't
|
|
31
|
-
// know about arbitrary user-supplied lengths. We default `circle`'s
|
|
32
|
-
// height to `width` so consumers don't have to repeat themselves.
|
|
33
|
-
const style: CSSProperties = {};
|
|
34
|
-
if (width != null) style.width = width;
|
|
35
|
-
if (height != null) {
|
|
36
|
-
style.height = height;
|
|
37
|
-
} else if (variant === 'circle' && width != null) {
|
|
38
|
-
style.height = width;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<span
|
|
43
|
-
aria-hidden="true"
|
|
44
|
-
role="presentation"
|
|
45
|
-
className={cn(v.root(), sx, slotProps?.root?.className)}
|
|
46
|
-
style={style}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { SkeletonVariants } from './skeleton.variants.js';
|
|
2
|
-
|
|
3
|
-
export interface SkeletonSlotProps {
|
|
4
|
-
/** Root element override. */
|
|
5
|
-
root?: { className?: string };
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Props for `<Skeleton>`.
|
|
10
|
-
*
|
|
11
|
-
* Visual loading placeholder shown while data / images / components
|
|
12
|
-
* are being prepared. Three shapes (`variant`), three animations
|
|
13
|
-
* (`animation`), and free-form `width` / `height` for arbitrary
|
|
14
|
-
* dimensions.
|
|
15
|
-
*
|
|
16
|
-
* Rendered as a non-interactive `<span aria-hidden="true">` so screen
|
|
17
|
-
* readers skip it entirely.
|
|
18
|
-
*
|
|
19
|
-
* Compose by nesting: e.g. avatar + two text lines for a card
|
|
20
|
-
* placeholder.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <Skeleton variant="text" width="200px" />
|
|
25
|
-
* <Skeleton variant="rectangle" width="100%" height="120px" />
|
|
26
|
-
* <Skeleton variant="circle" width="40px" />
|
|
27
|
-
*
|
|
28
|
-
* // Compose to mimic a card shape
|
|
29
|
-
* <div className="flex gap-3">
|
|
30
|
-
* <Skeleton variant="circle" width="48px" />
|
|
31
|
-
* <div className="flex flex-col gap-2 flex-1">
|
|
32
|
-
* <Skeleton variant="text" width="60%" />
|
|
33
|
-
* <Skeleton variant="text" width="40%" />
|
|
34
|
-
* </div>
|
|
35
|
-
* </div>
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export interface SkeletonProps
|
|
39
|
-
extends Pick<SkeletonVariants, 'variant' | 'animation'> {
|
|
40
|
-
/**
|
|
41
|
-
* CSS width (e.g. `"200px"`, `"100%"`, `"60%"`).
|
|
42
|
-
*
|
|
43
|
-
* Defaults: `text` → `100%`, `rectangle` → `100%`, `circle` → `40px`.
|
|
44
|
-
*/
|
|
45
|
-
width?: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* CSS height (e.g. `"1em"`, `"120px"`).
|
|
49
|
-
*
|
|
50
|
-
* Defaults: `text` → `1em`, `rectangle` → `100px`, `circle` → matches `width`.
|
|
51
|
-
*/
|
|
52
|
-
height?: string;
|
|
53
|
-
|
|
54
|
-
/** Root-level Tailwind override (wins via `tailwind-merge`). */
|
|
55
|
-
sx?: string;
|
|
56
|
-
|
|
57
|
-
/** Per-slot overrides. */
|
|
58
|
-
slotProps?: SkeletonSlotProps;
|
|
59
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* `<Skeleton>` variant recipe.
|
|
5
|
-
*
|
|
6
|
-
* Slots:
|
|
7
|
-
* - `root` — single element (atomic component)
|
|
8
|
-
*
|
|
9
|
-
* Variant axes:
|
|
10
|
-
* - `variant` (`text` | `rectangle` | `circle`) — shape / radius
|
|
11
|
-
* - `animation` (`pulse` | `wave` | `none`) — how the placeholder
|
|
12
|
-
* "breathes" while data loads. Always gated on
|
|
13
|
-
* `prefers-reduced-motion` (no exception — animations are
|
|
14
|
-
* purely cosmetic).
|
|
15
|
-
*
|
|
16
|
-
* Implementation notes:
|
|
17
|
-
*
|
|
18
|
-
* - `pulse` uses Tailwind's built-in `animate-pulse` (opacity
|
|
19
|
-
* 1.0 ↔ 0.5 over 2s, ease-in-out infinite).
|
|
20
|
-
* - `wave` overlays a moving gradient. Implemented with a
|
|
21
|
-
* `relative` container + an `::after` pseudo-element via a
|
|
22
|
-
* Tailwind arbitrary-value class. The gradient slides
|
|
23
|
-
* horizontally over the surface, mimicking the MUI Skeleton
|
|
24
|
-
* "wave" look.
|
|
25
|
-
* - Color uses neutral-200 (light) and neutral-800 (dark) for
|
|
26
|
-
* the base, picked up automatically by the dashforge preset's
|
|
27
|
-
* CSS-variable layer.
|
|
28
|
-
*
|
|
29
|
-
* Accessibility: the root has `aria-hidden="true"` (set on the JSX
|
|
30
|
-
* side, not here). Screen readers skip the skeleton entirely;
|
|
31
|
-
* the surrounding component is responsible for announcing
|
|
32
|
-
* loading state via `aria-busy` or `aria-live` if needed.
|
|
33
|
-
*/
|
|
34
|
-
export const skeletonVariants = tv({
|
|
35
|
-
slots: {
|
|
36
|
-
root: [
|
|
37
|
-
'block',
|
|
38
|
-
// Neutral palette auto-inverts via CSS-var swap (no `dark:`).
|
|
39
|
-
'bg-neutral-200',
|
|
40
|
-
'motion-reduce:animate-none',
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
variants: {
|
|
44
|
-
variant: {
|
|
45
|
-
text: {
|
|
46
|
-
root: 'rounded h-[1em] w-full',
|
|
47
|
-
},
|
|
48
|
-
rectangle: {
|
|
49
|
-
root: 'rounded-md w-full h-[100px]',
|
|
50
|
-
},
|
|
51
|
-
circle: {
|
|
52
|
-
root: 'rounded-full w-10 h-10',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
animation: {
|
|
56
|
-
pulse: {
|
|
57
|
-
root: 'animate-pulse',
|
|
58
|
-
},
|
|
59
|
-
wave: {
|
|
60
|
-
root: [
|
|
61
|
-
'relative overflow-hidden',
|
|
62
|
-
// The wave is rendered via an arbitrary-value ::after
|
|
63
|
-
// pseudo-element with a moving linear gradient. Tailwind
|
|
64
|
-
// doesn't ship a `wave` keyframe; we use the built-in
|
|
65
|
-
// `animate-pulse` as a fallback if a consumer needs to
|
|
66
|
-
// override. The gradient stop direction works in both
|
|
67
|
-
// light and dark mode (white shimmer in light, lighter
|
|
68
|
-
// overlay in dark).
|
|
69
|
-
'after:absolute after:inset-0',
|
|
70
|
-
'after:bg-gradient-to-r after:from-transparent after:via-white/40 after:to-transparent',
|
|
71
|
-
'dark:after:via-white/10',
|
|
72
|
-
'after:animate-pulse',
|
|
73
|
-
'after:motion-reduce:animate-none',
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
none: {
|
|
77
|
-
root: '',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
defaultVariants: {
|
|
82
|
-
variant: 'text',
|
|
83
|
-
animation: 'pulse',
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export type SkeletonVariants = VariantProps<typeof skeletonVariants>;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
/**
|
|
3
|
-
* Performance + re-render budget tests for `<SnackbarProvider>`.
|
|
4
|
-
*
|
|
5
|
-
* Guardrails:
|
|
6
|
-
*
|
|
7
|
-
* 1. Mount cost stays tiny — provider lives near app root.
|
|
8
|
-
* 2. Enqueueing N snackbars in quick succession is O(N) total work,
|
|
9
|
-
* NOT O(N²) at the React level.
|
|
10
|
-
* 3. Provider re-renders ONLY when the visible set changes — children
|
|
11
|
-
* subtree is untouched per enqueue.
|
|
12
|
-
* 4. `api` object identity is stable across provider re-renders so
|
|
13
|
-
* consumers can put `enqueue` in `useEffect` deps safely.
|
|
14
|
-
*/
|
|
15
|
-
import * as React from 'react';
|
|
16
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
17
|
-
import {
|
|
18
|
-
render,
|
|
19
|
-
screen,
|
|
20
|
-
fireEvent,
|
|
21
|
-
cleanup,
|
|
22
|
-
act,
|
|
23
|
-
} from '@testing-library/react';
|
|
24
|
-
import { SnackbarProvider, useSnackbar } from './Snackbar.js';
|
|
25
|
-
|
|
26
|
-
void React;
|
|
27
|
-
afterEach(() => cleanup());
|
|
28
|
-
|
|
29
|
-
describe('<SnackbarProvider> performance', () => {
|
|
30
|
-
it('mounts in under 200ms with empty children (cold-start safe budget)', () => {
|
|
31
|
-
const t0 = performance.now();
|
|
32
|
-
render(
|
|
33
|
-
<SnackbarProvider>
|
|
34
|
-
<div />
|
|
35
|
-
</SnackbarProvider>
|
|
36
|
-
);
|
|
37
|
-
const t1 = performance.now();
|
|
38
|
-
// Generous bound for cold-start under workspace-wide test runs;
|
|
39
|
-
// warm path is sub-10ms.
|
|
40
|
-
expect(t1 - t0).toBeLessThan(200);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('enqueues 50 snackbars (cap=50) under 200ms', () => {
|
|
44
|
-
function Adder() {
|
|
45
|
-
const { enqueue } = useSnackbar();
|
|
46
|
-
return (
|
|
47
|
-
<button
|
|
48
|
-
data-testid="a"
|
|
49
|
-
onClick={() => {
|
|
50
|
-
for (let i = 0; i < 50; i++) {
|
|
51
|
-
enqueue({ message: `msg-${i}`, autoHideMs: 0 });
|
|
52
|
-
}
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
add
|
|
56
|
-
</button>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
render(
|
|
60
|
-
<SnackbarProvider maxVisible={50}>
|
|
61
|
-
<Adder />
|
|
62
|
-
</SnackbarProvider>
|
|
63
|
-
);
|
|
64
|
-
const t0 = performance.now();
|
|
65
|
-
act(() => {
|
|
66
|
-
fireEvent.click(screen.getByTestId('a'));
|
|
67
|
-
});
|
|
68
|
-
const t1 = performance.now();
|
|
69
|
-
expect(t1 - t0).toBeLessThan(200);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('<SnackbarProvider> re-render budget', () => {
|
|
74
|
-
it('children subtree does NOT re-render on enqueue', () => {
|
|
75
|
-
const childCount = { count: 0 };
|
|
76
|
-
const Child = () => {
|
|
77
|
-
childCount.count++;
|
|
78
|
-
return <div data-testid="child" />;
|
|
79
|
-
};
|
|
80
|
-
function Adder() {
|
|
81
|
-
const { enqueue } = useSnackbar();
|
|
82
|
-
return (
|
|
83
|
-
<button
|
|
84
|
-
data-testid="a"
|
|
85
|
-
onClick={() => enqueue({ message: 'hi', autoHideMs: 0 })}
|
|
86
|
-
>
|
|
87
|
-
add
|
|
88
|
-
</button>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
render(
|
|
92
|
-
<SnackbarProvider>
|
|
93
|
-
<Child />
|
|
94
|
-
<Adder />
|
|
95
|
-
</SnackbarProvider>
|
|
96
|
-
);
|
|
97
|
-
const baseline = childCount.count;
|
|
98
|
-
act(() => {
|
|
99
|
-
fireEvent.click(screen.getByTestId('a'));
|
|
100
|
-
fireEvent.click(screen.getByTestId('a'));
|
|
101
|
-
fireEvent.click(screen.getByTestId('a'));
|
|
102
|
-
});
|
|
103
|
-
// The provider RE-renders on each enqueue (state change), which
|
|
104
|
-
// re-renders its direct children — Child is one of them, so it
|
|
105
|
-
// re-renders too. The contract is "no MORE than one re-render
|
|
106
|
-
// PER enqueue". Three enqueues ⇒ ≤ 3 extra child renders.
|
|
107
|
-
expect(childCount.count - baseline).toBeLessThanOrEqual(3);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('useSnackbar() returns a STABLE api identity across re-renders', () => {
|
|
111
|
-
const captured: Array<unknown> = [];
|
|
112
|
-
function Capture() {
|
|
113
|
-
const api = useSnackbar();
|
|
114
|
-
captured.push(api);
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
const Outer = ({ x }: { x: number }) => (
|
|
118
|
-
<SnackbarProvider>
|
|
119
|
-
<div data-x={x} />
|
|
120
|
-
<Capture />
|
|
121
|
-
</SnackbarProvider>
|
|
122
|
-
);
|
|
123
|
-
const { rerender } = render(<Outer x={1} />);
|
|
124
|
-
rerender(<Outer x={2} />);
|
|
125
|
-
rerender(<Outer x={3} />);
|
|
126
|
-
expect(captured.length).toBeGreaterThanOrEqual(3);
|
|
127
|
-
expect(captured[0]).toBe(captured[1]);
|
|
128
|
-
expect(captured[1]).toBe(captured[2]);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('renders at most 2 times on mount (provider wrapper)', () => {
|
|
132
|
-
let count = 0;
|
|
133
|
-
const Counted = (p: React.ComponentProps<typeof SnackbarProvider>) => {
|
|
134
|
-
count++;
|
|
135
|
-
return <SnackbarProvider {...p} />;
|
|
136
|
-
};
|
|
137
|
-
render(
|
|
138
|
-
<Counted>
|
|
139
|
-
<div />
|
|
140
|
-
</Counted>
|
|
141
|
-
);
|
|
142
|
-
expect(count).toBeLessThanOrEqual(2);
|
|
143
|
-
});
|
|
144
|
-
});
|