@osrd-project/ui-core 0.0.83 → 0.0.85
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/index.d.ts +382 -20
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2101 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.css +1202 -983
- package/package.json +16 -16
- package/dist/components/Button.d.ts +0 -16
- package/dist/components/Checkbox/Checkbox.d.ts +0 -9
- package/dist/components/Checkbox/CheckboxList.d.ts +0 -12
- package/dist/components/Checkbox/CheckboxTree.d.ts +0 -11
- package/dist/components/Checkbox/__tests__/utils.spec.d.ts +0 -1
- package/dist/components/Checkbox/index.d.ts +0 -4
- package/dist/components/Checkbox/type.d.ts +0 -14
- package/dist/components/Checkbox/utils.d.ts +0 -15
- package/dist/components/ComboBox/ComboBox.d.ts +0 -34
- package/dist/components/ComboBox/index.d.ts +0 -2
- package/dist/components/ComboBox/useDefaultComboBox.d.ts +0 -6
- package/dist/components/DatePicker/Calendar.d.ts +0 -10
- package/dist/components/DatePicker/CalendarPicker.d.ts +0 -19
- package/dist/components/DatePicker/DatePicker.d.ts +0 -28
- package/dist/components/DatePicker/__tests__/useCalendar.spec.d.ts +0 -9
- package/dist/components/DatePicker/__tests__/useCalendarPicker.spec.d.ts +0 -1
- package/dist/components/DatePicker/__tests__/useDatePicker.spec.d.ts +0 -1
- package/dist/components/DatePicker/__tests__/utils.spec.d.ts +0 -1
- package/dist/components/DatePicker/index.d.ts +0 -2
- package/dist/components/DatePicker/type.d.ts +0 -4
- package/dist/components/DatePicker/useCalendar.d.ts +0 -7
- package/dist/components/DatePicker/useCalendarPicker.d.ts +0 -9
- package/dist/components/DatePicker/useDatePicker.d.ts +0 -18
- package/dist/components/DatePicker/utils.d.ts +0 -113
- package/dist/components/Dialog.d.ts +0 -22
- package/dist/components/FieldWrapper.d.ts +0 -22
- package/dist/components/Hint.d.ts +0 -6
- package/dist/components/Input.d.ts +0 -27
- package/dist/components/InputModal.d.ts +0 -10
- package/dist/components/InputStatusIcon.d.ts +0 -9
- package/dist/components/Label.d.ts +0 -11
- package/dist/components/PasswordInput.d.ts +0 -21
- package/dist/components/RadioButton.d.ts +0 -9
- package/dist/components/RadioGroup.d.ts +0 -17
- package/dist/components/SegmentedControl.d.ts +0 -12
- package/dist/components/Select.d.ts +0 -12
- package/dist/components/Slider.d.ts +0 -9
- package/dist/components/StatusMessage.d.ts +0 -17
- package/dist/components/Table/Table.d.ts +0 -15
- package/dist/components/Table/tableAmbientThemes.d.ts +0 -22
- package/dist/components/TextArea.d.ts +0 -5
- package/dist/components/TimePicker.d.ts +0 -16
- package/dist/components/TokenInput.d.ts +0 -7
- package/dist/components/TolerancePicker/TolerancePicker.d.ts +0 -14
- package/dist/components/TolerancePicker/ToleranceRangeGrid.d.ts +0 -8
- package/dist/components/TolerancePicker/consts.d.ts +0 -4
- package/dist/hooks/__tests__/useOutsideClick.spec.d.ts +0 -1
- package/dist/hooks/useFocusByTab.d.ts +0 -11
- package/dist/hooks/useModalPosition.d.ts +0 -7
- package/dist/hooks/useOutsideClick.d.ts +0 -2
- package/dist/index.esm.js +0 -1462
- package/dist/index.esm.js.map +0 -1
- package/dist/theme.css.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osrd-project/ui-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.85",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"bugs": "https://github.com/OpenRailAssociation/osrd/issues",
|
|
6
6
|
"repository": {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
|
-
"module": "dist/index.
|
|
15
|
+
"module": "dist/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
-
"main": "dist/index.
|
|
17
|
+
"main": "dist/index.js",
|
|
18
18
|
"style": "dist/theme.css",
|
|
19
19
|
"files": [
|
|
20
20
|
"/dist"
|
|
@@ -23,33 +23,33 @@
|
|
|
23
23
|
"./dist/theme.css": "./dist/theme.css",
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"default": "./dist/index.
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"clean": "rimraf dist",
|
|
31
|
-
"build": "
|
|
32
|
-
"watch": "
|
|
31
|
+
"build": "tsdown --fail-on-warn",
|
|
32
|
+
"watch": "tsdown -w",
|
|
33
33
|
"test": "vitest run",
|
|
34
34
|
"prepublishOnly": "npm run clean && npm run build",
|
|
35
|
-
"lint": "
|
|
36
|
-
"lint:fix": "
|
|
35
|
+
"lint": "stylelint '**/*.css' && oxlint . --max-warnings 0 && oxfmt . --check",
|
|
36
|
+
"lint:fix": "stylelint '**/*.css' --fix && oxlint . --fix && oxfmt . --write"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "^18.0.0 || ^19.1.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@osrd-project/ui-icons": "0.0.
|
|
42
|
+
"@osrd-project/ui-icons": "0.0.85",
|
|
43
43
|
"classnames": "^2.5.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tailwindcss/postcss": "^4.
|
|
47
|
-
"@testing-library/dom": "^10.
|
|
48
|
-
"@testing-library/react": "^16.3.
|
|
49
|
-
"@types/react": "^19.
|
|
50
|
-
"@types/react-dom": "^19.
|
|
51
|
-
"
|
|
46
|
+
"@tailwindcss/postcss": "^4.3.5",
|
|
47
|
+
"@testing-library/dom": "^10.4.2",
|
|
48
|
+
"@testing-library/react": "^16.3.3",
|
|
49
|
+
"@types/react": "^19.3.0",
|
|
50
|
+
"@types/react-dom": "^19.3.0",
|
|
51
|
+
"happy-dom": "^21.0.4",
|
|
52
52
|
"tailwindcss": "^4.2.2",
|
|
53
|
-
"vitest": "^
|
|
53
|
+
"vitest": "^5.1.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
type ButtonVariant = 'Normal' | 'Cancel' | 'Quiet' | 'Destructive' | 'Primary';
|
|
3
|
-
type ButtonSize = 'large' | 'medium' | 'small';
|
|
4
|
-
export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled'> & {
|
|
5
|
-
label: string;
|
|
6
|
-
variant?: ButtonVariant;
|
|
7
|
-
isLoading?: boolean;
|
|
8
|
-
isDisabled?: boolean;
|
|
9
|
-
leadingIcon?: ReactNode;
|
|
10
|
-
counter?: number | null;
|
|
11
|
-
size?: ButtonSize;
|
|
12
|
-
dataTestID?: string;
|
|
13
|
-
onClick: () => void;
|
|
14
|
-
};
|
|
15
|
-
declare const Button: ({ label, variant, isLoading, isDisabled, leadingIcon, counter, size, onClick, dataTestID, ...btnAttrs }: ButtonProps) => React.JSX.Element;
|
|
16
|
-
export default Button;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { type InputHTMLAttributes } from 'react';
|
|
2
|
-
export type CheckboxProps = React.PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputElement>, 'children'> & {
|
|
3
|
-
label?: string;
|
|
4
|
-
small?: boolean;
|
|
5
|
-
hint?: string;
|
|
6
|
-
isIndeterminate?: boolean;
|
|
7
|
-
}>;
|
|
8
|
-
declare const Checkbox: ({ label, small, hint, disabled, checked, readOnly, isIndeterminate, onClick, children, ...rest }: CheckboxProps) => React.JSX.Element;
|
|
9
|
-
export default Checkbox;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type CheckboxTreeItem } from './type';
|
|
3
|
-
export type CheckboxListProps = {
|
|
4
|
-
items: CheckboxTreeItem[];
|
|
5
|
-
onClickItem: (e: React.MouseEvent<HTMLInputElement, MouseEvent>, item: CheckboxTreeItem) => void;
|
|
6
|
-
small?: boolean;
|
|
7
|
-
label?: string;
|
|
8
|
-
readOnly?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const CheckboxList: (checkBoxListprops: CheckboxListProps) => React.JSX.Element;
|
|
12
|
-
export default CheckboxList;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type FieldWrapperProps } from '../FieldWrapper';
|
|
3
|
-
import { type CheckboxTreeItem } from './type';
|
|
4
|
-
export type CheckboxesTreeProps = Omit<FieldWrapperProps, 'children'> & {
|
|
5
|
-
readOnly?: boolean;
|
|
6
|
-
items: CheckboxTreeItem[];
|
|
7
|
-
onChange?: (newItems: CheckboxTreeItem[], item: CheckboxTreeItem) => void;
|
|
8
|
-
computeNewItemsTree?: (prevItemsTree: CheckboxTreeItem[], item: CheckboxTreeItem) => CheckboxTreeItem[];
|
|
9
|
-
};
|
|
10
|
-
declare const CheckboxesTree: ({ items, small, id, label, hint, statusWithMessage, disabled, required, readOnly, onChange, computeNewItemsTree, }: CheckboxesTreeProps) => React.JSX.Element;
|
|
11
|
-
export default CheckboxesTree;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as Checkbox, type CheckboxProps } from './Checkbox';
|
|
2
|
-
export { default as CheckboxList, type CheckboxListProps } from './CheckboxList';
|
|
3
|
-
export { default as CheckboxesTree, type CheckboxesTreeProps } from './CheckboxTree';
|
|
4
|
-
export { CheckboxState, CheckboxTreeItem, ChildrenParentMap, ItemStates, ParentChildrenMap, } from './type';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type CheckboxProps } from './Checkbox';
|
|
2
|
-
export declare enum CheckboxState {
|
|
3
|
-
UNCHECKED = 0,
|
|
4
|
-
CHECKED = 1,
|
|
5
|
-
INDETERMINATE = 2
|
|
6
|
-
}
|
|
7
|
-
export type ItemStates = Record<number, CheckboxState>;
|
|
8
|
-
export type CheckboxTreeItem = {
|
|
9
|
-
id: number;
|
|
10
|
-
props: CheckboxProps;
|
|
11
|
-
items?: CheckboxTreeItem[];
|
|
12
|
-
};
|
|
13
|
-
export type ParentChildrenMap = Record<number, number[]>;
|
|
14
|
-
export type ChildrenParentMap = Record<number, number>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CheckboxState, type CheckboxTreeItem, type ChildrenParentMap, type ItemStates, type ParentChildrenMap } from './type';
|
|
2
|
-
export declare const traverseTree: (items: CheckboxTreeItem[], onVisit: (item: CheckboxTreeItem, parent?: CheckboxTreeItem) => void, parent?: CheckboxTreeItem) => void;
|
|
3
|
-
export declare const buildRelationshipMaps: (items: CheckboxTreeItem[]) => {
|
|
4
|
-
parentChildrenMap: ParentChildrenMap;
|
|
5
|
-
childrenParentMap: ChildrenParentMap;
|
|
6
|
-
};
|
|
7
|
-
export declare const updateItemAndDescendantsStates: (itemId: number, newItemStates: CheckboxState, parentChildrenMap: ParentChildrenMap, itemStates: ItemStates) => void;
|
|
8
|
-
export declare const updateAscendantsStates: (childId: number, itemStates: ItemStates, relastionShipMap: {
|
|
9
|
-
parentChildrenMap: ParentChildrenMap;
|
|
10
|
-
childrenParentMap: ChildrenParentMap;
|
|
11
|
-
}) => void;
|
|
12
|
-
export declare const updateItemStates: (itemsTree: CheckboxTreeItem[], initialItemStates: ItemStates, clickedItemId: number) => ItemStates;
|
|
13
|
-
export declare const computeInitialItemStates: (items: CheckboxTreeItem[]) => ItemStates;
|
|
14
|
-
export declare const applyStateToItem: (itemsTree: CheckboxTreeItem[], itemStates: ItemStates) => any;
|
|
15
|
-
export declare const computeNewItemsTree: (itemsTree: CheckboxTreeItem[], clickedItem: CheckboxTreeItem) => CheckboxTreeItem[];
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
import { type InputProps } from '../Input';
|
|
3
|
-
export type ComboBoxProps<T> = Omit<InputProps, 'value'> & {
|
|
4
|
-
value?: T;
|
|
5
|
-
suggestions: Array<T>;
|
|
6
|
-
customLabel?: ReactNode;
|
|
7
|
-
numberOfSuggestionsToShow?: number;
|
|
8
|
-
getSuggestionLabel: (option: T) => string;
|
|
9
|
-
onSelectSuggestion: (option: T | undefined) => void;
|
|
10
|
-
resetSuggestions: () => void;
|
|
11
|
-
testIdPrefix?: string;
|
|
12
|
-
renderListElementComponent?: (params: {
|
|
13
|
-
suggestion: T;
|
|
14
|
-
index: number;
|
|
15
|
-
isActive: boolean;
|
|
16
|
-
isSelected: boolean;
|
|
17
|
-
}) => ReactNode;
|
|
18
|
-
renderFooterItem?: () => ReactNode;
|
|
19
|
-
allowCustomValue?: boolean;
|
|
20
|
-
onAddCustomValue?: (value: string) => void;
|
|
21
|
-
addCustomValueLabel?: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* ComboBox component
|
|
25
|
-
*
|
|
26
|
-
* You can use the hook useDefaultComboBox to get the default behavior.
|
|
27
|
-
* See the stories.
|
|
28
|
-
*
|
|
29
|
-
* When `allowCustomValue` is true, an option appears at the bottom of the dropdown
|
|
30
|
-
* when the typed value doesn't match any existing suggestion.
|
|
31
|
-
* Defocusing without selecting cancels the input.
|
|
32
|
-
*/
|
|
33
|
-
declare const ComboBox: <T>({ suggestions, customLabel, numberOfSuggestionsToShow, value, small, getSuggestionLabel, onChange, onSelectSuggestion, resetSuggestions, testIdPrefix, renderListElementComponent, renderFooterItem, allowCustomValue, onAddCustomValue, addCustomValueLabel, ...inputProps }: ComboBoxProps<T>) => React.JSX.Element;
|
|
34
|
-
export default ComboBox;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type CalendarSlot } from './type';
|
|
3
|
-
export type CalendarProps = {
|
|
4
|
-
selectedSlot?: CalendarSlot;
|
|
5
|
-
selectableSlot?: CalendarSlot;
|
|
6
|
-
displayedMonthStartDate: Date;
|
|
7
|
-
onDayClick: (date: Date) => void;
|
|
8
|
-
};
|
|
9
|
-
declare const Calendar: (props: CalendarProps) => React.JSX.Element;
|
|
10
|
-
export default Calendar;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type CalendarSlot } from './type';
|
|
3
|
-
export type CalendarPickerPrivateProps = {
|
|
4
|
-
selectedSlot?: CalendarSlot;
|
|
5
|
-
onDayClick: (day: Date) => void;
|
|
6
|
-
modalPosition: {
|
|
7
|
-
top: number;
|
|
8
|
-
left: number;
|
|
9
|
-
};
|
|
10
|
-
calendarPickerRef: React.RefObject<HTMLDivElement | null>;
|
|
11
|
-
selectableSlot?: CalendarSlot;
|
|
12
|
-
};
|
|
13
|
-
export type CalendarPickerPublicProps = {
|
|
14
|
-
initialDate?: Date;
|
|
15
|
-
numberOfMonths?: 1 | 2 | 3;
|
|
16
|
-
};
|
|
17
|
-
export type CalendarPickerProps = CalendarPickerPrivateProps & CalendarPickerPublicProps;
|
|
18
|
-
declare const CalendarPicker: ({ initialDate, selectedSlot, selectableSlot, numberOfMonths, onDayClick, modalPosition, calendarPickerRef, }: CalendarPickerProps) => React.JSX.Element;
|
|
19
|
-
export default CalendarPicker;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type CalendarSlot } from '.';
|
|
3
|
-
import { type InputProps } from '../Input';
|
|
4
|
-
import { type CalendarPickerPublicProps } from './CalendarPicker';
|
|
5
|
-
type BaseDatePickerProps = {
|
|
6
|
-
selectableSlot?: CalendarSlot;
|
|
7
|
-
inputProps: InputProps;
|
|
8
|
-
calendarPickerProps?: CalendarPickerPublicProps;
|
|
9
|
-
errorMessages?: {
|
|
10
|
-
invalidInput?: string;
|
|
11
|
-
invalidDate?: string;
|
|
12
|
-
};
|
|
13
|
-
width?: number;
|
|
14
|
-
testIdPrefix?: string;
|
|
15
|
-
};
|
|
16
|
-
export type SingleDatePickerProps = BaseDatePickerProps & {
|
|
17
|
-
isRangeMode?: false;
|
|
18
|
-
onDateChange: (nextDate?: Date) => void;
|
|
19
|
-
value?: Date;
|
|
20
|
-
};
|
|
21
|
-
export type RangeDatePickerProps = BaseDatePickerProps & {
|
|
22
|
-
isRangeMode: true;
|
|
23
|
-
onDateChange: (clickedDate: Date, nextSelectedSlot?: CalendarSlot) => void;
|
|
24
|
-
value?: CalendarSlot;
|
|
25
|
-
};
|
|
26
|
-
export type DatePickerProps = SingleDatePickerProps | RangeDatePickerProps;
|
|
27
|
-
export declare const DatePicker: (props: DatePickerProps) => React.JSX.Element;
|
|
28
|
-
export default DatePicker;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const january = 0;
|
|
2
|
-
export declare const february = 1;
|
|
3
|
-
export declare const march = 2;
|
|
4
|
-
export declare const april = 3;
|
|
5
|
-
export declare const june = 5;
|
|
6
|
-
export declare const july = 6;
|
|
7
|
-
export declare const august = 7;
|
|
8
|
-
export declare const november = 10;
|
|
9
|
-
export declare const december = 11;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type CalendarProps } from './Calendar';
|
|
2
|
-
export default function useCalendar({ displayedMonthStartDate, selectableSlot, selectedSlot, }: CalendarProps): {
|
|
3
|
-
days: Date[];
|
|
4
|
-
isToday: (date: Date) => boolean;
|
|
5
|
-
buildDayWrapperClassName: (date: Date) => string;
|
|
6
|
-
isDateSelectable: (date: Date) => boolean;
|
|
7
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type CalendarPickerProps } from './CalendarPicker';
|
|
2
|
-
export default function useCalendarPicker({ initialDate, selectedSlot, selectableSlot, numberOfMonths, }: Omit<CalendarPickerProps, 'modalPosition' | 'calendarPickerRef' | 'onDayClick'>): {
|
|
3
|
-
displayedMonthsStartDates: Date[];
|
|
4
|
-
showNavigationBtn: boolean;
|
|
5
|
-
canGoToPreviousMonth: boolean;
|
|
6
|
-
canGoToNextMonth: boolean;
|
|
7
|
-
handleGoToPreviousMonth: () => void;
|
|
8
|
-
handleGoToNextMonth: () => void;
|
|
9
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { StatusWithMessage } from '../StatusMessage';
|
|
2
|
-
import type { DatePickerProps } from './DatePicker';
|
|
3
|
-
export default function useDatePicker(datePickerProps: DatePickerProps): {
|
|
4
|
-
showPicker: boolean;
|
|
5
|
-
inputValue: string;
|
|
6
|
-
statusWithMessage: StatusWithMessage | undefined;
|
|
7
|
-
selectedSlot: import("./type").CalendarSlot | undefined;
|
|
8
|
-
modalPosition: {
|
|
9
|
-
top: number;
|
|
10
|
-
left: number;
|
|
11
|
-
};
|
|
12
|
-
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
13
|
-
calendarPickerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
14
|
-
setShowPicker: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
15
|
-
handleDayClick: (clickedDate: Date) => void;
|
|
16
|
-
handleInputClick: () => void;
|
|
17
|
-
handleInputOnChange: (newValue: string) => void;
|
|
18
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { type DatePickerProps, type CalendarSlot } from './index';
|
|
2
|
-
export declare const INVALID_SELECTED_SLOT_ERROR = "Invalid selectedSlot: If start and end are defined, the start date must be before the end date.";
|
|
3
|
-
export declare const INVALID_SELECTABLE_SLOT_ERROR = "Invalid selectableSlot: If start and end are defined, the start date must be before the end date.";
|
|
4
|
-
export declare const INVALID_SELECTED_SLOT_BASED_ON_SELECTABLE_SLOT_ERROR = "selectedSlot must be within selectableSlot";
|
|
5
|
-
export declare const INVALID_INITIAL_DATE_ERROR = "initialDate must be within selectableSlot";
|
|
6
|
-
export declare const containsOnlyNumbersAndSlashes: (s: string) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Normalize the given date to midnight
|
|
9
|
-
* @param date The date to normalize
|
|
10
|
-
* @returns The normalized date
|
|
11
|
-
*/
|
|
12
|
-
export declare function normalizeDate(date: Date): Date;
|
|
13
|
-
/**
|
|
14
|
-
* Check if the given slot is valid
|
|
15
|
-
* @param slot The slot to check
|
|
16
|
-
* @returns True if the slot is valid, false otherwise
|
|
17
|
-
*/
|
|
18
|
-
export declare function isValidSlot(slot: CalendarSlot): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Get the dates from the previous month that are in the first week of the current month
|
|
21
|
-
* @param month The month of the current date
|
|
22
|
-
* @param fullYear The year of the current date
|
|
23
|
-
* @returns An array of dates from the previous month that are in the first week of the current month
|
|
24
|
-
*/
|
|
25
|
-
export declare function getDatesFromPreviousMonthInFirstWeek(month: number, fullYear: number): Date[];
|
|
26
|
-
/**
|
|
27
|
-
* Get the dates from the next month that are in the last week of the current month
|
|
28
|
-
* @param month The month of the current date
|
|
29
|
-
* @param fullYear The year of the current date
|
|
30
|
-
* @returns An array of dates from the next month that are in the last week of the current month
|
|
31
|
-
*/
|
|
32
|
-
export declare function getDatesFromNextMonthInLastWeek(month: number, fullYear: number): Date[];
|
|
33
|
-
/**
|
|
34
|
-
* Get all the dates in the month of the given date
|
|
35
|
-
* @param month The month of the current date
|
|
36
|
-
* @param fullYear The year of the current date
|
|
37
|
-
* @returns An array of all the dates in the month of the given date
|
|
38
|
-
*/
|
|
39
|
-
export declare function getAllDatesInMonth(month: number, fullYear: number): Date[];
|
|
40
|
-
/**
|
|
41
|
-
* Check if the given dates are the same day
|
|
42
|
-
* @param date1 The first date
|
|
43
|
-
* @param date2 The second date
|
|
44
|
-
* @returns True if the dates are the same day, false otherwise
|
|
45
|
-
*/
|
|
46
|
-
export declare function isSameDay(date1: Date | null, date2: Date | null): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Check if the given date is within the given slot
|
|
49
|
-
* if the slot is not provided, the date is considered to be within the slot
|
|
50
|
-
* if a boundary of the slot is not provided, it's considered to be an open boundary
|
|
51
|
-
* @param date The date to check
|
|
52
|
-
* @param slot The slot to check
|
|
53
|
-
* @returns True if the date is within the slot, false otherwise
|
|
54
|
-
*/
|
|
55
|
-
export declare function isWithinInterval(date: Date, slot?: CalendarSlot): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Generates a list of dates, each representing the start of a month,
|
|
58
|
-
* starting from a given date and continuing for a specified number of months.
|
|
59
|
-
* This function correctly handles year rollover.
|
|
60
|
-
* @param startDate - The date from which to start generating month start dates.
|
|
61
|
-
* @param monthsCount - The number of month start dates to generate.
|
|
62
|
-
* @returns An array of Dates, each set to the first day of consecutive months starting from startDate.
|
|
63
|
-
*/
|
|
64
|
-
export declare function generateSequentialDates(startDate: Date, monthsCount: number): Date[];
|
|
65
|
-
/**
|
|
66
|
-
* Format the given date as a string in the format 'dd/mm/yy'.
|
|
67
|
-
* @param date The date to format
|
|
68
|
-
* @returns The formatted date string
|
|
69
|
-
*/
|
|
70
|
-
export declare function formatDateString(date?: Date | null): string;
|
|
71
|
-
/**
|
|
72
|
-
* Handles the logic for when a day is clicked on the calendar.
|
|
73
|
-
*
|
|
74
|
-
* @param clickedDate - The date that was clicked.
|
|
75
|
-
* @param isRangeMode - Whether the calendar is in range mode.
|
|
76
|
-
* @param prevSelectedSlot - The previously selected slot.
|
|
77
|
-
* Spec 1: If the user clicks on a single date, that date is set as the start date of the slot.
|
|
78
|
-
* Spec 2: If the user selects the same end date as the start date, clear the slot
|
|
79
|
-
* Spec 3: If the user clicks on a date that is before the currently selected start date, the new date becomes the start date and the previous start date becomes the end date.
|
|
80
|
-
* Spec 4: If the user clicks on a date that is after the currently selected start date, that date becomes the end date of the slot.
|
|
81
|
-
* Spec 5: If a slot is already defined (i.e., both start and end dates are defined) and the user clicks on a new date, the existing slot is cleared and the new date becomes the start date of the new slot.
|
|
82
|
-
*/
|
|
83
|
-
export declare function computeNewSelectedSlot(clickedDate: Date, prevSelectedSlot: CalendarSlot | undefined): CalendarSlot | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Format the selected slot to a string that can be displayed in the input field.
|
|
86
|
-
* @param slot The new selected slot
|
|
87
|
-
* @returns The formatted string
|
|
88
|
-
* Spec 0: If the slot is undefined, return an empty string.
|
|
89
|
-
* Spec 1: If the start and end dates are the same, return the formatted date of the start date.
|
|
90
|
-
* Spec 2: If the start and end dates are in the same year, return the formatted start date without the year and end date.
|
|
91
|
-
* Spec 3: If the start and end dates are in different years, return the formatted start date and end date with the year.
|
|
92
|
-
*/
|
|
93
|
-
export declare function formatSlotToInputValue(slot: CalendarSlot | undefined): string;
|
|
94
|
-
/**
|
|
95
|
-
* Format the new value to a string that can be displayed in the input field.
|
|
96
|
-
* @param value The new value
|
|
97
|
-
* @param isRangeMode Whether the calendar is in range mode
|
|
98
|
-
* @returns The formatted string
|
|
99
|
-
*/
|
|
100
|
-
export declare function formatInputValue({ value, isRangeMode }: DatePickerProps): string;
|
|
101
|
-
export declare function formatValueToSlot({ value, isRangeMode }: DatePickerProps): CalendarSlot | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* Validates the selected and selectable slots as well as the initial date.
|
|
104
|
-
* @param selectedSlot The selected slot to validate.
|
|
105
|
-
* @param selectableSlot The selectable slot to validate.
|
|
106
|
-
* @param date The date to validate.
|
|
107
|
-
*
|
|
108
|
-
* Three main validation checks are performed:
|
|
109
|
-
* - Check if the selected and selectable slots are valid.
|
|
110
|
-
* - Ensures the selected slot is within the selectable slot.
|
|
111
|
-
* - Ensures the initial date is within the selectable slot
|
|
112
|
-
*/
|
|
113
|
-
export declare function validateSlots(selectedSlot: CalendarSlot | undefined, selectableSlot: CalendarSlot | undefined, date: Date | undefined): void;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { type DialogHTMLAttributes } from 'react';
|
|
2
|
-
type ModalProps = DialogHTMLAttributes<HTMLDialogElement> & {
|
|
3
|
-
fullscreen?: boolean;
|
|
4
|
-
headerClassname?: string;
|
|
5
|
-
bodyClassname?: string;
|
|
6
|
-
footerClassname?: string;
|
|
7
|
-
header: React.ReactNode;
|
|
8
|
-
footer: React.ReactNode;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Display a styled dialog box.
|
|
12
|
-
* You are in charge of its lifecycle (open & close), this componant just display it.
|
|
13
|
-
*
|
|
14
|
-
* Children must be an array of 3 items, where :
|
|
15
|
-
* - the first one is for the header
|
|
16
|
-
* - the second one is for the content
|
|
17
|
-
* - the last is for the footer
|
|
18
|
-
*
|
|
19
|
-
* NB: Inside header, only title tags have the good style (font weight and size)
|
|
20
|
-
*/
|
|
21
|
-
declare const Dialog: ({ children, className, fullscreen, header, headerClassname, footer, footerClassname, bodyClassname, ...dialogProps }: ModalProps) => React.JSX.Element;
|
|
22
|
-
export default Dialog;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type StatusWithMessage } from './StatusMessage';
|
|
3
|
-
export type FieldWrapperProps = {
|
|
4
|
-
id: string;
|
|
5
|
-
label?: string;
|
|
6
|
-
hint?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
statusWithMessage?: StatusWithMessage;
|
|
10
|
-
statusIconPosition?: 'next-to-field' | 'before-status-message';
|
|
11
|
-
/**
|
|
12
|
-
* Input without any wrapper padding.
|
|
13
|
-
* Should not be used with required or statusWithMessage with no tooltip.
|
|
14
|
-
*/
|
|
15
|
-
narrow?: boolean;
|
|
16
|
-
small?: boolean;
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
className?: string;
|
|
19
|
-
onCloseStatusMessage?: () => void;
|
|
20
|
-
};
|
|
21
|
-
declare const FieldWrapper: ({ id, label, hint, required, disabled, statusWithMessage, statusIconPosition, narrow, small, className, children, onCloseStatusMessage, }: FieldWrapperProps) => React.JSX.Element;
|
|
22
|
-
export default FieldWrapper;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type FieldWrapperProps } from './FieldWrapper';
|
|
3
|
-
type InputAffixContent = string | React.ReactNode;
|
|
4
|
-
type InputAffixContentWithCallback = {
|
|
5
|
-
content: string | React.ReactNode;
|
|
6
|
-
onClickCallback: () => void;
|
|
7
|
-
};
|
|
8
|
-
type IconConfig = {
|
|
9
|
-
icon: React.ReactNode;
|
|
10
|
-
action: () => void;
|
|
11
|
-
className?: string;
|
|
12
|
-
};
|
|
13
|
-
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & Omit<FieldWrapperProps, 'children'> & {
|
|
14
|
-
leadingContent?: InputAffixContent | InputAffixContentWithCallback;
|
|
15
|
-
trailingContent?: InputAffixContent | InputAffixContentWithCallback;
|
|
16
|
-
inputFieldWrapperClassname?: string;
|
|
17
|
-
withIcons?: IconConfig[];
|
|
18
|
-
testIdPrefix?: string;
|
|
19
|
-
};
|
|
20
|
-
declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & Omit<FieldWrapperProps, "children"> & {
|
|
21
|
-
leadingContent?: InputAffixContent | InputAffixContentWithCallback;
|
|
22
|
-
trailingContent?: InputAffixContent | InputAffixContentWithCallback;
|
|
23
|
-
inputFieldWrapperClassname?: string;
|
|
24
|
-
withIcons?: IconConfig[];
|
|
25
|
-
testIdPrefix?: string;
|
|
26
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
-
export default Input;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type ModalProps = {
|
|
3
|
-
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
testIdPrefix?: string;
|
|
8
|
-
};
|
|
9
|
-
declare const InputModal: ({ inputRef, isOpen, onClose, children, testIdPrefix }: ModalProps) => React.JSX.Element | null;
|
|
10
|
-
export default InputModal;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type status = 'success' | 'info' | 'error' | 'warning' | 'loading';
|
|
3
|
-
type InputStatusIconProps = {
|
|
4
|
-
status: status;
|
|
5
|
-
small?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
8
|
-
declare const InputStatusIcon: ({ status, small, className }: InputStatusIconProps) => React.JSX.Element;
|
|
9
|
-
export default InputStatusIcon;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type LabelProps = {
|
|
3
|
-
htmlFor: string;
|
|
4
|
-
text: string;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
hasHint?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
small: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const Label: ({ htmlFor, text, required, hasHint, disabled, small }: LabelProps) => React.JSX.Element;
|
|
11
|
-
export default Label;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type InputProps } from './Input';
|
|
3
|
-
export type PasswordInputProps = InputProps;
|
|
4
|
-
declare const PasswordInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & Omit<import("./FieldWrapper").FieldWrapperProps, "children"> & {
|
|
5
|
-
leadingContent?: React.ReactNode | {
|
|
6
|
-
content: string | React.ReactNode;
|
|
7
|
-
onClickCallback: () => void;
|
|
8
|
-
};
|
|
9
|
-
trailingContent?: React.ReactNode | {
|
|
10
|
-
content: string | React.ReactNode;
|
|
11
|
-
onClickCallback: () => void;
|
|
12
|
-
};
|
|
13
|
-
inputFieldWrapperClassname?: string;
|
|
14
|
-
withIcons?: {
|
|
15
|
-
icon: React.ReactNode;
|
|
16
|
-
action: () => void;
|
|
17
|
-
className?: string;
|
|
18
|
-
}[];
|
|
19
|
-
testIdPrefix?: string;
|
|
20
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
-
export default PasswordInput;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type RadioButtonProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'> & {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
hint?: string;
|
|
6
|
-
small?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare const RadioButton: ({ id, label, value, hint, readOnly, onBlur, onKeyUp, small, ...rest }: RadioButtonProps) => React.JSX.Element;
|
|
9
|
-
export default RadioButton;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type RadioButtonProps } from './RadioButton';
|
|
3
|
-
import { type StatusWithMessage } from './StatusMessage';
|
|
4
|
-
export type RadioGroupProps = {
|
|
5
|
-
label?: string;
|
|
6
|
-
subtitle?: string;
|
|
7
|
-
readOnly?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
small?: boolean;
|
|
11
|
-
value?: string;
|
|
12
|
-
options: RadioButtonProps[];
|
|
13
|
-
statusWithMessage?: StatusWithMessage;
|
|
14
|
-
onChange?: (value: string) => void;
|
|
15
|
-
};
|
|
16
|
-
declare const RadioGroup: ({ label, value, subtitle, readOnly, disabled, options, statusWithMessage, required, small, onChange, }: RadioGroupProps) => React.JSX.Element;
|
|
17
|
-
export default RadioGroup;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type SegmentedControlProps<T> = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'checked'> & {
|
|
3
|
-
options: Array<T>;
|
|
4
|
-
onChange: (option: T) => void;
|
|
5
|
-
value: T;
|
|
6
|
-
getOptionLabel: (option: T) => string;
|
|
7
|
-
getOptionValue: (option: T) => string;
|
|
8
|
-
getOptionIcon?: (option: T) => React.ReactNode;
|
|
9
|
-
small?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const SegmentedControl: <T>({ options, onChange, value, getOptionLabel, getOptionValue, getOptionIcon, small, ...inputProps }: SegmentedControlProps<T>) => React.JSX.Element;
|
|
12
|
-
export default SegmentedControl;
|