@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,102 +0,0 @@
|
|
|
1
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
2
|
-
import { cn } from '../../utils/cn.js';
|
|
3
|
-
import { dialogVariants } from './dialog.variants.js';
|
|
4
|
-
import type { DialogProps } from './dialog.types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Dashforge TW `<Dialog>` — declarative modal dialog.
|
|
8
|
-
*
|
|
9
|
-
* Built on `@radix-ui/react-dialog`:
|
|
10
|
-
* - APG dialog pattern out of the box (focus trap, restore focus on
|
|
11
|
-
* close, Esc-to-close, `aria-modal`, `aria-labelledby`).
|
|
12
|
-
* - Renders into a portal (no z-index hell).
|
|
13
|
-
* - Scroll lock on `<body>` while open.
|
|
14
|
-
*
|
|
15
|
-
* Use the imperative `useDialog()` (export from this same module) if
|
|
16
|
-
* you want a `confirm()`-style return value pattern (similar to
|
|
17
|
-
* `useConfirm()` from `ConfirmDialog`). Use `<Dialog>` when you want
|
|
18
|
-
* the control flow living in your component tree.
|
|
19
|
-
*/
|
|
20
|
-
export function Dialog(props: DialogProps) {
|
|
21
|
-
const {
|
|
22
|
-
open,
|
|
23
|
-
onOpenChange,
|
|
24
|
-
children,
|
|
25
|
-
title,
|
|
26
|
-
description,
|
|
27
|
-
showCloseButton = true,
|
|
28
|
-
disableBackdropClose = false,
|
|
29
|
-
disableEscapeClose = false,
|
|
30
|
-
size = 'md',
|
|
31
|
-
sx,
|
|
32
|
-
slotProps,
|
|
33
|
-
} = props;
|
|
34
|
-
|
|
35
|
-
const v = dialogVariants({ size });
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<RadixDialog.Root open={open} onOpenChange={onOpenChange}>
|
|
39
|
-
<RadixDialog.Portal>
|
|
40
|
-
<RadixDialog.Overlay
|
|
41
|
-
className={cn(v.overlay(), slotProps?.overlay?.className)}
|
|
42
|
-
/>
|
|
43
|
-
<RadixDialog.Content
|
|
44
|
-
className={cn(v.content(), sx, slotProps?.content?.className)}
|
|
45
|
-
// When no `description` is supplied we render no
|
|
46
|
-
// `<RadixDialog.Description>`. Radix then logs a dev warning
|
|
47
|
-
// unless the Content explicitly opts out via
|
|
48
|
-
// `aria-describedby={undefined}` — the documented escape
|
|
49
|
-
// hatch for description-less dialogs. Spread it ONLY in that
|
|
50
|
-
// case so a present description still auto-links its id.
|
|
51
|
-
{...(description == null
|
|
52
|
-
? { 'aria-describedby': undefined }
|
|
53
|
-
: {})}
|
|
54
|
-
onPointerDownOutside={(event) => {
|
|
55
|
-
if (disableBackdropClose) event.preventDefault();
|
|
56
|
-
}}
|
|
57
|
-
onEscapeKeyDown={(event) => {
|
|
58
|
-
if (disableEscapeClose) event.preventDefault();
|
|
59
|
-
}}
|
|
60
|
-
>
|
|
61
|
-
{title != null && (
|
|
62
|
-
<RadixDialog.Title
|
|
63
|
-
className={cn(v.title(), slotProps?.title?.className)}
|
|
64
|
-
>
|
|
65
|
-
{title}
|
|
66
|
-
</RadixDialog.Title>
|
|
67
|
-
)}
|
|
68
|
-
{description != null && (
|
|
69
|
-
<RadixDialog.Description
|
|
70
|
-
className={cn(v.description(), slotProps?.description?.className)}
|
|
71
|
-
>
|
|
72
|
-
{description}
|
|
73
|
-
</RadixDialog.Description>
|
|
74
|
-
)}
|
|
75
|
-
<div className={cn(v.body(), slotProps?.body?.className)}>
|
|
76
|
-
{children}
|
|
77
|
-
</div>
|
|
78
|
-
{showCloseButton && (
|
|
79
|
-
<RadixDialog.Close
|
|
80
|
-
aria-label="Close"
|
|
81
|
-
className={cn(v.closeButton(), slotProps?.closeButton?.className)}
|
|
82
|
-
>
|
|
83
|
-
<svg
|
|
84
|
-
width="1em"
|
|
85
|
-
height="1em"
|
|
86
|
-
viewBox="0 0 16 16"
|
|
87
|
-
fill="none"
|
|
88
|
-
stroke="currentColor"
|
|
89
|
-
strokeWidth="1.5"
|
|
90
|
-
strokeLinecap="round"
|
|
91
|
-
strokeLinejoin="round"
|
|
92
|
-
aria-hidden="true"
|
|
93
|
-
>
|
|
94
|
-
<path d="M4 4l8 8M12 4l-8 8" />
|
|
95
|
-
</svg>
|
|
96
|
-
</RadixDialog.Close>
|
|
97
|
-
)}
|
|
98
|
-
</RadixDialog.Content>
|
|
99
|
-
</RadixDialog.Portal>
|
|
100
|
-
</RadixDialog.Root>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { DialogVariants } from './dialog.variants.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Per-slot className overrides for `<Dialog>`. Mirrors the
|
|
6
|
-
* canonical TW slotProps shape: `{ slot?: { className?: string } }`.
|
|
7
|
-
*/
|
|
8
|
-
export interface DialogSlotProps {
|
|
9
|
-
overlay?: { className?: string };
|
|
10
|
-
content?: { className?: string };
|
|
11
|
-
title?: { className?: string };
|
|
12
|
-
description?: { className?: string };
|
|
13
|
-
closeButton?: { className?: string };
|
|
14
|
-
body?: { className?: string };
|
|
15
|
-
actions?: { className?: string };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Props for the declarative `<Dialog>` component.
|
|
20
|
-
*
|
|
21
|
-
* Built on `@radix-ui/react-dialog`. Use this when:
|
|
22
|
-
* - You want full control over the dialog's open state (controlled
|
|
23
|
-
* from a parent component).
|
|
24
|
-
* - You want to mount a custom-styled dialog body / trigger that
|
|
25
|
-
* composes with the rest of your component tree.
|
|
26
|
-
* - You don't need an imperative `confirm()`-style return value
|
|
27
|
-
* (use `useDialog()` or `useConfirm()` for those).
|
|
28
|
-
*
|
|
29
|
-
* Three size variants (`sm` / `md` / `lg`) with sensible defaults.
|
|
30
|
-
* Backdrop + content animations respect `prefers-reduced-motion`.
|
|
31
|
-
*/
|
|
32
|
-
export interface DialogProps extends Pick<DialogVariants, 'size'> {
|
|
33
|
-
/** Controlled open state. */
|
|
34
|
-
open: boolean;
|
|
35
|
-
/** Called when the dialog requests to change open state. */
|
|
36
|
-
onOpenChange: (open: boolean) => void;
|
|
37
|
-
/** Dialog body — usually a `<DialogContent>` subtree. */
|
|
38
|
-
children: ReactNode;
|
|
39
|
-
/** Dialog title (screen-reader announced via `aria-labelledby`). */
|
|
40
|
-
title?: ReactNode;
|
|
41
|
-
/** Dialog description (announced via `aria-describedby`). */
|
|
42
|
-
description?: ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* Show the `×` close button in the top-right corner.
|
|
45
|
-
* @default true
|
|
46
|
-
*/
|
|
47
|
-
showCloseButton?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Disable closing on backdrop click.
|
|
50
|
-
* @default false
|
|
51
|
-
*/
|
|
52
|
-
disableBackdropClose?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Disable closing on Escape key.
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
disableEscapeClose?: boolean;
|
|
58
|
-
/** Root className shortcut on the content element. */
|
|
59
|
-
sx?: string;
|
|
60
|
-
/** Per-slot overrides. */
|
|
61
|
-
slotProps?: DialogSlotProps;
|
|
62
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* `<Dialog>` variant recipe.
|
|
5
|
-
*
|
|
6
|
-
* Slots:
|
|
7
|
-
* - `overlay` — backdrop (Radix's `DialogOverlay`)
|
|
8
|
-
* - `content` — the dialog box itself
|
|
9
|
-
* - `title` — heading at the top
|
|
10
|
-
* - `description` — secondary text under the title
|
|
11
|
-
* - `closeButton` — top-right `×` button
|
|
12
|
-
* - `body` — main scrollable area
|
|
13
|
-
* - `actions` — footer action bar
|
|
14
|
-
*
|
|
15
|
-
* Three sizes (`sm` / `md` / `lg`) drive the content max-width.
|
|
16
|
-
* Motion is gated by `prefers-reduced-motion` so the slide-in
|
|
17
|
-
* animation collapses to an instant appear on users that opt out.
|
|
18
|
-
*/
|
|
19
|
-
export const dialogVariants = tv({
|
|
20
|
-
slots: {
|
|
21
|
-
overlay: [
|
|
22
|
-
'fixed inset-0 z-50 bg-neutral-950/60 backdrop-blur-sm',
|
|
23
|
-
'data-[state=open]:animate-in data-[state=open]:fade-in-0',
|
|
24
|
-
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
|
|
25
|
-
'motion-reduce:transition-none motion-reduce:duration-0',
|
|
26
|
-
],
|
|
27
|
-
content: [
|
|
28
|
-
'fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2',
|
|
29
|
-
// bg-white hardcoded (doesn't auto-invert) so `dark:` is needed.
|
|
30
|
-
// Target `dark:bg-neutral-100` = #171717 in dark mode (one
|
|
31
|
-
// elevation tier above page surface).
|
|
32
|
-
'w-full bg-white dark:bg-neutral-100 rounded-lg shadow-xl',
|
|
33
|
-
// border-neutral-200 auto-inverts — no `dark:` needed.
|
|
34
|
-
'border border-neutral-200',
|
|
35
|
-
'p-6 flex flex-col gap-4 max-h-[90vh]',
|
|
36
|
-
'focus:outline-none',
|
|
37
|
-
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
38
|
-
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
39
|
-
'motion-reduce:transition-none motion-reduce:duration-0',
|
|
40
|
-
],
|
|
41
|
-
// All neutral text classes auto-invert via CSS-var swap.
|
|
42
|
-
title: 'text-lg font-semibold leading-tight text-neutral-900',
|
|
43
|
-
description: 'text-sm text-neutral-600',
|
|
44
|
-
closeButton: [
|
|
45
|
-
'absolute top-4 right-4 inline-flex items-center justify-center',
|
|
46
|
-
'h-8 w-8 rounded-md text-neutral-500 hover:text-neutral-900',
|
|
47
|
-
'hover:bg-neutral-100',
|
|
48
|
-
'focus:outline-none focus:ring-2 focus:ring-primary-500',
|
|
49
|
-
'transition-colors',
|
|
50
|
-
],
|
|
51
|
-
body: 'flex-1 overflow-y-auto',
|
|
52
|
-
actions: 'flex justify-end gap-2 pt-2',
|
|
53
|
-
},
|
|
54
|
-
variants: {
|
|
55
|
-
size: {
|
|
56
|
-
sm: { content: 'max-w-sm' },
|
|
57
|
-
md: { content: 'max-w-md' },
|
|
58
|
-
lg: { content: 'max-w-2xl' },
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
defaultVariants: {
|
|
62
|
-
size: 'md',
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export type DialogVariants = VariantProps<typeof dialogVariants>;
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import { Divider } from './Divider.js';
|
|
5
|
-
|
|
6
|
-
describe('<Divider>', () => {
|
|
7
|
-
// ─── Line-only mode ─────────────────────────────────────────────────
|
|
8
|
-
describe('line-only (no children)', () => {
|
|
9
|
-
it('renders <hr> for horizontal', () => {
|
|
10
|
-
const { container } = render(<Divider />);
|
|
11
|
-
expect(container.firstElementChild?.tagName).toBe('HR');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('renders <div role="separator"> for vertical', () => {
|
|
15
|
-
const { container } = render(<Divider orientation="vertical" />);
|
|
16
|
-
const el = container.firstElementChild;
|
|
17
|
-
expect(el?.tagName).toBe('DIV');
|
|
18
|
-
expect(el?.getAttribute('role')).toBe('separator');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('sets aria-orientation correctly', () => {
|
|
22
|
-
const { container: ch } = render(<Divider />);
|
|
23
|
-
expect(ch.firstElementChild?.getAttribute('aria-orientation')).toBe('horizontal');
|
|
24
|
-
|
|
25
|
-
const { container: cv } = render(<Divider orientation="vertical" />);
|
|
26
|
-
expect(cv.firstElementChild?.getAttribute('aria-orientation')).toBe('vertical');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('horizontal applies border-t (line carrier)', () => {
|
|
30
|
-
const { container } = render(<Divider />);
|
|
31
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
32
|
-
expect(cls).toContain('border-t');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('vertical applies border-l', () => {
|
|
36
|
-
const { container } = render(<Divider orientation="vertical" />);
|
|
37
|
-
expect(container.firstElementChild?.className).toContain('border-l');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('strips <hr> UA default via border-0', () => {
|
|
41
|
-
const { container } = render(<Divider />);
|
|
42
|
-
expect(container.firstElementChild?.className).toContain('border-0');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// ─── Variants — line style ──────────────────────────────────────────
|
|
47
|
-
describe('variant', () => {
|
|
48
|
-
it('default solid', () => {
|
|
49
|
-
const { container } = render(<Divider />);
|
|
50
|
-
expect(container.firstElementChild?.className).toContain('border-solid');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('dashed', () => {
|
|
54
|
-
const { container } = render(<Divider variant="dashed" />);
|
|
55
|
-
expect(container.firstElementChild?.className).toContain('border-dashed');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('dotted', () => {
|
|
59
|
-
const { container } = render(<Divider variant="dotted" />);
|
|
60
|
-
expect(container.firstElementChild?.className).toContain('border-dotted');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ─── Color intent ───────────────────────────────────────────────────
|
|
65
|
-
describe('color', () => {
|
|
66
|
-
it('default neutral', () => {
|
|
67
|
-
const { container } = render(<Divider />);
|
|
68
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
69
|
-
// Sprint 4.3 identity sweep: neutral palette auto-inverts via
|
|
70
|
-
// the dashforgePreset() CSS-var swap — no `dark:` needed.
|
|
71
|
-
expect(cls).toContain('border-neutral-200');
|
|
72
|
-
expect(cls).not.toContain('dark:border-neutral-');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('color="primary"', () => {
|
|
76
|
-
const { container } = render(<Divider color="primary" />);
|
|
77
|
-
expect(container.firstElementChild?.className).toContain('border-primary-300');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('color="danger"', () => {
|
|
81
|
-
const { container } = render(<Divider color="danger" />);
|
|
82
|
-
expect(container.firstElementChild?.className).toContain('border-danger-300');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// ─── Labeled mode ───────────────────────────────────────────────────
|
|
87
|
-
describe('labeled (with children)', () => {
|
|
88
|
-
it('renders 3 children: line, label, line', () => {
|
|
89
|
-
const { container } = render(<Divider>OR</Divider>);
|
|
90
|
-
const root = container.firstElementChild;
|
|
91
|
-
expect(root?.children.length).toBe(3);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('label text is preserved', () => {
|
|
95
|
-
const { container } = render(<Divider>OR</Divider>);
|
|
96
|
-
expect(container.firstElementChild?.textContent).toBe('OR');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('root has role="separator" + aria-orientation', () => {
|
|
100
|
-
const { container } = render(<Divider>OR</Divider>);
|
|
101
|
-
const root = container.firstElementChild;
|
|
102
|
-
expect(root?.getAttribute('role')).toBe('separator');
|
|
103
|
-
expect(root?.getAttribute('aria-orientation')).toBe('horizontal');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('line segments are aria-hidden (separator role is on the root)', () => {
|
|
107
|
-
const { container } = render(<Divider>OR</Divider>);
|
|
108
|
-
const lines = container.firstElementChild?.querySelectorAll('span[aria-hidden]');
|
|
109
|
-
expect(lines?.length).toBe(2);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('center alignment: both segments flex-1', () => {
|
|
113
|
-
const { container } = render(<Divider align="center">OR</Divider>);
|
|
114
|
-
const lines = container.firstElementChild?.querySelectorAll('span[aria-hidden]');
|
|
115
|
-
lines?.forEach((line) => {
|
|
116
|
-
expect(line.className).toContain('flex-1');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('start alignment: left segment is short stub', () => {
|
|
121
|
-
const { container } = render(<Divider align="start">OR</Divider>);
|
|
122
|
-
const lines = container.firstElementChild?.querySelectorAll('span[aria-hidden]');
|
|
123
|
-
expect(lines?.[0].className).toContain('basis-8');
|
|
124
|
-
expect(lines?.[1].className).toContain('flex-1');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('end alignment: right segment is short stub', () => {
|
|
128
|
-
const { container } = render(<Divider align="end">OR</Divider>);
|
|
129
|
-
const lines = container.firstElementChild?.querySelectorAll('span[aria-hidden]');
|
|
130
|
-
expect(lines?.[0].className).toContain('flex-1');
|
|
131
|
-
expect(lines?.[1].className).toContain('basis-8');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('label gets shrink-0 + padding so it does not collapse', () => {
|
|
135
|
-
const { container } = render(<Divider>Hello</Divider>);
|
|
136
|
-
const label = container.firstElementChild?.children[1] as HTMLElement;
|
|
137
|
-
expect(label.className).toContain('shrink-0');
|
|
138
|
-
expect(label.className).toContain('px-3');
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('color applies to both segments in labeled mode', () => {
|
|
142
|
-
const { container } = render(<Divider color="primary">OR</Divider>);
|
|
143
|
-
const lines = container.firstElementChild?.querySelectorAll('span[aria-hidden]');
|
|
144
|
-
lines?.forEach((line) => {
|
|
145
|
-
expect(line.className).toContain('border-primary-300');
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('renders complex children (JSX)', () => {
|
|
150
|
-
const { container } = render(
|
|
151
|
-
<Divider>
|
|
152
|
-
<strong>Section title</strong>
|
|
153
|
-
</Divider>,
|
|
154
|
-
);
|
|
155
|
-
const label = container.firstElementChild?.children[1];
|
|
156
|
-
expect(label?.querySelector('strong')?.textContent).toBe('Section title');
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// ─── Override ───────────────────────────────────────────────────────
|
|
161
|
-
describe('override', () => {
|
|
162
|
-
it('sx wins over variant defaults', () => {
|
|
163
|
-
const { container } = render(<Divider sx="border-t-4" />);
|
|
164
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
165
|
-
expect(cls).toContain('border-t-4');
|
|
166
|
-
// tailwind-merge collapses border-t → border-t-4
|
|
167
|
-
expect(cls).not.toMatch(/border-t (?!-)/);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('sx applies on root in labeled mode', () => {
|
|
171
|
-
const { container } = render(<Divider sx="my-8">OR</Divider>);
|
|
172
|
-
expect(container.firstElementChild?.className).toContain('my-8');
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// ─── Pass-through ───────────────────────────────────────────────────
|
|
177
|
-
describe('pass-through', () => {
|
|
178
|
-
it('forwards data-* on root', () => {
|
|
179
|
-
const { container } = render(<Divider data-testid="d" />);
|
|
180
|
-
expect(container.firstElementChild?.getAttribute('data-testid')).toBe('d');
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('forwards data-* in labeled mode too', () => {
|
|
184
|
-
const { container } = render(<Divider data-testid="d">OR</Divider>);
|
|
185
|
-
expect(container.firstElementChild?.getAttribute('data-testid')).toBe('d');
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// ─── F11-bis edge cases ─────────────────────────────────────────────
|
|
190
|
-
describe('color — every intent', () => {
|
|
191
|
-
const INTENTS = ['secondary', 'success', 'warning', 'danger', 'info'] as const;
|
|
192
|
-
it.each(INTENTS)('color="%s" emits border-%s-300 with dark pair', (color) => {
|
|
193
|
-
const { container } = render(<Divider color={color} />);
|
|
194
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
195
|
-
expect(cls).toContain(`border-${color}-300`);
|
|
196
|
-
expect(cls).toContain(`dark:border-${color}-700`);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
describe('vertical labeled mode', () => {
|
|
201
|
-
it('vertical + label renders all 3 children with vertical layout', () => {
|
|
202
|
-
const { container } = render(
|
|
203
|
-
<Divider orientation="vertical">section</Divider>,
|
|
204
|
-
);
|
|
205
|
-
const root = container.firstElementChild;
|
|
206
|
-
expect(root?.tagName).toBe('DIV');
|
|
207
|
-
expect(root?.getAttribute('aria-orientation')).toBe('vertical');
|
|
208
|
-
expect(root?.className).toContain('flex-col');
|
|
209
|
-
expect(root?.children.length).toBe(3);
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
describe('label edge values', () => {
|
|
214
|
-
it('numeric label (0) renders correctly', () => {
|
|
215
|
-
const { container } = render(<Divider>{0}</Divider>);
|
|
216
|
-
// 0 is a valid React child, should render as "0"
|
|
217
|
-
expect(container.firstElementChild?.textContent).toBe('0');
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('JSX with multiple elements as label', () => {
|
|
221
|
-
const { container } = render(
|
|
222
|
-
<Divider>
|
|
223
|
-
<strong>bold</strong>
|
|
224
|
-
<em> italic</em>
|
|
225
|
-
</Divider>,
|
|
226
|
-
);
|
|
227
|
-
const root = container.firstElementChild;
|
|
228
|
-
// root has 3 children (line + label-span + line); label-span has 2 nested
|
|
229
|
-
expect(root?.children.length).toBe(3);
|
|
230
|
-
expect(root?.querySelector('strong')?.textContent).toBe('bold');
|
|
231
|
-
expect(root?.querySelector('em')?.textContent).toBe(' italic');
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
describe('flexItem (no-op forward-compat hook)', () => {
|
|
236
|
-
it('flexItem prop does not crash or leak as attribute', () => {
|
|
237
|
-
const { container } = render(<Divider flexItem />);
|
|
238
|
-
const el = container.firstElementChild as HTMLElement;
|
|
239
|
-
expect(el.hasAttribute('flexitem')).toBe(false);
|
|
240
|
-
expect(el.hasAttribute('flexItem')).toBe(false);
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
});
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import { cn } from '../../utils/cn.js';
|
|
3
|
-
import { dividerVariants, dividerLineVariants } from './divider.variants.js';
|
|
4
|
-
import type { DividerProps } from './divider.types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* `<Divider>` — visual separator. Two modes:
|
|
8
|
-
*
|
|
9
|
-
* 1. Line-only (no children):
|
|
10
|
-
*
|
|
11
|
-
* <Divider />
|
|
12
|
-
* → <hr role="separator" aria-orientation="horizontal" />
|
|
13
|
-
*
|
|
14
|
-
* Renders a single horizontal line via `border-t-*` on an `<hr>`
|
|
15
|
-
* (which by default has no `display`, no margin in our reset, just
|
|
16
|
-
* acts as the border carrier).
|
|
17
|
-
*
|
|
18
|
-
* 2. Labeled (with children):
|
|
19
|
-
*
|
|
20
|
-
* <Divider><Typography variant="overline">OR</Typography></Divider>
|
|
21
|
-
* → <div role="separator" aria-orientation="horizontal">
|
|
22
|
-
* <span aria-hidden className="flex-1 border-t" />
|
|
23
|
-
* <span className="px-3">OR</span>
|
|
24
|
-
* <span aria-hidden className="flex-1 border-t" />
|
|
25
|
-
* </div>
|
|
26
|
-
*
|
|
27
|
-
* Two line segments share the available space; the label sits
|
|
28
|
-
* between them with horizontal padding for breathing room. Each
|
|
29
|
-
* line segment is `aria-hidden` (the role="separator" on the root
|
|
30
|
-
* conveys the separator semantics — duplicating it would confuse
|
|
31
|
-
* screen readers).
|
|
32
|
-
*
|
|
33
|
-
* Alignment:
|
|
34
|
-
* • align="start" → label hugs the left, right segment grows
|
|
35
|
-
* • align="center" (default) → both segments equal
|
|
36
|
-
* • align="end" → label hugs the right, left segment grows
|
|
37
|
-
*
|
|
38
|
-
* Implemented by setting `flex-basis: 0` to either segment to keep
|
|
39
|
-
* it minimal. We use `basis-[2rem]` (32px short stub) rather than
|
|
40
|
-
* `basis-0` so a tiny line still hints at the divider on the squashed
|
|
41
|
-
* side — pure flex-1 vs basis-0 would collapse it invisibly.
|
|
42
|
-
*
|
|
43
|
-
* Vertical orientation:
|
|
44
|
-
* The line orientation flips (border-l instead of border-t). Vertical
|
|
45
|
-
* labeled dividers are RARE in practice — supported for parity but
|
|
46
|
-
* the typical use is line-only between flex row items.
|
|
47
|
-
*
|
|
48
|
-
* a11y:
|
|
49
|
-
* • Root element gets `role="separator"` (or implicit via `<hr>`)
|
|
50
|
-
* • `aria-orientation` is set explicitly so AT knows the axis
|
|
51
|
-
* • Labeled mode: label has no extra role; the visual layout speaks
|
|
52
|
-
*/
|
|
53
|
-
export const Divider = forwardRef<HTMLElement, DividerProps>(
|
|
54
|
-
function Divider(props, ref) {
|
|
55
|
-
const {
|
|
56
|
-
orientation = 'horizontal',
|
|
57
|
-
align = 'center',
|
|
58
|
-
variant = 'solid',
|
|
59
|
-
color = 'neutral',
|
|
60
|
-
children,
|
|
61
|
-
flexItem, // currently a no-op (see types) — `self-stretch` is in TV base
|
|
62
|
-
sx,
|
|
63
|
-
...rest
|
|
64
|
-
} = props;
|
|
65
|
-
|
|
66
|
-
// Reference flexItem to silence unused-var lint while keeping it in the
|
|
67
|
-
// public API for parity with MUI Divider. Forward-compat hook.
|
|
68
|
-
void flexItem;
|
|
69
|
-
|
|
70
|
-
// ─── Mode 1: line-only (no children) ─────────────────────────────
|
|
71
|
-
if (children == null) {
|
|
72
|
-
const lineClasses = cn(
|
|
73
|
-
dividerLineVariants({ orientation, variant, color, segment: 'full' }),
|
|
74
|
-
sx,
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
// Horizontal → <hr>: zero default styling once we strip the UA
|
|
78
|
-
// default `<hr>` border via `border-0` (in `dividerLineVariants`
|
|
79
|
-
// base) and apply our own `border-t-*`. Vertical → <div> because
|
|
80
|
-
// <hr> can't be vertical cross-browser-consistently.
|
|
81
|
-
if (orientation === 'horizontal') {
|
|
82
|
-
return (
|
|
83
|
-
<hr
|
|
84
|
-
ref={ref as never}
|
|
85
|
-
role="separator"
|
|
86
|
-
aria-orientation="horizontal"
|
|
87
|
-
className={cn('border-0', lineClasses)}
|
|
88
|
-
{...rest}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
return (
|
|
93
|
-
<div
|
|
94
|
-
ref={ref as never}
|
|
95
|
-
role="separator"
|
|
96
|
-
aria-orientation="vertical"
|
|
97
|
-
className={lineClasses}
|
|
98
|
-
{...rest}
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// ─── Mode 2: labeled (with children) ─────────────────────────────
|
|
104
|
-
const rootClasses = cn(dividerVariants({ orientation, align }), sx);
|
|
105
|
-
|
|
106
|
-
/*
|
|
107
|
-
* Segment widths per `align`:
|
|
108
|
-
* • center → both flex-1 (equal share)
|
|
109
|
-
* • start → left short stub, right grows
|
|
110
|
-
* • end → left grows, right short stub
|
|
111
|
-
*
|
|
112
|
-
* "Short stub" = 2rem so the divider visually exists on the squashed
|
|
113
|
-
* side without dominating the label.
|
|
114
|
-
*/
|
|
115
|
-
const isHorizontal = orientation === 'horizontal';
|
|
116
|
-
const leftStubClass = align === 'start' ? (isHorizontal ? 'basis-8 grow-0' : 'basis-8 grow-0') : 'flex-1';
|
|
117
|
-
const rightStubClass = align === 'end' ? (isHorizontal ? 'basis-8 grow-0' : 'basis-8 grow-0') : 'flex-1';
|
|
118
|
-
|
|
119
|
-
const lineCommon = dividerLineVariants({ orientation, variant, color, segment: 'grow' });
|
|
120
|
-
const labelPadding = isHorizontal ? 'px-3' : 'py-3';
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<div
|
|
124
|
-
ref={ref as never}
|
|
125
|
-
role="separator"
|
|
126
|
-
aria-orientation={orientation}
|
|
127
|
-
className={rootClasses}
|
|
128
|
-
{...rest}
|
|
129
|
-
>
|
|
130
|
-
<span aria-hidden="true" className={cn(lineCommon, leftStubClass)} />
|
|
131
|
-
<span className={cn('shrink-0 text-sm text-neutral-500', labelPadding)}>
|
|
132
|
-
{children}
|
|
133
|
-
</span>
|
|
134
|
-
<span aria-hidden="true" className={cn(lineCommon, rightStubClass)} />
|
|
135
|
-
</div>
|
|
136
|
-
);
|
|
137
|
-
},
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
Divider.displayName = 'Divider';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import type { DividerVariants, DividerLineVariants } from './divider.variants.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Props for `<Divider>` — visual separator with optional inline label.
|
|
6
|
-
*
|
|
7
|
-
* Two rendering modes:
|
|
8
|
-
* • Line-only (no `children`) — renders an `<hr>` (horizontal) or
|
|
9
|
-
* `<div role="separator">` (vertical).
|
|
10
|
-
* • Labeled (with `children`) — renders a flex row: two line
|
|
11
|
-
* segments around the centered label.
|
|
12
|
-
* Canonical "OR" separator pattern.
|
|
13
|
-
*
|
|
14
|
-
* The user passes ONE consistent prop set; the implementation chooses
|
|
15
|
-
* the mode based on whether `children` is provided.
|
|
16
|
-
*/
|
|
17
|
-
export interface DividerProps
|
|
18
|
-
extends Omit<HTMLAttributes<HTMLElement>, 'className' | 'color' | 'children'>,
|
|
19
|
-
Pick<DividerVariants, 'orientation' | 'align'>,
|
|
20
|
-
Pick<DividerLineVariants, 'variant' | 'color'> {
|
|
21
|
-
/**
|
|
22
|
-
* Optional inline label. When present, the divider switches from
|
|
23
|
-
* "single line" to "two segments + label" layout — the canonical
|
|
24
|
-
* "OR" separator pattern between sign-in methods, section titled
|
|
25
|
-
* separators, etc.
|
|
26
|
-
*
|
|
27
|
-
* Accepts any node (string, Typography element, Stack with icon,
|
|
28
|
-
* etc.). Recommended: `<Typography variant="overline">OR</Typography>`
|
|
29
|
-
* for short uppercase labels.
|
|
30
|
-
*/
|
|
31
|
-
children?: ReactNode;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* In a flex Stack `direction="row"`, a `<Divider orientation="vertical">`
|
|
35
|
-
* with `flexItem` stretches to the row's cross-axis height (via
|
|
36
|
-
* `self-stretch`). Without it, vertical dividers may collapse to
|
|
37
|
-
* 0 height because there's nothing to anchor them.
|
|
38
|
-
*
|
|
39
|
-
* Implementation note: `self-stretch` is already applied on the
|
|
40
|
-
* vertical line segment by default in the TV — this prop is a
|
|
41
|
-
* no-op for now, kept for API parity with MUI's same flag (and as
|
|
42
|
-
* a forward-compatibility hook if we ever change the default).
|
|
43
|
-
*/
|
|
44
|
-
flexItem?: boolean;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Utility classes appended to the variant chain. Resolved via
|
|
48
|
-
* `tailwind-merge`. Useful for one-off margin (`sx="my-8"`) or
|
|
49
|
-
* a custom border weight (`sx="border-t-2"`).
|
|
50
|
-
*/
|
|
51
|
-
sx?: string;
|
|
52
|
-
}
|