@paygreen/pgui 3.0.1-beta → 3.0.2
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/date-picker/date-picker.d.ts +47 -6
- package/dist/components/field-wrapper/field-wrapper.d.ts +8 -8
- package/dist/components/input/input.d.ts +4 -3
- package/dist/components/input-mask/input-mask.d.ts +1 -1
- package/dist/components/input-phone/input-phone.d.ts +5 -5
- package/dist/components/input-search/input-search.d.ts +1 -1
- package/dist/components/select/select.d.ts +35 -18
- package/dist/components/sidebar/sidebar.d.ts +19 -11
- package/dist/index.js +10 -10
- package/dist/index.mjs +3204 -2560
- package/dist/pgui.css +1 -1
- package/dist/theme/recipes/alert-recipe.d.ts +2 -0
- package/dist/theme/recipes/index.d.ts +0 -14
- package/dist/theme/semanticTokens/colors.d.ts +56 -0
- package/dist/theme/semanticTokens/index.d.ts +56 -0
- package/dist/theme/tokens/colors.d.ts +48 -0
- package/dist/theme/tokens/index.d.ts +101 -0
- package/dist/theme/tokens/z-index.d.ts +54 -0
- package/package.json +4 -3
- package/src/components/date-picker/date-picker.css +50 -1
- package/src/components/select/select.css +5 -2
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Locale } from 'date-fns';
|
|
2
1
|
/**
|
|
3
2
|
* Props for the DatePicker component
|
|
4
3
|
*/
|
|
5
4
|
export interface DatePickerProps {
|
|
5
|
+
/** ID attribute for the input element */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Name attribute for form integration */
|
|
8
|
+
name?: string;
|
|
6
9
|
/** The selected date or date range */
|
|
7
10
|
value?: Date | [Date | null, Date | null] | null;
|
|
8
11
|
/** Label text displayed above the input */
|
|
@@ -13,10 +16,10 @@ export interface DatePickerProps {
|
|
|
13
16
|
isRange?: boolean;
|
|
14
17
|
/** Whether to enable time selection */
|
|
15
18
|
isDateTime?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/** Locale for date formatting and translations */
|
|
19
|
-
locale?:
|
|
19
|
+
/** Custom placeholder text for the input (overrides default format placeholder) */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Locale string for date formatting and translations ('en', 'fr') */
|
|
22
|
+
locale?: 'en' | 'fr';
|
|
20
23
|
/** Minimum selectable date */
|
|
21
24
|
minDate?: Date;
|
|
22
25
|
/** Maximum selectable date */
|
|
@@ -26,18 +29,56 @@ export interface DatePickerProps {
|
|
|
26
29
|
/** Callback fired when the input loses focus */
|
|
27
30
|
onBlur?: () => void;
|
|
28
31
|
/** Whether the input is disabled */
|
|
29
|
-
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** Whether to show a clear button when there's a value (default: true) */
|
|
34
|
+
clearable?: boolean;
|
|
35
|
+
/** Whether the input is in invalid state */
|
|
36
|
+
invalid?: boolean;
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
39
|
* A reusable date picker component with floating label and range selection support
|
|
33
40
|
*
|
|
34
41
|
* @example
|
|
35
42
|
* ```tsx
|
|
43
|
+
* // Default behavior - shows format as placeholder (mm/dd/yyyy)
|
|
36
44
|
* <DatePicker
|
|
37
45
|
* label="Birthdate"
|
|
38
46
|
* value={date}
|
|
39
47
|
* onChange={setDate}
|
|
40
48
|
* />
|
|
49
|
+
*
|
|
50
|
+
* // French locale - shows French format (jj/mm/aaaa)
|
|
51
|
+
* <DatePicker
|
|
52
|
+
* label="Date de naissance"
|
|
53
|
+
* value={date}
|
|
54
|
+
* onChange={setDate}
|
|
55
|
+
* locale="fr"
|
|
56
|
+
* />
|
|
57
|
+
*
|
|
58
|
+
* // With custom placeholder (overrides default format)
|
|
59
|
+
* <DatePicker
|
|
60
|
+
* label="Birthdate"
|
|
61
|
+
* value={date}
|
|
62
|
+
* onChange={setDate}
|
|
63
|
+
* placeholderText="Choose your birthdate"
|
|
64
|
+
* />
|
|
65
|
+
*
|
|
66
|
+
* // To disable the clear button:
|
|
67
|
+
* <DatePicker
|
|
68
|
+
* label="Birthdate"
|
|
69
|
+
* value={date}
|
|
70
|
+
* onChange={setDate}
|
|
71
|
+
* clearable={false}
|
|
72
|
+
* />
|
|
73
|
+
*
|
|
74
|
+
* // With name and id for form integration:
|
|
75
|
+
* <DatePicker
|
|
76
|
+
* id="birthdate-input"
|
|
77
|
+
* name="birthdate"
|
|
78
|
+
* label="Birthdate"
|
|
79
|
+
* value={date}
|
|
80
|
+
* onChange={setDate}
|
|
81
|
+
* />
|
|
41
82
|
* ```
|
|
42
83
|
*/
|
|
43
84
|
declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
interface FieldContextType {
|
|
3
3
|
/** Whether the field is invalid */
|
|
4
|
-
|
|
4
|
+
invalid?: boolean;
|
|
5
5
|
/** Whether the field is required */
|
|
6
|
-
|
|
6
|
+
required?: boolean;
|
|
7
7
|
/** Whether the field is disabled */
|
|
8
|
-
|
|
8
|
+
disabled?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface FieldWrapperProps {
|
|
11
11
|
/** The field label */
|
|
@@ -13,11 +13,11 @@ export interface FieldWrapperProps {
|
|
|
13
13
|
/** The error message to display */
|
|
14
14
|
errorMessage?: string;
|
|
15
15
|
/** Whether the field is invalid */
|
|
16
|
-
|
|
16
|
+
invalid?: boolean;
|
|
17
17
|
/** Whether the field is required */
|
|
18
|
-
|
|
18
|
+
required?: boolean;
|
|
19
19
|
/** Whether the field is disabled */
|
|
20
|
-
|
|
20
|
+
disabled?: boolean;
|
|
21
21
|
/** Helper text to display below the field */
|
|
22
22
|
helperText?: string;
|
|
23
23
|
/** The field content (input, select, etc.) */
|
|
@@ -35,8 +35,8 @@ export interface FieldWrapperProps {
|
|
|
35
35
|
* <FieldWrapper
|
|
36
36
|
* label="Email"
|
|
37
37
|
* errorMessage="Please enter a valid email"
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* invalid={hasError}
|
|
39
|
+
* required
|
|
40
40
|
* >
|
|
41
41
|
* <Input type="email" />
|
|
42
42
|
* </FieldWrapper>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { InputProps as ChakraInputProps } from '@chakra-ui/react';
|
|
2
3
|
/**
|
|
3
4
|
* Props for the Input component
|
|
4
5
|
*/
|
|
5
6
|
export interface InputProps extends ChakraInputProps {
|
|
6
7
|
/** Label text displayed above the input */
|
|
7
|
-
label?:
|
|
8
|
+
label?: ReactNode;
|
|
8
9
|
/** Whether the input is disabled */
|
|
9
|
-
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* A reusable input component that extends Chakra UI's Input with floating label and field validation
|
|
@@ -16,7 +17,7 @@ export interface InputProps extends ChakraInputProps {
|
|
|
16
17
|
* <Input
|
|
17
18
|
* label="Email"
|
|
18
19
|
* placeholder="Enter your email"
|
|
19
|
-
*
|
|
20
|
+
* required
|
|
20
21
|
* />
|
|
21
22
|
* ```
|
|
22
23
|
*/
|
|
@@ -11,15 +11,15 @@ export interface InputPhoneProps {
|
|
|
11
11
|
/** Placeholder text for the input */
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
/** Whether the input is disabled */
|
|
14
|
-
|
|
14
|
+
disabled?: boolean;
|
|
15
15
|
/** Additional props to pass to the input element */
|
|
16
16
|
inputProps?: Record<string, unknown>;
|
|
17
17
|
/** Callback fired when the phone number changes */
|
|
18
18
|
onChange?: (value: string) => void;
|
|
19
19
|
/** Whether the input is required */
|
|
20
|
-
|
|
20
|
+
required?: boolean;
|
|
21
21
|
/** Whether the input is invalid */
|
|
22
|
-
|
|
22
|
+
invalid?: boolean;
|
|
23
23
|
/** Error message to display when invalid */
|
|
24
24
|
errorMessage?: string;
|
|
25
25
|
/** Custom labels for the country search component */
|
|
@@ -51,12 +51,12 @@ declare const formatPhoneIntl: (val: string) => string;
|
|
|
51
51
|
* <InputPhone
|
|
52
52
|
* value="+33612345678"
|
|
53
53
|
* onChange={setPhoneNumber}
|
|
54
|
-
*
|
|
54
|
+
* required
|
|
55
55
|
* />
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
declare const InputPhone: {
|
|
59
|
-
({ locale, label, value, placeholder,
|
|
59
|
+
({ locale, label, value, placeholder, disabled, inputProps, onChange, required, invalid, errorMessage, searchLabels, ...props }: InputPhoneProps): import("react/jsx-runtime").JSX.Element;
|
|
60
60
|
displayName: string;
|
|
61
61
|
};
|
|
62
62
|
export { formatPhoneIntl, InputPhone, isValidPhone };
|
|
@@ -11,39 +11,56 @@ export interface SelectOptionType {
|
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Props for
|
|
14
|
+
* Props for single-select mode
|
|
15
15
|
*/
|
|
16
|
-
export interface
|
|
16
|
+
export interface SingleSelectProps extends Omit<ReactSelectProps<SelectOptionType, false>, 'options' | 'isMulti' | 'onChange' | 'value'> {
|
|
17
17
|
/** Array of options to display */
|
|
18
18
|
options?: SelectOptionType[];
|
|
19
|
-
/** Enable multi-selection */
|
|
20
|
-
isMulti?:
|
|
19
|
+
/** Enable multi-selection - must be false or undefined */
|
|
20
|
+
isMulti?: false;
|
|
21
|
+
/** Current value for controlled component */
|
|
22
|
+
value?: SingleValue<SelectOptionType> | null;
|
|
23
|
+
/** onChange handler for controlled component */
|
|
24
|
+
onChange?: (value: SingleValue<SelectOptionType> | null, actionMeta: ActionMeta<SelectOptionType>) => void;
|
|
25
|
+
/** Enable async loading of options */
|
|
26
|
+
isAsync?: boolean;
|
|
27
|
+
/** Enable creating new options */
|
|
28
|
+
isCreatable?: boolean;
|
|
29
|
+
/** Function to load options asynchronously */
|
|
30
|
+
loadOptions?: (inputValue: string) => Promise<SelectOptionType[]>;
|
|
31
|
+
/** Name attribute for form integration */
|
|
32
|
+
name?: string;
|
|
33
|
+
/** Whether the select is in invalid state */
|
|
34
|
+
invalid?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props for multi-select mode
|
|
39
|
+
*/
|
|
40
|
+
export interface MultiSelectProps extends Omit<ReactSelectProps<SelectOptionType, true>, 'options' | 'isMulti' | 'onChange' | 'value'> {
|
|
41
|
+
/** Array of options to display */
|
|
42
|
+
options?: SelectOptionType[];
|
|
43
|
+
/** Enable multi-selection - must be true */
|
|
44
|
+
isMulti: true;
|
|
45
|
+
/** Current value for controlled component - never null in multi mode, always an array */
|
|
46
|
+
value?: MultiValue<SelectOptionType>;
|
|
47
|
+
/** onChange handler for controlled component - never receives null in multi mode */
|
|
48
|
+
onChange?: (value: MultiValue<SelectOptionType>, actionMeta: ActionMeta<SelectOptionType>) => void;
|
|
21
49
|
/** Enable async loading of options */
|
|
22
50
|
isAsync?: boolean;
|
|
23
51
|
/** Enable creating new options */
|
|
24
52
|
isCreatable?: boolean;
|
|
25
53
|
/** Function to load options asynchronously */
|
|
26
54
|
loadOptions?: (inputValue: string) => Promise<SelectOptionType[]>;
|
|
27
|
-
/** Current value for controlled component */
|
|
28
|
-
value?: SingleValue<SelectOptionType> | MultiValue<SelectOptionType> | null;
|
|
29
|
-
/** onChange handler for controlled component */
|
|
30
|
-
onChange?: (value: SingleValue<SelectOptionType> | MultiValue<SelectOptionType> | null, actionMeta: ActionMeta<SelectOptionType>) => void;
|
|
31
55
|
/** Name attribute for form integration */
|
|
32
56
|
name?: string;
|
|
33
57
|
/** Whether the select is in invalid state */
|
|
34
58
|
invalid?: boolean;
|
|
59
|
+
disabled?: boolean;
|
|
35
60
|
}
|
|
36
61
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* <Select
|
|
42
|
-
* options={[{value: 'option1', label: 'Option 1'}]}
|
|
43
|
-
* placeholder="Choose an option..."
|
|
44
|
-
* isClearable
|
|
45
|
-
* />
|
|
46
|
-
* ```
|
|
62
|
+
* Union type for Select component props
|
|
47
63
|
*/
|
|
64
|
+
export type SelectProps = SingleSelectProps | MultiSelectProps;
|
|
48
65
|
declare const Select: import('react').ForwardRefExoticComponent<SelectProps & import('react').RefAttributes<any>>;
|
|
49
66
|
export { Select };
|
|
@@ -3,7 +3,7 @@ import { BoxProps, DrawerRootProps } from '@chakra-ui/react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Theme configuration for sidebar styling
|
|
5
5
|
*/
|
|
6
|
-
interface SidebarTheme {
|
|
6
|
+
export interface SidebarTheme {
|
|
7
7
|
/** Width of the sidebar in desktop mode */
|
|
8
8
|
width?: string;
|
|
9
9
|
/** Background color */
|
|
@@ -13,14 +13,14 @@ interface SidebarTheme {
|
|
|
13
13
|
/** Box shadow */
|
|
14
14
|
boxShadow?: string;
|
|
15
15
|
/** Z-index value */
|
|
16
|
-
zIndex?: number;
|
|
16
|
+
zIndex?: number | string;
|
|
17
17
|
/** Transition duration for animations */
|
|
18
18
|
transitionDuration?: string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Props for individual navigation items in the sidebar
|
|
22
22
|
*/
|
|
23
|
-
interface NavItemProps {
|
|
23
|
+
export interface NavItemProps {
|
|
24
24
|
/** Icon component to display before the label */
|
|
25
25
|
icon?: React.ElementType;
|
|
26
26
|
/** Text label for the navigation item */
|
|
@@ -45,7 +45,7 @@ interface NavItemProps {
|
|
|
45
45
|
/**
|
|
46
46
|
* Props for navigation sections that group related navigation items
|
|
47
47
|
*/
|
|
48
|
-
interface NavSectionProps {
|
|
48
|
+
export interface NavSectionProps {
|
|
49
49
|
/** Optional title for the navigation section */
|
|
50
50
|
title?: string;
|
|
51
51
|
/** Array of navigation items to display in this section */
|
|
@@ -58,14 +58,24 @@ interface NavSectionProps {
|
|
|
58
58
|
/**
|
|
59
59
|
* Props for the sidebar body component that contains navigation sections
|
|
60
60
|
*/
|
|
61
|
-
interface SidebarBodyProps {
|
|
61
|
+
export interface SidebarBodyProps {
|
|
62
62
|
navSections: NavSectionProps[] | null;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Context type for the sidebar
|
|
66
|
+
*/
|
|
67
|
+
export interface SidebarContextType {
|
|
68
|
+
pathname: string;
|
|
69
|
+
displayDrawer: boolean;
|
|
70
|
+
navItemsAs?: React.ElementType;
|
|
71
|
+
navItemsProps?: (item: NavItemProps) => Record<string, any>;
|
|
72
|
+
}
|
|
64
73
|
/**
|
|
65
74
|
* Props for the sidebar root component
|
|
66
75
|
*/
|
|
67
|
-
interface SidebarRootProps extends SidebarProps {
|
|
76
|
+
export interface SidebarRootProps extends SidebarProps {
|
|
68
77
|
pathname: string;
|
|
78
|
+
displayDrawer: boolean;
|
|
69
79
|
navItemsAs?: React.ElementType;
|
|
70
80
|
navItemsProps?: (item: NavItemProps) => Record<string, any>;
|
|
71
81
|
}
|
|
@@ -73,14 +83,12 @@ interface SidebarRootProps extends SidebarProps {
|
|
|
73
83
|
* Main props for the Sidebar component
|
|
74
84
|
*/
|
|
75
85
|
export interface SidebarProps extends Omit<DrawerRootProps, 'open'> {
|
|
76
|
-
/** Custom breakpoint configuration for responsive behavior */
|
|
77
|
-
breakpoints?: any[] | Partial<Record<string, any>>;
|
|
78
86
|
/** Whether the sidebar is currently open/visible */
|
|
79
87
|
open: boolean;
|
|
80
88
|
/** Function to control the sidebar open/close state */
|
|
81
89
|
setOpen: (val: boolean) => void;
|
|
82
90
|
/** Reference to the container element where the drawer portal should be rendered */
|
|
83
|
-
containerRef
|
|
91
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
84
92
|
/** Path to the active item */
|
|
85
93
|
activePath?: string;
|
|
86
94
|
/** Child components (Header, Body, Footer) to render inside the sidebar */
|
|
@@ -102,7 +110,7 @@ export interface SidebarProps extends Omit<DrawerRootProps, 'open'> {
|
|
|
102
110
|
* ```
|
|
103
111
|
*/
|
|
104
112
|
declare const Sidebar: {
|
|
105
|
-
({
|
|
113
|
+
({ open, setOpen, containerRef, children, theme, ...props }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
106
114
|
NavItem: import('react').NamedExoticComponent<NavItemProps>;
|
|
107
115
|
NavSection: import('react').NamedExoticComponent<NavSectionProps>;
|
|
108
116
|
Body: import('react').NamedExoticComponent<SidebarBodyProps>;
|
|
@@ -112,6 +120,6 @@ declare const Sidebar: {
|
|
|
112
120
|
Footer({ children, ...props }: {
|
|
113
121
|
children: ReactNode;
|
|
114
122
|
} & Partial<BoxProps>): import("react/jsx-runtime").JSX.Element;
|
|
115
|
-
Root: ({ pathname, navItemsAs, navItemsProps, ...props }: SidebarRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
123
|
+
Root: ({ pathname, navItemsAs, navItemsProps, displayDrawer, ...props }: SidebarRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
116
124
|
};
|
|
117
125
|
export { Sidebar };
|