@ssa-ui-kit/core 2.33.0 → 3.0.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/dist/components/AccordionGroup/Accordion.d.ts +37 -0
- package/dist/components/AccordionGroup/AccordionContent.d.ts +48 -0
- package/dist/components/AccordionGroup/AccordionContext.d.ts +76 -2
- package/dist/components/AccordionGroup/AccordionGroup.d.ts +56 -0
- package/dist/components/AccordionGroup/AccordionTitle.d.ts +41 -0
- package/dist/components/AccordionGroup/types.d.ts +199 -1
- package/dist/components/Avatar/Avatar.d.ts +33 -0
- package/dist/components/Button/Button.d.ts +61 -0
- package/dist/components/Button/fixtures.d.ts +52 -31
- package/dist/components/Button/styles.d.ts +7 -12
- package/dist/components/Button/types.d.ts +98 -4
- package/dist/components/Charts/BarGaugeChart/components/BarGaugeChartHeader.d.ts +1 -1
- package/dist/components/Charts/BarLineComplexChart/BarLineComplexChartView.d.ts +2 -2
- package/dist/components/Charts/BarLineComplexChart/types.d.ts +2 -2
- package/dist/components/Charts/BigNumberChart/BigNumberChart.d.ts +4 -2
- package/dist/components/Charts/BigNumberChart/components/BigNumberChartHeader.d.ts +1 -1
- package/dist/components/Charts/BigNumberChart/components/TrendLine.d.ts +8 -3
- package/dist/components/Charts/BigNumberChart/components/TrendLineTooltip.d.ts +8 -5
- package/dist/components/Charts/GaugeChart/components/GaugeChartBase.d.ts +3 -1
- package/dist/components/Charts/GaugeChart/components/GaugeChartHeader.d.ts +1 -1
- package/dist/components/Charts/PieChart/PieChartLegendMarker.d.ts +1 -1
- package/dist/components/Charts/PieChart/styles.d.ts +1 -1
- package/dist/components/Charts/PieChart/types.d.ts +1 -1
- package/dist/components/Charts/RadarChart/RadarChart.d.ts +1 -1
- package/dist/components/Charts/RadarChart/components/RadarChartHeader.d.ts +1 -1
- package/dist/components/Charts/TreeMapChart/TreeMapChart.d.ts +1 -1
- package/dist/components/Charts/TreeMapChart/TreeMapChartHeader.d.ts +1 -1
- package/dist/components/Charts/index.d.ts +1 -0
- package/dist/components/Charts/utils/nivoReact19Compat.d.ts +18 -0
- package/dist/components/Checkbox/Checkbox.d.ts +84 -0
- package/dist/components/Checkbox/CheckboxBase.d.ts +1 -1
- package/dist/components/Checkbox/styles.d.ts +2 -2
- package/dist/components/Checkbox/types.d.ts +104 -3
- package/dist/components/Chip/Chip.d.ts +70 -0
- package/dist/components/Chip/constants.d.ts +1 -1
- package/dist/components/Chip/helpers.d.ts +6 -0
- package/dist/components/Chip/types.d.ts +129 -1
- package/dist/components/CollapsibleNavBar/CollapsibleNavBar.d.ts +1 -1
- package/dist/components/CollapsibleNavBar/CollapsibleNavBarContext.d.ts +2 -2
- package/dist/components/CollapsibleNavBar/components/TriggerIcon.d.ts +4 -2
- package/dist/components/CollapsibleNavBar/types.d.ts +9 -2
- package/dist/components/ColorPicker/components/CopyButton.d.ts +1 -1
- package/dist/components/DatePicker/constants.d.ts +22 -0
- package/dist/components/DatePicker/hooks/useDatePicker.d.ts +7 -5
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts +3 -2
- package/dist/components/DatePicker/types.d.ts +10 -2
- package/dist/components/DatePicker/utils/dates.d.ts +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePickerFormBridge.d.ts +46 -0
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +3 -2
- package/dist/components/DateRangePicker/constants.d.ts +1 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +22 -17
- package/dist/components/DateRangePicker/index.d.ts +3 -0
- package/dist/components/DateRangePicker/styles.d.ts +6 -4
- package/dist/components/DateRangePicker/types.d.ts +24 -7
- package/dist/components/DateRangePicker/utils/dates.d.ts +2 -2
- package/dist/components/Drawer/index.d.ts +2 -1
- package/dist/components/Dropdown/Dropdown.d.ts +88 -0
- package/dist/components/Dropdown/types.d.ts +78 -0
- package/dist/components/DropdownOptions/DropdownOptions.d.ts +31 -0
- package/dist/components/DropdownOptions/types.d.ts +22 -0
- package/dist/components/DropdownToggle/DropdownToggle.d.ts +1 -1
- package/dist/components/Field/FieldControl.d.ts +62 -1
- package/dist/components/Field/FieldDescription.d.ts +33 -0
- package/dist/components/Field/FieldError.d.ts +36 -0
- package/dist/components/Field/FieldLabel.d.ts +37 -0
- package/dist/components/Field/FieldProvider.d.ts +19 -1
- package/dist/components/Field/FieldRoot.d.ts +90 -0
- package/dist/components/Field/FieldSuccess.d.ts +34 -0
- package/dist/components/Field/index.d.ts +4 -0
- package/dist/components/Filters/FilterBlockWrapper.d.ts +3 -2
- package/dist/components/Filters/FiltersContext.d.ts +4 -4
- package/dist/components/Filters/hooks/useVisibility.d.ts +2 -2
- package/dist/components/FullscreenModeContext.d.ts +1 -4
- package/dist/components/Icon/icons/iconsList.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +39 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/IconButton/styles.d.ts +2 -0
- package/dist/components/IconButton/types.d.ts +41 -0
- package/dist/components/Indicator/types.d.ts +4 -2
- package/dist/components/Input/types.d.ts +157 -0
- package/dist/components/JsonSchemaForm/fields/DateRangeField.d.ts +15 -1
- package/dist/components/JsonSchemaForm/utils/dateFormats.d.ts +37 -0
- package/dist/components/JsonSchemaForm/utils/dateRangeField.d.ts +24 -0
- package/dist/components/JsonSchemaForm/utils/index.d.ts +1 -0
- package/dist/components/JsonSchemaForm/utils/selectWidget.d.ts +16 -0
- package/dist/components/Modal/Modal.d.ts +60 -0
- package/dist/components/Modal/types.d.ts +21 -1
- package/dist/components/ModalContent/ModalContent.d.ts +42 -1
- package/dist/components/ModalDialog/ModalDialog.d.ts +27 -0
- package/dist/components/ModalDialog/types.d.ts +18 -0
- package/dist/components/ModalDismissButton/ModalDismissButton.d.ts +29 -2
- package/dist/components/ModalOpenButton/ModalOpenButton.d.ts +25 -1
- package/dist/components/NavBar/types.d.ts +1 -1
- package/dist/components/NotificationMenu/types.d.ts +3 -3
- package/dist/components/Pagination/ArrowButton.d.ts +32 -0
- package/dist/components/Pagination/Pagination.d.ts +81 -0
- package/dist/components/Pagination/PaginationButtons.d.ts +35 -0
- package/dist/components/Pagination/PaginationContext.d.ts +30 -0
- package/dist/components/Pagination/WithPagination.d.ts +47 -4
- package/dist/components/Pagination/components/RowsPerPageDropdown/RowsPerPageDropdown.d.ts +41 -0
- package/dist/components/Pagination/components/RowsPerPageDropdown/types.d.ts +39 -0
- package/dist/components/Pagination/styles.d.ts +1 -1
- package/dist/components/Pagination/types.d.ts +178 -0
- package/dist/components/PersonInfo/styles.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +120 -0
- package/dist/components/Popover/PopoverClose.d.ts +26 -0
- package/dist/components/Popover/PopoverContent.d.ts +33 -0
- package/dist/components/Popover/PopoverDescription.d.ts +22 -1
- package/dist/components/Popover/PopoverHeading.d.ts +22 -1
- package/dist/components/Popover/PopoverTrigger.d.ts +30 -0
- package/dist/components/Popover/hooks/usePopover.d.ts +21 -0
- package/dist/components/Popover/hooks/usePopoverContext.d.ts +23 -0
- package/dist/components/Popover/types.d.ts +86 -0
- package/dist/components/Radio/Radio.d.ts +69 -1
- package/dist/components/Radio/RadioBase.d.ts +1 -1
- package/dist/components/Radio/types.d.ts +109 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/types.d.ts +42 -0
- package/dist/components/SearchBox/SearchBox.d.ts +60 -0
- package/dist/components/SearchBox/SearchBoxInput.d.ts +1 -1
- package/dist/components/SearchBox/types.d.ts +46 -0
- package/dist/components/Slider/Slider.d.ts +53 -0
- package/dist/components/Slider/consts.d.ts +4 -0
- package/dist/components/Slider/index.d.ts +4 -0
- package/dist/components/Slider/styles.d.ts +90 -0
- package/dist/components/Slider/types.d.ts +69 -0
- package/dist/components/Switch/Switch.d.ts +66 -1
- package/dist/components/Switch/SwitchBase.d.ts +5 -1
- package/dist/components/Switch/SwitchContext.d.ts +50 -0
- package/dist/components/Switch/types.d.ts +74 -0
- package/dist/components/Table/Table.d.ts +74 -0
- package/dist/components/TableBody/TableBody.d.ts +55 -0
- package/dist/components/TableCell/TableCell.d.ts +56 -4
- package/dist/components/TableCell/types.d.ts +33 -0
- package/dist/components/TableCellHeader/TableCellHeader.d.ts +63 -2
- package/dist/components/TableCellHeader/types.d.ts +28 -0
- package/dist/components/TableFilters/TableFilters.d.ts +72 -0
- package/dist/components/TableFilters/hooks/useTableData.d.ts +3 -3
- package/dist/components/TableFilters/types.d.ts +130 -2
- package/dist/components/TableHead/TableHead.d.ts +37 -0
- package/dist/components/TableRow/TableRow.d.ts +2 -7
- package/dist/components/TableRow/types.d.ts +34 -0
- package/dist/components/TextField/TextField.d.ts +76 -0
- package/dist/components/TextField/types.d.ts +80 -0
- package/dist/components/Textarea/Textarea.d.ts +81 -0
- package/dist/components/Textarea/types.d.ts +95 -0
- package/dist/components/Tooltip/SimpleChartTooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.d.ts +73 -0
- package/dist/components/Tooltip/types.d.ts +116 -5
- package/dist/components/TooltipContent/TooltipContent.d.ts +45 -0
- package/dist/components/TooltipTrigger/TooltipTrigger.d.ts +27 -1
- package/dist/components/Typeahead/Typeahead.context.d.ts +10 -4
- package/dist/components/Typeahead/Typeahead.d.ts +173 -9
- package/dist/components/Typeahead/components/TypeaheadOption.d.ts +1 -1
- package/dist/components/Typeahead/styles.d.ts +9 -4
- package/dist/components/Typeahead/types.d.ts +191 -1
- package/dist/components/Typeahead/useTypeahead.d.ts +13 -5
- package/dist/components/Typography/Typography.d.ts +50 -0
- package/dist/components/Typography/types.d.ts +67 -0
- package/dist/components/UserProfile/UserProfile.d.ts +76 -0
- package/dist/components/UserProfile/styles.d.ts +6 -4
- package/dist/components/UserProfile/types.d.ts +85 -1
- package/dist/components/WidgetCard/Title.d.ts +1 -1
- package/dist/components/WidgetCard/WidgetCardBase.d.ts +1 -1
- package/dist/components/WithLink.d.ts +1 -1
- package/dist/components/Wrapper/Wrapper.d.ts +83 -2
- package/dist/components/Wrapper/index.d.ts +1 -0
- package/dist/components/index.d.ts +113 -85
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47400 -19567
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +63 -0
- package/dist/utils/react19HocCompat.d.ts +14 -0
- package/package.json +42 -33
|
@@ -1,3 +1,68 @@
|
|
|
1
1
|
import { SwitchProps } from './types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Switch - Toggle switch component for binary states
|
|
4
|
+
*
|
|
5
|
+
* A toggle switch component for enabling/disabling features or settings.
|
|
6
|
+
* Displays an on/off toggle that users can click to change state. Must be
|
|
7
|
+
* used within SwitchContextProvider which manages the switch state and
|
|
8
|
+
* provides toggle functionality.
|
|
9
|
+
*
|
|
10
|
+
* Colors are sourced from `theme.palette` for consistency with Button,
|
|
11
|
+
* Checkbox, and Radio. Pass `color="custom"` together with the `colors`
|
|
12
|
+
* object to supply arbitrary CSS color values.
|
|
13
|
+
*
|
|
14
|
+
* The off state always shows a neutral grey background. The disabled state
|
|
15
|
+
* always uses `greyFocused40`, regardless of color variant.
|
|
16
|
+
*
|
|
17
|
+
* @category Form Controls
|
|
18
|
+
* @subcategory Input
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Default (primary / blue)
|
|
23
|
+
* <SwitchContextProvider initialState={false}>
|
|
24
|
+
* <Switch label="Enable notifications" />
|
|
25
|
+
* </SwitchContextProvider>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Success (green) variant
|
|
31
|
+
* <SwitchContextProvider initialState={false}>
|
|
32
|
+
* <Switch label="Enable feature" color="success" />
|
|
33
|
+
* </SwitchContextProvider>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Disabled (muted grey, cannot toggle)
|
|
39
|
+
* <SwitchContextProvider initialState={true}>
|
|
40
|
+
* <Switch label="Locked feature" isDisabled />
|
|
41
|
+
* </SwitchContextProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // Custom color escape hatch
|
|
47
|
+
* <SwitchContextProvider initialState={false}>
|
|
48
|
+
* <Switch
|
|
49
|
+
* label="Custom toggle"
|
|
50
|
+
* color="custom"
|
|
51
|
+
* colors={{ on: '#ff0000', offOutline: '#ff9999' }}
|
|
52
|
+
* />
|
|
53
|
+
* </SwitchContextProvider>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @see {@link SwitchContextProvider} - Required parent component for state management
|
|
57
|
+
*
|
|
58
|
+
* @accessibility
|
|
59
|
+
* - Uses role="switch" for proper ARIA semantics
|
|
60
|
+
* - aria-checked reflects current state
|
|
61
|
+
* - aria-readonly reflects disabled state
|
|
62
|
+
* - aria-label provided via label prop
|
|
63
|
+
* - Keyboard accessible (Space/Enter to toggle)
|
|
64
|
+
*
|
|
65
|
+
* @requires SwitchContextProvider - Must be wrapped in SwitchContextProvider
|
|
66
|
+
*/
|
|
67
|
+
declare const Switch: ({ label, isDisabled, color, colors, }: SwitchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
68
|
export default Switch;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
interface SwitchBaseProps {
|
|
2
|
+
onColor: string;
|
|
3
|
+
offOutlineColor: string;
|
|
4
|
+
}
|
|
1
5
|
declare const SwitchBase: import("@emotion/styled").StyledComponent<{
|
|
2
6
|
theme?: import("@emotion/react").Theme;
|
|
3
7
|
as?: React.ElementType;
|
|
4
|
-
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
8
|
+
} & SwitchBaseProps, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
5
9
|
export default SwitchBase;
|
|
@@ -1,10 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch context value
|
|
3
|
+
* Provides switch state and toggle function to Switch component
|
|
4
|
+
*/
|
|
1
5
|
export interface SwitchContext {
|
|
6
|
+
/**
|
|
7
|
+
* Current state of the switch
|
|
8
|
+
* - `true`: Switch is on/enabled
|
|
9
|
+
* - `false`: Switch is off/disabled (default)
|
|
10
|
+
*/
|
|
2
11
|
isOn: boolean;
|
|
12
|
+
/** Function to toggle switch state */
|
|
3
13
|
toggle: () => void;
|
|
4
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Default context value for SwitchContext
|
|
17
|
+
* Used as fallback when context is accessed outside SwitchContextProvider
|
|
18
|
+
* @default isOn: false - Switch defaults to off state
|
|
19
|
+
*/
|
|
5
20
|
export declare const SwitchContext: import("react").Context<SwitchContext>;
|
|
21
|
+
/**
|
|
22
|
+
* Hook to access Switch context
|
|
23
|
+
*
|
|
24
|
+
* @returns Switch context with isOn state and toggle function
|
|
25
|
+
* @throws Error if used outside SwitchContextProvider
|
|
26
|
+
*/
|
|
6
27
|
export declare const useSwitchContext: () => SwitchContext;
|
|
28
|
+
/**
|
|
29
|
+
* SwitchContextProvider - Context provider for Switch component
|
|
30
|
+
*
|
|
31
|
+
* Provides switch state management and toggle functionality to child Switch
|
|
32
|
+
* components. Manages the on/off state internally and exposes it via context.
|
|
33
|
+
*
|
|
34
|
+
* @category Form Controls
|
|
35
|
+
* @subcategory Context
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <SwitchContextProvider initialState={false}>
|
|
40
|
+
* <Switch label="Enable feature" />
|
|
41
|
+
* </SwitchContextProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // Multiple switches sharing state (if needed)
|
|
47
|
+
* <SwitchContextProvider initialState={true}>
|
|
48
|
+
* <Switch label="Switch 1" />
|
|
49
|
+
* <Switch label="Switch 2" />
|
|
50
|
+
* </SwitchContextProvider>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @see {@link Switch} - Component that consumes this context
|
|
54
|
+
*/
|
|
7
55
|
export declare const SwitchContextProvider: ({ initialState, children, }: {
|
|
56
|
+
/** Initial on/off state of the switch */
|
|
8
57
|
initialState?: boolean;
|
|
58
|
+
/** Child components (typically Switch component) */
|
|
9
59
|
children: React.ReactNode;
|
|
10
60
|
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the Switch component
|
|
3
|
+
*
|
|
4
|
+
* Toggle switch component for binary on/off states. Must be used within
|
|
5
|
+
* SwitchContextProvider to access toggle state and functionality.
|
|
6
|
+
*
|
|
7
|
+
* Colors are driven by `theme.palette` for consistency with Button, Checkbox,
|
|
8
|
+
* and Radio:
|
|
9
|
+
* - `primary` (default) — blue; uses `palette.primary.main` for the on-state
|
|
10
|
+
* background, `palette.primary.light` for the off-state focus outline.
|
|
11
|
+
* - `success` — green; uses `palette.success.main` for the on-state background,
|
|
12
|
+
* `palette.success.light` for the off-state focus outline.
|
|
13
|
+
* - `custom` — no built-in color; supply exact values via the `colors` prop.
|
|
14
|
+
*
|
|
15
|
+
* The off state always uses a neutral grey background regardless of variant.
|
|
16
|
+
* Disabled state always uses `greyFocused40` (semi-transparent grey, same for all variants).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Default (primary / blue)
|
|
21
|
+
* <SwitchContextProvider initialState={false}>
|
|
22
|
+
* <Switch label="Enable notifications" />
|
|
23
|
+
* </SwitchContextProvider>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Success (green) variant
|
|
29
|
+
* <SwitchContextProvider initialState={false}>
|
|
30
|
+
* <Switch label="Enable feature" color="success" />
|
|
31
|
+
* </SwitchContextProvider>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Custom color escape hatch
|
|
37
|
+
* <SwitchContextProvider initialState={false}>
|
|
38
|
+
* <Switch
|
|
39
|
+
* label="Custom toggle"
|
|
40
|
+
* color="custom"
|
|
41
|
+
* colors={{
|
|
42
|
+
* on: '#ff0000',
|
|
43
|
+
* offOutline: '#ff9999',
|
|
44
|
+
* }}
|
|
45
|
+
* />
|
|
46
|
+
* </SwitchContextProvider>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
1
49
|
export interface SwitchProps {
|
|
50
|
+
/**
|
|
51
|
+
* Accessible label for the switch
|
|
52
|
+
* Used as aria-label for screen readers
|
|
53
|
+
*/
|
|
2
54
|
label: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the switch is disabled
|
|
57
|
+
* Disabled switches cannot be toggled and appear visually muted
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
3
60
|
isDisabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Palette-based color variant.
|
|
63
|
+
* - `primary` — blue (uses `palette.primary`)
|
|
64
|
+
* - `success` — green (uses `palette.success`)
|
|
65
|
+
* - `custom` — no built-in color; supply exact values via the `colors` prop
|
|
66
|
+
* @default 'primary'
|
|
67
|
+
*/
|
|
68
|
+
color?: 'primary' | 'success' | 'custom';
|
|
69
|
+
/**
|
|
70
|
+
* Fine-grained color overrides — only applied when `color="custom"`.
|
|
71
|
+
*/
|
|
72
|
+
colors?: {
|
|
73
|
+
/** Background color when the switch is on (checked) */
|
|
74
|
+
on?: string;
|
|
75
|
+
/** Border color of the outline shown when off and focused/hovered */
|
|
76
|
+
offOutline?: string;
|
|
77
|
+
};
|
|
4
78
|
}
|
|
@@ -1,4 +1,78 @@
|
|
|
1
1
|
import { CommonProps } from '../../types/emotion';
|
|
2
|
+
/**
|
|
3
|
+
* Table - Base table component for displaying tabular data
|
|
4
|
+
*
|
|
5
|
+
* A styled table element that serves as the foundation for displaying
|
|
6
|
+
* structured tabular data. Works in conjunction with TableHead, TableBody,
|
|
7
|
+
* TableRow, TableCell, and TableCellHeader components to create complete
|
|
8
|
+
* data tables with proper semantics and styling.
|
|
9
|
+
*
|
|
10
|
+
* Component structure:
|
|
11
|
+
* - Table (root container)
|
|
12
|
+
* - TableHead (header section with column headers)
|
|
13
|
+
* - TableRow
|
|
14
|
+
* - TableCellHeader (header cells)
|
|
15
|
+
* - TableBody (body section with data rows)
|
|
16
|
+
* - TableRow (data rows)
|
|
17
|
+
* - TableCell (data cells)
|
|
18
|
+
*
|
|
19
|
+
* @category Components
|
|
20
|
+
* @subcategory Data Display
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Basic table
|
|
25
|
+
* <Table>
|
|
26
|
+
* <TableHead>
|
|
27
|
+
* <TableRow>
|
|
28
|
+
* <TableCellHeader>Name</TableCellHeader>
|
|
29
|
+
* <TableCellHeader>Email</TableCellHeader>
|
|
30
|
+
* <TableCellHeader>Role</TableCellHeader>
|
|
31
|
+
* </TableRow>
|
|
32
|
+
* </TableHead>
|
|
33
|
+
* <TableBody>
|
|
34
|
+
* {users.map(user => (
|
|
35
|
+
* <TableRow key={user.id}>
|
|
36
|
+
* <TableCell>{user.name}</TableCell>
|
|
37
|
+
* <TableCell>{user.email}</TableCell>
|
|
38
|
+
* <TableCell>{user.role}</TableCell>
|
|
39
|
+
* </TableRow>
|
|
40
|
+
* ))}
|
|
41
|
+
* </TableBody>
|
|
42
|
+
* </Table>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* // Table with custom styling
|
|
48
|
+
* <Table css={{ border: '1px solid #ccc' }}>
|
|
49
|
+
* <TableHead>
|
|
50
|
+
* <TableRow>
|
|
51
|
+
* <TableCellHeader>Column 1</TableCellHeader>
|
|
52
|
+
* <TableCellHeader align="center">Column 2</TableCellHeader>
|
|
53
|
+
* </TableRow>
|
|
54
|
+
* </TableHead>
|
|
55
|
+
* <TableBody>
|
|
56
|
+
* <TableRow>
|
|
57
|
+
* <TableCell>Data 1</TableCell>
|
|
58
|
+
* <TableCell align="center">Data 2</TableCell>
|
|
59
|
+
* </TableRow>
|
|
60
|
+
* </TableBody>
|
|
61
|
+
* </Table>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see {@link TableHead} - Header section component
|
|
65
|
+
* @see {@link TableBody} - Body section component
|
|
66
|
+
* @see {@link TableRow} - Row component
|
|
67
|
+
* @see {@link TableCell} - Data cell component
|
|
68
|
+
* @see {@link TableCellHeader} - Header cell component
|
|
69
|
+
*
|
|
70
|
+
* @accessibility
|
|
71
|
+
* - Semantic HTML table element
|
|
72
|
+
* - Proper table structure for screen readers
|
|
73
|
+
* - Keyboard navigation support
|
|
74
|
+
* - ARIA attributes when needed
|
|
75
|
+
*/
|
|
2
76
|
declare const Table: import("@emotion/styled").StyledComponent<{
|
|
3
77
|
theme?: import("@emotion/react").Theme;
|
|
4
78
|
as?: React.ElementType;
|
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
import { CommonProps } from '../../types/emotion';
|
|
2
|
+
/**
|
|
3
|
+
* TableBody - Body section container for table data rows
|
|
4
|
+
*
|
|
5
|
+
* A styled tbody element that wraps table data rows. Provides styling
|
|
6
|
+
* for the table body section including hover effects on rows, rounded
|
|
7
|
+
* corners for the last row, and proper spacing. Used with TableRow and
|
|
8
|
+
* TableCell components.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
* @subcategory Data Display
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Basic table body
|
|
16
|
+
* <Table>
|
|
17
|
+
* <TableHead>
|
|
18
|
+
* // header rows go here
|
|
19
|
+
* </TableHead>
|
|
20
|
+
* <TableBody>
|
|
21
|
+
* {data.map(item => (
|
|
22
|
+
* <TableRow key={item.id}>
|
|
23
|
+
* <TableCell>{item.name}</TableCell>
|
|
24
|
+
* <TableCell>{item.email}</TableCell>
|
|
25
|
+
* <TableCell>{item.role}</TableCell>
|
|
26
|
+
* </TableRow>
|
|
27
|
+
* ))}
|
|
28
|
+
* </TableBody>
|
|
29
|
+
* </Table>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* // Table body with disabled rows (aria-disabled is automatically set)
|
|
35
|
+
* <TableBody>
|
|
36
|
+
* {items.map(item => (
|
|
37
|
+
* <TableRow
|
|
38
|
+
* key={item.id}
|
|
39
|
+
* isDisabled={item.disabled}>
|
|
40
|
+
* <TableCell>{item.name}</TableCell>
|
|
41
|
+
* </TableRow>
|
|
42
|
+
* ))}
|
|
43
|
+
* </TableBody>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @see {@link Table} - Parent table component
|
|
47
|
+
* @see {@link TableRow} - Row component for data
|
|
48
|
+
* @see {@link TableCell} - Data cell component
|
|
49
|
+
* @see {@link TableHead} - Header section component
|
|
50
|
+
*
|
|
51
|
+
* @accessibility
|
|
52
|
+
* - Semantic HTML tbody element
|
|
53
|
+
* - Proper table structure for screen readers
|
|
54
|
+
* - Hover effects respect aria-disabled attribute
|
|
55
|
+
* - Supports ARIA attributes via CommonProps
|
|
56
|
+
*/
|
|
2
57
|
declare const TableBody: import("@emotion/styled").StyledComponent<{
|
|
3
58
|
theme?: import("@emotion/react").Theme;
|
|
4
59
|
as?: React.ElementType;
|
|
@@ -1,8 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableCellProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TableCell - Table data cell component
|
|
4
|
+
*
|
|
5
|
+
* A styled td element that represents a single data cell in a table row.
|
|
6
|
+
* Used within TableRow components in the TableBody section. Supports
|
|
7
|
+
* text alignment customization. For header cells, use TableCellHeader instead.
|
|
8
|
+
*
|
|
9
|
+
* @category Components
|
|
10
|
+
* @subcategory Data Display
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic table cell
|
|
15
|
+
* <TableRow>
|
|
16
|
+
* <TableCell>John Doe</TableCell>
|
|
17
|
+
* <TableCell>john@example.com</TableCell>
|
|
18
|
+
* <TableCell>Admin</TableCell>
|
|
19
|
+
* </TableRow>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Table cell with center alignment
|
|
25
|
+
* <TableRow>
|
|
26
|
+
* <TableCell>Name</TableCell>
|
|
27
|
+
* <TableCell align="center">Status</TableCell>
|
|
28
|
+
* <TableCell align="right">Price</TableCell>
|
|
29
|
+
* </TableRow>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* // Table cell with custom content
|
|
35
|
+
* <TableRow>
|
|
36
|
+
* <TableCell>
|
|
37
|
+
* <Badge color="success">Active</Badge>
|
|
38
|
+
* </TableCell>
|
|
39
|
+
* <TableCell>
|
|
40
|
+
* <Button size="small">Edit</Button>
|
|
41
|
+
* </TableCell>
|
|
42
|
+
* </TableRow>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @see {@link Table} - Parent table component
|
|
46
|
+
* @see {@link TableRow} - Row component (use this in TableBody)
|
|
47
|
+
* @see {@link TableCellHeader} - Header cell component (use in TableHead)
|
|
48
|
+
* @see {@link TableHead} - Header section component
|
|
49
|
+
* @see {@link TableBody} - Body section component
|
|
50
|
+
*
|
|
51
|
+
* @accessibility
|
|
52
|
+
* - Semantic HTML td element
|
|
53
|
+
* - Proper table structure for screen readers
|
|
54
|
+
* - Supports ARIA attributes via CommonProps
|
|
55
|
+
*/
|
|
2
56
|
declare const TableCell: import("@emotion/styled").StyledComponent<{
|
|
3
57
|
theme?: import("@emotion/react").Theme;
|
|
4
58
|
as?: React.ElementType;
|
|
5
|
-
} & {
|
|
6
|
-
align?: string;
|
|
7
|
-
} & CommonProps, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
|
|
59
|
+
} & TableCellProps, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
|
|
8
60
|
export default TableCell;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { CommonProps } from '../../types/emotion';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the TableCell component
|
|
5
|
+
*
|
|
6
|
+
* A styled table cell component that represents a single data cell in a table row.
|
|
7
|
+
* Supports text alignment customization.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // Basic table cell
|
|
12
|
+
* <TableCell>Data content</TableCell>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Table cell with center alignment
|
|
18
|
+
* <TableCell align="center">Centered</TableCell>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Table cell with right alignment
|
|
24
|
+
* <TableCell align="right">Right aligned</TableCell>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export interface TableCellProps extends CommonProps, Omit<HTMLAttributes<HTMLTableCellElement>, 'align'> {
|
|
28
|
+
/**
|
|
29
|
+
* Text alignment for the cell content
|
|
30
|
+
* @default 'left'
|
|
31
|
+
*/
|
|
32
|
+
align?: 'left' | 'center' | 'right' | 'justify';
|
|
33
|
+
}
|
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableCellHeaderProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TableCellHeader - Table header cell component
|
|
5
|
+
*
|
|
6
|
+
* A wrapper component that renders TableCell as a semantic th element for
|
|
7
|
+
* table headers. Used within TableRow components in the TableHead section.
|
|
8
|
+
* Provides the same styling and props as TableCell but with proper semantic
|
|
9
|
+
* HTML for header cells.
|
|
10
|
+
*
|
|
11
|
+
* @category Components
|
|
12
|
+
* @subcategory Data Display
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic table header
|
|
17
|
+
* <TableHead>
|
|
18
|
+
* <TableRow>
|
|
19
|
+
* <TableCellHeader>Name</TableCellHeader>
|
|
20
|
+
* <TableCellHeader>Email</TableCellHeader>
|
|
21
|
+
* <TableCellHeader>Role</TableCellHeader>
|
|
22
|
+
* </TableRow>
|
|
23
|
+
* </TableHead>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Table header with alignment
|
|
29
|
+
* <TableHead>
|
|
30
|
+
* <TableRow>
|
|
31
|
+
* <TableCellHeader>Product</TableCellHeader>
|
|
32
|
+
* <TableCellHeader align="center">Quantity</TableCellHeader>
|
|
33
|
+
* <TableCellHeader align="right">Price</TableCellHeader>
|
|
34
|
+
* </TableRow>
|
|
35
|
+
* </TableHead>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Table header with custom content
|
|
41
|
+
* <TableHead>
|
|
42
|
+
* <TableRow>
|
|
43
|
+
* <TableCellHeader>
|
|
44
|
+
* <Icon name="user" /> User
|
|
45
|
+
* </TableCellHeader>
|
|
46
|
+
* <TableCellHeader>Email</TableCellHeader>
|
|
47
|
+
* </TableRow>
|
|
48
|
+
* </TableHead>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see {@link Table} - Parent table component
|
|
52
|
+
* @see {@link TableHead} - Header section component (use this component here)
|
|
53
|
+
* @see {@link TableRow} - Row component (use in TableHead)
|
|
54
|
+
* @see {@link TableCell} - Data cell component (use in TableBody)
|
|
55
|
+
* @see {@link TableBody} - Body section component
|
|
56
|
+
*
|
|
57
|
+
* @accessibility
|
|
58
|
+
* - Semantic HTML th element (renders as th)
|
|
59
|
+
* - Proper table header semantics for screen readers
|
|
60
|
+
* - Supports ARIA attributes via TableCellProps
|
|
61
|
+
* - Better accessibility than using TableCell in headers
|
|
62
|
+
*/
|
|
63
|
+
declare const TableCellHeader: ({ children, ...props }: React.PropsWithChildren<TableCellHeaderProps>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
64
|
export default TableCellHeader;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TableCellProps } from '../TableCell/types';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the TableCellHeader component
|
|
4
|
+
*
|
|
5
|
+
* A wrapper component that renders TableCell as a th element for table headers.
|
|
6
|
+
* Inherits all props from TableCell but renders as a header cell semantically.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // Basic table cell header
|
|
11
|
+
* <TableRow>
|
|
12
|
+
* <TableCellHeader>Name</TableCellHeader>
|
|
13
|
+
* <TableCellHeader>Email</TableCellHeader>
|
|
14
|
+
* <TableCellHeader>Role</TableCellHeader>
|
|
15
|
+
* </TableRow>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Table cell header with alignment
|
|
21
|
+
* <TableRow>
|
|
22
|
+
* <TableCellHeader>Name</TableCellHeader>
|
|
23
|
+
* <TableCellHeader align="center">Status</TableCellHeader>
|
|
24
|
+
* <TableCellHeader align="right">Price</TableCellHeader>
|
|
25
|
+
* </TableRow>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export type TableCellHeaderProps = TableCellProps;
|
|
@@ -1,2 +1,74 @@
|
|
|
1
1
|
import { TableFiltersView } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TableFilters - Filter component for table data with grouped checkboxes
|
|
4
|
+
*
|
|
5
|
+
* A comprehensive filter component that provides grouped checkbox filters in a
|
|
6
|
+
* popover with accordion-style collapsible groups. Supports draft state management
|
|
7
|
+
* with submit, reset, and clear actions. Displays notification badge with selected
|
|
8
|
+
* filter group count.
|
|
9
|
+
*
|
|
10
|
+
* Component structure:
|
|
11
|
+
* - TableFilters (main component)
|
|
12
|
+
* - Popover (wrapper with trigger and content)
|
|
13
|
+
* - TableFilterTriggerWithNotification (trigger button with badge)
|
|
14
|
+
* - PopoverContent (filter content)
|
|
15
|
+
* - AccordionGroup (collapsible filter groups)
|
|
16
|
+
* - TableFiltersAccordion (individual filter group)
|
|
17
|
+
* - TableFiltersAccordionContent
|
|
18
|
+
* - TableFilterCheckbox (filter items)
|
|
19
|
+
* - TableFiltersButtons (submit, cancel, clear actions)
|
|
20
|
+
*
|
|
21
|
+
* @category Components
|
|
22
|
+
* @subcategory Data Display
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const filterConfig: TableFilterConfig = {
|
|
27
|
+
* status: {
|
|
28
|
+
* id: 'status',
|
|
29
|
+
* title: 'Status',
|
|
30
|
+
* isOpened: true,
|
|
31
|
+
* ariaControls: 'status-controls',
|
|
32
|
+
* items: {
|
|
33
|
+
* active: {
|
|
34
|
+
* key: 'active',
|
|
35
|
+
* name: 'active',
|
|
36
|
+
* content: { statePath: [], text: 'Active' },
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* selectedItems: [],
|
|
40
|
+
* },
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* <TableFilters
|
|
44
|
+
* checkboxData={filterConfig}
|
|
45
|
+
* onSubmit={() => applyFilters()}
|
|
46
|
+
* onReset={() => resetFilters()}
|
|
47
|
+
* onClear={() => clearFilters()}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // With checkbox toggle callback
|
|
54
|
+
* <TableFilters
|
|
55
|
+
* checkboxData={filterConfig}
|
|
56
|
+
* onCheckboxToggle={(groupName, itemName) => {
|
|
57
|
+
* console.log(`Toggled ${itemName} in ${groupName}`);
|
|
58
|
+
* }}
|
|
59
|
+
* onSubmit={handleSubmit}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @see {@link AccordionGroup} - Used for collapsible filter groups
|
|
64
|
+
* @see {@link Popover} - Used for filter popover overlay
|
|
65
|
+
* @see {@link TableFilterConfig} - Configuration type for filter data
|
|
66
|
+
*
|
|
67
|
+
* @accessibility
|
|
68
|
+
* - ARIA attributes for accordion groups
|
|
69
|
+
* - Keyboard navigation support
|
|
70
|
+
* - Screen reader friendly
|
|
71
|
+
* - Proper focus management
|
|
72
|
+
* - Notification badge for selected filters
|
|
73
|
+
*/
|
|
2
74
|
export declare const TableFilters: ({ checkboxData, onReset, onSubmit, onClear, onCheckboxToggle, handleMoreButtonVisibleChange, }: TableFiltersView) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { BaseSyntheticEvent } from 'react';
|
|
|
2
2
|
import { TableFilterConfig } from '../types';
|
|
3
3
|
export interface UseTableDataParameters {
|
|
4
4
|
initialState?: TableFilterConfig;
|
|
5
|
-
wrapperRef?: React.RefObject<HTMLElement>;
|
|
5
|
+
wrapperRef?: React.RefObject<HTMLElement | null>;
|
|
6
6
|
updatedCheckboxData?: TableFilterConfig;
|
|
7
7
|
handleCancel?: () => void;
|
|
8
8
|
handleClear?: () => void;
|
|
@@ -15,8 +15,8 @@ export interface UseTableDataParameters {
|
|
|
15
15
|
}
|
|
16
16
|
export declare const useTableData: ({ initialState, wrapperRef, updatedCheckboxData, handleCancel, handleSubmit, handleClear, handleDropdownChange, }: UseTableDataParameters) => {
|
|
17
17
|
checkboxData: TableFilterConfig;
|
|
18
|
-
wrapperRef: import("react").RefObject<HTMLElement> | undefined;
|
|
19
|
-
refsList: import("react").
|
|
18
|
+
wrapperRef: import("react").RefObject<HTMLElement | null> | undefined;
|
|
19
|
+
refsList: import("react").RefObject<HTMLElement | null>[];
|
|
20
20
|
setElementRef: (groupName: string, element: HTMLElement | null) => void;
|
|
21
21
|
onCheckboxToggle: (groupName: string, name: string | number) => void;
|
|
22
22
|
onDropdownChange: (groupName: string, name: string | number) => void;
|