@equisoft/design-elements-react 5.6.1-snapshot.20231213205711 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  import { VoidFunctionComponent } from 'react';
2
- import { Option } from '../dropdown-list/dropdown-list';
2
+ import { DropdownListOption } from '../dropdown-list/dropdown-list';
3
3
  interface CalendarHeaderProps {
4
4
  date: Date;
5
5
  months: string[];
6
- monthsOptions: Option[];
6
+ monthsOptions: DropdownListOption[];
7
7
  nextMonthButtonDisabled: boolean;
8
8
  prevMonthButtonDisabled: boolean;
9
- yearsOptions: Option[];
9
+ yearsOptions: DropdownListOption[];
10
10
  changeMonth(month: number): void;
11
11
  changeYear(year: number): void;
12
12
  decreaseMonth(): void;
@@ -1,11 +1,11 @@
1
1
  import type { Locale } from 'date-fns';
2
- import { Option } from '../../dropdown-list/dropdown-list';
2
+ import { DropdownListOption } from '../../dropdown-list/dropdown-list';
3
3
  export type SupportedLocale = 'fr-CA' | 'en-CA' | 'en-US';
4
4
  export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
5
5
  export declare function getLocale(localeArray: Locale[], localeCode?: SupportedLocale): Locale;
6
6
  export declare function getLocaleMonthsShort(locale: Locale): string[];
7
7
  export declare function getLocaleDateFormat(locale?: Locale): string;
8
8
  export declare function getLocaleDatePlaceholder(locale?: Locale): string;
9
- export declare function getLocaleMonthsOptions(locale: Locale): Option[];
10
- export declare function getYearsOptions(minDate?: Date | null, maxDate?: Date | null): Option[];
9
+ export declare function getLocaleMonthsOptions(locale: Locale): DropdownListOption[];
10
+ export declare function getYearsOptions(minDate?: Date | null, maxDate?: Date | null): DropdownListOption[];
11
11
  export declare function setLocaleFirstDayOfWeek(locale: Locale, dayOfWeek?: DayOfWeek): void;
@@ -1,12 +1,12 @@
1
1
  import { VoidFunctionComponent } from 'react';
2
2
  import { ListboxOption } from '../listbox/listbox';
3
3
  import { TooltipProps } from '../tooltip/tooltip';
4
- export interface Option extends ListboxOption {
4
+ export interface DropdownListOption extends ListboxOption {
5
5
  label: string;
6
6
  }
7
7
  interface DropdownListProps {
8
8
  /**
9
- * Sets input's aria-label
9
+ * Aria label for the input (used when no visual label is present)
10
10
  */
11
11
  ariaLabel?: string;
12
12
  className?: string;
@@ -30,20 +30,8 @@ interface DropdownListProps {
30
30
  /**
31
31
  * { disabled?: boolean, value: string; label: string; }[]
32
32
  */
33
- options: Option[];
34
- placeholder?: string;
33
+ options: DropdownListOption[];
35
34
  required?: boolean;
36
- /**
37
- * Adds search functionality with autocomplete
38
- */
39
- searchable?: boolean;
40
- /**
41
- * Adds a skip button
42
- */
43
- skipOption?: {
44
- label: string;
45
- value?: string;
46
- };
47
35
  tooltip?: TooltipProps;
48
36
  /**
49
37
  * Sets input validity
@@ -62,7 +50,7 @@ interface DropdownListProps {
62
50
  /**
63
51
  * OnChange callback function, invoked when an option is selected
64
52
  */
65
- onChange?(option: Option): void;
53
+ onChange?(option: DropdownListOption): void;
66
54
  }
67
55
  export declare const DropdownList: VoidFunctionComponent<DropdownListProps>;
68
56
  export {};
@@ -3,6 +3,7 @@ import { TooltipProps } from '../tooltip/tooltip';
3
3
  interface LabelProps {
4
4
  className?: string;
5
5
  forId: string;
6
+ id?: string;
6
7
  required?: boolean;
7
8
  requiredLabelType?: 'text';
8
9
  tooltip?: TooltipProps;
@@ -48,6 +48,10 @@ interface ListboxProps {
48
48
  * Callback function, invoked when focused value changes
49
49
  */
50
50
  onFocusChange?(option?: ListboxOption): void;
51
+ /**
52
+ * Callback function, invoked when an option is clicked
53
+ */
54
+ onOptionClick?(option?: ListboxOption): void;
51
55
  }
52
56
  export declare const Listbox: ForwardRefExoticComponent<ListboxProps & RefAttributes<HTMLDivElement>>;
53
57
  export {};
@@ -0,0 +1,6 @@
1
+ interface ConditionalId {
2
+ id: string | undefined;
3
+ include?: boolean;
4
+ }
5
+ export declare function useAriaConditionalIds(conditionalIds: ConditionalId[]): string | undefined;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { MutableRefObject } from 'react';
2
+ export declare function useClickOutside<T extends HTMLElement>(targets: MutableRefObject<T | null>[], callback: () => void): void;
@@ -0,0 +1,13 @@
1
+ interface UseListSearchRequest<T> {
2
+ elements: T[];
3
+ focusedElement?: T;
4
+ onFoundElementChange?: (element: T | undefined) => void;
5
+ searchPropertyAccessor: (element: T) => string;
6
+ predicate?: (element: T) => boolean;
7
+ searchResetTimeout?: number;
8
+ }
9
+ interface UseListSearchResponse {
10
+ handleSearchInput: (char: string) => void;
11
+ }
12
+ export declare function useListSearch<T>({ elements, focusedElement, onFoundElementChange, searchPropertyAccessor, predicate, searchResetTimeout, }: UseListSearchRequest<T>): UseListSearchResponse;
13
+ export {};
@@ -24,6 +24,10 @@ export declare const Translations: {
24
24
  monthSelectLabel: string;
25
25
  yearSelectLabel: string;
26
26
  };
27
+ 'dropdown-list': {
28
+ inputAriaLabel: string;
29
+ validationErrorMessage: string;
30
+ };
27
31
  'error-summary': {
28
32
  title: string;
29
33
  message: string;
@@ -85,10 +89,6 @@ export declare const Translations: {
85
89
  Neutral: string;
86
90
  dismissLabel: string;
87
91
  };
88
- select: {
89
- inputAriaLabel: string;
90
- validationErrorMessage: string;
91
- };
92
92
  'skip-link': {
93
93
  label: string;
94
94
  };
@@ -144,6 +144,10 @@ export declare const Translations: {
144
144
  monthSelectLabel: string;
145
145
  yearSelectLabel: string;
146
146
  };
147
+ 'dropdown-list': {
148
+ inputAriaLabel: string;
149
+ validationErrorMessage: string;
150
+ };
147
151
  'error-summary': {
148
152
  title: string;
149
153
  message: string;
@@ -205,10 +209,6 @@ export declare const Translations: {
205
209
  Neutral: string;
206
210
  dismissLabel: string;
207
211
  };
208
- select: {
209
- inputAriaLabel: string;
210
- validationErrorMessage: string;
211
- };
212
212
  'skip-link': {
213
213
  label: string;
214
214
  };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Avatar } from './components/avatar/avatar';
9
9
  export { Checkbox } from './components/checkbox/checkbox';
10
10
  export { CheckboxGroup } from './components/checkbox-group/checkbox-group';
11
11
  export { Datepicker, DatepickerHandles } from './components/date-picker/date-picker';
12
- export { DropdownList } from './components/dropdown-list/dropdown-list';
12
+ export { DropdownList, DropdownListOption } from './components/dropdown-list/dropdown-list';
13
13
  export { MoneyInput } from './components/money-input/money-input';
14
14
  export { NumericInput } from './components/numeric-input/numeric-input';
15
15
  export { OptionButton } from './components/option-button/option-button';
@@ -0,0 +1 @@
1
+ export declare function allSameLetter(text: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equisoft/design-elements-react",
3
- "version": "5.6.1-snapshot.20231213205711",
3
+ "version": "6.0.0",
4
4
  "description": "React implementation of the Equisoft design system.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/bundle.js",