@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,128 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { ClassValue } from 'tailwind-variants';
|
|
3
|
-
import type { Engine } from '@dashforge/ui-core';
|
|
4
|
-
import type { AccessRequirement } from '@dashforge/rbac';
|
|
5
|
-
import type { ChipVariants } from './chip.variants.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Props for `<Chip>` — status / filter / tag pill.
|
|
9
|
-
*
|
|
10
|
-
* Mirrors MUI Chip's API surface where it makes sense (label, icon,
|
|
11
|
-
* avatar, clickable, onDelete) and extends with Dashforge-specific
|
|
12
|
-
* affordances (`selected` for filter chips, `access` for RBAC).
|
|
13
|
-
*
|
|
14
|
-
* Variant axis (`soft | solid | outline`) is the **Dashforge chip
|
|
15
|
-
* vocabulary** — distinct from Button's (`solid | outline | ghost |
|
|
16
|
-
* link`) and Alert's (`standard | filled | outlined`). The asymmetry
|
|
17
|
-
* is intentional and category-scoped: each component family uses the
|
|
18
|
-
* vocabulary that maps to its design needs (see CHANGELOG +
|
|
19
|
-
* MIGRATION.md for the design note).
|
|
20
|
-
*
|
|
21
|
-
* @see https://mui.com/material-ui/api/chip/
|
|
22
|
-
*/
|
|
23
|
-
export interface ChipProps
|
|
24
|
-
extends Pick<
|
|
25
|
-
ChipVariants,
|
|
26
|
-
'color' | 'variant' | 'size' | 'selected' | 'disabled'
|
|
27
|
-
> {
|
|
28
|
-
/**
|
|
29
|
-
* The chip's textual content. Named `label` for MUI parity — most
|
|
30
|
-
* design systems (MUI, Radix Themes, Mantine, Tremor) use `label`
|
|
31
|
-
* as the canonical content prop on Chip / Badge / Pill primitives.
|
|
32
|
-
*/
|
|
33
|
-
label: ReactNode;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Leading icon — typically a small SVG (16px). Consumer brings
|
|
37
|
-
* their iconography. Rendered inside the chip BEFORE the label.
|
|
38
|
-
* Falls back to `avatar` if not provided.
|
|
39
|
-
*/
|
|
40
|
-
icon?: ReactNode;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Leading avatar — alternative to `icon`, typically a small
|
|
44
|
-
* circular image (Avatar component or `<img>`). When BOTH `icon`
|
|
45
|
-
* and `avatar` are set, `avatar` wins (matches MUI behaviour).
|
|
46
|
-
*/
|
|
47
|
-
avatar?: ReactNode;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Makes the chip interactive — renders as `<button>` (instead of
|
|
51
|
-
* `<span>`), adds focus ring + hover state. Set automatically to
|
|
52
|
-
* `true` when `onClick` is provided.
|
|
53
|
-
*/
|
|
54
|
-
clickable?: boolean;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Click handler. Implies `clickable=true`. Fires on chip-body
|
|
58
|
-
* click (NOT on the delete button — `onDelete` is the dedicated
|
|
59
|
-
* path for that).
|
|
60
|
-
*/
|
|
61
|
-
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* When set, renders a trailing × delete button. The handler fires
|
|
65
|
-
* on delete-button click and stops propagation so the chip's
|
|
66
|
-
* `onClick` doesn't also fire.
|
|
67
|
-
*/
|
|
68
|
-
onDelete?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Custom delete icon. Defaults to an inline stroke-style × SVG.
|
|
72
|
-
* `currentColor` flows through, so the icon inherits the chip's
|
|
73
|
-
* text colour.
|
|
74
|
-
*/
|
|
75
|
-
deleteIcon?: ReactNode;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* `aria-label` for the delete button. Required for screen readers
|
|
79
|
-
* since the × glyph alone is not semantic.
|
|
80
|
-
* @default 'Remove'
|
|
81
|
-
*/
|
|
82
|
-
deleteLabel?: string;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Reactive visibility predicate. Re-evaluated on every engine state
|
|
86
|
-
* change when the chip is mounted inside a `<DashForm>`; outside
|
|
87
|
-
* a form, evaluated as a plain predicate (the consumer captures
|
|
88
|
-
* any external state in the closure).
|
|
89
|
-
*
|
|
90
|
-
* When the predicate returns `false`, the component renders `null`
|
|
91
|
-
* — same contract as `<Alert>` / `<TextField>` / other bridge-aware
|
|
92
|
-
* components. Useful for status chips that should appear / disappear
|
|
93
|
-
* based on form values without forcing JSX guards on the consumer.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```tsx
|
|
97
|
-
* // Inside a DashForm — engine-reactive
|
|
98
|
-
* <Chip
|
|
99
|
-
* label="Premium"
|
|
100
|
-
* color="primary"
|
|
101
|
-
* visibleWhen={(engine) => engine.getNode('plan')?.value === 'premium'}
|
|
102
|
-
* />
|
|
103
|
-
*
|
|
104
|
-
* // Outside a form — closure over external state
|
|
105
|
-
* <Chip
|
|
106
|
-
* label={`${count} results`}
|
|
107
|
-
* visibleWhen={() => count > 0}
|
|
108
|
-
* />
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
visibleWhen?: (engine: Engine) => boolean;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* RBAC requirement. Same contract as `<Button>` / `<IconButton>` —
|
|
115
|
-
* `onUnauthorized: 'hide' | 'disable' | 'readonly'`.
|
|
116
|
-
* (`readonly` maps to `disabled` for chips, matching Button.)
|
|
117
|
-
*/
|
|
118
|
-
access?: AccessRequirement;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Root-element class shortcut (string or clsx-compatible value).
|
|
122
|
-
* Last-wins via `tailwind-merge` inside `cn()`.
|
|
123
|
-
*/
|
|
124
|
-
sx?: ClassValue;
|
|
125
|
-
|
|
126
|
-
/** Standard React `className` — appended to the root via `cn()`. */
|
|
127
|
-
className?: string;
|
|
128
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tailwind-variants recipe for `<Chip>` — promoted from the internal
|
|
5
|
-
* `Table/cells/RenderChip` (Sprint 4.4). The visual treatment is
|
|
6
|
-
* preserved byte-identical: the same 3 × 7 compound matrix
|
|
7
|
-
* (variant × color) emitted by RenderChip is now the single source
|
|
8
|
-
* of truth, consumed by both the public `<Chip>` and (via thin
|
|
9
|
-
* wrapper) the legacy `RenderChip` internal.
|
|
10
|
-
*
|
|
11
|
-
* Slots (only `root` slot used by the public Chip; sub-slots
|
|
12
|
-
* surfaced via separate inline classes in `Chip.tsx`):
|
|
13
|
-
* - `root` — outer chip surface
|
|
14
|
-
*
|
|
15
|
-
* Variants axis (3 × 7, plus orthogonal `size`):
|
|
16
|
-
* - `color`: 7 intents (`neutral / primary / secondary / success /
|
|
17
|
-
* warning / danger / info`)
|
|
18
|
-
* - `variant`: `soft` (default) / `solid` / `outline`
|
|
19
|
-
* - `size`: `sm` (default) / `md`
|
|
20
|
-
*
|
|
21
|
-
* Token-driven: every Tailwind utility resolves through
|
|
22
|
-
* `dashforgePreset()` → CSS variables. No hardcoded hex.
|
|
23
|
-
*
|
|
24
|
-
* `dark:` variants on color palettes (lines 49-77 of legacy
|
|
25
|
-
* RenderChip, preserved here) are INTENTIONAL — color palettes do not
|
|
26
|
-
* auto-invert via the CSS-var swap (only the `neutral` palette does),
|
|
27
|
-
* so the `dark:` shift is a deliberate design choice (darker bg +
|
|
28
|
-
* lighter text in dark mode for visual cohesion). `dark:` on the
|
|
29
|
-
* `neutral` row is AVOIDED — that would double-invert.
|
|
30
|
-
*/
|
|
31
|
-
export const chipVariants = tv({
|
|
32
|
-
base: [
|
|
33
|
-
'inline-flex items-center gap-1 rounded-full font-medium',
|
|
34
|
-
'whitespace-nowrap',
|
|
35
|
-
// Smooth transitions for clickable / selected state changes.
|
|
36
|
-
'transition-colors',
|
|
37
|
-
'motion-reduce:transition-none',
|
|
38
|
-
],
|
|
39
|
-
variants: {
|
|
40
|
-
color: {
|
|
41
|
-
neutral: '',
|
|
42
|
-
primary: '',
|
|
43
|
-
secondary: '',
|
|
44
|
-
success: '',
|
|
45
|
-
warning: '',
|
|
46
|
-
danger: '',
|
|
47
|
-
info: '',
|
|
48
|
-
},
|
|
49
|
-
variant: {
|
|
50
|
-
soft: '',
|
|
51
|
-
solid: '',
|
|
52
|
-
outline: '',
|
|
53
|
-
},
|
|
54
|
-
size: {
|
|
55
|
-
sm: 'h-5 px-2 text-xs',
|
|
56
|
-
md: 'h-6 px-2.5 text-xs',
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* Clickable state — adds focus ring + hover transition. Applied
|
|
60
|
-
* when the chip renders as `<button>` (i.e. `onClick` or
|
|
61
|
-
* explicit `clickable` is set).
|
|
62
|
-
*/
|
|
63
|
-
clickable: {
|
|
64
|
-
true: [
|
|
65
|
-
'cursor-pointer select-none',
|
|
66
|
-
'outline-none focus-visible:ring-2 focus-visible:ring-offset-1',
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Selected state — used on filter chips to indicate active
|
|
71
|
-
* selection. Visually shifts the chip to a heavier emphasis
|
|
72
|
-
* (one step up the elevation ladder of its current variant).
|
|
73
|
-
* Compound rules below apply the actual shift per (variant, color)
|
|
74
|
-
* cell.
|
|
75
|
-
*/
|
|
76
|
-
selected: {
|
|
77
|
-
true: 'ring-2 ring-offset-1',
|
|
78
|
-
},
|
|
79
|
-
/** Disabled state for clickable chips. */
|
|
80
|
-
disabled: {
|
|
81
|
-
true: 'opacity-50 cursor-not-allowed pointer-events-none',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
compoundVariants: [
|
|
85
|
-
// ─── soft × color ──────────────────────────────────────────────
|
|
86
|
-
// Subtle bg + readable text. Neutral row uses NO `dark:` (auto-
|
|
87
|
-
// inverts via the dashforgePreset CSS-var swap). Color rows KEEP
|
|
88
|
-
// `dark:` (color palettes don't auto-invert).
|
|
89
|
-
{ variant: 'soft', color: 'neutral', class: 'bg-neutral-100 text-neutral-700' },
|
|
90
|
-
{ variant: 'soft', color: 'primary', class: 'bg-primary-100 dark:bg-primary-950 text-primary-700 dark:text-primary-300' },
|
|
91
|
-
{ variant: 'soft', color: 'secondary', class: 'bg-secondary-100 dark:bg-secondary-950 text-secondary-700 dark:text-secondary-300' },
|
|
92
|
-
{ variant: 'soft', color: 'success', class: 'bg-success-100 dark:bg-success-950 text-success-700 dark:text-success-300' },
|
|
93
|
-
{ variant: 'soft', color: 'warning', class: 'bg-warning-100 dark:bg-warning-950 text-warning-700 dark:text-warning-300' },
|
|
94
|
-
{ variant: 'soft', color: 'danger', class: 'bg-danger-100 dark:bg-danger-950 text-danger-700 dark:text-danger-300' },
|
|
95
|
-
{ variant: 'soft', color: 'info', class: 'bg-info-100 dark:bg-info-950 text-info-700 dark:text-info-300' },
|
|
96
|
-
// ─── solid × color ─────────────────────────────────────────────
|
|
97
|
-
// Full bg + contrasting text. Solid neutral uses neutral-700/50
|
|
98
|
-
// (both on neutral palette → auto-invert together).
|
|
99
|
-
// `text-white` is deliberately NOT used: white does not auto-invert,
|
|
100
|
-
// which would flip the contrast in dark mode for the neutral row.
|
|
101
|
-
{ variant: 'solid', color: 'neutral', class: 'bg-neutral-700 text-neutral-50' },
|
|
102
|
-
{ variant: 'solid', color: 'primary', class: 'bg-primary-500 text-white' },
|
|
103
|
-
{ variant: 'solid', color: 'secondary', class: 'bg-secondary-500 text-white' },
|
|
104
|
-
{ variant: 'solid', color: 'success', class: 'bg-success-500 text-white' },
|
|
105
|
-
{ variant: 'solid', color: 'warning', class: 'bg-warning-500 text-white' },
|
|
106
|
-
{ variant: 'solid', color: 'danger', class: 'bg-danger-500 text-white' },
|
|
107
|
-
{ variant: 'solid', color: 'info', class: 'bg-info-500 text-white' },
|
|
108
|
-
// ─── outline × color ───────────────────────────────────────────
|
|
109
|
-
// Border + colored text. Outline neutral: both auto-invert via
|
|
110
|
-
// CSS-var swap. Color rows: `dark:text-*-300` for legibility in
|
|
111
|
-
// dark mode on a transparent background.
|
|
112
|
-
{ variant: 'outline', color: 'neutral', class: 'border border-neutral-300 text-neutral-700' },
|
|
113
|
-
{ variant: 'outline', color: 'primary', class: 'border border-primary-500 text-primary-700 dark:text-primary-300' },
|
|
114
|
-
{ variant: 'outline', color: 'secondary', class: 'border border-secondary-500 text-secondary-700 dark:text-secondary-300' },
|
|
115
|
-
{ variant: 'outline', color: 'success', class: 'border border-success-500 text-success-700 dark:text-success-300' },
|
|
116
|
-
{ variant: 'outline', color: 'warning', class: 'border border-warning-500 text-warning-700 dark:text-warning-300' },
|
|
117
|
-
{ variant: 'outline', color: 'danger', class: 'border border-danger-500 text-danger-700 dark:text-danger-300' },
|
|
118
|
-
{ variant: 'outline', color: 'info', class: 'border border-info-500 text-info-700 dark:text-info-300' },
|
|
119
|
-
// ─── clickable × color hover (subtle bg shift) ─────────────────
|
|
120
|
-
// Hover state on clickable chips. Each (variant, color) hover
|
|
121
|
-
// emits a one-tier deeper bg tint, working across both modes via
|
|
122
|
-
// the same auto-invert logic as the base compound.
|
|
123
|
-
{ clickable: true, variant: 'soft', color: 'neutral', class: 'hover:bg-neutral-200' },
|
|
124
|
-
{ clickable: true, variant: 'soft', color: 'primary', class: 'hover:bg-primary-200 dark:hover:bg-primary-900' },
|
|
125
|
-
{ clickable: true, variant: 'soft', color: 'secondary', class: 'hover:bg-secondary-200 dark:hover:bg-secondary-900' },
|
|
126
|
-
{ clickable: true, variant: 'soft', color: 'success', class: 'hover:bg-success-200 dark:hover:bg-success-900' },
|
|
127
|
-
{ clickable: true, variant: 'soft', color: 'warning', class: 'hover:bg-warning-200 dark:hover:bg-warning-900' },
|
|
128
|
-
{ clickable: true, variant: 'soft', color: 'danger', class: 'hover:bg-danger-200 dark:hover:bg-danger-900' },
|
|
129
|
-
{ clickable: true, variant: 'soft', color: 'info', class: 'hover:bg-info-200 dark:hover:bg-info-900' },
|
|
130
|
-
// Solid hover → one tone darker
|
|
131
|
-
{ clickable: true, variant: 'solid', color: 'neutral', class: 'hover:bg-neutral-800' },
|
|
132
|
-
{ clickable: true, variant: 'solid', color: 'primary', class: 'hover:bg-primary-600' },
|
|
133
|
-
{ clickable: true, variant: 'solid', color: 'secondary', class: 'hover:bg-secondary-600' },
|
|
134
|
-
{ clickable: true, variant: 'solid', color: 'success', class: 'hover:bg-success-600' },
|
|
135
|
-
{ clickable: true, variant: 'solid', color: 'warning', class: 'hover:bg-warning-600' },
|
|
136
|
-
{ clickable: true, variant: 'solid', color: 'danger', class: 'hover:bg-danger-600' },
|
|
137
|
-
{ clickable: true, variant: 'solid', color: 'info', class: 'hover:bg-info-600' },
|
|
138
|
-
// Outline hover → tinted bg appears (transparent → light tint)
|
|
139
|
-
{ clickable: true, variant: 'outline', color: 'neutral', class: 'hover:bg-neutral-100' },
|
|
140
|
-
{ clickable: true, variant: 'outline', color: 'primary', class: 'hover:bg-primary-50 dark:hover:bg-primary-950' },
|
|
141
|
-
{ clickable: true, variant: 'outline', color: 'secondary', class: 'hover:bg-secondary-50 dark:hover:bg-secondary-950' },
|
|
142
|
-
{ clickable: true, variant: 'outline', color: 'success', class: 'hover:bg-success-50 dark:hover:bg-success-950' },
|
|
143
|
-
{ clickable: true, variant: 'outline', color: 'warning', class: 'hover:bg-warning-50 dark:hover:bg-warning-950' },
|
|
144
|
-
{ clickable: true, variant: 'outline', color: 'danger', class: 'hover:bg-danger-50 dark:hover:bg-danger-950' },
|
|
145
|
-
{ clickable: true, variant: 'outline', color: 'info', class: 'hover:bg-info-50 dark:hover:bg-info-950' },
|
|
146
|
-
// ─── selected × color (focus ring tone) ────────────────────────
|
|
147
|
-
// When selected, the ring color matches the chip's intent.
|
|
148
|
-
{ selected: true, color: 'neutral', class: 'ring-neutral-400' },
|
|
149
|
-
{ selected: true, color: 'primary', class: 'ring-primary-500' },
|
|
150
|
-
{ selected: true, color: 'secondary', class: 'ring-secondary-500' },
|
|
151
|
-
{ selected: true, color: 'success', class: 'ring-success-500' },
|
|
152
|
-
{ selected: true, color: 'warning', class: 'ring-warning-500' },
|
|
153
|
-
{ selected: true, color: 'danger', class: 'ring-danger-500' },
|
|
154
|
-
{ selected: true, color: 'info', class: 'ring-info-500' },
|
|
155
|
-
// ─── clickable × color (focus ring tone) ───────────────────────
|
|
156
|
-
// Tab-focused ring tone matches the chip color (same intent as
|
|
157
|
-
// selected but only when keyboard-focused, via focus-visible).
|
|
158
|
-
{ clickable: true, color: 'neutral', class: 'focus-visible:ring-neutral-400' },
|
|
159
|
-
{ clickable: true, color: 'primary', class: 'focus-visible:ring-primary-500' },
|
|
160
|
-
{ clickable: true, color: 'secondary', class: 'focus-visible:ring-secondary-500' },
|
|
161
|
-
{ clickable: true, color: 'success', class: 'focus-visible:ring-success-500' },
|
|
162
|
-
{ clickable: true, color: 'warning', class: 'focus-visible:ring-warning-500' },
|
|
163
|
-
{ clickable: true, color: 'danger', class: 'focus-visible:ring-danger-500' },
|
|
164
|
-
{ clickable: true, color: 'info', class: 'focus-visible:ring-info-500' },
|
|
165
|
-
],
|
|
166
|
-
defaultVariants: {
|
|
167
|
-
color: 'neutral',
|
|
168
|
-
variant: 'soft',
|
|
169
|
-
size: 'sm',
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
export type ChipVariants = VariantProps<typeof chipVariants>;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
/**
|
|
3
|
-
* Performance + re-render budget tests for `<ConfirmDialogProvider>`.
|
|
4
|
-
*
|
|
5
|
-
* Guardrails:
|
|
6
|
-
*
|
|
7
|
-
* 1. Provider mount is cheap — it lives near the top of the tree, so
|
|
8
|
-
* it must not chase any expensive setup paths.
|
|
9
|
-
*
|
|
10
|
-
* 2. `confirm()` reference is stable across provider re-renders so
|
|
11
|
-
* consumers can pass it through `useEffect` deps without thrashing.
|
|
12
|
-
*
|
|
13
|
-
* 3. Children do NOT re-render every time a confirm() opens/closes —
|
|
14
|
-
* state lives inside the provider, but a memoized context value
|
|
15
|
-
* plus React's bail-out on identical context means the children
|
|
16
|
-
* subtree stays put.
|
|
17
|
-
*
|
|
18
|
-
* 4. Dismissing the dialog with the queue drained does not allocate
|
|
19
|
-
* a new array (cheap idle path).
|
|
20
|
-
*/
|
|
21
|
-
import * as React from 'react';
|
|
22
|
-
import { describe, it, expect, afterEach, beforeAll } from 'vitest';
|
|
23
|
-
import {
|
|
24
|
-
render,
|
|
25
|
-
screen,
|
|
26
|
-
fireEvent,
|
|
27
|
-
cleanup,
|
|
28
|
-
act,
|
|
29
|
-
} from '@testing-library/react';
|
|
30
|
-
import {
|
|
31
|
-
ConfirmDialogProvider,
|
|
32
|
-
useConfirm,
|
|
33
|
-
} from './ConfirmDialog.js';
|
|
34
|
-
|
|
35
|
-
void React;
|
|
36
|
-
afterEach(() => cleanup());
|
|
37
|
-
|
|
38
|
-
beforeAll(() => {
|
|
39
|
-
if (typeof HTMLDialogElement === 'undefined') return;
|
|
40
|
-
const proto = HTMLDialogElement.prototype as unknown as {
|
|
41
|
-
showModal?: () => void;
|
|
42
|
-
close?: (returnValue?: string) => void;
|
|
43
|
-
};
|
|
44
|
-
if (typeof proto.showModal !== 'function') {
|
|
45
|
-
proto.showModal = function (this: HTMLDialogElement) {
|
|
46
|
-
this.setAttribute('open', '');
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (typeof proto.close !== 'function') {
|
|
50
|
-
proto.close = function (this: HTMLDialogElement) {
|
|
51
|
-
this.removeAttribute('open');
|
|
52
|
-
this.dispatchEvent(new Event('close'));
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('<ConfirmDialogProvider> performance', () => {
|
|
58
|
-
it('mounts under 200ms with empty children (cold-start safe budget)', () => {
|
|
59
|
-
const t0 = performance.now();
|
|
60
|
-
render(
|
|
61
|
-
<ConfirmDialogProvider>
|
|
62
|
-
<div />
|
|
63
|
-
</ConfirmDialogProvider>
|
|
64
|
-
);
|
|
65
|
-
const t1 = performance.now();
|
|
66
|
-
// Generous bound to accommodate cold-start variance under full
|
|
67
|
-
// workspace test run; warm path is in single-digit ms.
|
|
68
|
-
expect(t1 - t0).toBeLessThan(200);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('opens + closes a dialog in under 30ms', async () => {
|
|
72
|
-
const Harness = () => {
|
|
73
|
-
const confirm = useConfirm();
|
|
74
|
-
return (
|
|
75
|
-
<button
|
|
76
|
-
data-testid="t"
|
|
77
|
-
onClick={async () => {
|
|
78
|
-
await confirm({ title: 'X' });
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
go
|
|
82
|
-
</button>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
render(
|
|
86
|
-
<ConfirmDialogProvider>
|
|
87
|
-
<Harness />
|
|
88
|
-
</ConfirmDialogProvider>
|
|
89
|
-
);
|
|
90
|
-
const t0 = performance.now();
|
|
91
|
-
await act(async () => {
|
|
92
|
-
fireEvent.click(screen.getByTestId('t'));
|
|
93
|
-
});
|
|
94
|
-
await act(async () => {
|
|
95
|
-
fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
|
|
96
|
-
});
|
|
97
|
-
const t1 = performance.now();
|
|
98
|
-
// Generous budget to absorb cold-start variance when run alongside
|
|
99
|
-
// the rest of the workspace test suite.
|
|
100
|
-
expect(t1 - t0).toBeLessThan(200);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('<ConfirmDialogProvider> re-render budget', () => {
|
|
105
|
-
it('does NOT re-render unrelated children when confirm() opens', async () => {
|
|
106
|
-
const sibCount = { count: 0 };
|
|
107
|
-
const Sibling = () => {
|
|
108
|
-
sibCount.count++;
|
|
109
|
-
return <div data-testid="sib" />;
|
|
110
|
-
};
|
|
111
|
-
const Trigger = () => {
|
|
112
|
-
const confirm = useConfirm();
|
|
113
|
-
return (
|
|
114
|
-
<button data-testid="t" onClick={() => void confirm({ title: 'X' })}>
|
|
115
|
-
go
|
|
116
|
-
</button>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
render(
|
|
120
|
-
<ConfirmDialogProvider>
|
|
121
|
-
<Sibling />
|
|
122
|
-
<Trigger />
|
|
123
|
-
</ConfirmDialogProvider>
|
|
124
|
-
);
|
|
125
|
-
const baseline = sibCount.count;
|
|
126
|
-
await act(async () => {
|
|
127
|
-
fireEvent.click(screen.getByTestId('t'));
|
|
128
|
-
});
|
|
129
|
-
// The provider re-renders to inflate the dialog, which causes one
|
|
130
|
-
// children-pass re-render at the parent level — Sibling re-renders
|
|
131
|
-
// once. Budget: ≤ 1 extra.
|
|
132
|
-
expect(sibCount.count - baseline).toBeLessThanOrEqual(1);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('confirm() reference is stable across provider re-renders', () => {
|
|
136
|
-
const refs: Array<unknown> = [];
|
|
137
|
-
const Capture = () => {
|
|
138
|
-
const confirm = useConfirm();
|
|
139
|
-
refs.push(confirm);
|
|
140
|
-
return null;
|
|
141
|
-
};
|
|
142
|
-
const Outer = ({ x }: { x: number }) => (
|
|
143
|
-
<ConfirmDialogProvider>
|
|
144
|
-
<div data-x={x} />
|
|
145
|
-
<Capture />
|
|
146
|
-
</ConfirmDialogProvider>
|
|
147
|
-
);
|
|
148
|
-
const { rerender } = render(<Outer x={1} />);
|
|
149
|
-
rerender(<Outer x={2} />);
|
|
150
|
-
rerender(<Outer x={3} />);
|
|
151
|
-
// Three renders → confirm reference must be identical each time.
|
|
152
|
-
expect(refs.length).toBeGreaterThanOrEqual(3);
|
|
153
|
-
expect(refs[0]).toBe(refs[1]);
|
|
154
|
-
expect(refs[1]).toBe(refs[2]);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('renders at most 2 times on mount', () => {
|
|
158
|
-
let count = 0;
|
|
159
|
-
const Counted = (
|
|
160
|
-
props: React.ComponentProps<typeof ConfirmDialogProvider>
|
|
161
|
-
) => {
|
|
162
|
-
count++;
|
|
163
|
-
return <ConfirmDialogProvider {...props} />;
|
|
164
|
-
};
|
|
165
|
-
render(
|
|
166
|
-
<Counted>
|
|
167
|
-
<div />
|
|
168
|
-
</Counted>
|
|
169
|
-
);
|
|
170
|
-
expect(count).toBeLessThanOrEqual(2);
|
|
171
|
-
});
|
|
172
|
-
});
|