@dashforge/tw 1.0.0 → 1.1.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 +221 -0
- package/README.md +74 -15
- package/dashforge-tw-1.0.0.tgz +0 -0
- package/dist/index.d.ts +1 -146
- package/dist/index.esm.js +3127 -748
- package/dist/src/components/Alert/Alert.d.ts +65 -0
- package/dist/src/components/Alert/Alert.d.ts.map +1 -0
- package/dist/src/components/Alert/alert.types.d.ts +130 -0
- package/dist/src/components/Alert/alert.types.d.ts.map +1 -0
- package/dist/src/components/Alert/alert.variants.d.ts +85 -0
- package/dist/src/components/Alert/alert.variants.d.ts.map +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +48 -0
- package/dist/src/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/src/components/Avatar/avatar.types.d.ts +162 -0
- package/dist/src/components/Avatar/avatar.types.d.ts.map +1 -0
- package/dist/src/components/Avatar/avatar.variants.d.ts +208 -0
- package/dist/src/components/Avatar/avatar.variants.d.ts.map +1 -0
- package/dist/src/components/Badge/Badge.d.ts +63 -0
- package/dist/src/components/Badge/Badge.d.ts.map +1 -0
- package/dist/src/components/Badge/badge.types.d.ts +124 -0
- package/dist/src/components/Badge/badge.types.d.ts.map +1 -0
- package/dist/src/components/Badge/badge.variants.d.ts +262 -0
- package/dist/src/components/Badge/badge.variants.d.ts.map +1 -0
- package/dist/src/components/Box/Box.d.ts.map +1 -1
- package/dist/src/components/Box/box.types.d.ts +53 -0
- package/dist/src/components/Box/box.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 +35 -0
- package/dist/src/components/Button/button.types.d.ts.map +1 -1
- package/dist/src/components/Card/Card.d.ts +107 -0
- package/dist/src/components/Card/Card.d.ts.map +1 -0
- package/dist/src/components/Card/card.types.d.ts +119 -0
- package/dist/src/components/Card/card.types.d.ts.map +1 -0
- package/dist/src/components/Chip/Chip.d.ts +67 -0
- package/dist/src/components/Chip/Chip.d.ts.map +1 -0
- package/dist/src/components/Chip/chip.types.d.ts +113 -0
- package/dist/src/components/Chip/chip.types.d.ts.map +1 -0
- package/dist/src/components/Chip/chip.variants.d.ts +155 -0
- package/dist/src/components/Chip/chip.variants.d.ts.map +1 -0
- package/dist/src/components/IconButton/IconButton.d.ts +57 -0
- package/dist/src/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/src/components/IconButton/iconButton.types.d.ts +96 -0
- package/dist/src/components/IconButton/iconButton.types.d.ts.map +1 -0
- package/dist/src/components/IconButton/iconButton.variants.d.ts +26 -0
- package/dist/src/components/IconButton/iconButton.variants.d.ts.map +1 -0
- package/dist/src/components/Menu/Menu.d.ts +118 -0
- package/dist/src/components/Menu/Menu.d.ts.map +1 -0
- package/dist/src/components/Menu/menu.types.d.ts +179 -0
- package/dist/src/components/Menu/menu.types.d.ts.map +1 -0
- package/dist/src/components/Menu/menu.variants.d.ts +129 -0
- package/dist/src/components/Menu/menu.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 +40 -3
- package/dist/src/components/Snackbar/snackbar.types.d.ts.map +1 -1
- package/dist/src/components/Snackbar/snackbar.variants.d.ts +12 -57
- package/dist/src/components/Snackbar/snackbar.variants.d.ts.map +1 -1
- package/dist/src/components/Spinner/Spinner.d.ts +44 -0
- package/dist/src/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/src/components/Spinner/spinner.types.d.ts +89 -0
- package/dist/src/components/Spinner/spinner.types.d.ts.map +1 -0
- package/dist/src/components/Spinner/spinner.variants.d.ts +111 -0
- package/dist/src/components/Spinner/spinner.variants.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderChip.d.ts +15 -72
- package/dist/src/components/Table/cells/RenderChip.d.ts.map +1 -1
- package/dist/src/components/_shared/severity/index.d.ts +21 -0
- package/dist/src/components/_shared/severity/index.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severity.types.d.ts +48 -0
- package/dist/src/components/_shared/severity/severity.types.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severityIcons.d.ts +45 -0
- package/dist/src/components/_shared/severity/severityIcons.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severityVariants.d.ts +22 -0
- package/dist/src/components/_shared/severity/severityVariants.d.ts.map +1 -0
- package/dist/src/index.d.ts +27 -2
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/Alert/Alert.test.tsx +302 -0
- package/src/components/Alert/Alert.tsx +186 -0
- package/src/components/Alert/alert.types.ts +144 -0
- package/src/components/Alert/alert.variants.ts +71 -0
- package/src/components/Autocomplete/autocomplete.variants.ts +1 -1
- package/src/components/Avatar/Avatar.test.tsx +287 -0
- package/src/components/Avatar/Avatar.tsx +304 -0
- package/src/components/Avatar/avatar.types.ts +205 -0
- package/src/components/Avatar/avatar.variants.ts +194 -0
- package/src/components/Badge/Badge.test.tsx +385 -0
- package/src/components/Badge/Badge.tsx +174 -0
- package/src/components/Badge/badge.types.ts +154 -0
- package/src/components/Badge/badge.variants.ts +161 -0
- package/src/components/Box/Box.test.tsx +21 -0
- package/src/components/Box/Box.tsx +32 -3
- package/src/components/Box/box.types.ts +55 -0
- package/src/components/Button/Button.test.tsx +21 -0
- package/src/components/Button/Button.tsx +28 -27
- package/src/components/Button/button.types.ts +36 -0
- package/src/components/Card/Card.test.tsx +291 -0
- package/src/components/Card/Card.tsx +241 -0
- package/src/components/Card/card.types.ts +132 -0
- package/src/components/Chip/Chip.test.tsx +316 -0
- package/src/components/Chip/Chip.tsx +224 -0
- package/src/components/Chip/chip.types.ts +128 -0
- package/src/components/Chip/chip.variants.ts +173 -0
- package/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx +1 -1
- package/src/components/IconButton/IconButton.test.tsx +367 -0
- package/src/components/IconButton/IconButton.tsx +159 -0
- package/src/components/IconButton/iconButton.types.ts +106 -0
- package/src/components/IconButton/iconButton.variants.ts +31 -0
- package/src/components/LeftNav/leftNav.variants.ts +2 -2
- package/src/components/Menu/Menu.test.tsx +408 -0
- package/src/components/Menu/Menu.tsx +335 -0
- package/src/components/Menu/menu.types.ts +221 -0
- package/src/components/Menu/menu.variants.ts +132 -0
- package/src/components/Pagination/pagination.variants.ts +1 -1
- package/src/components/Snackbar/Snackbar.tsx +46 -28
- package/src/components/Snackbar/snackbar.types.ts +47 -3
- package/src/components/Snackbar/snackbar.variants.ts +29 -22
- package/src/components/Spinner/Spinner.test.tsx +199 -0
- package/src/components/Spinner/Spinner.tsx +158 -0
- package/src/components/Spinner/spinner.types.ts +113 -0
- package/src/components/Spinner/spinner.variants.ts +83 -0
- package/src/components/Table/cells/RenderChip.tsx +24 -87
- package/src/components/Table/cells/RowActionsMenu.tsx +1 -1
- package/src/components/_shared/severity/index.ts +33 -0
- package/src/components/_shared/severity/severity.types.ts +50 -0
- package/src/components/_shared/severity/severityIcons.tsx +104 -0
- package/src/components/_shared/severity/severityVariants.test.ts +136 -0
- package/src/components/_shared/severity/severityVariants.ts +115 -0
- package/src/index.ts +163 -1
- package/LICENSE +0 -21
- package/dist/components/Accordion/Accordion.d.ts +0 -21
- package/dist/components/Accordion/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion/accordion.types.d.ts +0 -74
- package/dist/components/Accordion/accordion.types.d.ts.map +0 -1
- package/dist/components/Accordion/accordion.variants.d.ts +0 -58
- package/dist/components/Accordion/accordion.variants.d.ts.map +0 -1
- package/dist/components/AppShell/AppShell.d.ts +0 -46
- package/dist/components/AppShell/AppShell.d.ts.map +0 -1
- package/dist/components/AppShell/appShell.types.d.ts +0 -62
- package/dist/components/AppShell/appShell.types.d.ts.map +0 -1
- package/dist/components/AppShell/appShell.variants.d.ts +0 -65
- package/dist/components/AppShell/appShell.variants.d.ts.map +0 -1
- package/dist/components/AspectRatio/AspectRatio.d.ts +0 -36
- package/dist/components/AspectRatio/AspectRatio.d.ts.map +0 -1
- package/dist/components/AspectRatio/aspectRatio.types.d.ts +0 -50
- package/dist/components/AspectRatio/aspectRatio.types.d.ts.map +0 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +0 -32
- package/dist/components/Autocomplete/Autocomplete.d.ts.map +0 -1
- package/dist/components/Autocomplete/autocomplete.types.d.ts +0 -214
- package/dist/components/Autocomplete/autocomplete.types.d.ts.map +0 -1
- package/dist/components/Autocomplete/autocomplete.variants.d.ts +0 -214
- package/dist/components/Autocomplete/autocomplete.variants.d.ts.map +0 -1
- package/dist/components/Box/Box.d.ts +0 -36
- package/dist/components/Box/Box.d.ts.map +0 -1
- package/dist/components/Box/box.types.d.ts +0 -54
- package/dist/components/Box/box.types.d.ts.map +0 -1
- package/dist/components/Box/box.variants.d.ts +0 -402
- package/dist/components/Box/box.variants.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -23
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/breadcrumbs.types.d.ts +0 -98
- package/dist/components/Breadcrumbs/breadcrumbs.types.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/breadcrumbs.variants.d.ts +0 -85
- package/dist/components/Breadcrumbs/breadcrumbs.variants.d.ts.map +0 -1
- package/dist/components/Button/Button.d.ts +0 -44
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/button.types.d.ts +0 -66
- package/dist/components/Button/button.types.d.ts.map +0 -1
- package/dist/components/Button/button.variants.d.ts +0 -104
- package/dist/components/Button/button.variants.d.ts.map +0 -1
- package/dist/components/Calendar/Calendar.d.ts +0 -14
- package/dist/components/Calendar/Calendar.d.ts.map +0 -1
- package/dist/components/Calendar/calendar.types.d.ts +0 -72
- package/dist/components/Calendar/calendar.types.d.ts.map +0 -1
- package/dist/components/Calendar/calendar.variants.d.ts +0 -99
- package/dist/components/Calendar/calendar.variants.d.ts.map +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +0 -31
- package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox/checkbox.types.d.ts +0 -86
- package/dist/components/Checkbox/checkbox.types.d.ts.map +0 -1
- package/dist/components/Checkbox/checkbox.variants.d.ts +0 -109
- package/dist/components/Checkbox/checkbox.variants.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +0 -38
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/confirmDialog.types.d.ts +0 -80
- package/dist/components/ConfirmDialog/confirmDialog.types.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/confirmDialog.variants.d.ts +0 -90
- package/dist/components/ConfirmDialog/confirmDialog.variants.d.ts.map +0 -1
- package/dist/components/Container/Container.d.ts +0 -35
- package/dist/components/Container/Container.d.ts.map +0 -1
- package/dist/components/Container/container.types.d.ts +0 -41
- package/dist/components/Container/container.types.d.ts.map +0 -1
- package/dist/components/Container/container.variants.d.ts +0 -93
- package/dist/components/Container/container.variants.d.ts.map +0 -1
- package/dist/components/DataGrid/DataGrid.d.ts +0 -29
- package/dist/components/DataGrid/DataGrid.d.ts.map +0 -1
- package/dist/components/DataGrid/dataGrid.types.d.ts +0 -214
- package/dist/components/DataGrid/dataGrid.types.d.ts.map +0 -1
- package/dist/components/DataGrid/dataGrid.variants.d.ts +0 -222
- package/dist/components/DataGrid/dataGrid.variants.d.ts.map +0 -1
- package/dist/components/DataGrid/filters/ColumnFilters.d.ts +0 -23
- package/dist/components/DataGrid/filters/ColumnFilters.d.ts.map +0 -1
- package/dist/components/DataGrid/reorder/useColumnReorder.d.ts +0 -50
- package/dist/components/DataGrid/reorder/useColumnReorder.d.ts.map +0 -1
- package/dist/components/DataGrid/resize/useColumnResize.d.ts +0 -39
- package/dist/components/DataGrid/resize/useColumnResize.d.ts.map +0 -1
- package/dist/components/DataGrid/visibility/ColumnVisibilityMenu.d.ts +0 -44
- package/dist/components/DataGrid/visibility/ColumnVisibilityMenu.d.ts.map +0 -1
- package/dist/components/DatePicker/DatePicker.d.ts +0 -14
- package/dist/components/DatePicker/DatePicker.d.ts.map +0 -1
- package/dist/components/DatePicker/datePicker.types.d.ts +0 -88
- package/dist/components/DatePicker/datePicker.types.d.ts.map +0 -1
- package/dist/components/DatePicker/datePicker.variants.d.ts +0 -97
- package/dist/components/DatePicker/datePicker.variants.d.ts.map +0 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +0 -13
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +0 -1
- package/dist/components/DateRangePicker/dateRangePicker.types.d.ts +0 -85
- package/dist/components/DateRangePicker/dateRangePicker.types.d.ts.map +0 -1
- package/dist/components/DateRangePicker/dateRangePicker.variants.d.ts +0 -183
- package/dist/components/DateRangePicker/dateRangePicker.variants.d.ts.map +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -13
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +0 -1
- package/dist/components/DateTimePicker/dateTimePicker.types.d.ts +0 -90
- package/dist/components/DateTimePicker/dateTimePicker.types.d.ts.map +0 -1
- package/dist/components/DateTimePicker/dateTimePicker.variants.d.ts +0 -107
- package/dist/components/DateTimePicker/dateTimePicker.variants.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -17
- package/dist/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog/dialog.types.d.ts +0 -75
- package/dist/components/Dialog/dialog.types.d.ts.map +0 -1
- package/dist/components/Dialog/dialog.variants.d.ts +0 -80
- package/dist/components/Dialog/dialog.variants.d.ts.map +0 -1
- package/dist/components/Divider/Divider.d.ts +0 -50
- package/dist/components/Divider/Divider.d.ts.map +0 -1
- package/dist/components/Divider/divider.types.d.ts +0 -47
- package/dist/components/Divider/divider.types.d.ts.map +0 -1
- package/dist/components/Divider/divider.variants.d.ts +0 -129
- package/dist/components/Divider/divider.variants.d.ts.map +0 -1
- package/dist/components/Grid/Grid.d.ts +0 -32
- package/dist/components/Grid/Grid.d.ts.map +0 -1
- package/dist/components/Grid/grid.types.d.ts +0 -103
- package/dist/components/Grid/grid.types.d.ts.map +0 -1
- package/dist/components/Grid/grid.variants.d.ts +0 -453
- package/dist/components/Grid/grid.variants.d.ts.map +0 -1
- package/dist/components/LeftNav/LeftNav.d.ts +0 -34
- package/dist/components/LeftNav/LeftNav.d.ts.map +0 -1
- package/dist/components/LeftNav/leftNav.types.d.ts +0 -136
- package/dist/components/LeftNav/leftNav.types.d.ts.map +0 -1
- package/dist/components/LeftNav/leftNav.variants.d.ts +0 -143
- package/dist/components/LeftNav/leftNav.variants.d.ts.map +0 -1
- package/dist/components/NumberField/NumberField.d.ts +0 -18
- package/dist/components/NumberField/NumberField.d.ts.map +0 -1
- package/dist/components/NumberField/numberField.types.d.ts +0 -79
- package/dist/components/NumberField/numberField.types.d.ts.map +0 -1
- package/dist/components/NumberField/numberField.variants.d.ts +0 -169
- package/dist/components/NumberField/numberField.variants.d.ts.map +0 -1
- package/dist/components/OTPField/OTPField.d.ts +0 -25
- package/dist/components/OTPField/OTPField.d.ts.map +0 -1
- package/dist/components/OTPField/otpField.types.d.ts +0 -74
- package/dist/components/OTPField/otpField.types.d.ts.map +0 -1
- package/dist/components/OTPField/otpField.variants.d.ts +0 -105
- package/dist/components/OTPField/otpField.variants.d.ts.map +0 -1
- package/dist/components/Pagination/Pagination.d.ts +0 -32
- package/dist/components/Pagination/Pagination.d.ts.map +0 -1
- package/dist/components/Pagination/pagination.helpers.d.ts +0 -23
- package/dist/components/Pagination/pagination.helpers.d.ts.map +0 -1
- package/dist/components/Pagination/pagination.types.d.ts +0 -120
- package/dist/components/Pagination/pagination.types.d.ts.map +0 -1
- package/dist/components/Pagination/pagination.variants.d.ts +0 -150
- package/dist/components/Pagination/pagination.variants.d.ts.map +0 -1
- package/dist/components/Popover/Popover.d.ts +0 -15
- package/dist/components/Popover/Popover.d.ts.map +0 -1
- package/dist/components/Popover/popover.types.d.ts +0 -45
- package/dist/components/Popover/popover.types.d.ts.map +0 -1
- package/dist/components/Popover/popover.variants.d.ts +0 -34
- package/dist/components/Popover/popover.variants.d.ts.map +0 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +0 -35
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +0 -1
- package/dist/components/RadioGroup/radioGroup.types.d.ts +0 -103
- package/dist/components/RadioGroup/radioGroup.types.d.ts.map +0 -1
- package/dist/components/RadioGroup/radioGroup.variants.d.ts +0 -166
- package/dist/components/RadioGroup/radioGroup.variants.d.ts.map +0 -1
- package/dist/components/Skeleton/Skeleton.d.ts +0 -23
- package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/Skeleton/skeleton.types.d.ts +0 -56
- package/dist/components/Skeleton/skeleton.types.d.ts.map +0 -1
- package/dist/components/Skeleton/skeleton.variants.d.ts +0 -110
- package/dist/components/Skeleton/skeleton.variants.d.ts.map +0 -1
- package/dist/components/Snackbar/Snackbar.d.ts +0 -37
- package/dist/components/Snackbar/Snackbar.d.ts.map +0 -1
- package/dist/components/Snackbar/snackbar.types.d.ts +0 -86
- package/dist/components/Snackbar/snackbar.types.d.ts.map +0 -1
- package/dist/components/Snackbar/snackbar.variants.d.ts +0 -153
- package/dist/components/Snackbar/snackbar.variants.d.ts.map +0 -1
- package/dist/components/Stack/Stack.d.ts +0 -24
- package/dist/components/Stack/Stack.d.ts.map +0 -1
- package/dist/components/Stack/stack.types.d.ts +0 -61
- package/dist/components/Stack/stack.types.d.ts.map +0 -1
- package/dist/components/Stack/stack.variants.d.ts +0 -163
- package/dist/components/Stack/stack.variants.d.ts.map +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -15
- package/dist/components/Switch/Switch.d.ts.map +0 -1
- package/dist/components/Switch/switch.types.d.ts +0 -47
- package/dist/components/Switch/switch.types.d.ts.map +0 -1
- package/dist/components/Switch/switch.variants.d.ts +0 -105
- package/dist/components/Switch/switch.variants.d.ts.map +0 -1
- package/dist/components/Table/Table.d.ts +0 -24
- package/dist/components/Table/Table.d.ts.map +0 -1
- package/dist/components/Table/cells/RenderButton.d.ts +0 -13
- package/dist/components/Table/cells/RenderButton.d.ts.map +0 -1
- package/dist/components/Table/cells/RenderChip.d.ts +0 -80
- package/dist/components/Table/cells/RenderChip.d.ts.map +0 -1
- package/dist/components/Table/cells/RenderText.d.ts +0 -21
- package/dist/components/Table/cells/RenderText.d.ts.map +0 -1
- package/dist/components/Table/cells/RenderTwoLine.d.ts +0 -20
- package/dist/components/Table/cells/RenderTwoLine.d.ts.map +0 -1
- package/dist/components/Table/cells/RowActionsMenu.d.ts +0 -36
- package/dist/components/Table/cells/RowActionsMenu.d.ts.map +0 -1
- package/dist/components/Table/cells/index.d.ts +0 -11
- package/dist/components/Table/cells/index.d.ts.map +0 -1
- package/dist/components/Table/table.types.d.ts +0 -399
- package/dist/components/Table/table.types.d.ts.map +0 -1
- package/dist/components/Table/table.variants.d.ts +0 -285
- package/dist/components/Table/table.variants.d.ts.map +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -19
- package/dist/components/Tabs/Tabs.d.ts.map +0 -1
- package/dist/components/Tabs/tabs.types.d.ts +0 -61
- package/dist/components/Tabs/tabs.types.d.ts.map +0 -1
- package/dist/components/Tabs/tabs.variants.d.ts +0 -82
- package/dist/components/Tabs/tabs.variants.d.ts.map +0 -1
- package/dist/components/Tabs/useTabs.d.ts +0 -55
- package/dist/components/Tabs/useTabs.d.ts.map +0 -1
- package/dist/components/TextField/TextField.d.ts +0 -25
- package/dist/components/TextField/TextField.d.ts.map +0 -1
- package/dist/components/TextField/textField.types.d.ts +0 -98
- package/dist/components/TextField/textField.types.d.ts.map +0 -1
- package/dist/components/TextField/textField.variants.d.ts +0 -166
- package/dist/components/TextField/textField.variants.d.ts.map +0 -1
- package/dist/components/Textarea/Textarea.d.ts +0 -16
- package/dist/components/Textarea/Textarea.d.ts.map +0 -1
- package/dist/components/Textarea/textarea.types.d.ts +0 -63
- package/dist/components/Textarea/textarea.types.d.ts.map +0 -1
- package/dist/components/Textarea/textarea.variants.d.ts +0 -197
- package/dist/components/Textarea/textarea.variants.d.ts.map +0 -1
- package/dist/components/TimePicker/TimePicker.d.ts +0 -12
- package/dist/components/TimePicker/TimePicker.d.ts.map +0 -1
- package/dist/components/TimePicker/timePicker.types.d.ts +0 -80
- package/dist/components/TimePicker/timePicker.types.d.ts.map +0 -1
- package/dist/components/TimePicker/timePicker.variants.d.ts +0 -103
- package/dist/components/TimePicker/timePicker.variants.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -29
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/tooltip.types.d.ts +0 -47
- package/dist/components/Tooltip/tooltip.types.d.ts.map +0 -1
- package/dist/components/Tooltip/tooltip.variants.d.ts +0 -34
- package/dist/components/Tooltip/tooltip.variants.d.ts.map +0 -1
- package/dist/components/TopBar/TopBar.d.ts +0 -33
- package/dist/components/TopBar/TopBar.d.ts.map +0 -1
- package/dist/components/TopBar/topBar.types.d.ts +0 -49
- package/dist/components/TopBar/topBar.types.d.ts.map +0 -1
- package/dist/components/TopBar/topBar.variants.d.ts +0 -79
- package/dist/components/TopBar/topBar.variants.d.ts.map +0 -1
- package/dist/components/Typography/Typography.d.ts +0 -42
- package/dist/components/Typography/Typography.d.ts.map +0 -1
- package/dist/components/Typography/typography.types.d.ts +0 -61
- package/dist/components/Typography/typography.types.d.ts.map +0 -1
- package/dist/components/Typography/typography.variants.d.ts +0 -167
- package/dist/components/Typography/typography.variants.d.ts.map +0 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +0 -42
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +0 -1
- package/dist/components/VisuallyHidden/visuallyHidden.types.d.ts +0 -42
- package/dist/components/VisuallyHidden/visuallyHidden.types.d.ts.map +0 -1
- package/dist/components/_shared/data/getNestedValue.d.ts +0 -20
- package/dist/components/_shared/data/getNestedValue.d.ts.map +0 -1
- package/dist/components/_shared/data/useColumnAutoDetect.d.ts +0 -45
- package/dist/components/_shared/data/useColumnAutoDetect.d.ts.map +0 -1
- package/dist/components/_shared/data/useControllableState.d.ts +0 -23
- package/dist/components/_shared/data/useControllableState.d.ts.map +0 -1
- package/dist/components/_shared/data/useDebouncedValue.d.ts +0 -10
- package/dist/components/_shared/data/useDebouncedValue.d.ts.map +0 -1
- package/dist/components/_shared/data/useTableFilter.d.ts +0 -36
- package/dist/components/_shared/data/useTableFilter.d.ts.map +0 -1
- package/dist/components/_shared/data/useTableSearch.d.ts +0 -23
- package/dist/components/_shared/data/useTableSearch.d.ts.map +0 -1
- package/dist/components/_shared/data/useTableSelection.d.ts +0 -25
- package/dist/components/_shared/data/useTableSelection.d.ts.map +0 -1
- package/dist/components/_shared/data/useTableSort.d.ts +0 -20
- package/dist/components/_shared/data/useTableSort.d.ts.map +0 -1
- package/dist/components/_shared/data/useVirtualizer.d.ts +0 -107
- package/dist/components/_shared/data/useVirtualizer.d.ts.map +0 -1
- package/dist/components/_shared/resolveValidationState.d.ts +0 -42
- package/dist/components/_shared/resolveValidationState.d.ts.map +0 -1
- package/dist/hooks/useAccessState.d.ts +0 -37
- package/dist/hooks/useAccessState.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/utils/cn.d.ts +0 -26
- package/dist/utils/cn.d.ts.map +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Size scale — maps to spacing tokens (w/h) and matching stroke
|
|
6
|
+
* width in the variants recipe.
|
|
7
|
+
*/
|
|
8
|
+
export type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Intent color. When omitted, the spinner inherits the parent's
|
|
12
|
+
* text color via `currentColor` — the right default for nested
|
|
13
|
+
* usage (inside Button, Alert, Card, etc.).
|
|
14
|
+
*/
|
|
15
|
+
export type SpinnerColor =
|
|
16
|
+
| 'neutral'
|
|
17
|
+
| 'primary'
|
|
18
|
+
| 'secondary'
|
|
19
|
+
| 'success'
|
|
20
|
+
| 'warning'
|
|
21
|
+
| 'danger'
|
|
22
|
+
| 'info';
|
|
23
|
+
|
|
24
|
+
/** Stroke thickness — 3 steps mapped to SVG stroke-width. */
|
|
25
|
+
export type SpinnerThickness = 'thin' | 'md' | 'thick';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Props for `<Spinner>` — rotating-arc loading indicator.
|
|
29
|
+
*
|
|
30
|
+
* A11y: the spinner renders with `role="status"` + `aria-live="polite"`
|
|
31
|
+
* + a visually-hidden text label (default `'Loading'`). Screen readers
|
|
32
|
+
* announce the label politely (queued, doesn't interrupt) when the
|
|
33
|
+
* spinner mounts.
|
|
34
|
+
*
|
|
35
|
+
* Performance: SVG `animate-spin` (Tailwind built-in) — pure CSS,
|
|
36
|
+
* GPU-accelerated, motion-reduce-safe (skips animation entirely
|
|
37
|
+
* under `prefers-reduced-motion`).
|
|
38
|
+
*/
|
|
39
|
+
export interface SpinnerProps {
|
|
40
|
+
// ─── Visual ────────────────────────────────────────────────────
|
|
41
|
+
/** @default 'md' */
|
|
42
|
+
size?: SpinnerSize;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Intent color. **When omitted, inherits parent's text color via
|
|
46
|
+
* `currentColor`** — works seamlessly inside Button, Alert, Card,
|
|
47
|
+
* or any colored container without configuration. Pass explicitly
|
|
48
|
+
* for standalone usage on neutral surfaces.
|
|
49
|
+
*/
|
|
50
|
+
color?: SpinnerColor;
|
|
51
|
+
|
|
52
|
+
/** @default 'md' */
|
|
53
|
+
thickness?: SpinnerThickness;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Renders a faint "ghost ring" behind the spinning arc (20%
|
|
57
|
+
* opacity of `currentColor`). Improves contrast on busy or dark
|
|
58
|
+
* backgrounds, reads as more "premium" on slow operations.
|
|
59
|
+
*
|
|
60
|
+
* Visually: WITHOUT track you see a rotating partial arc (3/4
|
|
61
|
+
* circle missing in any frame). WITH track you see the full
|
|
62
|
+
* circle (low-opacity) AND the arc on top. The track stays put
|
|
63
|
+
* while the arc rotates.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
withTrack?: boolean;
|
|
68
|
+
|
|
69
|
+
// ─── A11y ──────────────────────────────────────────────────────
|
|
70
|
+
/**
|
|
71
|
+
* Accessible label announced by screen readers via
|
|
72
|
+
* `role="status"` + `aria-live="polite"`. Rendered as a visually-
|
|
73
|
+
* hidden `<span>` inside the spinner.
|
|
74
|
+
* @default 'Loading'
|
|
75
|
+
*/
|
|
76
|
+
label?: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Wait N milliseconds before rendering — prevents a flash of the
|
|
80
|
+
* spinner on quick operations (Atlassian-style anti-flash). The
|
|
81
|
+
* spinner mounts as `null` for the first N ms, then swaps to the
|
|
82
|
+
* actual SVG. Pairs naturally with `visibleWhen`.
|
|
83
|
+
*
|
|
84
|
+
* Common pattern:
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <Spinner
|
|
87
|
+
* visibleWhen={(e) => e.isSubmitting()}
|
|
88
|
+
* delay={150}
|
|
89
|
+
* />
|
|
90
|
+
* // Spinner appears only when isSubmitting AND that has been
|
|
91
|
+
* // true for 150ms — quick submits never flash.
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @default 0
|
|
95
|
+
*/
|
|
96
|
+
delay?: number;
|
|
97
|
+
|
|
98
|
+
// ─── Bridge ────────────────────────────────────────────────────
|
|
99
|
+
/**
|
|
100
|
+
* Reactive visibility predicate — same contract as Alert/Chip/
|
|
101
|
+
* Button/etc. Spinner is intrinsically conditional (loading IS a
|
|
102
|
+
* state), so this fits naturally even though the component is
|
|
103
|
+
* otherwise display-only.
|
|
104
|
+
*/
|
|
105
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
106
|
+
|
|
107
|
+
// No `access` — loading state is not permission-driven by
|
|
108
|
+
// category. For permission-gated spinners, wrap in `<Box access>`.
|
|
109
|
+
|
|
110
|
+
// ─── Override ──────────────────────────────────────────────────
|
|
111
|
+
className?: string;
|
|
112
|
+
sx?: ClassValue;
|
|
113
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
2
|
+
import type { SpinnerColor } from './spinner.types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind-variants recipe for `<Spinner>`.
|
|
6
|
+
*
|
|
7
|
+
* Axes:
|
|
8
|
+
* - `size` — 5 steps (xs/sm/md/lg/xl) → w/h spacing tokens
|
|
9
|
+
* - `thickness` — 3 steps (thin/md/thick) → SVG stroke-width
|
|
10
|
+
* - `color` — 7 intents (or omitted → `currentColor`)
|
|
11
|
+
*
|
|
12
|
+
* The stroke + fill of the SVG paths are governed by
|
|
13
|
+
* `stroke="currentColor"` (set inline in Spinner.tsx), so the root
|
|
14
|
+
* `text-*` class drives the color. When `color` is omitted, no
|
|
15
|
+
* `text-*` class is emitted at all — `currentColor` resolves to
|
|
16
|
+
* whatever the parent's text color is.
|
|
17
|
+
*/
|
|
18
|
+
export const spinnerVariants = tv({
|
|
19
|
+
base: 'inline-block animate-spin motion-reduce:animate-none',
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
xs: 'w-3 h-3',
|
|
23
|
+
sm: 'w-4 h-4',
|
|
24
|
+
md: 'w-5 h-5',
|
|
25
|
+
lg: 'w-6 h-6',
|
|
26
|
+
xl: 'w-8 h-8',
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Color → text-{color}-600 (mid-tone, readable on most surfaces).
|
|
30
|
+
* Note: text-{color}-600 acts on currentColor inside the SVG via
|
|
31
|
+
* `stroke="currentColor"`. Neutral uses `text-neutral-600` which
|
|
32
|
+
* auto-inverts via the dashforgePreset CSS-var swap (no `dark:`
|
|
33
|
+
* needed). Color rows do NOT carry `dark:` either — the chosen
|
|
34
|
+
* 600 step works in both modes for the spinner's specific use
|
|
35
|
+
* (small element, brief visibility).
|
|
36
|
+
*/
|
|
37
|
+
color: {
|
|
38
|
+
neutral: 'text-neutral-600',
|
|
39
|
+
primary: 'text-primary-600',
|
|
40
|
+
secondary: 'text-secondary-600',
|
|
41
|
+
success: 'text-success-600',
|
|
42
|
+
warning: 'text-warning-600',
|
|
43
|
+
danger: 'text-danger-600',
|
|
44
|
+
info: 'text-info-600',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: 'md',
|
|
49
|
+
// No default `color` — when omitted, the spinner inherits via
|
|
50
|
+
// `currentColor`, which is the right default for nested use.
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* SVG stroke-width per thickness step. Picked to read well at every
|
|
58
|
+
* size — thin (1.5px) is the minimum readable; thick (3px) saturates
|
|
59
|
+
* the available radius at sizes xs/sm.
|
|
60
|
+
*/
|
|
61
|
+
export const SPINNER_STROKE_WIDTH: Record<'thin' | 'md' | 'thick', number> = {
|
|
62
|
+
thin: 1.5,
|
|
63
|
+
md: 2.25,
|
|
64
|
+
thick: 3,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The track ring renders at this opacity of `currentColor`. 0.2 is
|
|
69
|
+
* the sweet spot — visible enough to anchor the eye, faint enough
|
|
70
|
+
* to read as background.
|
|
71
|
+
*/
|
|
72
|
+
export const SPINNER_TRACK_OPACITY = 0.2;
|
|
73
|
+
|
|
74
|
+
/** Re-export the color name list so playground demos can iterate. */
|
|
75
|
+
export const SPINNER_COLORS: SpinnerColor[] = [
|
|
76
|
+
'neutral',
|
|
77
|
+
'primary',
|
|
78
|
+
'secondary',
|
|
79
|
+
'success',
|
|
80
|
+
'warning',
|
|
81
|
+
'danger',
|
|
82
|
+
'info',
|
|
83
|
+
];
|
|
@@ -1,100 +1,37 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Chip } from '../../Chip/Chip.js';
|
|
3
|
+
import type { ChipProps } from '../../Chip/chip.types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Internal mini-chip used by the cell renderer library.
|
|
7
|
-
* from `@dashforge/tw` as a standalone component (per Sprint 4.1
|
|
8
|
-
* scope decision — a standalone `<Chip>` may ship in Sprint 5 if
|
|
9
|
-
* demand emerges).
|
|
6
|
+
* Internal mini-chip used by the Table cell renderer library.
|
|
10
7
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* **Sprint 4.4 refactor**: this component used to own its own
|
|
9
|
+
* `chipVariants` recipe (the 3 × 7 variant × color matrix). The
|
|
10
|
+
* matrix has since been promoted to the public `<Chip>` at
|
|
11
|
+
* `components/Chip/Chip.tsx` as the single source of truth.
|
|
12
|
+
* `RenderChip` is now a thin wrapper that translates its
|
|
13
|
+
* `children`-style API to `<Chip label={…}>` without any visual
|
|
14
|
+
* change. Table cell consumers keep working unchanged.
|
|
15
|
+
*
|
|
16
|
+
* For new code, prefer importing `<Chip>` from `@dashforge/tw`
|
|
17
|
+
* directly — `RenderChip` exists only for the Table cell renderer
|
|
18
|
+
* registry where the `children` prop convention pre-dates the
|
|
19
|
+
* public Chip API.
|
|
16
20
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'inline-flex items-center gap-1 rounded-full font-medium',
|
|
20
|
-
'whitespace-nowrap',
|
|
21
|
-
],
|
|
22
|
-
variants: {
|
|
23
|
-
color: {
|
|
24
|
-
neutral: '',
|
|
25
|
-
primary: '',
|
|
26
|
-
success: '',
|
|
27
|
-
warning: '',
|
|
28
|
-
danger: '',
|
|
29
|
-
info: '',
|
|
30
|
-
secondary: '',
|
|
31
|
-
},
|
|
32
|
-
variant: {
|
|
33
|
-
soft: '',
|
|
34
|
-
solid: '',
|
|
35
|
-
outline: '',
|
|
36
|
-
},
|
|
37
|
-
size: {
|
|
38
|
-
sm: 'h-5 px-2 text-xs',
|
|
39
|
-
md: 'h-6 px-2.5 text-xs',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
compoundVariants: [
|
|
43
|
-
// soft = subtle bg + dark text.
|
|
44
|
-
// Neutral row uses NO `dark:` variants — the dashforgePreset()
|
|
45
|
-
// CSS-var swap auto-inverts the neutral palette already.
|
|
46
|
-
// Color rows below KEEP `dark:` variants because color palettes
|
|
47
|
-
// don't auto-invert: the `dark:` shift is an intentional design
|
|
48
|
-
// choice (darker bg + lighter text in dark mode for visual cohesion).
|
|
49
|
-
{ variant: 'soft', color: 'neutral', class: 'bg-neutral-100 text-neutral-700' },
|
|
50
|
-
{ variant: 'soft', color: 'primary', class: 'bg-primary-100 dark:bg-primary-950 text-primary-700 dark:text-primary-300' },
|
|
51
|
-
{ variant: 'soft', color: 'success', class: 'bg-success-100 dark:bg-success-950 text-success-700 dark:text-success-300' },
|
|
52
|
-
{ variant: 'soft', color: 'warning', class: 'bg-warning-100 dark:bg-warning-950 text-warning-700 dark:text-warning-300' },
|
|
53
|
-
{ variant: 'soft', color: 'danger', class: 'bg-danger-100 dark:bg-danger-950 text-danger-700 dark:text-danger-300' },
|
|
54
|
-
{ variant: 'soft', color: 'info', class: 'bg-info-100 dark:bg-info-950 text-info-700 dark:text-info-300' },
|
|
55
|
-
{ variant: 'soft', color: 'secondary', class: 'bg-secondary-100 dark:bg-secondary-950 text-secondary-700 dark:text-secondary-300' },
|
|
56
|
-
// solid = full bg + contrasting text.
|
|
57
|
-
// solid neutral: both `bg-neutral-700` and `text-neutral-50` sit
|
|
58
|
-
// on the neutral palette, so they auto-invert together via the
|
|
59
|
-
// CSS-var swap — bg/text contrast is preserved in BOTH modes.
|
|
60
|
-
// (`text-white` is deliberately NOT used here: white does not
|
|
61
|
-
// auto-invert, which would flip the contrast in dark mode.)
|
|
62
|
-
{ variant: 'solid', color: 'neutral', class: 'bg-neutral-700 text-neutral-50' },
|
|
63
|
-
{ variant: 'solid', color: 'primary', class: 'bg-primary-500 text-white' },
|
|
64
|
-
{ variant: 'solid', color: 'success', class: 'bg-success-500 text-white' },
|
|
65
|
-
{ variant: 'solid', color: 'warning', class: 'bg-warning-500 text-white' },
|
|
66
|
-
{ variant: 'solid', color: 'danger', class: 'bg-danger-500 text-white' },
|
|
67
|
-
{ variant: 'solid', color: 'info', class: 'bg-info-500 text-white' },
|
|
68
|
-
{ variant: 'solid', color: 'secondary', class: 'bg-secondary-500 text-white' },
|
|
69
|
-
// outline = border + colored text
|
|
70
|
-
// outline neutral: both border + text auto-invert via CSS-var swap.
|
|
71
|
-
{ variant: 'outline', color: 'neutral', class: 'border border-neutral-300 text-neutral-700' },
|
|
72
|
-
{ variant: 'outline', color: 'primary', class: 'border border-primary-500 text-primary-700 dark:text-primary-300' },
|
|
73
|
-
{ variant: 'outline', color: 'success', class: 'border border-success-500 text-success-700 dark:text-success-300' },
|
|
74
|
-
{ variant: 'outline', color: 'warning', class: 'border border-warning-500 text-warning-700 dark:text-warning-300' },
|
|
75
|
-
{ variant: 'outline', color: 'danger', class: 'border border-danger-500 text-danger-700 dark:text-danger-300' },
|
|
76
|
-
{ variant: 'outline', color: 'info', class: 'border border-info-500 text-info-700 dark:text-info-300' },
|
|
77
|
-
{ variant: 'outline', color: 'secondary', class: 'border border-secondary-500 text-secondary-700 dark:text-secondary-300' },
|
|
78
|
-
],
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
color: 'neutral',
|
|
81
|
-
variant: 'soft',
|
|
82
|
-
size: 'sm',
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
type ChipVariants = VariantProps<typeof chipVariants>;
|
|
87
|
-
|
|
88
|
-
export interface RenderChipProps extends ChipVariants {
|
|
21
|
+
export interface RenderChipProps
|
|
22
|
+
extends Pick<ChipProps, 'color' | 'variant' | 'size' | 'className'> {
|
|
89
23
|
children: ReactNode;
|
|
90
|
-
className?: string;
|
|
91
24
|
}
|
|
92
25
|
|
|
93
26
|
export function RenderChip(props: RenderChipProps) {
|
|
94
27
|
const { children, color, variant, size, className } = props;
|
|
95
28
|
return (
|
|
96
|
-
<
|
|
97
|
-
{children}
|
|
98
|
-
|
|
29
|
+
<Chip
|
|
30
|
+
label={children}
|
|
31
|
+
color={color}
|
|
32
|
+
variant={variant}
|
|
33
|
+
size={size}
|
|
34
|
+
className={className}
|
|
35
|
+
/>
|
|
99
36
|
);
|
|
100
37
|
}
|
|
@@ -57,7 +57,7 @@ export function RowActionsMenu<T>(props: RowActionsMenuProps<T>) {
|
|
|
57
57
|
side="bottom"
|
|
58
58
|
align="end"
|
|
59
59
|
content={
|
|
60
|
-
<ul className="flex flex-col gap-0.5 min-w-[140px]" role="menu">
|
|
60
|
+
<ul className="flex flex-col gap-0.5 min-w-[140px] list-none pl-0 m-0" role="menu">
|
|
61
61
|
{visibleActions.map((action, idx) => (
|
|
62
62
|
<RowActionMenuItem
|
|
63
63
|
key={idx}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `_shared/severity/` — foundation for every severity-aware
|
|
3
|
+
* component in `@dashforge/tw` (Alert, refactored Snackbar, future
|
|
4
|
+
* Banner / status indicators).
|
|
5
|
+
*
|
|
6
|
+
* Centralising:
|
|
7
|
+
* - the `Severity` and `SeverityVariant` taxonomies (mirror MUI;
|
|
8
|
+
* `danger` not `error` for token alignment)
|
|
9
|
+
* - the 3×4 token-driven color matrix (token-resolved, no hardcoded
|
|
10
|
+
* hex, no `dark:` variants on neutral)
|
|
11
|
+
* - the default per-severity inline SVG icons (`icon={false}` opt-out
|
|
12
|
+
* supported on consumer components)
|
|
13
|
+
* - the ARIA role helper (`alert` vs `status`)
|
|
14
|
+
*
|
|
15
|
+
* Consumers (Alert, Snackbar) import from this barrel — never reach
|
|
16
|
+
* into the individual files.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export type {
|
|
20
|
+
Severity,
|
|
21
|
+
SeverityClasses,
|
|
22
|
+
SeverityVariant,
|
|
23
|
+
} from './severity.types.js';
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
getSeverityClasses,
|
|
27
|
+
getSeverityRole,
|
|
28
|
+
} from './severityVariants.js';
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
SEVERITY_DEFAULT_ICON,
|
|
32
|
+
getDefaultSeverityIcon,
|
|
33
|
+
} from './severityIcons.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared severity types — consumed by every component that surfaces
|
|
3
|
+
* a "semantic visual tone" (Alert, Snackbar, Banner, Badge, Chip when
|
|
4
|
+
* acting as a status indicator, …).
|
|
5
|
+
*
|
|
6
|
+
* **Naming choice**: we follow MUI's `severity` taxonomy
|
|
7
|
+
* (`info / success / warning / danger`) and `variant` taxonomy
|
|
8
|
+
* (`standard / filled / outlined`) so consumers porting from MUI keep
|
|
9
|
+
* their muscle memory. The single Dashforge-specific divergence is
|
|
10
|
+
* `danger` (not MUI's `error`) — chosen to match the `danger.*` token
|
|
11
|
+
* palette in `@dashforge/tw-tokens`. Semantically identical to MUI's
|
|
12
|
+
* `error`; documented in the migration guide.
|
|
13
|
+
*
|
|
14
|
+
* @module @dashforge/tw/_shared/severity
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Visual severity — drives the color treatment of a component.
|
|
19
|
+
* `danger` instead of `error` for token-palette alignment.
|
|
20
|
+
*/
|
|
21
|
+
export type Severity = 'info' | 'success' | 'warning' | 'danger';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Variant of the severity surface. Mirrors MUI's `Alert` variant axis
|
|
25
|
+
* 1:1 so the migration story is trivial.
|
|
26
|
+
*
|
|
27
|
+
* - `standard` (default) — tinted soft background with severity-toned
|
|
28
|
+
* text. The "all-purpose" reading. Most modern design systems call
|
|
29
|
+
* this "soft".
|
|
30
|
+
* - `filled` — solid severity background with light text. Strong
|
|
31
|
+
* visual weight, for high-priority callouts.
|
|
32
|
+
* - `outlined` — transparent background with severity border and
|
|
33
|
+
* severity-toned text. Minimal weight, for dense layouts.
|
|
34
|
+
*/
|
|
35
|
+
export type SeverityVariant = 'standard' | 'filled' | 'outlined';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Per-slot Tailwind class strings emitted by the severity matrix for
|
|
39
|
+
* one (variant, severity) pair. Resolved through `dashforgePreset()`
|
|
40
|
+
* to CSS variables → patch-theme friendly.
|
|
41
|
+
*/
|
|
42
|
+
export interface SeverityClasses {
|
|
43
|
+
/** `<root>` surface: background + text + border base. */
|
|
44
|
+
surface: string;
|
|
45
|
+
/** Border overrides (kept separate from `surface` so components can
|
|
46
|
+
* swap `border-2` etc. without losing the color). */
|
|
47
|
+
border: string;
|
|
48
|
+
/** Icon container color (uses `currentColor` on the inner SVG). */
|
|
49
|
+
icon: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode, SVGProps } from 'react';
|
|
2
|
+
import type { Severity } from './severity.types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Default severity icons — inline stroke SVG, no runtime icon dep.
|
|
6
|
+
*
|
|
7
|
+
* Convention copied from `Calendar` / `Autocomplete` (existing pattern
|
|
8
|
+
* in the lib): icons live INLINE inside the component module, never as
|
|
9
|
+
* imports from an external icon library. The "no icons in the library"
|
|
10
|
+
* principle means **no external icon package** (`lucide-react`,
|
|
11
|
+
* `phosphor-icons`, etc.) — small file-local SVG functions are
|
|
12
|
+
* allowed and already used.
|
|
13
|
+
*
|
|
14
|
+
* All icons:
|
|
15
|
+
* - 20×20 viewBox (5:1 ratio of intrinsic size to body text-sm)
|
|
16
|
+
* - `stroke="currentColor"` — colored via the parent's
|
|
17
|
+
* `text-<severity>-600` class through the severity matrix
|
|
18
|
+
* - `fill="none"` — outline style, matches Tabler / Heroicons /
|
|
19
|
+
* Phosphor-outline conventions, low visual weight
|
|
20
|
+
* - `aria-hidden="true"` — the message text carries the semantic;
|
|
21
|
+
* the icon is decorative reinforcement, not the announcement
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
type IconProps = SVGProps<SVGSVGElement>;
|
|
25
|
+
|
|
26
|
+
const BASE_PROPS: IconProps = {
|
|
27
|
+
width: '1.25em',
|
|
28
|
+
height: '1.25em',
|
|
29
|
+
viewBox: '0 0 20 20',
|
|
30
|
+
fill: 'none',
|
|
31
|
+
stroke: 'currentColor',
|
|
32
|
+
strokeWidth: 1.5,
|
|
33
|
+
strokeLinecap: 'round',
|
|
34
|
+
strokeLinejoin: 'round',
|
|
35
|
+
'aria-hidden': 'true',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function InfoIcon(props: IconProps) {
|
|
39
|
+
return (
|
|
40
|
+
<svg {...BASE_PROPS} {...props}>
|
|
41
|
+
<circle cx="10" cy="10" r="8.25" />
|
|
42
|
+
<path d="M10 6.5h.01M10 9.5v4" />
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SuccessIcon(props: IconProps) {
|
|
48
|
+
return (
|
|
49
|
+
<svg {...BASE_PROPS} {...props}>
|
|
50
|
+
<circle cx="10" cy="10" r="8.25" />
|
|
51
|
+
<path d="m6.5 10 2.5 2.5 4.5-5" />
|
|
52
|
+
</svg>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function WarningIcon(props: IconProps) {
|
|
57
|
+
return (
|
|
58
|
+
<svg {...BASE_PROPS} {...props}>
|
|
59
|
+
<path d="M10 2.5 18 17H2L10 2.5Z" />
|
|
60
|
+
<path d="M10 8v3.5M10 14.5h.01" />
|
|
61
|
+
</svg>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function DangerIcon(props: IconProps) {
|
|
66
|
+
return (
|
|
67
|
+
<svg {...BASE_PROPS} {...props}>
|
|
68
|
+
<circle cx="10" cy="10" r="8.25" />
|
|
69
|
+
<path d="m7 7 6 6M13 7l-6 6" />
|
|
70
|
+
</svg>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Map of severity → default Icon component. Used by Alert (and
|
|
76
|
+
* eventually Snackbar / Banner / etc.) to render the per-severity
|
|
77
|
+
* default when the consumer doesn't pass a custom `icon` prop and
|
|
78
|
+
* doesn't opt-out with `icon={false}`.
|
|
79
|
+
*/
|
|
80
|
+
export const SEVERITY_DEFAULT_ICON: Record<Severity, ComponentType<IconProps>> = {
|
|
81
|
+
info: InfoIcon,
|
|
82
|
+
success: SuccessIcon,
|
|
83
|
+
warning: WarningIcon,
|
|
84
|
+
danger: DangerIcon,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Convenience helper — render the default icon for a severity as a
|
|
89
|
+
* `ReactNode`, ready to inject into a JSX slot.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* <span className={severityClasses.icon}>
|
|
93
|
+
* {getDefaultSeverityIcon('warning')}
|
|
94
|
+
* </span>
|
|
95
|
+
*/
|
|
96
|
+
export function getDefaultSeverityIcon(severity: Severity): ReactNode {
|
|
97
|
+
const Icon = SEVERITY_DEFAULT_ICON[severity];
|
|
98
|
+
return <Icon />;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Re-export individual icons for cases where a consumer wants the same
|
|
102
|
+
// glyph in a custom context (e.g. inline in a paragraph). Not part of
|
|
103
|
+
// the public `@dashforge/tw` barrel — internal use only.
|
|
104
|
+
export { InfoIcon, SuccessIcon, WarningIcon, DangerIcon };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
getSeverityClasses,
|
|
4
|
+
getSeverityRole,
|
|
5
|
+
} from './severityVariants.js';
|
|
6
|
+
import { SEVERITY_DEFAULT_ICON } from './severityIcons.js';
|
|
7
|
+
import type { Severity, SeverityVariant } from './severity.types.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Exhaustive coverage of the 3×4 severity matrix.
|
|
11
|
+
*
|
|
12
|
+
* The matrix is the foundation every severity-aware component reads
|
|
13
|
+
* from. Regressions here ripple through Alert, Snackbar, future
|
|
14
|
+
* Banner, etc. — so we lock down every cell, the role helper, and the
|
|
15
|
+
* default-icon map.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const SEVERITIES: Severity[] = ['info', 'success', 'warning', 'danger'];
|
|
19
|
+
const VARIANTS: SeverityVariant[] = ['standard', 'filled', 'outlined'];
|
|
20
|
+
|
|
21
|
+
describe('getSeverityClasses', () => {
|
|
22
|
+
it('returns a SeverityClasses object for every (variant, severity) pair', () => {
|
|
23
|
+
for (const variant of VARIANTS) {
|
|
24
|
+
for (const severity of SEVERITIES) {
|
|
25
|
+
const classes = getSeverityClasses(variant, severity);
|
|
26
|
+
expect(classes).toBeDefined();
|
|
27
|
+
expect(typeof classes.surface).toBe('string');
|
|
28
|
+
expect(typeof classes.border).toBe('string');
|
|
29
|
+
expect(typeof classes.icon).toBe('string');
|
|
30
|
+
expect(classes.surface.length).toBeGreaterThan(0);
|
|
31
|
+
expect(classes.border.length).toBeGreaterThan(0);
|
|
32
|
+
expect(classes.icon.length).toBeGreaterThan(0);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('uses token-driven color utilities (no hardcoded hex, no dark: variants)', () => {
|
|
38
|
+
for (const variant of VARIANTS) {
|
|
39
|
+
for (const severity of SEVERITIES) {
|
|
40
|
+
const classes = getSeverityClasses(variant, severity);
|
|
41
|
+
const all = `${classes.surface} ${classes.border} ${classes.icon}`;
|
|
42
|
+
// No hex literals
|
|
43
|
+
expect(all).not.toMatch(/#[0-9a-fA-F]{3,8}/);
|
|
44
|
+
// No dark: variants — preset auto-inverts neutral via CSS var swap
|
|
45
|
+
expect(all).not.toMatch(/\bdark:/);
|
|
46
|
+
// Severity palette names appear in the utilities
|
|
47
|
+
if (severity === 'info' || severity === 'success' || severity === 'warning' || severity === 'danger') {
|
|
48
|
+
expect(all).toContain(severity);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('standard variant — tinted soft surface', () => {
|
|
55
|
+
it.each(SEVERITIES)('uses bg-<severity>-50 + text-<severity>-900 for %s', (sev) => {
|
|
56
|
+
const { surface } = getSeverityClasses('standard', sev);
|
|
57
|
+
expect(surface).toContain(`bg-${sev}-50`);
|
|
58
|
+
expect(surface).toContain(`text-${sev}-900`);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it.each(SEVERITIES)('uses border-<severity>-100 for %s', (sev) => {
|
|
62
|
+
const { border } = getSeverityClasses('standard', sev);
|
|
63
|
+
expect(border).toContain(`border-${sev}-100`);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it.each(SEVERITIES)('uses text-<severity>-600 for icon in %s', (sev) => {
|
|
67
|
+
const { icon } = getSeverityClasses('standard', sev);
|
|
68
|
+
expect(icon).toContain(`text-${sev}-600`);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('filled variant — solid colored surface', () => {
|
|
73
|
+
it.each(SEVERITIES)('uses bg-<severity>-600 + text-<severity>-50 for %s', (sev) => {
|
|
74
|
+
const { surface } = getSeverityClasses('filled', sev);
|
|
75
|
+
expect(surface).toContain(`bg-${sev}-600`);
|
|
76
|
+
expect(surface).toContain(`text-${sev}-50`);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it.each(SEVERITIES)('uses border-<severity>-700 for %s', (sev) => {
|
|
80
|
+
const { border } = getSeverityClasses('filled', sev);
|
|
81
|
+
expect(border).toContain(`border-${sev}-700`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it.each(SEVERITIES)('icon inherits the light tone (text-<severity>-50) for %s', (sev) => {
|
|
85
|
+
const { icon } = getSeverityClasses('filled', sev);
|
|
86
|
+
expect(icon).toContain(`text-${sev}-50`);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('outlined variant — transparent surface', () => {
|
|
91
|
+
it.each(SEVERITIES)('uses bg-transparent + text-<severity>-700 for %s', (sev) => {
|
|
92
|
+
const { surface } = getSeverityClasses('outlined', sev);
|
|
93
|
+
expect(surface).toContain('bg-transparent');
|
|
94
|
+
expect(surface).toContain(`text-${sev}-700`);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it.each(SEVERITIES)('uses border-<severity>-300 for %s', (sev) => {
|
|
98
|
+
const { border } = getSeverityClasses('outlined', sev);
|
|
99
|
+
expect(border).toContain(`border-${sev}-300`);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('never reuses primary-* for info severity (info has its own token scale)', () => {
|
|
104
|
+
// Regression: Snackbar 1.0.x aliased `info` to `primary-*`. The
|
|
105
|
+
// shared foundation MUST use the dedicated `info-*` scale so a
|
|
106
|
+
// patchTheme({ info: … }) call does not bleed into primary.
|
|
107
|
+
for (const variant of VARIANTS) {
|
|
108
|
+
const classes = getSeverityClasses(variant, 'info');
|
|
109
|
+
const all = `${classes.surface} ${classes.border} ${classes.icon}`;
|
|
110
|
+
expect(all).not.toMatch(/\bprimary-/);
|
|
111
|
+
expect(all).toContain('info-');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('getSeverityRole', () => {
|
|
117
|
+
it('returns "alert" for assertive severities (warning, danger)', () => {
|
|
118
|
+
expect(getSeverityRole('warning')).toBe('alert');
|
|
119
|
+
expect(getSeverityRole('danger')).toBe('alert');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('returns "status" for polite severities (info, success)', () => {
|
|
123
|
+
expect(getSeverityRole('info')).toBe('status');
|
|
124
|
+
expect(getSeverityRole('success')).toBe('status');
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
describe('SEVERITY_DEFAULT_ICON', () => {
|
|
129
|
+
it('exposes a default icon component for every severity', () => {
|
|
130
|
+
for (const sev of SEVERITIES) {
|
|
131
|
+
const Icon = SEVERITY_DEFAULT_ICON[sev];
|
|
132
|
+
expect(Icon).toBeDefined();
|
|
133
|
+
expect(typeof Icon).toBe('function');
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|