@juspay/blend-design-system 0.0.36-beta.0 → 0.0.36-beta.1
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/README.md +5 -5
- package/dist/components/ChatInput/ChatInput.d.ts +1 -0
- package/dist/components/ChatInput/MobileChatInput.d.ts +1 -0
- package/dist/components/ChatInput/chatInput.tokens.d.ts +8 -6
- package/dist/components/ChatInput/types.d.ts +1 -0
- package/dist/components/DataTable/TableBody/types.d.ts +2 -0
- package/dist/components/DataTable/TableHeader/types.d.ts +4 -0
- package/dist/components/DataTable/TableHeader/utils.d.ts +4 -2
- package/dist/components/DateRangePicker/CalendarGrid.d.ts +1 -0
- package/dist/components/DateRangePicker/types.d.ts +3 -0
- package/dist/components/DateRangePicker/utils.d.ts +2 -2
- package/dist/components/MultiSelect/types.d.ts +1 -1
- package/dist/components/SelectorV2/CheckboxV2/CheckboxV2.d.ts +19 -0
- package/dist/components/SelectorV2/CheckboxV2/StyledCheckboxV2.d.ts +11 -0
- package/dist/components/SelectorV2/CheckboxV2/checkboxV2.animations.d.ts +2 -0
- package/dist/components/SelectorV2/CheckboxV2/checkboxV2.dark.tokens.d.ts +3 -0
- package/dist/components/SelectorV2/CheckboxV2/checkboxV2.light.tokens.d.ts +3 -0
- package/dist/components/SelectorV2/CheckboxV2/checkboxV2.tokens.d.ts +94 -0
- package/dist/components/SelectorV2/CheckboxV2/checkboxV2.types.d.ts +64 -0
- package/dist/components/SelectorV2/CheckboxV2/index.d.ts +3 -0
- package/dist/components/SelectorV2/CheckboxV2/utils.d.ts +67 -0
- package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/SwitchV2.d.ts +3 -3
- package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/switchV2.dark.tokens.d.ts +1 -1
- package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/switchV2.light.tokens.d.ts +1 -1
- package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/switchV2.tokens.d.ts +16 -15
- package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/switchV2.types.d.ts +5 -8
- package/dist/components/SelectorV2/selectorV2.types.d.ts +12 -0
- package/dist/components/SelectorsContent/SelectorsContent.types.d.ts +5 -2
- package/dist/components/SelectorsContent/SelectorsLabel.d.ts +1 -1
- package/dist/components/SelectorsContent/SelectorsSubLabel.d.ts +1 -1
- package/dist/context/ThemeContext.d.ts +3 -1
- package/dist/context/useComponentToken.d.ts +3 -2
- package/dist/main.js +25671 -24935
- package/package.json +2 -2
- /package/dist/components/{SwitchV2 → SelectorV2/SwitchV2}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -134,9 +134,9 @@ function App() {
|
|
|
134
134
|
|
|
135
135
|
## 📖 Documentation
|
|
136
136
|
|
|
137
|
-
- **[Component Documentation](https://juspay.design/)** - Complete component API and examples
|
|
138
|
-
- **[Storybook](https://
|
|
139
|
-
- **[Design Guidelines](https://juspay.design/guidelines)** - Design principles and usage guidelines
|
|
137
|
+
- **[Component Documentation](https://blend.juspay.design/)** - Complete component API and examples
|
|
138
|
+
- **[Storybook](https://blend.juspay.design/storybook/)** - Interactive component playground
|
|
139
|
+
- **[Design Guidelines](https://blend.juspay.design/guidelines)** - Design principles and usage guidelines
|
|
140
140
|
|
|
141
141
|
## 🛠️ Development
|
|
142
142
|
|
|
@@ -167,10 +167,10 @@ MIT © [Juspay Technologies](https://juspay.in)
|
|
|
167
167
|
|
|
168
168
|
## 🔗 Links
|
|
169
169
|
|
|
170
|
-
- **Homepage**: [https://juspay.design/](https://juspay.design/)
|
|
170
|
+
- **Homepage**: [https://blend.juspay.design/](https://blend.juspay.design/)
|
|
171
171
|
- **Repository**: [https://github.com/juspay/blend-design-system](https://github.com/juspay/blend-design-system)
|
|
172
172
|
- **Issues**: [https://github.com/juspay/blend-design-system/issues](https://github.com/juspay/blend-design-system/issues)
|
|
173
|
-
- **Storybook**: [https://
|
|
173
|
+
- **Storybook**: [https://blend.juspay.design/storybook/](https://blend.juspay.design/storybook/)
|
|
174
174
|
|
|
175
175
|
---
|
|
176
176
|
|
|
@@ -4,6 +4,7 @@ export declare const getDocIcon: (fileType: AttachedFile["type"]) => React.React
|
|
|
4
4
|
declare const ChatInput: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
slot1?: React.ReactNode;
|
|
7
|
+
slot2?: React.ReactNode;
|
|
7
8
|
onChange?: (value: string) => void;
|
|
8
9
|
onSend?: (message: string, files: AttachedFile[]) => void;
|
|
9
10
|
onAttachFiles?: (files: File[]) => void;
|
|
@@ -70,10 +70,7 @@ export type ChatInputTokensType = Readonly<{
|
|
|
70
70
|
focus: CSSObject['border'];
|
|
71
71
|
};
|
|
72
72
|
borderRadius: CSSObject['borderRadius'];
|
|
73
|
-
|
|
74
|
-
paddingRight: CSSObject['paddingRight'];
|
|
75
|
-
paddingBottom: CSSObject['paddingBottom'];
|
|
76
|
-
paddingLeft: CSSObject['paddingLeft'];
|
|
73
|
+
padding: CSSObject['padding'];
|
|
77
74
|
gap: CSSObject['gap'];
|
|
78
75
|
minHeight: CSSObject['minHeight'];
|
|
79
76
|
transition: CSSObject['transition'];
|
|
@@ -93,8 +90,10 @@ export type ChatInputTokensType = Readonly<{
|
|
|
93
90
|
color: CSSObject['color'];
|
|
94
91
|
fontSize: CSSObject['fontSize'];
|
|
95
92
|
lineHeight: CSSObject['lineHeight'];
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
paddingTop: CSSObject['paddingTop'];
|
|
94
|
+
paddingRight: CSSObject['paddingRight'];
|
|
95
|
+
paddingBottom: CSSObject['paddingBottom'];
|
|
96
|
+
paddingLeft: CSSObject['paddingLeft'];
|
|
98
97
|
border: CSSObject['border'];
|
|
99
98
|
borderRadius: CSSObject['borderRadius'];
|
|
100
99
|
placeholder: {
|
|
@@ -112,6 +111,7 @@ export type ChatInputTokensType = Readonly<{
|
|
|
112
111
|
paddingY: CSSObject['padding'];
|
|
113
112
|
maxHeight: CSSObject['maxHeight'];
|
|
114
113
|
overflowY: CSSObject['overflowY'];
|
|
114
|
+
margin: CSSObject['margin'];
|
|
115
115
|
};
|
|
116
116
|
bottomActions: {
|
|
117
117
|
paddingX: CSSObject['padding'];
|
|
@@ -158,6 +158,8 @@ export type ChatInputTokensType = Readonly<{
|
|
|
158
158
|
scrollContainer: {
|
|
159
159
|
overflowY: CSSObject['overflowY'];
|
|
160
160
|
maxHeightOffset: number;
|
|
161
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
162
|
+
scrollbarColor: string;
|
|
161
163
|
};
|
|
162
164
|
item: {
|
|
163
165
|
backgroundColor: {
|
|
@@ -15,6 +15,7 @@ export type TopQuery = {
|
|
|
15
15
|
export type ChatInputProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange' | 'value'> & {
|
|
16
16
|
value?: string;
|
|
17
17
|
slot1?: ReactNode;
|
|
18
|
+
slot2?: ReactNode;
|
|
18
19
|
onChange?: (value: string) => void;
|
|
19
20
|
onSend?: (message: string, files: AttachedFile[]) => void;
|
|
20
21
|
onAttachFiles?: (files: File[]) => void;
|
|
@@ -16,6 +16,8 @@ export type TableBodyProps<T extends Record<string, unknown>> = {
|
|
|
16
16
|
enableRowSelection?: boolean;
|
|
17
17
|
rowActions?: RowActionsConfig<T>;
|
|
18
18
|
columnFreeze?: number;
|
|
19
|
+
/** Measured pixel widths of frozen columns (from header ResizeObserver). Used for sticky left offset. */
|
|
20
|
+
measuredFrozenWidths?: number[];
|
|
19
21
|
mobileConfig?: MobileDataTableConfig;
|
|
20
22
|
mobileOverflowColumns?: ColumnDefinition<T>[];
|
|
21
23
|
onMobileOverflowClick?: (row: T) => void;
|
|
@@ -55,4 +55,8 @@ export type TableHeaderProps<T extends Record<string, unknown>> = {
|
|
|
55
55
|
}>;
|
|
56
56
|
onHeaderChange?: (field: keyof T, newHeader: string) => void;
|
|
57
57
|
getColumnWidth: (column: ColumnDefinition<T>, index: number) => React.CSSProperties;
|
|
58
|
+
/** Measured pixel widths of frozen columns (from ResizeObserver). Used for sticky left offset. */
|
|
59
|
+
measuredFrozenWidths?: number[];
|
|
60
|
+
/** Called when frozen column header cells are measured so left offsets can use content-based widths. */
|
|
61
|
+
onFrozenWidthsMeasured?: (widths: number[]) => void;
|
|
58
62
|
};
|
|
@@ -17,7 +17,8 @@ export declare const filterItemsBySearch: (items: Array<{
|
|
|
17
17
|
value: string;
|
|
18
18
|
}>;
|
|
19
19
|
export declare const getPopoverAlignment: (index: number, totalColumns: number) => "start" | "center" | "end";
|
|
20
|
-
export declare
|
|
20
|
+
export declare function getFrozenLeftOffset(index: number, _columnFreeze: number, enableRowExpansion: boolean, enableRowSelection: boolean, visibleColumns: ColumnDefinition<Record<string, unknown>>[], getColumnWidth: (column: ColumnDefinition<Record<string, unknown>>, i: number) => React.CSSProperties, measuredFrozenWidths?: number[]): number;
|
|
21
|
+
export declare const getFrozenColumnStyles: (index: number, columnFreeze: number, enableRowExpansion: boolean, enableRowSelection: boolean, visibleColumns: ColumnDefinition<Record<string, unknown>>[], getColumnWidth: (column: ColumnDefinition<Record<string, unknown>>, index: number) => React.CSSProperties, backgroundColor: string, measuredFrozenWidths?: number[]) => {
|
|
21
22
|
padding: string;
|
|
22
23
|
} | {
|
|
23
24
|
borderRight?: string | undefined;
|
|
@@ -26,8 +27,9 @@ export declare const getFrozenColumnStyles: (index: number, columnFreeze: number
|
|
|
26
27
|
zIndex: number;
|
|
27
28
|
backgroundColor: string;
|
|
28
29
|
padding: string;
|
|
29
|
-
width: string;
|
|
30
30
|
minWidth: string;
|
|
31
31
|
maxWidth: string;
|
|
32
|
+
width: string;
|
|
32
33
|
boxSizing: "border-box";
|
|
34
|
+
overflow: string;
|
|
33
35
|
};
|
|
@@ -14,6 +14,7 @@ type CalendarGridProps = {
|
|
|
14
14
|
resetScrollPosition?: number;
|
|
15
15
|
timezone?: string;
|
|
16
16
|
isSingleDatePicker?: boolean;
|
|
17
|
+
maxYearOffset?: number;
|
|
17
18
|
};
|
|
18
19
|
declare const CalendarGrid: import('react').ForwardRefExoticComponent<CalendarGridProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
19
20
|
export default CalendarGrid;
|
|
@@ -282,6 +282,7 @@ export type DateRangePickerProps = {
|
|
|
282
282
|
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
283
283
|
*/
|
|
284
284
|
timezone?: string;
|
|
285
|
+
maxYearOffset?: number;
|
|
285
286
|
};
|
|
286
287
|
export type PresetItemProps = {
|
|
287
288
|
preset: DateRangePreset;
|
|
@@ -320,6 +321,7 @@ export type DatePickerComponentProps = {
|
|
|
320
321
|
isDisabled?: boolean;
|
|
321
322
|
disableFutureDates?: boolean;
|
|
322
323
|
disablePastDates?: boolean;
|
|
324
|
+
maxYearOffset?: number;
|
|
323
325
|
};
|
|
324
326
|
export type MobileDrawerPresetsProps = {
|
|
325
327
|
drawerOpen: boolean;
|
|
@@ -346,4 +348,5 @@ export type MobileDrawerPresetsProps = {
|
|
|
346
348
|
applyDisabledMessage?: string;
|
|
347
349
|
disableFutureDates?: boolean;
|
|
348
350
|
disablePastDates?: boolean;
|
|
351
|
+
maxYearOffset?: number;
|
|
349
352
|
};
|
|
@@ -537,7 +537,7 @@ export declare const calculateDayCellProps: (date: Date, selectedRange: DateRang
|
|
|
537
537
|
* @param endTime Current end time
|
|
538
538
|
* @returns Object with picker data for all columns
|
|
539
539
|
*/
|
|
540
|
-
export declare const generatePickerData: (tabType: "start" | "end", selectedRange?: DateRange, startTime?: string, endTime?: string) => {
|
|
540
|
+
export declare const generatePickerData: (tabType: "start" | "end", selectedRange?: DateRange, startTime?: string, endTime?: string, maxYearOffset?: number) => {
|
|
541
541
|
years: {
|
|
542
542
|
items: number[];
|
|
543
543
|
selectedIndex: number;
|
|
@@ -568,7 +568,7 @@ export declare const generatePickerData: (tabType: "start" | "end", selectedRang
|
|
|
568
568
|
* @param setEndDate End date setter function
|
|
569
569
|
* @returns Selection handler function
|
|
570
570
|
*/
|
|
571
|
-
export declare const createSelectionHandler: (tabType: "start" | "end", type: "year" | "month" | "date" | "time", dateFormat: string, handleStartTimeChange: (time: string) => void, handleEndTimeChange: (time: string) => void, setSelectedRange: (range: DateRange) => void, setStartDate: (date: string) => void, setEndDate: (date: string) => void, selectedRange?: DateRange) => (index: number) => void;
|
|
571
|
+
export declare const createSelectionHandler: (tabType: "start" | "end", type: "year" | "month" | "date" | "time", dateFormat: string, handleStartTimeChange: (time: string) => void, handleEndTimeChange: (time: string) => void, setSelectedRange: (range: DateRange) => void, setStartDate: (date: string) => void, setEndDate: (date: string) => void, selectedRange?: DateRange, maxYearOffset?: number) => (index: number) => void;
|
|
572
572
|
/**
|
|
573
573
|
* Gets preset display label with custom mappings
|
|
574
574
|
* @param preset The preset to get label for
|
|
@@ -141,7 +141,7 @@ export type MultiSelectMenuProps = {
|
|
|
141
141
|
searchPlaceholder?: string;
|
|
142
142
|
enableSelectAll?: boolean;
|
|
143
143
|
selectAllText?: string;
|
|
144
|
-
onSelectAll?: (selectAll: boolean) => void;
|
|
144
|
+
onSelectAll?: (selectAll: boolean, filteredItems: MultiSelectMenuGroupType[]) => void;
|
|
145
145
|
maxSelections?: number;
|
|
146
146
|
alignment?: MultiSelectMenuAlignment;
|
|
147
147
|
side?: MultiSelectMenuSide;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SelectorV2Size } from '../../SelectorV2/selectorV2.types';
|
|
2
|
+
declare const CheckboxV2: import('react').ForwardRefExoticComponent<{
|
|
3
|
+
checked?: boolean | "indeterminate";
|
|
4
|
+
onCheckedChange?: (checked: boolean | "indeterminate") => void;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
subLabel?: string;
|
|
9
|
+
size?: SelectorV2Size;
|
|
10
|
+
slot?: {
|
|
11
|
+
slot: import('react').ReactElement;
|
|
12
|
+
maxHeight?: import('styled-components').CSSObject["maxHeight"];
|
|
13
|
+
};
|
|
14
|
+
maxLength?: {
|
|
15
|
+
label?: number;
|
|
16
|
+
subLabel?: number;
|
|
17
|
+
};
|
|
18
|
+
} & Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "style" | "className" | "slot" | "onChange"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
export default CheckboxV2;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectorV2Size } from '../../SelectorV2/selectorV2.types';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
export declare const StyledCheckboxRoot: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<CheckboxPrimitive.CheckboxProps & import('react').RefAttributes<HTMLButtonElement>, {
|
|
4
|
+
size: SelectorV2Size;
|
|
5
|
+
$isDisabled: boolean;
|
|
6
|
+
$checked: boolean | "indeterminate";
|
|
7
|
+
$error?: boolean;
|
|
8
|
+
}>> & string & Omit<import('react').ForwardRefExoticComponent<CheckboxPrimitive.CheckboxProps & import('react').RefAttributes<HTMLButtonElement>>, keyof import('react').Component<any, {}, any>>;
|
|
9
|
+
export declare const StyledCheckboxIndicator: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<CheckboxPrimitive.CheckboxIndicatorProps & import('react').RefAttributes<HTMLSpanElement>, {
|
|
10
|
+
size: SelectorV2Size;
|
|
11
|
+
}>> & string & Omit<import('react').ForwardRefExoticComponent<CheckboxPrimitive.CheckboxIndicatorProps & import('react').RefAttributes<HTMLSpanElement>>, keyof import('react').Component<any, {}, any>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Theme } from '../../../context/theme.enum';
|
|
2
|
+
import { CSSObject } from 'styled-components';
|
|
3
|
+
import { CheckboxV2CheckedState } from './checkboxV2.types';
|
|
4
|
+
import { SelectorV2Size, SelectorV2InteractionState } from '../../SelectorV2/selectorV2.types';
|
|
5
|
+
import { BreakpointType } from '../../../breakpoints/breakPoints';
|
|
6
|
+
import { FoundationTokenType } from '../../../tokens/theme.token';
|
|
7
|
+
export type CheckboxV2TokensType = {
|
|
8
|
+
gap: CSSObject['gap'];
|
|
9
|
+
checkbox: {
|
|
10
|
+
height: {
|
|
11
|
+
[key in SelectorV2Size]: CSSObject['height'];
|
|
12
|
+
};
|
|
13
|
+
width: {
|
|
14
|
+
[key in SelectorV2Size]: CSSObject['width'];
|
|
15
|
+
};
|
|
16
|
+
opacity: CSSObject['opacity'];
|
|
17
|
+
backgroundColor: {
|
|
18
|
+
[key in CheckboxV2CheckedState]?: {
|
|
19
|
+
[key in SelectorV2InteractionState]?: CSSObject['backgroundColor'];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
borderRadius: {
|
|
23
|
+
[key in SelectorV2Size]: CSSObject['borderRadius'];
|
|
24
|
+
};
|
|
25
|
+
border: {
|
|
26
|
+
[key in CheckboxV2CheckedState]?: {
|
|
27
|
+
[key in SelectorV2InteractionState]?: CSSObject['border'];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
outline: CSSObject['outline'];
|
|
31
|
+
outlineOffset: CSSObject['outlineOffset'];
|
|
32
|
+
boxShadow: CSSObject['boxShadow'];
|
|
33
|
+
icon: {
|
|
34
|
+
color: {
|
|
35
|
+
[key in CheckboxV2CheckedState]?: {
|
|
36
|
+
[key in Extract<SelectorV2InteractionState, 'default' | 'disabled'>]?: CSSObject['color'];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
width: {
|
|
40
|
+
[key in SelectorV2Size]: CSSObject['width'];
|
|
41
|
+
};
|
|
42
|
+
height: {
|
|
43
|
+
[key in SelectorV2Size]: CSSObject['height'];
|
|
44
|
+
};
|
|
45
|
+
strokeWidth: {
|
|
46
|
+
[key in SelectorV2Size]: CSSObject['strokeWidth'];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
content: {
|
|
51
|
+
gap: CSSObject['gap'];
|
|
52
|
+
label: {
|
|
53
|
+
gap: CSSObject['gap'];
|
|
54
|
+
color: {
|
|
55
|
+
[key in SelectorV2InteractionState]: CSSObject['color'];
|
|
56
|
+
};
|
|
57
|
+
fontSize: {
|
|
58
|
+
[key in SelectorV2Size]: CSSObject['fontSize'];
|
|
59
|
+
};
|
|
60
|
+
fontWeight: {
|
|
61
|
+
[key in SelectorV2Size]: CSSObject['fontWeight'];
|
|
62
|
+
};
|
|
63
|
+
lineHeight: {
|
|
64
|
+
[key in SelectorV2Size]: CSSObject['lineHeight'];
|
|
65
|
+
};
|
|
66
|
+
slot: {
|
|
67
|
+
maxHeight: {
|
|
68
|
+
[key in SelectorV2Size]: CSSObject['maxHeight'];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
subLabel: {
|
|
73
|
+
color: {
|
|
74
|
+
[key in SelectorV2InteractionState]: CSSObject['color'];
|
|
75
|
+
};
|
|
76
|
+
fontSize: {
|
|
77
|
+
[key in SelectorV2Size]: CSSObject['fontSize'];
|
|
78
|
+
};
|
|
79
|
+
fontWeight: {
|
|
80
|
+
[key in SelectorV2Size]: CSSObject['fontWeight'];
|
|
81
|
+
};
|
|
82
|
+
lineHeight: {
|
|
83
|
+
[key in SelectorV2Size]: CSSObject['lineHeight'];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
required: {
|
|
87
|
+
color: CSSObject['color'];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export type ResponsiveCheckboxV2Tokens = {
|
|
92
|
+
[key in keyof BreakpointType]: CheckboxV2TokensType;
|
|
93
|
+
};
|
|
94
|
+
export declare const getCheckboxV2Tokens: (foundationToken: FoundationTokenType, theme?: Theme | string) => ResponsiveCheckboxV2Tokens;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
2
|
+
import { CheckboxV2TokensType } from './checkboxV2.tokens';
|
|
3
|
+
import { CSSObject } from 'styled-components';
|
|
4
|
+
import { SelectorV2Size } from '../../SelectorV2/selectorV2.types';
|
|
5
|
+
export declare enum CheckboxV2CheckedState {
|
|
6
|
+
CHECKED = "checked",
|
|
7
|
+
UNCHECKED = "unchecked",
|
|
8
|
+
INDETERMINATE = "indeterminate"
|
|
9
|
+
}
|
|
10
|
+
export type CheckboxV2Props = {
|
|
11
|
+
checked?: boolean | 'indeterminate';
|
|
12
|
+
onCheckedChange?: (checked: boolean | 'indeterminate') => void;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
label?: string;
|
|
16
|
+
subLabel?: string;
|
|
17
|
+
size?: SelectorV2Size;
|
|
18
|
+
slot?: {
|
|
19
|
+
slot: ReactElement;
|
|
20
|
+
maxHeight?: CSSObject['maxHeight'];
|
|
21
|
+
};
|
|
22
|
+
maxLength?: {
|
|
23
|
+
label?: number;
|
|
24
|
+
subLabel?: number;
|
|
25
|
+
};
|
|
26
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'style' | 'slot' | 'onChange'>;
|
|
27
|
+
export type CheckboxV2RootProps = {
|
|
28
|
+
tokens: CheckboxV2TokensType;
|
|
29
|
+
uniqueId: string;
|
|
30
|
+
name: string;
|
|
31
|
+
ref: React.RefObject<HTMLButtonElement>;
|
|
32
|
+
checked: boolean | 'indeterminate';
|
|
33
|
+
onCheckedChange: (checked: boolean | 'indeterminate') => void;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
required: boolean;
|
|
36
|
+
size: SelectorV2Size;
|
|
37
|
+
error: boolean;
|
|
38
|
+
shouldShake: boolean;
|
|
39
|
+
ariaAttributes: {
|
|
40
|
+
'aria-required': boolean;
|
|
41
|
+
'aria-invalid': boolean;
|
|
42
|
+
'aria-describedby': string;
|
|
43
|
+
};
|
|
44
|
+
restProps: {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type CheckboxV2ContentProps = {
|
|
49
|
+
uniqueId: string;
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
error: boolean;
|
|
52
|
+
required: boolean;
|
|
53
|
+
size: SelectorV2Size;
|
|
54
|
+
label?: string;
|
|
55
|
+
subLabel?: string;
|
|
56
|
+
slot?: {
|
|
57
|
+
slot: ReactElement;
|
|
58
|
+
maxHeight?: CSSObject['maxHeight'];
|
|
59
|
+
};
|
|
60
|
+
tokens: CheckboxV2TokensType;
|
|
61
|
+
labelMaxLength?: number;
|
|
62
|
+
subLabelMaxLength?: number;
|
|
63
|
+
subLabelId?: string;
|
|
64
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
import { CheckboxV2CheckedState } from './checkboxV2.types';
|
|
3
|
+
import { SelectorV2Size } from '../../SelectorV2/selectorV2.types';
|
|
4
|
+
import { CheckboxV2TokensType } from './checkboxV2.tokens';
|
|
5
|
+
export declare const getCheckboxDataState: (checked: boolean | "indeterminate") => string;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the icon color based on checkbox state
|
|
8
|
+
*/
|
|
9
|
+
export declare const getCheckboxIconColor: (tokens: CheckboxV2TokensType, currentChecked: boolean | "indeterminate", disabled: boolean) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the text color based on checkbox state
|
|
12
|
+
*/
|
|
13
|
+
export declare const getCheckboxTextColor: (tokens: CheckboxV2TokensType, disabled: boolean, error: boolean) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the subtext color based on checkbox state
|
|
16
|
+
*/
|
|
17
|
+
export declare const getCheckboxSubtextColor: (tokens: CheckboxV2TokensType, disabled: boolean, error: boolean) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the text properties for checkbox labels
|
|
20
|
+
*/
|
|
21
|
+
export declare const getCheckboxTextProps: (tokens: CheckboxV2TokensType, size: SelectorV2Size, disabled: boolean, error: boolean) => {
|
|
22
|
+
fontSize: string;
|
|
23
|
+
fontWeight: string;
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Gets the subtext properties for checkbox
|
|
28
|
+
*/
|
|
29
|
+
export declare const getCheckboxSubtextProps: (tokens: CheckboxV2TokensType, size: SelectorV2Size, disabled: boolean, error: boolean) => {
|
|
30
|
+
fontSize: string;
|
|
31
|
+
color: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Gets label styles for checkbox components
|
|
35
|
+
*/
|
|
36
|
+
export declare const getCheckboxLabelStyles: (disabled: boolean) => {
|
|
37
|
+
cursor: "not-allowed" | "pointer";
|
|
38
|
+
display: "flex";
|
|
39
|
+
alignItems: "center";
|
|
40
|
+
margin: number;
|
|
41
|
+
padding: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Gets accessibility attributes for checkbox
|
|
45
|
+
*/
|
|
46
|
+
export declare const getAccessibilityAttributes: (uniqueId: string, isIndeterminate: boolean) => {
|
|
47
|
+
role: string;
|
|
48
|
+
'aria-checked': string | undefined;
|
|
49
|
+
'aria-labelledby': string;
|
|
50
|
+
'aria-describedby': string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Generates subtext ID for aria-describedby connection
|
|
54
|
+
* WCAG 4.1.2: aria-describedby must connect to subtext/error messages
|
|
55
|
+
*/
|
|
56
|
+
export declare const getSubtextId: (uniqueId: string, hasSubtext: boolean) => string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Merges custom aria-describedby with subtext ID
|
|
59
|
+
* WCAG 4.1.2: Supports multiple IDs space-separated
|
|
60
|
+
*/
|
|
61
|
+
export declare const mergeAriaDescribedBy: (subtextId: string | undefined, customAriaDescribedBy?: string) => string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Handles keyboard interaction for checkbox root.
|
|
64
|
+
* - On Enter: toggles checked state (indeterminate -> true, otherwise toggles boolean)
|
|
65
|
+
*/
|
|
66
|
+
export declare const handleCheckboxKeyDown: (e: KeyboardEvent<HTMLButtonElement>, checked: boolean | "indeterminate" | undefined, disabled: boolean, onCheckedChange?: (checked: boolean | "indeterminate") => void) => void;
|
|
67
|
+
export declare const getCheckboxState: (checked: boolean | "indeterminate") => CheckboxV2CheckedState;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectorV2Size } from '../selectorV2.types';
|
|
2
2
|
declare const SwitchV2: import('react').ForwardRefExoticComponent<{
|
|
3
3
|
checked?: boolean;
|
|
4
|
-
|
|
4
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
error?: boolean;
|
|
7
7
|
label?: string;
|
|
8
8
|
subLabel?: string;
|
|
9
|
-
size?:
|
|
9
|
+
size?: SelectorV2Size;
|
|
10
10
|
slot?: {
|
|
11
11
|
slot: import('react').ReactElement;
|
|
12
12
|
maxHeight?: import('styled-components').CSSObject["maxHeight"];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FoundationTokenType } from '
|
|
1
|
+
import { FoundationTokenType } from '../../../tokens/theme.token';
|
|
2
2
|
import { ResponsiveSwitchV2Tokens } from './switchV2.tokens';
|
|
3
3
|
export declare const getSwitchV2DarkTokens: (foundationToken: FoundationTokenType) => ResponsiveSwitchV2Tokens;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FoundationTokenType } from '
|
|
1
|
+
import { FoundationTokenType } from '../../../tokens/theme.token';
|
|
2
2
|
import { ResponsiveSwitchV2Tokens } from './switchV2.tokens';
|
|
3
3
|
export declare const getSwitchV2LightTokens: (foundationToken: FoundationTokenType) => ResponsiveSwitchV2Tokens;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { Theme } from '
|
|
1
|
+
import { Theme } from '../../../context/theme.enum';
|
|
2
2
|
import { CSSObject } from 'styled-components';
|
|
3
|
-
import {
|
|
4
|
-
import { BreakpointType } from '
|
|
5
|
-
import { FoundationTokenType } from '
|
|
3
|
+
import { SwitchV2State, SwitchV2Variant } from './switchV2.types';
|
|
4
|
+
import { BreakpointType } from '../../../breakpoints/breakPoints';
|
|
5
|
+
import { FoundationTokenType } from '../../../tokens/theme.token';
|
|
6
|
+
import { SelectorV2Size } from '../selectorV2.types';
|
|
6
7
|
export type SwitchV2TokensType = {
|
|
7
8
|
gap: CSSObject['gap'];
|
|
8
9
|
switch: {
|
|
9
10
|
height: {
|
|
10
|
-
[key in
|
|
11
|
+
[key in SelectorV2Size]: CSSObject['height'];
|
|
11
12
|
};
|
|
12
13
|
width: {
|
|
13
|
-
[key in
|
|
14
|
+
[key in SelectorV2Size]: CSSObject['width'];
|
|
14
15
|
};
|
|
15
16
|
backgroundColor: {
|
|
16
17
|
[key in SwitchV2Variant]: {
|
|
@@ -21,10 +22,10 @@ export type SwitchV2TokensType = {
|
|
|
21
22
|
backgroundColor: CSSObject['backgroundColor'];
|
|
22
23
|
border: CSSObject['border'];
|
|
23
24
|
width: {
|
|
24
|
-
[key in
|
|
25
|
+
[key in SelectorV2Size]: CSSObject['width'];
|
|
25
26
|
};
|
|
26
27
|
height: {
|
|
27
|
-
[key in
|
|
28
|
+
[key in SelectorV2Size]: CSSObject['height'];
|
|
28
29
|
};
|
|
29
30
|
outline: CSSObject['outline'];
|
|
30
31
|
};
|
|
@@ -37,17 +38,17 @@ export type SwitchV2TokensType = {
|
|
|
37
38
|
[key in SwitchV2State]: CSSObject['color'];
|
|
38
39
|
};
|
|
39
40
|
fontSize: {
|
|
40
|
-
[key in
|
|
41
|
+
[key in SelectorV2Size]: CSSObject['fontSize'];
|
|
41
42
|
};
|
|
42
43
|
fontWeight: {
|
|
43
|
-
[key in
|
|
44
|
+
[key in SelectorV2Size]: CSSObject['fontWeight'];
|
|
44
45
|
};
|
|
45
46
|
lineHeight: {
|
|
46
|
-
[key in
|
|
47
|
+
[key in SelectorV2Size]: CSSObject['lineHeight'];
|
|
47
48
|
};
|
|
48
49
|
slot: {
|
|
49
50
|
maxHeight: {
|
|
50
|
-
[key in
|
|
51
|
+
[key in SelectorV2Size]: CSSObject['maxHeight'];
|
|
51
52
|
};
|
|
52
53
|
};
|
|
53
54
|
};
|
|
@@ -56,13 +57,13 @@ export type SwitchV2TokensType = {
|
|
|
56
57
|
[key in SwitchV2State]: CSSObject['color'];
|
|
57
58
|
};
|
|
58
59
|
fontSize: {
|
|
59
|
-
[key in
|
|
60
|
+
[key in SelectorV2Size]: CSSObject['fontSize'];
|
|
60
61
|
};
|
|
61
62
|
fontWeight: {
|
|
62
|
-
[key in
|
|
63
|
+
[key in SelectorV2Size]: CSSObject['fontWeight'];
|
|
63
64
|
};
|
|
64
65
|
lineHeight: {
|
|
65
|
-
[key in
|
|
66
|
+
[key in SelectorV2Size]: CSSObject['lineHeight'];
|
|
66
67
|
};
|
|
67
68
|
};
|
|
68
69
|
required: {
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
2
2
|
import { SwitchV2TokensType } from './switchV2.tokens';
|
|
3
3
|
import { CSSObject } from 'styled-components';
|
|
4
|
-
|
|
5
|
-
SM = "sm",
|
|
6
|
-
MD = "md"
|
|
7
|
-
}
|
|
4
|
+
import { SelectorV2Size } from '../selectorV2.types';
|
|
8
5
|
export type SwitchV2State = 'default' | 'hover' | 'disabled' | 'error';
|
|
9
6
|
export type SwitchV2Variant = 'checked' | 'unchecked';
|
|
10
7
|
export type SwitchV2ButtonProps = {
|
|
11
8
|
id: string;
|
|
12
9
|
checked?: boolean;
|
|
13
10
|
disabled: boolean;
|
|
14
|
-
size:
|
|
11
|
+
size: SelectorV2Size;
|
|
15
12
|
tokens: SwitchV2TokensType;
|
|
16
13
|
onToggle: () => void;
|
|
17
14
|
buttonProps?: Record<string, unknown>;
|
|
@@ -22,7 +19,7 @@ export type SwitchV2ContentProps = {
|
|
|
22
19
|
disabled: boolean;
|
|
23
20
|
error: boolean;
|
|
24
21
|
required: boolean;
|
|
25
|
-
size:
|
|
22
|
+
size: SelectorV2Size;
|
|
26
23
|
label?: string;
|
|
27
24
|
subLabel?: string;
|
|
28
25
|
slot?: {
|
|
@@ -36,12 +33,12 @@ export type SwitchV2ContentProps = {
|
|
|
36
33
|
};
|
|
37
34
|
export type SwitchV2Props = {
|
|
38
35
|
checked?: boolean;
|
|
39
|
-
|
|
36
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
40
37
|
required?: boolean;
|
|
41
38
|
error?: boolean;
|
|
42
39
|
label?: string;
|
|
43
40
|
subLabel?: string;
|
|
44
|
-
size?:
|
|
41
|
+
size?: SelectorV2Size;
|
|
45
42
|
slot?: {
|
|
46
43
|
slot: ReactElement;
|
|
47
44
|
maxHeight?: CSSObject['maxHeight'];
|