@indico-data/design-system 3.18.0 → 3.20.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/.eslintrc.js +87 -2
- package/.husky/pre-commit +2 -0
- package/.vscode/settings.json +10 -1
- package/lib/components/badge/Badge.d.ts +1 -1
- package/lib/components/badge/Badge.stories.d.ts +1 -1
- package/lib/components/button/Button.d.ts +2 -2
- package/lib/components/button/Button.stories.d.ts +1 -1
- package/lib/components/button/types.d.ts +1 -1
- package/lib/components/card/Card.d.ts +1 -1
- package/lib/components/card/Card.stories.d.ts +1 -1
- package/lib/components/floatUI/FloatUI.d.ts +1 -1
- package/lib/components/floatUI/FloatUI.stories.d.ts +2 -2
- package/lib/components/floatUI/types.d.ts +2 -2
- package/lib/components/forms/checkbox/Checkbox.stories.d.ts +1 -1
- package/lib/components/forms/date/datePicker/DatePicker.d.ts +1 -1
- package/lib/components/forms/date/datePicker/DatePicker.stories.d.ts +1 -1
- package/lib/components/forms/date/datePicker/contants.d.ts +1 -1
- package/lib/components/forms/date/datePicker/types.d.ts +8 -1
- package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +7 -4
- package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.d.ts +1 -1
- package/lib/components/forms/date/iconTriggerDatePicker/types.d.ts +5 -0
- package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +4 -3
- package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.d.ts +1 -1
- package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +7 -4
- package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.d.ts +1 -1
- package/lib/components/forms/date/inputDateRangePicker/types.d.ts +7 -0
- package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +4 -3
- package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.d.ts +1 -1
- package/lib/components/forms/form/Form.d.ts +1 -1
- package/lib/components/forms/form/Form.stories.d.ts +1 -1
- package/lib/components/forms/input/Input.d.ts +2 -2
- package/lib/components/forms/input/Input.stories.d.ts +1 -1
- package/lib/components/forms/numberInput/NumberInput.d.ts +2 -2
- package/lib/components/forms/numberInput/NumberInput.stories.d.ts +1 -1
- package/lib/components/forms/passwordInput/PasswordInput.d.ts +1 -1
- package/lib/components/forms/passwordInput/PasswordInput.stories.d.ts +1 -1
- package/lib/components/forms/radio/Radio.stories.d.ts +1 -1
- package/lib/components/forms/select/Select.d.ts +4 -2
- package/lib/components/forms/select/Select.stories.d.ts +4 -4
- package/lib/components/forms/select/types.d.ts +11 -1
- package/lib/components/forms/subcomponents/Label.d.ts +5 -1
- package/lib/components/forms/subcomponents/types.d.ts +5 -0
- package/lib/components/forms/textarea/Textarea.d.ts +1 -1
- package/lib/components/forms/textarea/Textarea.stories.d.ts +1 -1
- package/lib/components/forms/timePicker/TimePicker.d.ts +4 -1
- package/lib/components/forms/timePicker/types.d.ts +5 -0
- package/lib/components/forms/toggle/Toggle.stories.d.ts +1 -1
- package/lib/components/grid/col/Col.d.ts +1 -1
- package/lib/components/grid/col/Col.stories.d.ts +1 -1
- package/lib/components/grid/container/Container.d.ts +1 -1
- package/lib/components/grid/container/Container.stories.d.ts +1 -1
- package/lib/components/grid/row/Row.d.ts +1 -1
- package/lib/components/grid/row/Row.stories.d.ts +1 -1
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/Icon.stories.d.ts +2 -2
- package/lib/components/icons/indicons.d.ts +1 -1
- package/lib/components/icons/types.d.ts +4 -4
- package/lib/components/loading-indicators/BarSpinner/BarSpinner.stories.d.ts +1 -1
- package/lib/components/loading-indicators/CirclePulse/CirclePulse.stories.d.ts +1 -1
- package/lib/components/menu/Menu.stories.d.ts +2 -2
- package/lib/components/modal/ConfirmationModal.d.ts +2 -2
- package/lib/components/modal/Modal.d.ts +2 -2
- package/lib/components/modal/Modal.stories.d.ts +6 -2
- package/lib/components/modal/types.d.ts +21 -7
- package/lib/components/pagination/Pagination.d.ts +2 -2
- package/lib/components/pagination/Pagination.stories.d.ts +1 -1
- package/lib/components/pagination/index.d.ts +1 -0
- package/lib/components/pagination/types.d.ts +13 -0
- package/lib/components/pill/Pill.d.ts +1 -1
- package/lib/components/pill/Pill.stories.d.ts +1 -1
- package/lib/components/pill/types.d.ts +2 -2
- package/lib/components/skeleton/Skeleton.stories.d.ts +1 -1
- package/lib/components/stepper/Stepper.d.ts +2 -2
- package/lib/components/stepper/Stepper.stories.d.ts +1 -1
- package/lib/components/stepper/components/BackNavigation.d.ts +2 -1
- package/lib/components/stepper/components/Legend.d.ts +1 -1
- package/lib/components/stepper/components/NextNavigation.d.ts +3 -1
- package/lib/components/stepper/types.d.ts +12 -1
- package/lib/components/table/LoadingComponent.d.ts +5 -1
- package/lib/components/table/Table.d.ts +1 -1
- package/lib/components/table/Table.stories.d.ts +2 -2
- package/lib/components/table/components/HorizontalStickyHeader.d.ts +4 -1
- package/lib/components/table/components/helpers.d.ts +1 -1
- package/lib/components/table/hooks/usePinnedColumnsManager.d.ts +2 -2
- package/lib/components/table/sampleData.d.ts +1 -1
- package/lib/components/table/types.d.ts +20 -2
- package/lib/components/table/utils/processColumns.d.ts +2 -2
- package/lib/components/tanstackTable/TankstackTable.types.d.ts +20 -3
- package/lib/components/tanstackTable/TanstackTable.d.ts +2 -2
- package/lib/components/tanstackTable/TanstackTable.stories.d.ts +2 -2
- package/lib/components/tanstackTable/__tests__/__mocks__/test-mock-data.d.ts +1 -1
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.d.ts +2 -2
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.stories.d.ts +1 -1
- package/lib/components/tanstackTable/components/NoResults/NoResults.d.ts +2 -1
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +1 -1
- package/lib/components/tanstackTable/components/TableHeader/TableHeader.d.ts +1 -1
- package/lib/components/tanstackTable/components/TableLoading/TableLoading.d.ts +1 -1
- package/lib/components/tanstackTable/components/TablePagination/TablePagination.d.ts +3 -1
- package/lib/components/tanstackTable/docs/internalSorting/InternalClientSideSorting.stories.d.ts +2 -2
- package/lib/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.d.ts +2 -2
- package/lib/components/tanstackTable/docs/withRowClick/WithRowClick.stories.d.ts +2 -2
- package/lib/components/tanstackTable/helpers.d.ts +2 -2
- package/lib/components/tanstackTable/mock-data/table-configuration.d.ts +2 -2
- package/lib/components/tanstackTable/useTanstackTable.d.ts +1 -1
- package/lib/components/toast/Toast.stories.d.ts +1 -1
- package/lib/components/tooltip/Tooltip.d.ts +2 -2
- package/lib/components/tooltip/Tooltip.stories.d.ts +1 -1
- package/lib/components/truncate/Truncate.d.ts +1 -1
- package/lib/components/truncate/Truncate.stories.d.ts +2 -2
- package/lib/components/truncate/types.d.ts +1 -1
- package/lib/docs/BaseColorPalette/BaseColorsPalette.stories.d.ts +1 -1
- package/lib/docs/SemanticTokens/ColorSwatch.d.ts +1 -1
- package/lib/docs/SemanticTokens/SemanticTokens.stories.d.ts +1 -1
- package/lib/index.d.ts +165 -45
- package/lib/index.esm.js +253 -170
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +253 -170
- package/lib/index.js.map +1 -1
- package/lib/setup/setupIcons.d.ts +1 -1
- package/lib/storybook/formArgTypes.d.ts +1 -1
- package/lib/stylesAndAnimations/borders/BorderColor.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/borders/BorderRadius.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/borders/BorderStyles.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/borders/BorderThickness.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/colors/UtilityClasses.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/sizing/Sizing.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/typography/Typography.stories.d.ts +1 -1
- package/lib/stylesAndAnimations/utilityClasses/UtilityClassesTable.stories.d.ts +1 -1
- package/lib/types.d.ts +4 -4
- package/package.json +8 -2
- package/src/components/badge/Badge.stories.tsx +4 -3
- package/src/components/badge/Badge.tsx +2 -1
- package/src/components/badge/__tests__/Badge.test.tsx +1 -0
- package/src/components/button/Button.stories.tsx +5 -4
- package/src/components/button/Button.tsx +12 -22
- package/src/components/button/__tests__/Button.test.tsx +31 -28
- package/src/components/button/types.ts +1 -1
- package/src/components/card/Card.stories.tsx +2 -1
- package/src/components/card/Card.tsx +2 -1
- package/src/components/card/__tests__/Card.test.tsx +1 -0
- package/src/components/floatUI/FloatUI.stories.tsx +3 -2
- package/src/components/floatUI/FloatUI.tsx +6 -7
- package/src/components/floatUI/__tests__/FloatUI.test.tsx +5 -3
- package/src/components/floatUI/types.ts +2 -2
- package/src/components/forms/checkbox/Checkbox.stories.tsx +3 -2
- package/src/components/forms/checkbox/Checkbox.tsx +1 -1
- package/src/components/forms/checkbox/__tests__/Checkbox.test.tsx +2 -1
- package/src/components/forms/date/datePicker/DatePicker.stories.tsx +12 -1
- package/src/components/forms/date/datePicker/DatePicker.tsx +35 -25
- package/src/components/forms/date/datePicker/__tests__/DatePicker.test.tsx +1 -0
- package/src/components/forms/date/datePicker/contants.ts +1 -1
- package/src/components/forms/date/datePicker/types.ts +16 -8
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +16 -2
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +21 -8
- package/src/components/forms/date/iconTriggerDatePicker/__tests__/IconTriggerDatePicker.test.tsx +2 -1
- package/src/components/forms/date/iconTriggerDatePicker/types.ts +5 -0
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +4 -2
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +18 -13
- package/src/components/forms/date/inputDatePicker/__tests__/SingleInputDatePicker.test.tsx +4 -2
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +15 -4
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +29 -23
- package/src/components/forms/date/inputDateRangePicker/__tests__/InputDateRangePicker.test.tsx +2 -2
- package/src/components/forms/date/inputDateRangePicker/types.ts +7 -0
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +9 -5
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +18 -13
- package/src/components/forms/form/Form.stories.tsx +7 -6
- package/src/components/forms/form/Form.tsx +1 -1
- package/src/components/forms/form/__tests__/Form.test.tsx +7 -4
- package/src/components/forms/input/Input.stories.tsx +6 -3
- package/src/components/forms/input/Input.tsx +4 -3
- package/src/components/forms/input/__tests__/Input.test.tsx +5 -3
- package/src/components/forms/numberInput/NumberInput.stories.tsx +5 -2
- package/src/components/forms/numberInput/NumberInput.tsx +6 -3
- package/src/components/forms/numberInput/__tests__/NumberInput.test.tsx +2 -1
- package/src/components/forms/passwordInput/PasswordInput.stories.tsx +6 -3
- package/src/components/forms/passwordInput/PasswordInput.tsx +12 -3
- package/src/components/forms/passwordInput/__tests__/PasswordInput.test.tsx +3 -4
- package/src/components/forms/radio/Radio.stories.tsx +5 -2
- package/src/components/forms/radio/__tests__/Radio.test.tsx +3 -2
- package/src/components/forms/select/Select.stories.tsx +11 -9
- package/src/components/forms/select/Select.tsx +21 -6
- package/src/components/forms/select/__tests__/Select.test.tsx +2 -2
- package/src/components/forms/select/types.ts +13 -1
- package/src/components/forms/subcomponents/Label.tsx +24 -4
- package/src/components/forms/subcomponents/__tests__/Label.test.tsx +1 -0
- package/src/components/forms/subcomponents/types.ts +5 -0
- package/src/components/forms/textarea/Textarea.stories.tsx +5 -2
- package/src/components/forms/textarea/Textarea.tsx +5 -4
- package/src/components/forms/textarea/__tests__/Textarea.test.tsx +3 -3
- package/src/components/forms/timePicker/TimePicker.stories.tsx +14 -2
- package/src/components/forms/timePicker/TimePicker.tsx +15 -5
- package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +2 -1
- package/src/components/forms/timePicker/types.ts +5 -0
- package/src/components/forms/toggle/Toggle.stories.tsx +3 -2
- package/src/components/forms/toggle/__tests__/Toggle.test.tsx +3 -2
- package/src/components/grid/col/Col.stories.tsx +2 -1
- package/src/components/grid/col/Col.tsx +1 -1
- package/src/components/grid/container/Container.stories.tsx +2 -1
- package/src/components/grid/container/Container.tsx +1 -1
- package/src/components/grid/row/Row.stories.tsx +2 -1
- package/src/components/grid/row/Row.tsx +1 -1
- package/src/components/icons/Icon.stories.tsx +11 -4
- package/src/components/icons/Icon.tsx +4 -3
- package/src/components/icons/__tests__/Icon.test.tsx +1 -0
- package/src/components/icons/indicons.tsx +3 -3
- package/src/components/icons/types.ts +5 -4
- package/src/components/loading-indicators/BarSpinner/BarSpinner.stories.tsx +2 -1
- package/src/components/loading-indicators/BarSpinner/__tests__/BarSpinner.test.tsx +1 -0
- package/src/components/loading-indicators/CirclePulse/CirclePulse.stories.tsx +2 -1
- package/src/components/menu/Menu.stories.tsx +3 -2
- package/src/components/menu/Menu.test.tsx +1 -1
- package/src/components/menu/Menu.tsx +1 -1
- package/src/components/modal/ConfirmationModal.tsx +25 -18
- package/src/components/modal/Modal.stories.tsx +62 -28
- package/src/components/modal/Modal.tsx +9 -2
- package/src/components/modal/__tests__/Modal.test.tsx +1 -0
- package/src/components/modal/types.ts +23 -7
- package/src/components/pagination/Pagination.stories.tsx +14 -2
- package/src/components/pagination/Pagination.tsx +18 -8
- package/src/components/pagination/__tests__/Pagination.test.tsx +1 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pagination/types.ts +14 -0
- package/src/components/pill/Pill.stories.tsx +10 -6
- package/src/components/pill/Pill.tsx +2 -1
- package/src/components/pill/__tests__/Pill.test.tsx +4 -1
- package/src/components/pill/types.ts +4 -2
- package/src/components/skeleton/Skeleton.stories.tsx +2 -1
- package/src/components/skeleton/__tests__/Skeleton.test.tsx +1 -0
- package/src/components/stepper/Stepper.stories.tsx +20 -7
- package/src/components/stepper/Stepper.tsx +18 -3
- package/src/components/stepper/__tests__/Stepper.tests.tsx +5 -4
- package/src/components/stepper/components/BackNavigation.tsx +5 -3
- package/src/components/stepper/components/Legend.tsx +4 -3
- package/src/components/stepper/components/NextNavigation.tsx +15 -5
- package/src/components/stepper/examples/MixedExample.tsx +4 -3
- package/src/components/stepper/examples/OptionalStepsExample.tsx +4 -3
- package/src/components/stepper/examples/RequiredStepsExample.tsx +4 -3
- package/src/components/stepper/examples/commonExample/CommonExample.tsx +4 -3
- package/src/components/stepper/examples/commonExample/steps/StepOne.tsx +1 -0
- package/src/components/stepper/examples/commonExample/steps/StepThree.tsx +1 -0
- package/src/components/stepper/examples/commonExample/steps/StepTwo.tsx +1 -0
- package/src/components/stepper/types.ts +13 -1
- package/src/components/table/LoadingComponent.tsx +6 -2
- package/src/components/table/Table.stories.tsx +19 -5
- package/src/components/table/Table.tsx +16 -5
- package/src/components/table/__tests__/Table.test.tsx +2 -1
- package/src/components/table/components/HorizontalStickyHeader.tsx +14 -2
- package/src/components/table/components/TablePagination.tsx +1 -1
- package/src/components/table/components/__tests__/HorizontalStickyHeader.test.tsx +3 -3
- package/src/components/table/components/__tests__/TablePagination.test.tsx +1 -0
- package/src/components/table/components/helpers.ts +1 -1
- package/src/components/table/hooks/usePinnedColumnsManager.ts +7 -2
- package/src/components/table/sampleData.tsx +1 -3
- package/src/components/table/types.ts +25 -6
- package/src/components/table/utils/processColumns.tsx +4 -2
- package/src/components/tanstackTable/TankstackTable.types.ts +21 -3
- package/src/components/tanstackTable/TanstackTable.stories.tsx +14 -11
- package/src/components/tanstackTable/TanstackTable.tsx +28 -18
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +2 -1
- package/src/components/tanstackTable/__tests__/__mocks__/test-mock-data.tsx +2 -1
- package/src/components/tanstackTable/components/ActionBar/ActionBar.stories.tsx +6 -3
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +7 -3
- package/src/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.tsx +4 -1
- package/src/components/tanstackTable/components/NoResults/NoResults.tsx +9 -3
- package/src/components/tanstackTable/components/NoResults/__tests__/NoResult.test.tsx +1 -0
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +2 -1
- package/src/components/tanstackTable/components/TableHeader/TableHeader.tsx +3 -2
- package/src/components/tanstackTable/components/TableLoading/TableLoading.tsx +2 -1
- package/src/components/tanstackTable/components/TablePagination/TablePagination.tsx +4 -1
- package/src/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.tsx +1 -0
- package/src/components/tanstackTable/docs/internalSorting/InternalClientSideSorting.stories.tsx +5 -5
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.tsx +5 -4
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.stories.tsx +5 -4
- package/src/components/tanstackTable/helpers.ts +2 -2
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +7 -4
- package/src/components/tanstackTable/useTanstackTable.tsx +1 -2
- package/src/components/toast/Toast.stories.tsx +2 -1
- package/src/components/tooltip/Tooltip.stories.tsx +3 -2
- package/src/components/tooltip/Tooltip.tsx +2 -2
- package/src/components/truncate/Truncate.stories.tsx +3 -2
- package/src/components/truncate/Truncate.tsx +5 -4
- package/src/components/truncate/__tests__/Truncate.test.tsx +1 -0
- package/src/components/truncate/types.ts +1 -1
- package/src/docs/BaseColorPalette/BaseColorPalette.tsx +1 -0
- package/src/docs/BaseColorPalette/BaseColorsPalette.stories.tsx +2 -1
- package/src/docs/BaseColorPalette/Swatch.tsx +2 -1
- package/src/docs/SemanticTokens/ColorSwatch.tsx +1 -1
- package/src/docs/SemanticTokens/SemanticTokens.stories.tsx +2 -2
- package/src/index.ts +1 -1
- package/src/setup/setupIcons.ts +2 -2
- package/src/storybook/formArgTypes.ts +12 -1
- package/src/storybook/iconNames.ts +1 -0
- package/src/storybookDocs/Permafrost.mdx +8 -0
- package/src/stylesAndAnimations/borders/BorderColor.stories.tsx +2 -1
- package/src/stylesAndAnimations/borders/BorderColor.tsx +0 -1
- package/src/stylesAndAnimations/borders/BorderRadius.stories.tsx +2 -1
- package/src/stylesAndAnimations/borders/BorderRadius.tsx +0 -1
- package/src/stylesAndAnimations/borders/BorderStyles.stories.tsx +2 -1
- package/src/stylesAndAnimations/borders/BorderStyles.tsx +0 -1
- package/src/stylesAndAnimations/borders/BorderThickness.stories.tsx +2 -1
- package/src/stylesAndAnimations/borders/BorderThickness.tsx +0 -1
- package/src/stylesAndAnimations/colors/UtilityClasses.stories.tsx +2 -1
- package/src/stylesAndAnimations/colors/UtilityClasses.tsx +1 -2
- package/src/stylesAndAnimations/sizing/Sizing.stories.tsx +2 -1
- package/src/stylesAndAnimations/sizing/Sizing.tsx +0 -1
- package/src/stylesAndAnimations/typography/Typography.stories.tsx +2 -1
- package/src/stylesAndAnimations/typography/Typography.tsx +0 -1
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.stories.tsx +2 -1
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.tsx +6 -3
- package/src/types.ts +12 -6
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
3
4
|
import { indiconDefinitions } from '@/components/icons/indicons';
|
|
4
5
|
import { registerFontAwesomeIcons } from '@/setup/setupIcons';
|
|
5
|
-
registerFontAwesomeIcons(...Object.values(fas), ...indiconDefinitions);
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { CommonExample } from './examples/commonExample/CommonExample';
|
|
8
8
|
import { MixedExample } from './examples/MixedExample';
|
|
9
|
-
import { RequiredStepsExample } from './examples/RequiredStepsExample';
|
|
10
9
|
import { OptionalStepsExample } from './examples/OptionalStepsExample';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { RequiredStepsExample } from './examples/RequiredStepsExample';
|
|
11
|
+
import { Stepper } from './Stepper';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
registerFontAwesomeIcons(...Object.values(fas), ...indiconDefinitions);
|
|
13
15
|
|
|
14
16
|
const meta: Meta = {
|
|
15
17
|
title: 'Components/Stepper',
|
|
@@ -146,6 +148,17 @@ const meta: Meta = {
|
|
|
146
148
|
},
|
|
147
149
|
},
|
|
148
150
|
},
|
|
151
|
+
text: {
|
|
152
|
+
control: 'object',
|
|
153
|
+
description: 'Customizable text.',
|
|
154
|
+
table: {
|
|
155
|
+
category: 'i18n Text',
|
|
156
|
+
type: {
|
|
157
|
+
summary:
|
|
158
|
+
'{ previousStep?: string; previousStepAriaLabel?: string; nextStep?: string; nextStepAriaLabel?: string; finish?: string; finishAriaLabel?: string }',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
149
162
|
},
|
|
150
163
|
};
|
|
151
164
|
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { useState, Children } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { BackNavigation } from './components/BackNavigation';
|
|
4
|
+
import { Legend } from './components/Legend';
|
|
4
5
|
import { NextNavigation } from './components/NextNavigation';
|
|
5
|
-
import { StepperProps } from './types';
|
|
6
|
+
import { type StepperProps, type StepperText } from './types';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_TEXT: Required<StepperText> = {
|
|
9
|
+
previousStep: 'Previous Step',
|
|
10
|
+
nextStep: 'Next Step',
|
|
11
|
+
finish: 'Finish',
|
|
12
|
+
};
|
|
6
13
|
|
|
7
14
|
export const Stepper = ({
|
|
8
15
|
currentStep: externalCurrentStep,
|
|
@@ -14,7 +21,9 @@ export const Stepper = ({
|
|
|
14
21
|
onFinishClick,
|
|
15
22
|
children,
|
|
16
23
|
onStepClick,
|
|
24
|
+
text: textProp,
|
|
17
25
|
}: StepperProps) => {
|
|
26
|
+
const text = { ...DEFAULT_TEXT, ...textProp };
|
|
18
27
|
const [internalCurrentStep, setInternalCurrentStep] = useState(0);
|
|
19
28
|
|
|
20
29
|
const currentStep = externalCurrentStep !== undefined ? externalCurrentStep : internalCurrentStep;
|
|
@@ -71,12 +80,18 @@ export const Stepper = ({
|
|
|
71
80
|
<div className="stepper-steps">{childrenArray[currentStep]}</div>
|
|
72
81
|
</div>
|
|
73
82
|
<div className="stepper-actions">
|
|
74
|
-
<BackNavigation
|
|
83
|
+
<BackNavigation
|
|
84
|
+
isDisabled={isFirstStep}
|
|
85
|
+
onBackClick={handleBackClick}
|
|
86
|
+
label={text.previousStep}
|
|
87
|
+
/>
|
|
75
88
|
<NextNavigation
|
|
76
89
|
isLastStep={isLastStep}
|
|
77
90
|
onNextClick={handleNextClick}
|
|
78
91
|
onFinishClick={handleFinishClick}
|
|
79
92
|
isDisabled={disableNextButton(currentStep)}
|
|
93
|
+
nextLabel={text.nextStep}
|
|
94
|
+
finishLabel={text.finish}
|
|
80
95
|
/>
|
|
81
96
|
</div>
|
|
82
97
|
</div>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import { Stepper } from '../Stepper';
|
|
3
|
-
import { StepOne } from '../examples/commonExample/steps/StepOne';
|
|
4
|
-
import { StepTwo } from '../examples/commonExample/steps/StepTwo';
|
|
5
|
-
import { StepThree } from '../examples/commonExample/steps/StepThree';
|
|
6
2
|
import userEvent from '@testing-library/user-event';
|
|
7
3
|
import React from 'react';
|
|
8
4
|
|
|
5
|
+
import { StepOne } from '../examples/commonExample/steps/StepOne';
|
|
6
|
+
import { StepThree } from '../examples/commonExample/steps/StepThree';
|
|
7
|
+
import { StepTwo } from '../examples/commonExample/steps/StepTwo';
|
|
8
|
+
import { Stepper } from '../Stepper';
|
|
9
|
+
|
|
9
10
|
// NOTES ================================================
|
|
10
11
|
// The core functionality of the stepper is mainly various callbacks. As a result, we are indirectly testing them through the testing conditions created in this file. For example, to check if a step is complete, we have a callback function that fires when that step is complete. You will need to test your own logic in your implementation as the conditions tested here are for the purposes of the stepper itself, not the handlers we created.
|
|
11
12
|
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { Button } from '../../button';
|
|
2
|
+
|
|
2
3
|
type Props = {
|
|
3
4
|
isDisabled: boolean;
|
|
4
5
|
onBackClick: () => void;
|
|
6
|
+
label: string;
|
|
5
7
|
};
|
|
6
8
|
|
|
7
|
-
export const BackNavigation = ({ isDisabled, onBackClick }: Props) => {
|
|
9
|
+
export const BackNavigation = ({ isDisabled, onBackClick, label }: Props) => {
|
|
8
10
|
return (
|
|
9
11
|
<div className="stepper-navigation-back">
|
|
10
12
|
<Button
|
|
11
13
|
data-testid="stepper-back-button"
|
|
12
|
-
ariaLabel=
|
|
14
|
+
ariaLabel={label}
|
|
13
15
|
iconLeft="fa-arrow-left"
|
|
14
16
|
onClick={onBackClick}
|
|
15
17
|
variant="outline"
|
|
16
18
|
isDisabled={isDisabled}
|
|
17
19
|
>
|
|
18
|
-
|
|
20
|
+
{label}
|
|
19
21
|
</Button>
|
|
20
22
|
</div>
|
|
21
23
|
);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
|
|
3
|
-
import { Col, Row } from '../../grid/';
|
|
2
|
+
|
|
4
3
|
import { Button } from '../../button';
|
|
5
|
-
import {
|
|
4
|
+
import { Col, Row } from '../../grid/';
|
|
5
|
+
import { Icon } from '../../icons/Icon';
|
|
6
|
+
import { type StepperLegendProps } from '../types';
|
|
6
7
|
|
|
7
8
|
export const Legend = ({ currentStep, steps, onStepClick }: StepperLegendProps) => {
|
|
8
9
|
const totalSteps = steps?.length || 0;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { Button } from '../../button';
|
|
2
|
+
|
|
2
3
|
type Props = {
|
|
3
4
|
isLastStep: boolean;
|
|
4
5
|
onNextClick: () => void;
|
|
5
6
|
onFinishClick: () => void;
|
|
6
7
|
isDisabled: boolean;
|
|
8
|
+
nextLabel: string;
|
|
9
|
+
finishLabel: string;
|
|
7
10
|
};
|
|
8
11
|
|
|
9
|
-
export const NextNavigation = ({
|
|
12
|
+
export const NextNavigation = ({
|
|
13
|
+
isLastStep,
|
|
14
|
+
onNextClick,
|
|
15
|
+
onFinishClick,
|
|
16
|
+
isDisabled,
|
|
17
|
+
nextLabel,
|
|
18
|
+
finishLabel,
|
|
19
|
+
}: Props) => {
|
|
10
20
|
return (
|
|
11
21
|
<div className="stepper-navigation">
|
|
12
22
|
{!isLastStep ? (
|
|
@@ -14,22 +24,22 @@ export const NextNavigation = ({ isLastStep, onNextClick, onFinishClick, isDisab
|
|
|
14
24
|
<Button
|
|
15
25
|
data-testid="stepper-next-button"
|
|
16
26
|
iconRight="fa-arrow-right"
|
|
17
|
-
ariaLabel=
|
|
27
|
+
ariaLabel={nextLabel}
|
|
18
28
|
onClick={onNextClick}
|
|
19
29
|
isDisabled={isDisabled}
|
|
20
30
|
>
|
|
21
|
-
|
|
31
|
+
{nextLabel}
|
|
22
32
|
</Button>
|
|
23
33
|
</div>
|
|
24
34
|
) : (
|
|
25
35
|
<div className="stepper-navigation-finish">
|
|
26
36
|
<Button
|
|
27
37
|
data-testid="stepper-finish-button"
|
|
28
|
-
ariaLabel=
|
|
38
|
+
ariaLabel={finishLabel}
|
|
29
39
|
onClick={onFinishClick}
|
|
30
40
|
isDisabled={isDisabled}
|
|
31
41
|
>
|
|
32
|
-
|
|
42
|
+
{finishLabel}
|
|
33
43
|
</Button>
|
|
34
44
|
</div>
|
|
35
45
|
)}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { Button } from '../../button';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
4
3
|
import { MIXED_EXAMPLE_STEPS, STEP_CONTENT_DATA, INFO_BOX_STYLE } from './constants';
|
|
4
|
+
import { Button } from '../../button';
|
|
5
|
+
import { Stepper } from '../Stepper';
|
|
5
6
|
|
|
6
7
|
export const MixedExample = () => {
|
|
7
8
|
// Value of the current step.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { Button } from '../../button';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
4
3
|
import { OPTIONAL_STEPS, INFO_BOX_STYLE, STATUS_INDICATOR_STYLE } from './constants';
|
|
4
|
+
import { Button } from '../../button';
|
|
5
|
+
import { Stepper } from '../Stepper';
|
|
5
6
|
|
|
6
7
|
export const OptionalStepsExample = () => {
|
|
7
8
|
const [currentStep, setCurrentStep] = useState(0);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { Button } from '../../button';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
4
3
|
import { REQUIRED_STEPS, INFO_BOX_STYLE, STATUS_INDICATOR_STYLE } from './constants';
|
|
4
|
+
import { Button } from '../../button';
|
|
5
|
+
import { Stepper } from '../Stepper';
|
|
5
6
|
|
|
6
7
|
export const RequiredStepsExample = () => {
|
|
7
8
|
const [currentStep, setCurrentStep] = useState(0);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
3
|
import { StepOne } from './steps/StepOne';
|
|
4
|
-
import { StepTwo } from './steps/StepTwo';
|
|
5
4
|
import { StepThree } from './steps/StepThree';
|
|
5
|
+
import { StepTwo } from './steps/StepTwo';
|
|
6
|
+
import { Stepper } from '../../Stepper';
|
|
6
7
|
|
|
7
8
|
export const CommonExample = () => {
|
|
8
9
|
const exampleSteps = [
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Customizable text for Stepper. */
|
|
4
|
+
export interface StepperText {
|
|
5
|
+
/** Label for the "Previous Step" button. Default: "Previous Step" */
|
|
6
|
+
previousStep?: string;
|
|
7
|
+
/** Label for the "Next Step" button. Default: "Next Step" */
|
|
8
|
+
nextStep?: string;
|
|
9
|
+
/** Label for the "Finish" button. Default: "Finish" */
|
|
10
|
+
finish?: string;
|
|
11
|
+
}
|
|
2
12
|
|
|
3
13
|
export interface StepperProps {
|
|
4
14
|
/** An array of step objects that define the stepper navigation. */
|
|
@@ -18,6 +28,8 @@ export interface StepperProps {
|
|
|
18
28
|
children: React.ReactNode;
|
|
19
29
|
/** The function to call when a step is clicked ont he legend. */
|
|
20
30
|
onStepClick: (step: number) => void;
|
|
31
|
+
/** Customizable display text. */
|
|
32
|
+
text?: StepperText;
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
export interface StepperLegendProps {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface LoadingComponentProps {
|
|
2
|
+
loadingText: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const LoadingComponent = ({ loadingText }: LoadingComponentProps) => {
|
|
6
|
+
return <div className="table-loading">{loadingText}</div>;
|
|
3
7
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Table } from './Table';
|
|
3
|
-
import { columns, sampleData, SampleDataRow } from './sampleData';
|
|
4
|
-
import { registerFontAwesomeIcons } from '@/setup/setupIcons';
|
|
5
|
-
import { indiconDefinitions } from '@/components/icons/indicons';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
6
2
|
import { useState } from 'react';
|
|
7
3
|
|
|
4
|
+
import { indiconDefinitions } from '@/components/icons/indicons';
|
|
5
|
+
import { registerFontAwesomeIcons } from '@/setup/setupIcons';
|
|
6
|
+
|
|
7
|
+
import { columns, sampleData, type SampleDataRow } from './sampleData';
|
|
8
|
+
import { Table } from './Table';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
8
12
|
registerFontAwesomeIcons(...Object.values(indiconDefinitions));
|
|
9
13
|
|
|
10
14
|
const meta: Meta = {
|
|
@@ -494,6 +498,16 @@ const meta: Meta = {
|
|
|
494
498
|
disable: true,
|
|
495
499
|
},
|
|
496
500
|
},
|
|
501
|
+
text: {
|
|
502
|
+
control: 'object',
|
|
503
|
+
description: 'Customizable text.',
|
|
504
|
+
table: {
|
|
505
|
+
category: 'i18n Text',
|
|
506
|
+
type: {
|
|
507
|
+
summary: '{ loading?: string; unpinColumn?: string; pinColumn?: string }',
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
},
|
|
497
511
|
},
|
|
498
512
|
};
|
|
499
513
|
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import DataTable, {
|
|
3
|
-
Direction as RDTDirection,
|
|
4
|
-
Alignment as RDTAlignment,
|
|
3
|
+
type Direction as RDTDirection,
|
|
4
|
+
type Alignment as RDTAlignment,
|
|
5
5
|
} from 'react-data-table-component';
|
|
6
|
-
|
|
7
|
-
import { TableProps } from './types';
|
|
6
|
+
|
|
8
7
|
import { TablePagination } from './components/TablePagination';
|
|
9
8
|
import { usePinnedColumnsManager } from './hooks/usePinnedColumnsManager';
|
|
9
|
+
import { LoadingComponent } from './LoadingComponent';
|
|
10
|
+
import { type TableProps, type TableText } from './types';
|
|
11
|
+
|
|
12
|
+
const DEFAULT_TEXT: Required<TableText> = {
|
|
13
|
+
loading: 'Loading...',
|
|
14
|
+
unpinColumn: 'Unpin column',
|
|
15
|
+
pinColumn: 'Pin column',
|
|
16
|
+
};
|
|
10
17
|
|
|
11
18
|
export const Table = <T,>(props: TableProps<T>) => {
|
|
12
19
|
const {
|
|
@@ -26,14 +33,18 @@ export const Table = <T,>(props: TableProps<T>) => {
|
|
|
26
33
|
columns: initialColumns,
|
|
27
34
|
canPinColumns = false,
|
|
28
35
|
onPinnedColumnsChange,
|
|
36
|
+
text: textProp,
|
|
29
37
|
...rest
|
|
30
38
|
} = props;
|
|
31
39
|
|
|
40
|
+
const text = { ...DEFAULT_TEXT, ...textProp };
|
|
41
|
+
|
|
32
42
|
// Turns on/off column pinning.
|
|
33
43
|
const { columnsWithPinning } = usePinnedColumnsManager(
|
|
34
44
|
initialColumns,
|
|
35
45
|
canPinColumns,
|
|
36
46
|
onPinnedColumnsChange,
|
|
47
|
+
{ unpinColumn: text.unpinColumn, pinColumn: text.pinColumn },
|
|
37
48
|
);
|
|
38
49
|
|
|
39
50
|
const combinedClassName = classNames(className, {
|
|
@@ -59,7 +70,7 @@ export const Table = <T,>(props: TableProps<T>) => {
|
|
|
59
70
|
disabled={isDisabled}
|
|
60
71
|
noDataComponent={noDataComponent}
|
|
61
72
|
progressPending={isLoading}
|
|
62
|
-
progressComponent={<LoadingComponent />}
|
|
73
|
+
progressComponent={<LoadingComponent loadingText={text.loading} />}
|
|
63
74
|
pagination
|
|
64
75
|
paginationComponent={(props) => (
|
|
65
76
|
<TablePagination {...props} totalEntriesText={totalEntriesText} />
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import {
|
|
4
4
|
getPreviousHeadersWidth,
|
|
5
5
|
applyStickyStylesToTableHeader,
|
|
6
6
|
clearStickyStyles,
|
|
7
7
|
} from './helpers';
|
|
8
|
+
import { Button } from '../../button/Button';
|
|
9
|
+
import { type HorizontalStickyHeaderText } from '../types';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_TEXT: Required<HorizontalStickyHeaderText> = {
|
|
12
|
+
unpinColumn: 'Unpin column',
|
|
13
|
+
pinColumn: 'Pin column',
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
interface HorizontalStickyHeaderProps {
|
|
9
17
|
children: React.ReactNode;
|
|
10
18
|
position: number;
|
|
@@ -12,6 +20,8 @@ interface HorizontalStickyHeaderProps {
|
|
|
12
20
|
isPinned?: boolean;
|
|
13
21
|
forceUpdate?: number;
|
|
14
22
|
pinnedColumnIds: string[];
|
|
23
|
+
/** Customizable display text. */
|
|
24
|
+
text?: HorizontalStickyHeaderText;
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
const HorizontalStickyHeader = ({
|
|
@@ -20,7 +30,9 @@ const HorizontalStickyHeader = ({
|
|
|
20
30
|
onPinColumn,
|
|
21
31
|
isPinned = false,
|
|
22
32
|
pinnedColumnIds,
|
|
33
|
+
text: textProp,
|
|
23
34
|
}: HorizontalStickyHeaderProps) => {
|
|
35
|
+
const text = { ...DEFAULT_TEXT, ...textProp };
|
|
24
36
|
useEffect(() => {
|
|
25
37
|
const calculateWidth = async () => {
|
|
26
38
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
@@ -46,7 +58,7 @@ const HorizontalStickyHeader = ({
|
|
|
46
58
|
size="sm"
|
|
47
59
|
iconLeft="pin"
|
|
48
60
|
onClick={() => onPinColumn?.(`sticky-column-${position}`)}
|
|
49
|
-
ariaLabel={isPinned ?
|
|
61
|
+
ariaLabel={isPinned ? text.unpinColumn : text.pinColumn}
|
|
50
62
|
className={`table__column--${isPinned ? 'is-pinned' : 'is-not-pinned'} table__column__pin-action`}
|
|
51
63
|
/>
|
|
52
64
|
<div className="table__header-content">{children}</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { sampleData } from '../../sampleData';
|
|
4
|
-
import { Table } from '../../Table';
|
|
5
4
|
import { columns } from '../../sampleData';
|
|
6
|
-
import
|
|
5
|
+
import { Table } from '../../Table';
|
|
6
|
+
import HorizontalStickyHeader from '../HorizontalStickyHeader';
|
|
7
7
|
|
|
8
8
|
// Add ResizeObserver mock before tests
|
|
9
9
|
class ResizeObserverMock {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useCallback, useMemo } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { sortPinnedColumns, getPreviousHeadersWidth } from '../components/helpers';
|
|
4
|
+
import { type TableColumn, type HorizontalStickyHeaderText } from '../types';
|
|
4
5
|
import { processColumns } from '../utils/processColumns';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -11,6 +12,7 @@ export const usePinnedColumnsManager = <T>(
|
|
|
11
12
|
columns: TableColumn<T>[],
|
|
12
13
|
canPinColumns: boolean,
|
|
13
14
|
onPinnedColumnsChange?: (pinnedColumnIds: string[]) => void,
|
|
15
|
+
text?: HorizontalStickyHeaderText,
|
|
14
16
|
) => {
|
|
15
17
|
const pinnedColumnIds = columns.filter((column) => column.isPinned).map((column) => column.id);
|
|
16
18
|
|
|
@@ -137,7 +139,10 @@ export const usePinnedColumnsManager = <T>(
|
|
|
137
139
|
|
|
138
140
|
// Process columns for rendering with pin state
|
|
139
141
|
const columnsWithPinning = canPinColumns
|
|
140
|
-
? sortPinnedColumns(
|
|
142
|
+
? sortPinnedColumns(
|
|
143
|
+
processColumns(columns, dataColumnIds, togglePinnedColumn, text),
|
|
144
|
+
dataColumnIds,
|
|
145
|
+
)
|
|
141
146
|
: columns;
|
|
142
147
|
|
|
143
148
|
return {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
IDataTableProps,
|
|
2
|
+
type Direction as RDTDirection,
|
|
3
|
+
type Alignment as RDTAlignment,
|
|
4
|
+
type TableColumn as RDTTableColumn,
|
|
5
|
+
type IDataTableProps,
|
|
7
6
|
} from 'react-data-table-component';
|
|
8
|
-
import { CSSObject } from 'styled-components';
|
|
7
|
+
import { type CSSObject } from 'styled-components';
|
|
9
8
|
|
|
10
9
|
export type Direction = `${RDTDirection}`;
|
|
11
10
|
export type Alignment = `${RDTAlignment}`;
|
|
@@ -19,6 +18,24 @@ export interface PinnableColumn<T> extends RDTTableColumn<T> {
|
|
|
19
18
|
|
|
20
19
|
export type TableColumn<T> = PinnableColumn<T>;
|
|
21
20
|
|
|
21
|
+
/** Customizable text for Table. */
|
|
22
|
+
export interface TableText {
|
|
23
|
+
/** Text to display while loading. Default: "Loading..." */
|
|
24
|
+
loading?: string;
|
|
25
|
+
/** Aria label for unpinning a column. Default: "Unpin column" */
|
|
26
|
+
unpinColumn?: string;
|
|
27
|
+
/** Aria label for pinning a column. Default: "Pin column" */
|
|
28
|
+
pinColumn?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Customizable text for HorizontalStickyHeader. */
|
|
32
|
+
export interface HorizontalStickyHeaderText {
|
|
33
|
+
/** Aria label for unpinning a column. Default: "Unpin column" */
|
|
34
|
+
unpinColumn?: string;
|
|
35
|
+
/** Aria label for pinning a column. Default: "Pin column" */
|
|
36
|
+
pinColumn?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
export interface TableProps<T>
|
|
23
40
|
extends Omit<IDataTableProps<T>, 'paginationComponent' | 'direction' | 'subHeaderAlign'> {
|
|
24
41
|
/** The columns to display in the table. All columns require a unique id property. For pinned columns, please see the pinned example below. */
|
|
@@ -39,4 +56,6 @@ export interface TableProps<T>
|
|
|
39
56
|
canPinColumns?: boolean;
|
|
40
57
|
/** Callback that receives the IDs of the pinned columns when they change. */
|
|
41
58
|
onPinnedColumnsChange?: (pinnedColumnIds: any[]) => void;
|
|
59
|
+
/** Customizable display text. */
|
|
60
|
+
text?: TableText;
|
|
42
61
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { TableColumn } from '../types';
|
|
2
|
-
import HorizontalStickyHeader from '../components/HorizontalStickyHeader';
|
|
3
1
|
import { getPinnedColumnStyles } from '../components/helpers';
|
|
2
|
+
import HorizontalStickyHeader from '../components/HorizontalStickyHeader';
|
|
3
|
+
import { type TableColumn, type HorizontalStickyHeaderText } from '../types';
|
|
4
4
|
|
|
5
5
|
export const processColumns = <T,>(
|
|
6
6
|
columns: TableColumn<T>[],
|
|
7
7
|
pinnedColumnIds: string[],
|
|
8
8
|
togglePinnedColumn: (id: string) => void,
|
|
9
|
+
text?: HorizontalStickyHeaderText,
|
|
9
10
|
): TableColumn<T>[] => {
|
|
10
11
|
return columns.map((column, index) => {
|
|
11
12
|
const dataColumnId = `sticky-column-${index}`;
|
|
@@ -18,6 +19,7 @@ export const processColumns = <T,>(
|
|
|
18
19
|
isPinned={isPinned}
|
|
19
20
|
onPinColumn={() => togglePinnedColumn(column.id)}
|
|
20
21
|
pinnedColumnIds={pinnedColumnIds}
|
|
22
|
+
text={text}
|
|
21
23
|
>
|
|
22
24
|
{column.name}
|
|
23
25
|
</HorizontalStickyHeader>
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import { Row, ColumnDef, SortingState } from '@tanstack/react-table';
|
|
1
|
+
import { type Row, type ColumnDef, type SortingState } from '@tanstack/react-table';
|
|
2
|
+
|
|
3
|
+
/** Customizable text for TanstackTable. */
|
|
4
|
+
export interface TanstackTableText {
|
|
5
|
+
/** Message while table is loading. Default: "Table is loading..." */
|
|
6
|
+
loading?: string;
|
|
7
|
+
/** Message when no results found. Default: "No results found." */
|
|
8
|
+
noResults?: string;
|
|
9
|
+
/** Message when there's an error loading data. Default: "There was an error loading the data." */
|
|
10
|
+
error?: string;
|
|
11
|
+
/** Text for reset filters button. Default: "Reset filters" */
|
|
12
|
+
resetFilters?: string;
|
|
13
|
+
/** Singular entry text. Default: "entry" */
|
|
14
|
+
entry?: string;
|
|
15
|
+
/** Plural entries text. Default: "entries" */
|
|
16
|
+
entries?: string;
|
|
17
|
+
/** "of" text in pagination (e.g., "5 of 10 entries"). Default: "of" */
|
|
18
|
+
of?: string;
|
|
19
|
+
}
|
|
2
20
|
|
|
3
21
|
export type WithPaginationProps = {
|
|
4
22
|
/** Number of rows to display per pagination page. */
|
|
@@ -51,8 +69,6 @@ export type Props<T extends object> = {
|
|
|
51
69
|
hasFilters?: boolean;
|
|
52
70
|
/** When this is true, the table is considered to be in a loading state. */
|
|
53
71
|
isLoading?: boolean;
|
|
54
|
-
/** Message to display when the table is loading. */
|
|
55
|
-
isLoadingMessage?: string;
|
|
56
72
|
/** Columns that are pinned by default. */
|
|
57
73
|
defaultPinnedColumns?: string[];
|
|
58
74
|
/** Callback when a row is clicked. */
|
|
@@ -69,4 +85,6 @@ export type Props<T extends object> = {
|
|
|
69
85
|
onSelectAllChange?: (isSelected: boolean) => void;
|
|
70
86
|
/** You may pass a default sorting state to the table. This will be used to sort the table by default. This is useful if you want to sort the table by a column by default. */
|
|
71
87
|
defaultSorting?: SortingState;
|
|
88
|
+
/** Customizable display text. */
|
|
89
|
+
text?: TanstackTableText;
|
|
72
90
|
} & PaginationProps;
|