@dashforge/tw 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -1
- package/README.md +45 -0
- package/dist/index.esm.js +3986 -477
- package/dist/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/src/components/Accordion/accordion.types.d.ts +7 -0
- package/dist/src/components/Accordion/accordion.types.d.ts.map +1 -1
- package/dist/src/components/Alert/Alert.d.ts +1 -1
- package/dist/src/components/Alert/Alert.d.ts.map +1 -1
- package/dist/src/components/Alert/alert.types.d.ts +17 -0
- package/dist/src/components/Alert/alert.types.d.ts.map +1 -1
- package/dist/src/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/src/components/AppShell/appShell.types.d.ts +7 -0
- package/dist/src/components/AppShell/appShell.types.d.ts.map +1 -1
- package/dist/src/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/src/components/Autocomplete/autocomplete.types.d.ts +47 -1
- package/dist/src/components/Autocomplete/autocomplete.types.d.ts.map +1 -1
- package/dist/src/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/src/components/Avatar/avatar.types.d.ts +17 -1
- package/dist/src/components/Avatar/avatar.types.d.ts.map +1 -1
- package/dist/src/components/Badge/Badge.d.ts.map +1 -1
- package/dist/src/components/Badge/badge.types.d.ts +27 -2
- package/dist/src/components/Badge/badge.types.d.ts.map +1 -1
- package/dist/src/components/Box/Box.d.ts.map +1 -1
- package/dist/src/components/Box/box.types.d.ts +64 -1
- package/dist/src/components/Box/box.types.d.ts.map +1 -1
- package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/components/Breadcrumbs/breadcrumbs.types.d.ts +26 -1
- package/dist/src/components/Breadcrumbs/breadcrumbs.types.d.ts.map +1 -1
- package/dist/src/components/Button/Button.d.ts.map +1 -1
- package/dist/src/components/Button/button.types.d.ts +53 -1
- package/dist/src/components/Button/button.types.d.ts.map +1 -1
- package/dist/src/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/src/components/Calendar/calendar.types.d.ts +16 -0
- package/dist/src/components/Calendar/calendar.types.d.ts.map +1 -1
- package/dist/src/components/Card/Card.d.ts.map +1 -1
- package/dist/src/components/Card/card.types.d.ts +17 -0
- package/dist/src/components/Card/card.types.d.ts.map +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/src/components/Checkbox/checkbox.types.d.ts +19 -1
- package/dist/src/components/Checkbox/checkbox.types.d.ts.map +1 -1
- package/dist/src/components/Chip/Chip.d.ts.map +1 -1
- package/dist/src/components/Chip/chip.types.d.ts +40 -1
- package/dist/src/components/Chip/chip.types.d.ts.map +1 -1
- package/dist/src/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/src/components/ConfirmDialog/confirmDialog.types.d.ts +30 -2
- package/dist/src/components/ConfirmDialog/confirmDialog.types.d.ts.map +1 -1
- package/dist/src/components/Container/Container.d.ts.map +1 -1
- package/dist/src/components/Container/container.types.d.ts +29 -1
- package/dist/src/components/Container/container.types.d.ts.map +1 -1
- package/dist/src/components/DataGrid/DataGrid.d.ts +1 -1
- package/dist/src/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/src/components/DataGrid/dataGrid.types.d.ts +124 -10
- package/dist/src/components/DataGrid/dataGrid.types.d.ts.map +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/src/components/DatePicker/datePicker.types.d.ts +18 -0
- package/dist/src/components/DatePicker/datePicker.types.d.ts.map +1 -1
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts +18 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts +20 -0
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts.map +1 -1
- package/dist/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/src/components/Dialog/dialog.types.d.ts +25 -1
- package/dist/src/components/Dialog/dialog.types.d.ts.map +1 -1
- package/dist/src/components/Divider/Divider.d.ts.map +1 -1
- package/dist/src/components/Divider/divider.types.d.ts +37 -1
- package/dist/src/components/Divider/divider.types.d.ts.map +1 -1
- package/dist/src/components/Drawer/Drawer.d.ts +21 -0
- package/dist/src/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/src/components/Drawer/drawer.types.d.ts +311 -0
- package/dist/src/components/Drawer/drawer.types.d.ts.map +1 -0
- package/dist/src/components/Drawer/drawer.variants.d.ts +177 -0
- package/dist/src/components/Drawer/drawer.variants.d.ts.map +1 -0
- package/dist/src/components/Grid/Grid.d.ts.map +1 -1
- package/dist/src/components/Grid/grid.types.d.ts +16 -0
- package/dist/src/components/Grid/grid.types.d.ts.map +1 -1
- package/dist/src/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/src/components/IconButton/iconButton.types.d.ts +40 -1
- package/dist/src/components/IconButton/iconButton.types.d.ts.map +1 -1
- package/dist/src/components/LeftNav/LeftNav.d.ts.map +1 -1
- package/dist/src/components/LeftNav/leftNav.types.d.ts +26 -6
- package/dist/src/components/LeftNav/leftNav.types.d.ts.map +1 -1
- package/dist/src/components/Link/Link.d.ts +15 -0
- package/dist/src/components/Link/Link.d.ts.map +1 -0
- package/dist/src/components/Link/link.types.d.ts +169 -0
- package/dist/src/components/Link/link.types.d.ts.map +1 -0
- package/dist/src/components/Link/link.variants.d.ts +107 -0
- package/dist/src/components/Link/link.variants.d.ts.map +1 -0
- package/dist/src/components/Menu/Menu.d.ts +1 -1
- package/dist/src/components/Menu/Menu.d.ts.map +1 -1
- package/dist/src/components/Menu/menu.types.d.ts +20 -0
- package/dist/src/components/Menu/menu.types.d.ts.map +1 -1
- package/dist/src/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/src/components/NumberField/numberField.types.d.ts +47 -1
- package/dist/src/components/NumberField/numberField.types.d.ts.map +1 -1
- package/dist/src/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/src/components/OTPField/otpField.types.d.ts +35 -1
- package/dist/src/components/OTPField/otpField.types.d.ts.map +1 -1
- package/dist/src/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/src/components/Pagination/pagination.types.d.ts +26 -1
- package/dist/src/components/Pagination/pagination.types.d.ts.map +1 -1
- package/dist/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/src/components/Popover/popover.types.d.ts +29 -0
- package/dist/src/components/Popover/popover.types.d.ts.map +1 -1
- package/dist/src/components/Progress/Progress.d.ts +20 -0
- package/dist/src/components/Progress/Progress.d.ts.map +1 -0
- package/dist/src/components/Progress/progress.types.d.ts +200 -0
- package/dist/src/components/Progress/progress.types.d.ts.map +1 -0
- package/dist/src/components/Progress/progress.variants.d.ts +224 -0
- package/dist/src/components/Progress/progress.variants.d.ts.map +1 -0
- package/dist/src/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/src/components/RadioGroup/radioGroup.types.d.ts +25 -1
- package/dist/src/components/RadioGroup/radioGroup.types.d.ts.map +1 -1
- package/dist/src/components/Select/Select.d.ts +14 -0
- package/dist/src/components/Select/Select.d.ts.map +1 -0
- package/dist/src/components/Select/select.types.d.ts +272 -0
- package/dist/src/components/Select/select.types.d.ts.map +1 -0
- package/dist/src/components/Select/select.variants.d.ts +204 -0
- package/dist/src/components/Select/select.variants.d.ts.map +1 -0
- package/dist/src/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/src/components/Skeleton/skeleton.types.d.ts +25 -1
- package/dist/src/components/Skeleton/skeleton.types.d.ts.map +1 -1
- package/dist/src/components/Slider/Slider.d.ts +15 -0
- package/dist/src/components/Slider/Slider.d.ts.map +1 -0
- package/dist/src/components/Slider/slider.types.d.ts +268 -0
- package/dist/src/components/Slider/slider.types.d.ts.map +1 -0
- package/dist/src/components/Slider/slider.variants.d.ts +313 -0
- package/dist/src/components/Slider/slider.variants.d.ts.map +1 -0
- package/dist/src/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/dist/src/components/Snackbar/snackbar.types.d.ts +29 -5
- package/dist/src/components/Snackbar/snackbar.types.d.ts.map +1 -1
- package/dist/src/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/components/Spinner/spinner.types.d.ts +22 -2
- package/dist/src/components/Spinner/spinner.types.d.ts.map +1 -1
- package/dist/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/src/components/Stack/stack.types.d.ts +53 -2
- package/dist/src/components/Stack/stack.types.d.ts.map +1 -1
- package/dist/src/components/Stack/stack.variants.d.ts +23 -0
- package/dist/src/components/Stack/stack.variants.d.ts.map +1 -1
- package/dist/src/components/Stepper/Step.d.ts +30 -0
- package/dist/src/components/Stepper/Step.d.ts.map +1 -0
- package/dist/src/components/Stepper/Stepper.d.ts +15 -0
- package/dist/src/components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/src/components/Stepper/StepperContext.d.ts +8 -0
- package/dist/src/components/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/src/components/Stepper/stepper.types.d.ts +358 -0
- package/dist/src/components/Stepper/stepper.types.d.ts.map +1 -0
- package/dist/src/components/Stepper/stepper.variants.d.ts +253 -0
- package/dist/src/components/Stepper/stepper.variants.d.ts.map +1 -0
- package/dist/src/components/Stepper/useStep.d.ts +53 -0
- package/dist/src/components/Stepper/useStep.d.ts.map +1 -0
- package/dist/src/components/Switch/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch/switch.types.d.ts +44 -1
- package/dist/src/components/Switch/switch.types.d.ts.map +1 -1
- package/dist/src/components/Table/Table.d.ts +1 -1
- package/dist/src/components/Table/Table.d.ts.map +1 -1
- package/dist/src/components/Table/table.types.d.ts +103 -8
- package/dist/src/components/Table/table.types.d.ts.map +1 -1
- package/dist/src/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/src/components/Tabs/tabs.types.d.ts +26 -1
- package/dist/src/components/Tabs/tabs.types.d.ts.map +1 -1
- package/dist/src/components/TextField/TextField.d.ts.map +1 -1
- package/dist/src/components/TextField/textField.types.d.ts +30 -1
- package/dist/src/components/TextField/textField.types.d.ts.map +1 -1
- package/dist/src/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/src/components/Textarea/textarea.types.d.ts +51 -1
- package/dist/src/components/Textarea/textarea.types.d.ts.map +1 -1
- package/dist/src/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/src/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/src/components/TimePicker/timePicker.types.d.ts +18 -0
- package/dist/src/components/TimePicker/timePicker.types.d.ts.map +1 -1
- package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/components/Tooltip/tooltip.types.d.ts +30 -0
- package/dist/src/components/Tooltip/tooltip.types.d.ts.map +1 -1
- package/dist/src/components/TopBar/TopBar.d.ts.map +1 -1
- package/dist/src/components/TopBar/topBar.types.d.ts +25 -1
- package/dist/src/components/TopBar/topBar.types.d.ts.map +1 -1
- package/dist/src/components/Typography/Typography.d.ts.map +1 -1
- package/dist/src/components/Typography/typography.types.d.ts +47 -1
- package/dist/src/components/Typography/typography.types.d.ts.map +1 -1
- package/dist/src/components/Typography/typography.variants.d.ts +2 -2
- package/dist/src/components/Typography/typography.variants.d.ts.map +1 -1
- package/dist/src/hooks/useStandaloneFieldWarning.d.ts +38 -0
- package/dist/src/hooks/useStandaloneFieldWarning.d.ts.map +1 -0
- package/dist/src/index.d.ts +62 -42
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +11 -5
- 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,391 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import { Box } from './Box.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Suite mirrors the Typography/Button test shape (rendering · variants ·
|
|
8
|
-
* compound × intent · override · polymorphism · pass-through). The big
|
|
9
|
-
* delta here is the compound-variant matrix: 5 surface variants × 7
|
|
10
|
-
* intents = 35 combos, of which 21 carry actual visual differences
|
|
11
|
-
* (outlined / soft / solid × 7 intents). We spot-check a representative
|
|
12
|
-
* subset rather than enumerate all 35 — if the TV compound resolution
|
|
13
|
-
* works for one of each (primary, danger, neutral), it works for all.
|
|
14
|
-
*/
|
|
15
|
-
describe('<Box>', () => {
|
|
16
|
-
// ─── Default rendering ──────────────────────────────────────────────
|
|
17
|
-
describe('default rendering', () => {
|
|
18
|
-
it('renders a <div> by default', () => {
|
|
19
|
-
const { container } = render(<Box>x</Box>);
|
|
20
|
-
expect(container.firstElementChild?.tagName).toBe('DIV');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('default variant is plain — no border, no bg, no shadow', () => {
|
|
24
|
-
const { container } = render(<Box>x</Box>);
|
|
25
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
26
|
-
expect(cls).not.toContain('border');
|
|
27
|
-
expect(cls).not.toContain('bg-');
|
|
28
|
-
expect(cls).not.toContain('shadow-sm');
|
|
29
|
-
// baseline `block` is always present
|
|
30
|
-
expect(cls).toContain('block');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// ─── Variant — surface chrome ───────────────────────────────────────
|
|
35
|
-
describe('surface variants', () => {
|
|
36
|
-
it('variant="outlined" adds a border', () => {
|
|
37
|
-
const { container } = render(<Box variant="outlined" color="neutral">x</Box>);
|
|
38
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
39
|
-
expect(cls).toContain('border');
|
|
40
|
-
// neutral outlined picks the white surface + neutral-200 border
|
|
41
|
-
expect(cls).toContain('border-neutral-200');
|
|
42
|
-
expect(cls).toContain('bg-white');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('variant="elevated" adds the neutral surface, no border, no color tint', () => {
|
|
46
|
-
const { container } = render(<Box variant="elevated" elevation={3}>x</Box>);
|
|
47
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
48
|
-
expect(cls).toContain('bg-white');
|
|
49
|
-
// Sprint 4.3 theme identity sweep: corrected `dark:bg-neutral-900`
|
|
50
|
-
// (which resolved to near-white in dark mode via inversion — broken
|
|
51
|
-
// elevation) to `dark:bg-neutral-100` which resolves to `#171717`,
|
|
52
|
-
// one elevation tier above the page surface in dark mode.
|
|
53
|
-
expect(cls).toContain('dark:bg-neutral-100');
|
|
54
|
-
expect(cls).toContain('shadow-md');
|
|
55
|
-
expect(cls).not.toContain('border ');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('variant="soft" + color="warning" picks the warning soft tones', () => {
|
|
59
|
-
const { container } = render(<Box variant="soft" color="warning">x</Box>);
|
|
60
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
61
|
-
expect(cls).toContain('bg-warning-100');
|
|
62
|
-
expect(cls).toContain('text-warning-900');
|
|
63
|
-
expect(cls).toContain('dark:bg-warning-950/50');
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('variant="solid" + color="primary" picks the primary solid', () => {
|
|
67
|
-
const { container } = render(<Box variant="solid" color="primary">x</Box>);
|
|
68
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
69
|
-
expect(cls).toContain('bg-primary-600');
|
|
70
|
-
expect(cls).toContain('text-white');
|
|
71
|
-
expect(cls).toContain('dark:bg-primary-500');
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('variant="solid" + color="danger" picks the danger solid', () => {
|
|
75
|
-
const { container } = render(<Box variant="solid" color="danger">x</Box>);
|
|
76
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
77
|
-
expect(cls).toContain('bg-danger-600');
|
|
78
|
-
expect(cls).toContain('text-white');
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// ─── Elevation scale ─────────────────────────────────────────────────
|
|
83
|
-
describe('elevation', () => {
|
|
84
|
-
it('elevation={0} emits shadow-none', () => {
|
|
85
|
-
const { container } = render(<Box variant="elevated" elevation={0}>x</Box>);
|
|
86
|
-
expect(container.firstElementChild?.className).toContain('shadow-none');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('elevation={5} emits shadow-xl', () => {
|
|
90
|
-
const { container } = render(<Box variant="elevated" elevation={5}>x</Box>);
|
|
91
|
-
expect(container.firstElementChild?.className).toContain('shadow-xl');
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// ─── Spacing ─────────────────────────────────────────────────────────
|
|
96
|
-
describe('spacing', () => {
|
|
97
|
-
it('p={4} emits p-4', () => {
|
|
98
|
-
const { container } = render(<Box p={4}>x</Box>);
|
|
99
|
-
expect(container.firstElementChild?.className).toContain('p-4');
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('px={6} + py={2} emits px-6 + py-2', () => {
|
|
103
|
-
const { container } = render(<Box px={6} py={2}>x</Box>);
|
|
104
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
105
|
-
expect(cls).toContain('px-6');
|
|
106
|
-
expect(cls).toContain('py-2');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('m={"0.5"} emits m-0.5', () => {
|
|
110
|
-
const { container } = render(<Box m="0.5">x</Box>);
|
|
111
|
-
expect(container.firstElementChild?.className).toContain('m-0.5');
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// ─── Rounded + sizing ────────────────────────────────────────────────
|
|
116
|
-
describe('rounded + sizing', () => {
|
|
117
|
-
it('rounded="xl" emits rounded-xl', () => {
|
|
118
|
-
const { container } = render(<Box rounded="xl">x</Box>);
|
|
119
|
-
expect(container.firstElementChild?.className).toContain('rounded-xl');
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('fullWidth emits w-full', () => {
|
|
123
|
-
const { container } = render(<Box fullWidth>x</Box>);
|
|
124
|
-
expect(container.firstElementChild?.className).toContain('w-full');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('fullHeight emits h-full', () => {
|
|
128
|
-
const { container } = render(<Box fullHeight>x</Box>);
|
|
129
|
-
expect(container.firstElementChild?.className).toContain('h-full');
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// ─── Override semantics ─────────────────────────────────────────────
|
|
134
|
-
describe('override', () => {
|
|
135
|
-
it('sx wins over variant defaults via tailwind-merge', () => {
|
|
136
|
-
const { container } = render(
|
|
137
|
-
<Box variant="solid" color="primary" sx="bg-fuchsia-600">x</Box>,
|
|
138
|
-
);
|
|
139
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
140
|
-
expect(cls).toContain('bg-fuchsia-600');
|
|
141
|
-
// the conflicting bg-primary-600 from the compound is collapsed
|
|
142
|
-
expect(cls).not.toContain('bg-primary-600');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('sx can add utilities Box deliberately omits (overflow)', () => {
|
|
146
|
-
const { container } = render(<Box sx="overflow-hidden">x</Box>);
|
|
147
|
-
expect(container.firstElementChild?.className).toContain('overflow-hidden');
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// ─── Polymorphism ───────────────────────────────────────────────────
|
|
152
|
-
describe('polymorphism', () => {
|
|
153
|
-
it('as="section" renders a <section>', () => {
|
|
154
|
-
const { container } = render(<Box as="section">x</Box>);
|
|
155
|
-
expect(container.firstElementChild?.tagName).toBe('SECTION');
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('asChild renders the single child element with merged className', () => {
|
|
159
|
-
const { container } = render(
|
|
160
|
-
<Box variant="elevated" elevation={2} asChild>
|
|
161
|
-
<article>x</article>
|
|
162
|
-
</Box>,
|
|
163
|
-
);
|
|
164
|
-
const el = container.firstElementChild;
|
|
165
|
-
expect(el?.tagName).toBe('ARTICLE');
|
|
166
|
-
expect(el?.className).toContain('shadow');
|
|
167
|
-
expect(el?.className).toContain('bg-white');
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('asChild wins over as when both are passed', () => {
|
|
171
|
-
const { container } = render(
|
|
172
|
-
<Box as="section" asChild>
|
|
173
|
-
<article>x</article>
|
|
174
|
-
</Box>,
|
|
175
|
-
);
|
|
176
|
-
expect(container.firstElementChild?.tagName).toBe('ARTICLE');
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// ─── Pass-through ────────────────────────────────────────────────────
|
|
181
|
-
describe('pass-through', () => {
|
|
182
|
-
it('forwards data-* and aria-*', () => {
|
|
183
|
-
const { container } = render(
|
|
184
|
-
<Box data-testid="box" aria-label="surface">x</Box>,
|
|
185
|
-
);
|
|
186
|
-
const el = container.firstElementChild;
|
|
187
|
-
expect(el?.getAttribute('data-testid')).toBe('box');
|
|
188
|
-
expect(el?.getAttribute('aria-label')).toBe('surface');
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// ─── F11-bis edge cases: every compound variant explicit ─────────────
|
|
193
|
-
// The original suite spot-checked 4 surface×intent combos (outlined
|
|
194
|
-
// neutral, soft warning, solid primary, solid danger). The validation
|
|
195
|
-
// pass before publishing 0.2.0-beta enumerates ALL 21 visually-distinct
|
|
196
|
-
// compound entries so a future TV recipe edit can't silently drop one.
|
|
197
|
-
describe('compound variants matrix — every surface × intent', () => {
|
|
198
|
-
const INTENTS = ['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'neutral'] as const;
|
|
199
|
-
|
|
200
|
-
/*
|
|
201
|
-
* Outlined × 7 intents — each emits a tinted border + soft bg pair
|
|
202
|
-
* with the dark-mode counterpart pre-wired. Spot-check picks the
|
|
203
|
-
* `border-{color}-300` light token and the `dark:border-{color}-{N}` pair.
|
|
204
|
-
*/
|
|
205
|
-
describe('outlined × intent', () => {
|
|
206
|
-
it.each(INTENTS)('outlined × %s emits border + bg with dark pair', (color) => {
|
|
207
|
-
const { container } = render(<Box variant="outlined" color={color}>x</Box>);
|
|
208
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
209
|
-
if (color === 'neutral') {
|
|
210
|
-
// Sprint 4.3 identity sweep: neutral outlined uses
|
|
211
|
-
// `border-neutral-200` (auto-inverts via CSS-var swap; no
|
|
212
|
-
// `dark:` needed) + `bg-white dark:bg-neutral-100`
|
|
213
|
-
// (bg-white is hardcoded so `dark:` is required; target
|
|
214
|
-
// `dark:bg-neutral-100` = `#171717` is one tier elevated
|
|
215
|
-
// above the page surface in dark mode).
|
|
216
|
-
expect(cls).toContain('border-neutral-200');
|
|
217
|
-
expect(cls).toContain('bg-white');
|
|
218
|
-
expect(cls).toContain('dark:bg-neutral-100');
|
|
219
|
-
// No more dark:border-neutral-700 (auto-inverts).
|
|
220
|
-
expect(cls).not.toContain('dark:border-neutral-');
|
|
221
|
-
} else {
|
|
222
|
-
// primary/secondary/success/warning/danger/info share the
|
|
223
|
-
// border-{color}-300 + bg-{color}-50/40 + dark:* pattern
|
|
224
|
-
expect(cls).toContain(`border-${color}-300`);
|
|
225
|
-
expect(cls).toContain(`bg-${color}-50/40`);
|
|
226
|
-
expect(cls).toContain(`dark:border-${color}-800`);
|
|
227
|
-
expect(cls).toContain(`dark:bg-${color}-950/30`);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
/*
|
|
233
|
-
* Soft × 7 intents — semi-transparent tinted background + matching
|
|
234
|
-
* intent text colour. Dark pair uses a darker bg + lighter text so
|
|
235
|
-
* contrast holds in both modes.
|
|
236
|
-
*/
|
|
237
|
-
describe('soft × intent', () => {
|
|
238
|
-
it.each(INTENTS)('soft × %s emits bg + text with dark pair', (color) => {
|
|
239
|
-
const { container } = render(<Box variant="soft" color={color}>x</Box>);
|
|
240
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
241
|
-
if (color === 'neutral') {
|
|
242
|
-
// Sprint 4.3 identity sweep: both neutral classes auto-invert
|
|
243
|
-
// via the dashforgePreset() CSS-var swap — no `dark:` needed.
|
|
244
|
-
expect(cls).toContain('bg-neutral-100');
|
|
245
|
-
expect(cls).toContain('text-neutral-900');
|
|
246
|
-
expect(cls).not.toContain('dark:bg-neutral-');
|
|
247
|
-
expect(cls).not.toContain('dark:text-neutral-');
|
|
248
|
-
} else {
|
|
249
|
-
expect(cls).toContain(`bg-${color}-100`);
|
|
250
|
-
expect(cls).toContain(`text-${color}-900`);
|
|
251
|
-
expect(cls).toContain(`dark:bg-${color}-950/50`);
|
|
252
|
-
expect(cls).toContain(`dark:text-${color}-100`);
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
/*
|
|
258
|
-
* Solid × 7 intents — full-bleed intent background, white text by
|
|
259
|
-
* default (neutral inverts: black bg → white text in light, white
|
|
260
|
-
* bg → black text in dark). The dark variant typically uses a
|
|
261
|
-
* lighter shade so the surface doesn't look pitch black on already-
|
|
262
|
-
* dark page backgrounds.
|
|
263
|
-
*/
|
|
264
|
-
describe('solid × intent', () => {
|
|
265
|
-
it.each(INTENTS)('solid × %s emits bg + text-white (or contrast pair for neutral)', (color) => {
|
|
266
|
-
const { container } = render(<Box variant="solid" color={color}>x</Box>);
|
|
267
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
268
|
-
if (color === 'neutral') {
|
|
269
|
-
// Sprint 4.3 identity sweep: solid neutral now uses
|
|
270
|
-
// `bg-neutral-900 text-neutral-50` (both auto-invert) — the
|
|
271
|
-
// accent surface inverts WITH the page (dark surface in
|
|
272
|
-
// light mode, light surface in dark mode), consistent with
|
|
273
|
-
// identity rule. Previously was `text-white` (no inversion)
|
|
274
|
-
// forcing double-invert pattern to stay readable.
|
|
275
|
-
expect(cls).toContain('bg-neutral-900');
|
|
276
|
-
expect(cls).toContain('text-neutral-50');
|
|
277
|
-
expect(cls).not.toContain('text-white');
|
|
278
|
-
expect(cls).not.toContain('dark:bg-neutral-');
|
|
279
|
-
expect(cls).not.toContain('dark:text-neutral-');
|
|
280
|
-
} else if (color === 'warning') {
|
|
281
|
-
// warning uses 500/600 instead of 600/500 to keep contrast
|
|
282
|
-
// legible against an already-yellow surface in light mode.
|
|
283
|
-
expect(cls).toContain('bg-warning-500');
|
|
284
|
-
expect(cls).toContain('text-white');
|
|
285
|
-
expect(cls).toContain('dark:bg-warning-600');
|
|
286
|
-
} else {
|
|
287
|
-
expect(cls).toContain(`bg-${color}-600`);
|
|
288
|
-
expect(cls).toContain('text-white');
|
|
289
|
-
expect(cls).toContain(`dark:bg-${color}-500`);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// ─── F11-bis edge cases: color is ignored for plain / elevated ──────
|
|
296
|
-
// These two variants are color-agnostic by design (see box.variants.ts
|
|
297
|
-
// header) — passing `color` shouldn't accidentally inject the intent
|
|
298
|
-
// bg/border via the compound matrix.
|
|
299
|
-
describe('color-agnostic variants', () => {
|
|
300
|
-
it('plain + color="primary" does NOT add intent classes', () => {
|
|
301
|
-
const { container } = render(<Box variant="plain" color="primary">x</Box>);
|
|
302
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
303
|
-
expect(cls).not.toContain('bg-primary-');
|
|
304
|
-
expect(cls).not.toContain('border-primary-');
|
|
305
|
-
expect(cls).not.toContain('text-primary-');
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
it('elevated + color="danger" stays on the neutral surface', () => {
|
|
309
|
-
const { container } = render(<Box variant="elevated" color="danger">x</Box>);
|
|
310
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
311
|
-
// elevated paints bg-white / dark:bg-neutral-100 regardless of
|
|
312
|
-
// intent (Sprint 4.3 sweep: dark target corrected to
|
|
313
|
-
// `dark:bg-neutral-100` for proper dark elevation).
|
|
314
|
-
expect(cls).toContain('bg-white');
|
|
315
|
-
expect(cls).toContain('dark:bg-neutral-100');
|
|
316
|
-
expect(cls).not.toContain('bg-danger-');
|
|
317
|
-
expect(cls).not.toContain('border-danger-');
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
// ─── F11-bis edge cases: spacing axis coexistence ───────────────────
|
|
322
|
-
describe('spacing axis coexistence', () => {
|
|
323
|
-
it('p={4} + px={6}: both classes emitted (tailwind-merge resolves)', () => {
|
|
324
|
-
const { container } = render(<Box p={4} px={6}>x</Box>);
|
|
325
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
326
|
-
// tailwind-merge: px-6 wins over p-4 on horizontal padding,
|
|
327
|
-
// p-4 keeps applying vertical via py
|
|
328
|
-
expect(cls).toContain('px-6');
|
|
329
|
-
// p-4 → tailwind-merge collapses with px-6 (latter wins on x-axis)
|
|
330
|
-
// The vertical (py-4 derived from p-4) is what remains.
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
it('m={2} + mx={4} + my={6}: all three coexist (resolves to mx-4 + my-6 effectively)', () => {
|
|
334
|
-
const { container } = render(<Box m={2} mx={4} my={6}>x</Box>);
|
|
335
|
-
const cls = container.firstElementChild?.className ?? '';
|
|
336
|
-
expect(cls).toContain('mx-4');
|
|
337
|
-
expect(cls).toContain('my-6');
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
// ─── F11-bis edge cases: elevation × variant interaction ────────────
|
|
342
|
-
describe('elevation × variant', () => {
|
|
343
|
-
it('elevation works on non-elevated variants too (consumer choice)', () => {
|
|
344
|
-
const { container } = render(<Box variant="outlined" color="neutral" elevation={4}>x</Box>);
|
|
345
|
-
// The shadow class still gets emitted even though the design
|
|
346
|
-
// recommendation is "use elevation only with variant=elevated".
|
|
347
|
-
// We don't gate this at the TV level because compound restrictions
|
|
348
|
-
// would make the API harder to discover.
|
|
349
|
-
expect(container.firstElementChild?.className).toContain('shadow-lg');
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
it('elevation=0 explicitly disables shadow', () => {
|
|
353
|
-
const { container } = render(<Box variant="elevated" elevation={0}>x</Box>);
|
|
354
|
-
expect(container.firstElementChild?.className).toContain('shadow-none');
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
// ─── F11-bis edge cases: rounded full ───────────────────────────────
|
|
359
|
-
describe('rounded edge values', () => {
|
|
360
|
-
it('rounded="full" produces rounded-full (avatars, pills)', () => {
|
|
361
|
-
const { container } = render(<Box rounded="full">x</Box>);
|
|
362
|
-
expect(container.firstElementChild?.className).toContain('rounded-full');
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it('rounded="none" explicitly removes any rounding', () => {
|
|
366
|
-
const { container } = render(<Box rounded="none">x</Box>);
|
|
367
|
-
expect(container.firstElementChild?.className).toContain('rounded-none');
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
describe('bridge integration — visibleWhen (Sprint 4.4 surface alignment)', () => {
|
|
372
|
-
it('renders when visibleWhen returns true', () => {
|
|
373
|
-
const { container } = render(
|
|
374
|
-
<Box visibleWhen={() => true}>shown</Box>
|
|
375
|
-
);
|
|
376
|
-
expect(container.firstChild).toBeTruthy();
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
it('returns null when visibleWhen returns false', () => {
|
|
380
|
-
const { container } = render(
|
|
381
|
-
<Box visibleWhen={() => false}>hidden</Box>
|
|
382
|
-
);
|
|
383
|
-
expect(container.firstChild).toBeNull();
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
it('renders normally when visibleWhen is omitted', () => {
|
|
387
|
-
const { container } = render(<Box>always</Box>);
|
|
388
|
-
expect(container.firstChild).toBeTruthy();
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { forwardRef, useContext, type ElementType, type ReactElement } from 'react';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import { DashFormContext, useEngineVisibility } from '@dashforge/ui-core';
|
|
4
|
-
import { cn } from '../../utils/cn.js';
|
|
5
|
-
import { useAccessState } from '../../hooks/useAccessState.js';
|
|
6
|
-
import { boxVariants } from './box.variants.js';
|
|
7
|
-
import type { BoxProps } from './box.types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* `<Box>` — the surface primitive of @dashforge/tw.
|
|
11
|
-
*
|
|
12
|
-
* What it IS:
|
|
13
|
-
* A polymorphic container with typed surface variants (plain /
|
|
14
|
-
* outlined / elevated / soft / solid) × 7 intent colours, plus
|
|
15
|
-
* spacing / sizing / rounded / elevation as enumerated token-scale
|
|
16
|
-
* props. Replaces MUI's Box + Paper + Card + Surface in one component.
|
|
17
|
-
*
|
|
18
|
-
* What it is NOT (deliberate, enforced by the prop set):
|
|
19
|
-
* • Not a flex container → use <Stack>
|
|
20
|
-
* • Not a grid container → use <Grid>
|
|
21
|
-
* • Not a paragraph → use <Typography>
|
|
22
|
-
* • Not a button → use <Button>
|
|
23
|
-
*
|
|
24
|
-
* The "Box is not flex" rule is the spine of the layout layer. Without
|
|
25
|
-
* it, every `<div>` in an app gravitates back to Box and the surface
|
|
26
|
-
* vs layout distinction collapses. Box's job is the SURFACE around
|
|
27
|
-
* content; Stack/Grid's job is the ARRANGEMENT of content. Two
|
|
28
|
-
* primitives, two responsibilities.
|
|
29
|
-
*
|
|
30
|
-
* When BOTH `as` and `asChild` are passed, `asChild` wins. Same rule
|
|
31
|
-
* as Typography — documented to avoid the dimension-bloat of a
|
|
32
|
-
* discriminated union over an 11-axis props type.
|
|
33
|
-
*
|
|
34
|
-
* Layering:
|
|
35
|
-
* • Sits BENEATH every visual chrome — every card, every panel,
|
|
36
|
-
* every section background.
|
|
37
|
-
* • Composes ON TOP of @dashforge/tw-tokens (color + spacing + radius
|
|
38
|
-
* + shadow scales) via the dashforgePreset CSS variables.
|
|
39
|
-
* • Pairs with Typography for text content, Stack/Grid for layout
|
|
40
|
-
* children inside it.
|
|
41
|
-
*/
|
|
42
|
-
export const Box = forwardRef<HTMLElement, BoxProps>(
|
|
43
|
-
function Box(props, ref) {
|
|
44
|
-
const {
|
|
45
|
-
variant,
|
|
46
|
-
color,
|
|
47
|
-
elevation,
|
|
48
|
-
rounded,
|
|
49
|
-
p, px, py, m, mx, my,
|
|
50
|
-
fullWidth,
|
|
51
|
-
fullHeight,
|
|
52
|
-
as,
|
|
53
|
-
asChild = false,
|
|
54
|
-
sx,
|
|
55
|
-
visibleWhen,
|
|
56
|
-
access,
|
|
57
|
-
children,
|
|
58
|
-
...rest
|
|
59
|
-
} = props;
|
|
60
|
-
|
|
61
|
-
// Bridge — hooks called unconditionally (rules-of-hooks).
|
|
62
|
-
// `useEngineVisibility` subscribes to engine state inside a
|
|
63
|
-
// `<DashForm>` and re-evaluates the predicate reactively; outside
|
|
64
|
-
// a form, it evaluates the predicate as a plain closure.
|
|
65
|
-
// `useAccessState` consults the @dashforge/rbac policy engine.
|
|
66
|
-
// Both default to no-op when the corresponding prop is omitted.
|
|
67
|
-
const bridge = useContext(DashFormContext);
|
|
68
|
-
const isVisible = useEngineVisibility(bridge?.engine, visibleWhen);
|
|
69
|
-
const accessState = useAccessState(access);
|
|
70
|
-
|
|
71
|
-
// Early return — predicate false OR RBAC denies visibility.
|
|
72
|
-
if (!isVisible || !accessState.visible) return null;
|
|
73
|
-
|
|
74
|
-
const classes = cn(
|
|
75
|
-
boxVariants({
|
|
76
|
-
variant, color, elevation, rounded,
|
|
77
|
-
p, px, py, m, mx, my,
|
|
78
|
-
fullWidth, fullHeight,
|
|
79
|
-
}),
|
|
80
|
-
// RBAC-disabled / readonly surfaces dim visually + carry
|
|
81
|
-
// semantic ARIA attributes (assigned below) so descendants and
|
|
82
|
-
// assistive tech can react.
|
|
83
|
-
accessState.disabled && 'opacity-60',
|
|
84
|
-
accessState.readonly && 'opacity-80',
|
|
85
|
-
sx,
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const ariaProps = {
|
|
89
|
-
'aria-disabled': accessState.disabled || undefined,
|
|
90
|
-
'aria-readonly': accessState.readonly || undefined,
|
|
91
|
-
'data-disabled': accessState.disabled || undefined,
|
|
92
|
-
'data-readonly': accessState.readonly || undefined,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
if (asChild) {
|
|
96
|
-
return (
|
|
97
|
-
<Slot ref={ref} className={classes} {...ariaProps} {...rest}>
|
|
98
|
-
{children as ReactElement}
|
|
99
|
-
</Slot>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const Tag = (as ?? 'div') as ElementType;
|
|
104
|
-
return (
|
|
105
|
-
<Tag ref={ref as never} className={classes} {...ariaProps} {...rest}>
|
|
106
|
-
{children}
|
|
107
|
-
</Tag>
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
Box.displayName = 'Box';
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
-
import type { Engine } from '@dashforge/ui-core';
|
|
3
|
-
import type { AccessRequirement } from '@dashforge/rbac';
|
|
4
|
-
import type { BoxVariants } from './box.variants.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Props for `<Box>` — the surface primitive.
|
|
8
|
-
*
|
|
9
|
-
* What lives in props (typed, ergonomic):
|
|
10
|
-
* • Surface — variant, color, elevation, rounded
|
|
11
|
-
* • Spacing — p, px, py, m, mx, my (token-scale steps)
|
|
12
|
-
* • Sizing — fullWidth, fullHeight
|
|
13
|
-
* • Polymorphism — as, asChild
|
|
14
|
-
* • Override escape — sx (utility string, merged via tailwind-merge)
|
|
15
|
-
*
|
|
16
|
-
* What does NOT live here (deliberate, see Box.tsx header):
|
|
17
|
-
* • display / flex / grid / gap → use Stack or Grid
|
|
18
|
-
* • position / top / z-index → use sx
|
|
19
|
-
* • overflow / cursor → use sx
|
|
20
|
-
* • animation / transition → use sx
|
|
21
|
-
*
|
|
22
|
-
* Native attribute overrides:
|
|
23
|
-
* • `className` is omitted in favour of `sx` (string of utilities,
|
|
24
|
-
* resolved by tailwind-merge so consumer wins over variant defaults)
|
|
25
|
-
* — same convention as Button/TextField/Checkbox/Switch.
|
|
26
|
-
* • `color` is omitted: collides with the deprecated HTML4 `color`
|
|
27
|
-
* attribute. Our typed `color` (intent) is the right one.
|
|
28
|
-
*/
|
|
29
|
-
export interface BoxProps
|
|
30
|
-
extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'color'>,
|
|
31
|
-
Pick<BoxVariants,
|
|
32
|
-
'variant' | 'color' | 'elevation' | 'rounded'
|
|
33
|
-
| 'p' | 'px' | 'py' | 'm' | 'mx' | 'my'
|
|
34
|
-
| 'fullWidth' | 'fullHeight'> {
|
|
35
|
-
/**
|
|
36
|
-
* Override the rendered HTML tag. Defaults to `'div'`. Useful when
|
|
37
|
-
* the surface should also carry semantic meaning — `<Box as="section">`
|
|
38
|
-
* for a page section, `<Box as="article">` for a card-shaped article.
|
|
39
|
-
*
|
|
40
|
-
* Ignored when `asChild` is true.
|
|
41
|
-
*/
|
|
42
|
-
as?: ElementType;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Render via Radix `Slot` — the Box styles paint onto the single
|
|
46
|
-
* React child instead of wrapping it in our own element. Useful for
|
|
47
|
-
* `<Box asChild><Link>...</Link></Box>` to get a styled router link
|
|
48
|
-
* with no extra DOM wrapper.
|
|
49
|
-
*
|
|
50
|
-
* Mutually exclusive with `as` (when both are passed, `asChild` wins
|
|
51
|
-
* — see Box.tsx for the reasoning).
|
|
52
|
-
*/
|
|
53
|
-
asChild?: boolean;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Utility classes appended to the variant chain. Resolved via
|
|
57
|
-
* `tailwind-merge` so the consumer's classes always win over the
|
|
58
|
-
* variant defaults. Use for one-off overrides AND for utility
|
|
59
|
-
* dimensions Box deliberately doesn't expose as props (overflow,
|
|
60
|
-
* position, animation, etc.).
|
|
61
|
-
*/
|
|
62
|
-
sx?: string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Reactive visibility predicate — added in 1.1.0 (Sprint 4.4
|
|
66
|
-
* surface alignment). When the predicate returns `false`, the
|
|
67
|
-
* component renders `null`. Inside a `<DashForm>` it subscribes
|
|
68
|
-
* reactively to engine state changes; outside a form, it's
|
|
69
|
-
* evaluated as a plain closure.
|
|
70
|
-
*
|
|
71
|
-
* Use for state-driven hiding of dashboard cards, conditional
|
|
72
|
-
* sections, gated content, etc. **For permission-driven hiding,
|
|
73
|
-
* prefer `access` with `onUnauthorized: 'hide'`** — it's semantically
|
|
74
|
-
* the correct path and surfaces better in RBAC dev tools.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```tsx
|
|
78
|
-
* // Dashboard card visible only when there are pending shipments
|
|
79
|
-
* <Box variant="outlined" rounded="lg" p={4}
|
|
80
|
-
* visibleWhen={() => pendingCount > 0}>
|
|
81
|
-
* <Typography variant="h3">{pendingCount} pending</Typography>
|
|
82
|
-
* </Box>
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
visibleWhen?: (engine: Engine) => boolean;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* RBAC requirement — added in 1.1.0 (Sprint 4.4 surface alignment).
|
|
89
|
-
* Controls Box visibility / disabled-state via the centralized
|
|
90
|
-
* `@dashforge/rbac` policy engine.
|
|
91
|
-
*
|
|
92
|
-
* - `onUnauthorized: 'hide'` → Box does not render
|
|
93
|
-
* - `onUnauthorized: 'disable'` → adds `aria-disabled` + dimmed
|
|
94
|
-
* visual; interactive children should derive their disabled state
|
|
95
|
-
* from `data-disabled` on the Box or pass their own `access`
|
|
96
|
-
* - `onUnauthorized: 'readonly'` → adds `aria-readonly`; mostly used
|
|
97
|
-
* when Box wraps form sections that propagate readonly to children
|
|
98
|
-
*
|
|
99
|
-
* Use for permission-gated dashboard cards, admin-only sections,
|
|
100
|
-
* tenant-aware layouts. The hide path is the common case.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```tsx
|
|
104
|
-
* // Revenue card visible only to users with billing:read permission
|
|
105
|
-
* <Box variant="elevated" rounded="lg" elevation={2} p={4}
|
|
106
|
-
* access={{
|
|
107
|
-
* resource: 'billing',
|
|
108
|
-
* action: 'read',
|
|
109
|
-
* onUnauthorized: 'hide'
|
|
110
|
-
* }}>
|
|
111
|
-
* <Typography variant="h3">Q3 Revenue</Typography>
|
|
112
|
-
* </Box>
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
access?: AccessRequirement;
|
|
116
|
-
}
|