@ssa-ui-kit/core 2.33.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +102 -1
- package/dist/components/DropdownOption/DropdownOption.d.ts +2 -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 +3 -2
- package/dist/components/DropdownToggle/types.d.ts +5 -3
- 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/Assessment.d.ts +1 -1
- package/dist/components/Icon/icons/Award.d.ts +3 -0
- package/dist/components/Icon/icons/Bench.d.ts +3 -0
- package/dist/components/Icon/icons/Briefcase.d.ts +3 -0
- package/dist/components/Icon/icons/Building.d.ts +3 -0
- package/dist/components/Icon/icons/CalendarSchedule.d.ts +3 -0
- package/dist/components/Icon/icons/Camera.d.ts +3 -0
- package/dist/components/Icon/icons/CardText.d.ts +3 -0
- package/dist/components/Icon/icons/Case.d.ts +3 -0
- package/dist/components/Icon/icons/Comments.d.ts +3 -0
- package/dist/components/Icon/icons/Compensation.d.ts +3 -0
- package/dist/components/Icon/icons/Contacts.d.ts +3 -0
- package/dist/components/Icon/icons/CopyLink.d.ts +3 -0
- package/dist/components/Icon/icons/Delete.d.ts +3 -0
- package/dist/components/Icon/icons/DiamondRing.d.ts +3 -0
- package/dist/components/Icon/icons/Document.d.ts +3 -0
- package/dist/components/Icon/icons/Documents.d.ts +3 -0
- package/dist/components/Icon/icons/Education.d.ts +3 -0
- package/dist/components/Icon/icons/EmployeeProfile.d.ts +3 -0
- package/dist/components/Icon/icons/Export.d.ts +3 -0
- package/dist/components/Icon/icons/FollowLink.d.ts +3 -0
- package/dist/components/Icon/icons/Form.d.ts +3 -0
- package/dist/components/Icon/icons/Gender.d.ts +3 -0
- package/dist/components/Icon/icons/Gift.d.ts +3 -0
- package/dist/components/Icon/icons/Inventory.d.ts +3 -0
- package/dist/components/Icon/icons/Link.d.ts +3 -0
- package/dist/components/Icon/icons/OfficeChair.d.ts +3 -0
- package/dist/components/Icon/icons/OpenBook.d.ts +3 -0
- package/dist/components/Icon/icons/Report.d.ts +1 -1
- package/dist/components/Icon/icons/Results.d.ts +3 -0
- package/dist/components/Icon/icons/Signature.d.ts +3 -0
- package/dist/components/Icon/icons/Summery.d.ts +3 -0
- package/dist/components/Icon/icons/Team.d.ts +3 -0
- package/dist/components/Icon/icons/TechnicalReview.d.ts +3 -0
- package/dist/components/Icon/icons/TennisBall.d.ts +3 -0
- package/dist/components/Icon/icons/Timeline.d.ts +3 -0
- package/dist/components/Icon/icons/UnionCircle.d.ts +3 -0
- package/dist/components/Icon/icons/Url.d.ts +3 -0
- package/dist/components/Icon/icons/all.d.ts +36 -1
- 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/MultipleDropdown/index.d.ts +1 -0
- package/dist/components/MultipleDropdown/types.d.ts +74 -0
- 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/TextareaBase.d.ts +6 -1
- package/dist/components/Textarea/types.d.ts +109 -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 +10 -5
- 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 +48942 -19624
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +65 -0
- package/dist/utils/react19HocCompat.d.ts +14 -0
- package/package.json +42 -33
- package/dist/components/Icon/icons/Company.d.ts +0 -3
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import { RadioProps } from '../Radio/types';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the RadioGroup component
|
|
4
|
+
*
|
|
5
|
+
* Orchestrates a set of Radio buttons so only one can be selected at a time.
|
|
6
|
+
* The group manages the active value in internal state, syncs with `externalState`,
|
|
7
|
+
* and injects `name`, `isChecked`, and `onChange` into every Radio child via
|
|
8
|
+
* `cloneElement`. Individual Radio components can still override the group's
|
|
9
|
+
* `color` prop with their own `color` prop.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Basic radio group
|
|
14
|
+
* <RadioGroup name="fruit" onChange={(value) => console.log(value)}>
|
|
15
|
+
* <Radio id="r1" value="apple" text="Apple" />
|
|
16
|
+
* <Radio id="r2" value="orange" text="Orange" />
|
|
17
|
+
* <Radio id="r3" value="banana" text="Banana" isDisabled />
|
|
18
|
+
* </RadioGroup>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Controlled with external state and success color
|
|
24
|
+
* const [selected, setSelected] = useState('apple');
|
|
25
|
+
* <RadioGroup
|
|
26
|
+
* name="fruit"
|
|
27
|
+
* color="success"
|
|
28
|
+
* externalState={selected}
|
|
29
|
+
* onChange={setSelected}>
|
|
30
|
+
* <Radio id="r1" value="apple" text="Apple" />
|
|
31
|
+
* <Radio id="r2" value="orange" text="Orange" />
|
|
32
|
+
* </RadioGroup>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
2
35
|
export interface RadioGroupProps {
|
|
3
36
|
name: string;
|
|
4
37
|
isRequired?: boolean;
|
|
@@ -6,4 +39,13 @@ export interface RadioGroupProps {
|
|
|
6
39
|
className?: string;
|
|
7
40
|
onChange: (value: string | number) => void;
|
|
8
41
|
children?: React.ReactElement<RadioProps>[] | React.ReactElement<RadioProps>;
|
|
42
|
+
/**
|
|
43
|
+
* Palette-based color variant applied to every Radio child.
|
|
44
|
+
* Individual Radio components can still override this with their own `color` prop.
|
|
45
|
+
* - `primary` — blue (uses `palette.primary`)
|
|
46
|
+
* - `success` — green (uses `palette.success`)
|
|
47
|
+
* - `custom` — pass `colors` to each Radio individually
|
|
48
|
+
* @default 'primary'
|
|
49
|
+
*/
|
|
50
|
+
color?: RadioProps['color'];
|
|
9
51
|
}
|
|
@@ -1,2 +1,62 @@
|
|
|
1
1
|
import { SearchBoxProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SearchBox - Search input component with debounced callbacks
|
|
4
|
+
*
|
|
5
|
+
* A specialized search input component that combines Input functionality with
|
|
6
|
+
* search-specific features like debounced callbacks, clear button, and search
|
|
7
|
+
* icon. Automatically triggers search callbacks as the user types (with debounce)
|
|
8
|
+
* or immediately when Enter key is pressed.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Debounced search callbacks to reduce API calls
|
|
12
|
+
* - Visual feedback: search icon when empty, clear icon when has value
|
|
13
|
+
* - Enter key for immediate search execution
|
|
14
|
+
* - Configurable auto-search trigger
|
|
15
|
+
* - React Hook Form integration for form state management
|
|
16
|
+
*
|
|
17
|
+
* @category Form Controls
|
|
18
|
+
* @subcategory Input
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { control, register, resetField } = useForm();
|
|
23
|
+
*
|
|
24
|
+
* <SearchBox
|
|
25
|
+
* name="search"
|
|
26
|
+
* placeholder="Search products..."
|
|
27
|
+
* control={control}
|
|
28
|
+
* register={register}
|
|
29
|
+
* resetField={resetField}
|
|
30
|
+
* callback={(term) => {
|
|
31
|
+
* console.log('Searching for:', term);
|
|
32
|
+
* // Perform search API call
|
|
33
|
+
* }}
|
|
34
|
+
* callbackDelay={500}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Manual search only (no auto-trigger)
|
|
41
|
+
* <SearchBox
|
|
42
|
+
* name="query"
|
|
43
|
+
* control={control}
|
|
44
|
+
* register={register}
|
|
45
|
+
* resetField={resetField}
|
|
46
|
+
* callback={handleSearch}
|
|
47
|
+
* autoSearchTrigger={false}
|
|
48
|
+
* placeholder="Press Enter to search"
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see {@link Input} - Base input component used internally
|
|
53
|
+
*
|
|
54
|
+
* @requires React Hook Form - Must be used within FormProvider context
|
|
55
|
+
*
|
|
56
|
+
* @accessibility
|
|
57
|
+
* - Full keyboard navigation support
|
|
58
|
+
* - Enter key triggers search
|
|
59
|
+
* - Clear button accessible via keyboard
|
|
60
|
+
* - Screen reader friendly
|
|
61
|
+
*/
|
|
2
62
|
export declare const SearchBox: ({ name, placeholder, control, callbackDelay, autoSearchTrigger, register, resetField, callback, ...rest }: SearchBoxProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SearchBoxInput: import("@emotion/styled").StyledComponent<import("
|
|
1
|
+
export declare const SearchBoxInput: import("@emotion/styled").StyledComponent<import("..").InputProps & import("react").RefAttributes<HTMLInputElement> & {
|
|
2
2
|
theme?: import("@emotion/react").Theme;
|
|
3
3
|
}, {}, {}>;
|
|
@@ -1,7 +1,53 @@
|
|
|
1
1
|
import { InputProps } from '../Input/types';
|
|
2
2
|
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the SearchBox component
|
|
5
|
+
*
|
|
6
|
+
* A specialized search input component with debounced search callback, clear
|
|
7
|
+
* functionality, and React Hook Form integration. Automatically triggers search
|
|
8
|
+
* callbacks with configurable debounce delay and supports manual search via
|
|
9
|
+
* Enter key.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Debounced search callbacks (reduces API calls)
|
|
13
|
+
* - Clear button that appears when input has value
|
|
14
|
+
* - Search icon when input is empty
|
|
15
|
+
* - Enter key to trigger immediate search
|
|
16
|
+
* - Auto-search trigger on input change (configurable)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { control, register, resetField } = useForm();
|
|
21
|
+
* <SearchBox
|
|
22
|
+
* name="search"
|
|
23
|
+
* placeholder="Search products..."
|
|
24
|
+
* control={control}
|
|
25
|
+
* register={register}
|
|
26
|
+
* resetField={resetField}
|
|
27
|
+
* callback={(term) => handleSearch(term)}
|
|
28
|
+
* callbackDelay={500}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @requires React Hook Form - Must be used within FormProvider context
|
|
33
|
+
*/
|
|
3
34
|
export type SearchBoxProps = InputProps & Pick<UseFormReturn, 'control' | 'resetField'> & {
|
|
35
|
+
/**
|
|
36
|
+
* Callback function called when search is triggered
|
|
37
|
+
* Receives the current search term as parameter
|
|
38
|
+
* Triggered either by debounced input changes or Enter key press
|
|
39
|
+
*/
|
|
4
40
|
callback: (searchTerm: string) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Debounce delay in milliseconds for search callback
|
|
43
|
+
* Prevents excessive API calls while user is typing
|
|
44
|
+
* @default 500
|
|
45
|
+
*/
|
|
5
46
|
callbackDelay?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to automatically trigger search on input change
|
|
49
|
+
* When false, search only triggers on Enter key press
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
6
52
|
autoSearchTrigger?: boolean;
|
|
7
53
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SliderProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Slider — a dual-thumb range slider component.
|
|
4
|
+
*
|
|
5
|
+
* ## Variants
|
|
6
|
+
* - **Default** — floating value labels appear above each thumb
|
|
7
|
+
* (`valueLabelDisplay`).
|
|
8
|
+
* - **With inputs** (`withInputs`) — two editable number fields above the
|
|
9
|
+
* track; floating labels are hidden.
|
|
10
|
+
*
|
|
11
|
+
* ## Thumb-crossing behavior
|
|
12
|
+
* - **Default** (`disableSwap` omitted) — thumbs cross freely; values are
|
|
13
|
+
* re-sorted automatically so the fill always sits between them.
|
|
14
|
+
* - **`disableSwap`** — the active thumb stops at the other thumb (or
|
|
15
|
+
* `minDistance` away). Use with `minDistance` to enforce a minimum gap.
|
|
16
|
+
*
|
|
17
|
+
* ## Customization
|
|
18
|
+
* All inner styled sub-elements are exported from `@ssa-ui-kit/core` as
|
|
19
|
+
* `Slider*` components. Pass them as selectors inside the `css` prop or
|
|
20
|
+
* target them by their generated class names via `className`.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { css } from '@emotion/react';
|
|
24
|
+
* import { Slider, SliderTrackFill, SliderRangeInput } from '@ssa-ui-kit/core';
|
|
25
|
+
*
|
|
26
|
+
* // Override fill color via the css prop
|
|
27
|
+
* <Slider
|
|
28
|
+
* css={css`
|
|
29
|
+
* ${SliderTrackFill} { background: #52c587; }
|
|
30
|
+
* ${SliderRangeInput}::-webkit-slider-thumb { background: #52c587; }
|
|
31
|
+
* `}
|
|
32
|
+
* defaultValue={[20, 80]}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Basic range slider (thumbs swap when they cross)
|
|
39
|
+
* <Slider label="Price" min={0} max={1000} defaultValue={[200, 800]} />
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Prevent crossing + enforce a gap of at least 50
|
|
45
|
+
* <Slider
|
|
46
|
+
* label="Budget"
|
|
47
|
+
* min={0} max={1000}
|
|
48
|
+
* disableSwap minDistance={50}
|
|
49
|
+
* defaultValue={[100, 900]}
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const Slider: ({ label, min, max, step, value: valueProp, defaultValue, onChange, size, withInputs, valueLabelDisplay, disableSwap, minDistance, marks, disabled, className, css: customCss, }: SliderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Slider } from './Slider';
|
|
2
|
+
export { SliderRoot, SliderLabel, SliderInputsRow, SliderNumberInput, SliderTrackWrapper, SliderValueLabelsContainer, SliderValueLabel, SliderTrackRow, SliderTrackBg, SliderTrackFill, SliderRangeInput, SliderMarksRow, SliderMarkItem, SliderMarkTick, SliderMarkLabel, } from './styles';
|
|
3
|
+
export { SLIDER_THUMB_SIZES } from './consts';
|
|
4
|
+
export type { SliderProps, SliderMark, SliderSize, ValueLabelDisplay, } from './types';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SliderSize } from './types';
|
|
2
|
+
export declare const SliderRoot: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const SliderLabel: import("@emotion/styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme;
|
|
8
|
+
as?: React.ElementType;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
|
|
10
|
+
export declare const SliderInputsRow: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme;
|
|
12
|
+
as?: React.ElementType;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const SliderNumberInput: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
18
|
+
export declare const SliderTrackWrapper: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme;
|
|
20
|
+
as?: React.ElementType;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
22
|
+
export declare const SliderValueLabelsContainer: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
as?: React.ElementType;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
26
|
+
/**
|
|
27
|
+
* `leftCalc` is a CSS `calc()` string that aligns the label center precisely
|
|
28
|
+
* over the thumb, accounting for the thumb half-size offset at track edges.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SliderValueLabel: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
} & {
|
|
34
|
+
leftCalc: string;
|
|
35
|
+
isVisible: boolean;
|
|
36
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
37
|
+
export declare const SliderTrackRow: import("@emotion/styled").StyledComponent<{
|
|
38
|
+
theme?: import("@emotion/react").Theme;
|
|
39
|
+
as?: React.ElementType;
|
|
40
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
41
|
+
export declare const SliderTrackBg: import("@emotion/styled").StyledComponent<{
|
|
42
|
+
theme?: import("@emotion/react").Theme;
|
|
43
|
+
as?: React.ElementType;
|
|
44
|
+
} & {
|
|
45
|
+
size: SliderSize;
|
|
46
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
47
|
+
export declare const SliderTrackFill: import("@emotion/styled").StyledComponent<{
|
|
48
|
+
theme?: import("@emotion/react").Theme;
|
|
49
|
+
as?: React.ElementType;
|
|
50
|
+
} & {
|
|
51
|
+
left: number;
|
|
52
|
+
width: number;
|
|
53
|
+
isDisabled: boolean;
|
|
54
|
+
size: SliderSize;
|
|
55
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
56
|
+
/**
|
|
57
|
+
* `sliderSize` is used instead of `size` because `<input size>` is a built-in
|
|
58
|
+
* HTML attribute typed as `number`, which would conflict with our `SliderSize`
|
|
59
|
+
* string union and collapse the whole props intersection to `never`.
|
|
60
|
+
* `shouldForwardProp` prevents both custom props from reaching the DOM.
|
|
61
|
+
*/
|
|
62
|
+
export declare const SliderRangeInput: import("@emotion/styled").StyledComponent<{
|
|
63
|
+
theme?: import("@emotion/react").Theme;
|
|
64
|
+
as?: React.ElementType;
|
|
65
|
+
} & {
|
|
66
|
+
sliderSize: SliderSize;
|
|
67
|
+
zIndex?: number;
|
|
68
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
69
|
+
export declare const SliderMarksRow: import("@emotion/styled").StyledComponent<{
|
|
70
|
+
theme?: import("@emotion/react").Theme;
|
|
71
|
+
as?: React.ElementType;
|
|
72
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
73
|
+
/**
|
|
74
|
+
* `leftCalc` uses the same calc() formula as `SliderValueLabel` so ticks are
|
|
75
|
+
* pixel-perfect under each thumb position.
|
|
76
|
+
*/
|
|
77
|
+
export declare const SliderMarkItem: import("@emotion/styled").StyledComponent<{
|
|
78
|
+
theme?: import("@emotion/react").Theme;
|
|
79
|
+
as?: React.ElementType;
|
|
80
|
+
} & {
|
|
81
|
+
leftCalc: string;
|
|
82
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
83
|
+
export declare const SliderMarkTick: import("@emotion/styled").StyledComponent<{
|
|
84
|
+
theme?: import("@emotion/react").Theme;
|
|
85
|
+
as?: React.ElementType;
|
|
86
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
87
|
+
export declare const SliderMarkLabel: import("@emotion/styled").StyledComponent<{
|
|
88
|
+
theme?: import("@emotion/react").Theme;
|
|
89
|
+
as?: React.ElementType;
|
|
90
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import { MainSizes } from '../../types/global';
|
|
3
|
+
export type SliderSize = keyof MainSizes;
|
|
4
|
+
export type ValueLabelDisplay = 'auto' | 'on' | 'off';
|
|
5
|
+
export interface SliderMark {
|
|
6
|
+
value: number;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SliderProps {
|
|
10
|
+
/** Optional label shown above the slider */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Minimum value of the range */
|
|
13
|
+
min?: number;
|
|
14
|
+
/** Maximum value of the range */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** Granularity of each step */
|
|
17
|
+
step?: number;
|
|
18
|
+
/** Controlled [min, max] value pair */
|
|
19
|
+
value?: [number, number];
|
|
20
|
+
/** Uncontrolled initial [min, max] value pair */
|
|
21
|
+
defaultValue?: [number, number];
|
|
22
|
+
/** Called whenever either thumb changes */
|
|
23
|
+
onChange?: (value: [number, number]) => void;
|
|
24
|
+
/** Track / thumb size */
|
|
25
|
+
size?: SliderSize;
|
|
26
|
+
/**
|
|
27
|
+
* Render two number inputs above the slider instead of floating value labels.
|
|
28
|
+
*/
|
|
29
|
+
withInputs?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Control visibility of the floating value labels above the thumbs.
|
|
32
|
+
* - `'auto'` (default) — show on hover/focus
|
|
33
|
+
* - `'on'` — always visible
|
|
34
|
+
* - `'off'` — never shown
|
|
35
|
+
* Ignored when `withInputs` is `true`.
|
|
36
|
+
*/
|
|
37
|
+
valueLabelDisplay?: ValueLabelDisplay;
|
|
38
|
+
/**
|
|
39
|
+
* Prevent the two thumbs from crossing each other — the moving thumb
|
|
40
|
+
* stops when it would reach the other thumb (or `minDistance` away from it).
|
|
41
|
+
* Default is `false` (thumbs can cross; values swap automatically).
|
|
42
|
+
*/
|
|
43
|
+
disableSwap?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Minimum gap enforced between the two thumb values.
|
|
46
|
+
* Only takes effect when `disableSwap` is `true`.
|
|
47
|
+
* @example `minDistance={10}` — thumbs can get no closer than 10 units apart.
|
|
48
|
+
*/
|
|
49
|
+
minDistance?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Tick marks rendered below the track — like a speedometer scale.
|
|
52
|
+
* Each mark has a required `value` (must be within `min`–`max`) and an
|
|
53
|
+
* optional `label` string shown beneath the tick.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* marks={[
|
|
58
|
+
* { value: 0, label: '0' },
|
|
59
|
+
* { value: 50, label: '50' },
|
|
60
|
+
* { value: 100, label: '100' },
|
|
61
|
+
* ]}
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
marks?: SliderMark[];
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
className?: string;
|
|
67
|
+
/** Emotion `css` override — applied to the outermost wrapper element. */
|
|
68
|
+
css?: Interpolation<Theme>;
|
|
69
|
+
}
|
|
@@ -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
|
}
|