@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,11 +1,12 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type ColumnDef } from '@tanstack/react-table';
|
|
3
|
+
import { useState } from 'react';
|
|
2
4
|
|
|
3
|
-
import {
|
|
4
|
-
import { people, Person } from './mock-data/mock-data';
|
|
5
|
+
import { people, type Person } from './mock-data/mock-data';
|
|
5
6
|
import { columns } from './mock-data/table-configuration';
|
|
6
|
-
import {
|
|
7
|
+
import { TanstackTable } from './TanstackTable';
|
|
7
8
|
import { Button } from '../button';
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
const meta: Meta = {
|
|
10
11
|
title: 'Layout/Tanstack Table',
|
|
11
12
|
component: TanstackTable,
|
|
@@ -19,7 +20,6 @@ const meta: Meta = {
|
|
|
19
20
|
clearFilters: () => {},
|
|
20
21
|
hasFilters: false,
|
|
21
22
|
isLoading: false,
|
|
22
|
-
isLoadingMessage: 'Table is loading...',
|
|
23
23
|
enableRowSelection: true,
|
|
24
24
|
showPagination: false,
|
|
25
25
|
onClickRow: null,
|
|
@@ -116,12 +116,15 @@ const meta: Meta = {
|
|
|
116
116
|
defaultValue: { summary: 'false' },
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
|
-
|
|
120
|
-
control:
|
|
119
|
+
text: {
|
|
120
|
+
control: 'object',
|
|
121
|
+
description: 'Customizable text.',
|
|
121
122
|
table: {
|
|
122
|
-
category: '
|
|
123
|
-
type: {
|
|
124
|
-
|
|
123
|
+
category: 'i18n Text',
|
|
124
|
+
type: {
|
|
125
|
+
summary:
|
|
126
|
+
'{ loading?: string; noResults?: string; error?: string; resetFilters?: string; entry?: string; entries?: string; of?: string }',
|
|
127
|
+
},
|
|
125
128
|
},
|
|
126
129
|
},
|
|
127
130
|
defaultPinnedColumns: {
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
useReactTable,
|
|
5
3
|
getCoreRowModel,
|
|
6
4
|
getSortedRowModel,
|
|
7
|
-
SortingState,
|
|
5
|
+
type SortingState,
|
|
8
6
|
} from '@tanstack/react-table';
|
|
9
7
|
import classNames from 'classnames';
|
|
8
|
+
import { isNil } from 'lodash';
|
|
9
|
+
import { useEffect, useRef, useState } from 'react';
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
import { ActionBar } from './components/ActionBar';
|
|
12
13
|
import { NoResults } from './components/NoResults';
|
|
13
|
-
import { isNil } from 'lodash';
|
|
14
|
-
import { TablePagination } from './components/TablePagination';
|
|
15
|
-
import { Props } from './TankstackTable.types';
|
|
16
|
-
import { useTanstackTable } from './useTanstackTable';
|
|
17
|
-
import { TableHeader } from './components/TableHeader';
|
|
18
14
|
import { TableBody } from './components/TableBody';
|
|
15
|
+
import { TableHeader } from './components/TableHeader';
|
|
19
16
|
import { TableLoading } from './components/TableLoading/TableLoading';
|
|
17
|
+
import { TablePagination } from './components/TablePagination';
|
|
18
|
+
import { type Props, type TanstackTableText } from './TankstackTable.types';
|
|
19
|
+
import { useTanstackTable } from './useTanstackTable';
|
|
20
|
+
|
|
21
|
+
const DEFAULT_TEXT: Required<TanstackTableText> = {
|
|
22
|
+
loading: 'Table is loading...',
|
|
23
|
+
noResults: 'No results found.',
|
|
24
|
+
error: 'There was an error loading the data.',
|
|
25
|
+
resetFilters: 'Reset filters',
|
|
26
|
+
entry: 'entry',
|
|
27
|
+
entries: 'entries',
|
|
28
|
+
of: 'of',
|
|
29
|
+
};
|
|
20
30
|
|
|
21
31
|
export function TanstackTable<T extends object>({
|
|
22
32
|
columns: defaultColumns,
|
|
@@ -34,15 +44,16 @@ export function TanstackTable<T extends object>({
|
|
|
34
44
|
hasFilters,
|
|
35
45
|
showPagination = true,
|
|
36
46
|
isLoading = false,
|
|
37
|
-
isLoadingMessage = 'Table is loading...',
|
|
38
47
|
defaultPinnedColumns,
|
|
39
48
|
onRowClick,
|
|
40
49
|
activeRows = [],
|
|
41
50
|
isStriped = true,
|
|
42
51
|
actionBarClassName,
|
|
43
52
|
defaultSorting,
|
|
53
|
+
text: textProp,
|
|
44
54
|
...rest
|
|
45
55
|
}: Props<T & { id: string }>) {
|
|
56
|
+
const text = { ...DEFAULT_TEXT, ...textProp };
|
|
46
57
|
const {
|
|
47
58
|
columns,
|
|
48
59
|
defaultData,
|
|
@@ -120,11 +131,8 @@ export function TanstackTable<T extends object>({
|
|
|
120
131
|
<NoResults
|
|
121
132
|
clearFilters={clearFilters}
|
|
122
133
|
hasFilters={hasFilters}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
? error?.errorMessage ?? 'There was an error isLoading the data.'
|
|
126
|
-
: 'No results found.'
|
|
127
|
-
}
|
|
134
|
+
resetFiltersText={text.resetFilters}
|
|
135
|
+
message={hasErrorAndIsNotLoading ? error?.errorMessage ?? text.error : text.noResults}
|
|
128
136
|
/>
|
|
129
137
|
</td>
|
|
130
138
|
</tr>
|
|
@@ -132,7 +140,7 @@ export function TanstackTable<T extends object>({
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
if (isLoading) {
|
|
135
|
-
return <TableLoading columns={columns} message={
|
|
143
|
+
return <TableLoading columns={columns} message={text.loading} />;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
return (
|
|
@@ -169,10 +177,12 @@ export function TanstackTable<T extends object>({
|
|
|
169
177
|
onChangePage={onChangePage}
|
|
170
178
|
rowsPerPage={rowsPerPage}
|
|
171
179
|
totalEntriesText={
|
|
172
|
-
totalEntriesText ??
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
totalEntriesText ??
|
|
181
|
+
(rowCount === 1
|
|
182
|
+
? `1 ${text.entry}`
|
|
183
|
+
: `${totalRowsOnPage} ${text.of} ${rowCount} ${text.entries}`)
|
|
175
184
|
}
|
|
185
|
+
text={{ of: text.of }}
|
|
176
186
|
/>
|
|
177
187
|
) : null}
|
|
178
188
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
+
|
|
2
3
|
import '@testing-library/jest-dom';
|
|
3
|
-
import { TanstackTable } from '../TanstackTable';
|
|
4
4
|
import { data, columns } from './__mocks__/test-mock-data';
|
|
5
|
+
import { TanstackTable } from '../TanstackTable';
|
|
5
6
|
|
|
6
7
|
describe('Tanstack Table Component', () => {
|
|
7
8
|
test('renders the table with provided data', () => {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type Table } from '@tanstack/react-table';
|
|
3
|
+
|
|
4
4
|
import { Button } from '@/components/button';
|
|
5
5
|
|
|
6
|
+
import { ActionBar } from './ActionBar';
|
|
7
|
+
|
|
8
|
+
|
|
6
9
|
type DummyRow = {
|
|
7
10
|
id: string;
|
|
8
11
|
isSelected: boolean;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Row, Table } from '@tanstack/react-table';
|
|
3
|
-
import { Card } from '@/components/card';
|
|
1
|
+
import { type Row, type Table } from '@tanstack/react-table';
|
|
4
2
|
import classNames from 'classnames';
|
|
5
3
|
|
|
4
|
+
import { Card } from '@/components/card';
|
|
5
|
+
|
|
6
|
+
import type React from 'react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
6
10
|
type Props<T extends object> = {
|
|
7
11
|
/** Table instance. */
|
|
8
12
|
table: Table<T & { id: string }>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
+
|
|
3
|
+
|
|
3
4
|
import { ActionBar } from '../ActionBar';
|
|
5
|
+
|
|
4
6
|
import type { Table } from '@tanstack/react-table';
|
|
7
|
+
import type React from 'react';
|
|
5
8
|
|
|
6
9
|
type DummyRow = {
|
|
7
10
|
getIsSelected: () => boolean;
|
|
@@ -4,16 +4,22 @@ type Props = {
|
|
|
4
4
|
clearFilters?: () => void;
|
|
5
5
|
hasFilters?: boolean;
|
|
6
6
|
message: string;
|
|
7
|
+
resetFiltersText?: string;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
export function NoResults({
|
|
10
|
+
export function NoResults({
|
|
11
|
+
clearFilters,
|
|
12
|
+
hasFilters,
|
|
13
|
+
message,
|
|
14
|
+
resetFiltersText = 'Reset filters',
|
|
15
|
+
}: Props) {
|
|
10
16
|
return (
|
|
11
17
|
<div className="tanstack-table__no-results" data-testid="tanstack-table-no-results">
|
|
12
18
|
<p className="tanstack-table__no-results__text">{message}</p>
|
|
13
19
|
{hasFilters && (
|
|
14
20
|
<p className="tanstack-table__no-results__text">
|
|
15
|
-
<Button ariaLabel=
|
|
16
|
-
|
|
21
|
+
<Button ariaLabel={resetFiltersText} variant="link" onClick={clearFilters}>
|
|
22
|
+
{resetFiltersText}
|
|
17
23
|
</Button>
|
|
18
24
|
</p>
|
|
19
25
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Column, flexRender, Header, Table } from '@tanstack/react-table';
|
|
1
|
+
import { type Column, flexRender, type Header, type Table } from '@tanstack/react-table';
|
|
3
2
|
import classNames from 'classnames';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
|
|
4
5
|
import { getThStyles } from '../../helpers';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Pagination as PaginationComponent } from '../../../pagination';
|
|
2
1
|
import { Row, Col } from '../../../grid';
|
|
2
|
+
import { Pagination as PaginationComponent, type PaginationText } from '../../../pagination';
|
|
3
3
|
|
|
4
4
|
interface TablePaginationProps {
|
|
5
5
|
rowsPerPage: number;
|
|
@@ -7,6 +7,7 @@ interface TablePaginationProps {
|
|
|
7
7
|
onChangePage: (page: number) => void;
|
|
8
8
|
currentPage: number;
|
|
9
9
|
totalEntriesText?: string;
|
|
10
|
+
text?: PaginationText;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const TablePagination = ({
|
|
@@ -15,6 +16,7 @@ export const TablePagination = ({
|
|
|
15
16
|
onChangePage,
|
|
16
17
|
currentPage,
|
|
17
18
|
totalEntriesText,
|
|
19
|
+
text,
|
|
18
20
|
}: TablePaginationProps) => {
|
|
19
21
|
const totalPages = Math.ceil(rowCount / rowsPerPage);
|
|
20
22
|
|
|
@@ -37,6 +39,7 @@ export const TablePagination = ({
|
|
|
37
39
|
totalPages={totalPages}
|
|
38
40
|
currentPage={currentPage}
|
|
39
41
|
onChange={(page) => onChangePage(page)}
|
|
42
|
+
text={text}
|
|
40
43
|
/>
|
|
41
44
|
</Col>
|
|
42
45
|
</Row>
|
package/src/components/tanstackTable/docs/internalSorting/InternalClientSideSorting.stories.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type ColumnDef } from '@tanstack/react-table';
|
|
2
3
|
|
|
3
|
-
import { TanstackTable } from '../../TanstackTable';
|
|
4
|
-
import { people, Person } from '../../mock-data/mock-data';
|
|
5
|
-
import { columns } from '../../mock-data/table-configuration';
|
|
6
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
7
4
|
import { Button } from '../../../button';
|
|
5
|
+
import { people, type Person } from '../../mock-data/mock-data';
|
|
6
|
+
import { columns } from '../../mock-data/table-configuration';
|
|
7
|
+
import { TanstackTable } from '../../TanstackTable';
|
|
8
8
|
|
|
9
9
|
const meta: Meta = {
|
|
10
10
|
title: 'Layout/Tanstack Table/Internal Client Side Sorting',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type ColumnDef } from '@tanstack/react-table';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import { people, Person } from '../../mock-data/mock-data';
|
|
4
|
+
import { people, type Person } from '../../mock-data/mock-data';
|
|
5
5
|
import { columns } from '../../mock-data/table-configuration';
|
|
6
|
-
import {
|
|
6
|
+
import { TanstackTable } from '../../TanstackTable';
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
const meta: Meta = {
|
|
9
10
|
title: 'Layout/Tanstack Table/Pinned Columns',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type ColumnDef, type Row } from '@tanstack/react-table';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import { people, Person } from '../../mock-data/mock-data';
|
|
4
|
+
import { people, type Person } from '../../mock-data/mock-data';
|
|
5
5
|
import { columns } from '../../mock-data/table-configuration';
|
|
6
|
-
import {
|
|
6
|
+
import { TanstackTable } from '../../TanstackTable';
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
const meta: Meta = {
|
|
9
10
|
title: 'Layout/Tanstack Table/With Row Click',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Column } from '@tanstack/react-table';
|
|
2
|
-
import { CSSProperties } from 'react';
|
|
1
|
+
import { type Column } from '@tanstack/react-table';
|
|
2
|
+
import { type CSSProperties } from 'react';
|
|
3
3
|
|
|
4
4
|
// Sets style attributes for pinned columns
|
|
5
5
|
const getCommonPinningStyles = <T>(column: Column<T>): CSSProperties => {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
-
import { Person } from './mock-data';
|
|
3
|
-
import { Checkbox } from '@/components/forms/checkbox/Checkbox';
|
|
4
|
-
import { Button } from '@/components/button';
|
|
1
|
+
import { type ColumnDef } from '@tanstack/react-table';
|
|
5
2
|
import styled from 'styled-components';
|
|
6
3
|
|
|
4
|
+
|
|
5
|
+
import { Button } from '@/components/button';
|
|
6
|
+
import { Checkbox } from '@/components/forms/checkbox/Checkbox';
|
|
7
|
+
|
|
8
|
+
import { type Person } from './mock-data';
|
|
9
|
+
|
|
7
10
|
const PinHeaderColumns = ({
|
|
8
11
|
content,
|
|
9
12
|
onPinClick,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
2
3
|
import { Tooltip } from './Tooltip';
|
|
3
|
-
import { Col, Container, Row } from '../grid';
|
|
4
4
|
import { Button } from '../button';
|
|
5
|
+
import { Col, Container, Row } from '../grid';
|
|
5
6
|
|
|
6
7
|
const meta: Meta = {
|
|
7
8
|
title: 'Utilities/Tooltip',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import { PlacesType, Tooltip as ReactTooltip, PositionStrategy } from 'react-tooltip';
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import { type PlacesType, Tooltip as ReactTooltip, type PositionStrategy } from 'react-tooltip';
|
|
3
3
|
|
|
4
4
|
export interface TooltipProps {
|
|
5
5
|
id: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
2
3
|
import { Truncate } from './Truncate';
|
|
3
|
-
import { TruncateProps } from './types';
|
|
4
|
+
import { type TruncateProps } from './types';
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof Truncate> = {
|
|
6
7
|
title: 'Utilities/Truncate',
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useState, useEffect, CSSProperties, useMemo, useRef } from 'react';
|
|
2
|
-
import { Tooltip } from '../tooltip';
|
|
3
|
-
import { TruncateProps } from './types';
|
|
4
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
5
1
|
import classNames from 'classnames';
|
|
2
|
+
import { useState, useEffect, type CSSProperties, useMemo, useRef } from 'react';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
|
|
5
|
+
import { type TruncateProps } from './types';
|
|
6
|
+
import { Tooltip } from '../tooltip';
|
|
6
7
|
|
|
7
8
|
export const Truncate = ({
|
|
8
9
|
numLines = 1,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './swatches.scss';
|
|
2
2
|
import { Row, Col } from 'react-grid-system';
|
|
3
|
+
|
|
3
4
|
import { Icon } from '../../components';
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -34,7 +35,7 @@ export const Swatch = ({ color, shade, colorValue }: Props) => {
|
|
|
34
35
|
if (value.startsWith('rgba(')) {
|
|
35
36
|
const match = value.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);
|
|
36
37
|
if (match) {
|
|
37
|
-
const [,
|
|
38
|
+
const [, , , , a] = match;
|
|
38
39
|
const opacity = Math.round(parseFloat(a) * 100);
|
|
39
40
|
return `${opacity}%`;
|
|
40
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Meta } from '@storybook/react';
|
|
1
|
+
import { type Meta } from '@storybook/react';
|
|
2
|
+
|
|
2
3
|
import { ColorSwatch } from './ColorSwatch';
|
|
3
|
-
import { Card } from '../../index';
|
|
4
4
|
|
|
5
5
|
const TokenItem = ({ category, variant }: { category: string; variant: string }) => {
|
|
6
6
|
const colorVar = `--pf-semantic-${category}-${variant}`;
|
package/src/index.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type {
|
|
|
51
51
|
SortingFn,
|
|
52
52
|
} from '@tanstack/react-table';
|
|
53
53
|
export type { DateRange } from 'react-day-picker';
|
|
54
|
-
export type { SelectOption } from './components/forms/select/types';
|
|
54
|
+
export type { SelectOption, SelectText } from './components/forms/select/types';
|
|
55
55
|
|
|
56
56
|
// Functions
|
|
57
57
|
export {
|
package/src/setup/setupIcons.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IconDefinition, library } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
-
|
|
1
|
+
import { type IconDefinition, library } from '@fortawesome/fontawesome-svg-core';
|
|
3
2
|
// TODO: Once legacy components are removed, remove associated icons
|
|
4
3
|
import {
|
|
5
4
|
faArrowDown,
|
|
@@ -26,6 +25,7 @@ import {
|
|
|
26
25
|
faChevronLeft,
|
|
27
26
|
faChevronRight,
|
|
28
27
|
} from '@fortawesome/free-solid-svg-icons';
|
|
28
|
+
|
|
29
29
|
import { indiconDefinitions } from '@/components/icons/indicons';
|
|
30
30
|
|
|
31
31
|
// Utility for registering Font Awesome icons
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Common argTypes for form components that include a label and input
|
|
2
|
-
import { ArgTypes } from '@storybook/react';
|
|
2
|
+
import { type ArgTypes } from '@storybook/react';
|
|
3
|
+
|
|
3
4
|
import { iconNames } from './iconNames';
|
|
4
5
|
|
|
5
6
|
const labelArgTypes: ArgTypes = {
|
|
@@ -46,6 +47,16 @@ const labelArgTypes: ArgTypes = {
|
|
|
46
47
|
},
|
|
47
48
|
},
|
|
48
49
|
},
|
|
50
|
+
text: {
|
|
51
|
+
control: 'object',
|
|
52
|
+
description: 'Customizable text.',
|
|
53
|
+
table: {
|
|
54
|
+
category: 'i18n Text',
|
|
55
|
+
type: {
|
|
56
|
+
summary: '{ required?: string }',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
49
60
|
};
|
|
50
61
|
|
|
51
62
|
const baseInputArgTypes: ArgTypes = {
|
|
@@ -62,6 +62,14 @@ import { Icon } from '@indico-data/design-system';
|
|
|
62
62
|
<Icon name="indico-o" />;
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
### The `text` Prop
|
|
66
|
+
|
|
67
|
+
Components expose generic UI strings via a `text` prop to enable i18n. These are strings that are the same regardless of context (like "Loading...", "Close", "Next Page"). All have English defaults, pass custom values to override:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<Select text={{ placeholder: 'Choisir...', noOptions: 'Aucune option' }} />
|
|
71
|
+
```
|
|
72
|
+
|
|
65
73
|
### Utility Classes
|
|
66
74
|
|
|
67
75
|
Utility classes are pre-defined CSS classes that provide quick and easy styling options for common design patterns. They help maintain consistency and speed up development by offering ready-to-use styles for margins, typography, and more. For a complete list of available utility classes and their usage, see our [Utility Classes documentation](/docs/utility-classes-overview--docs).
|