@mackin.com/styleguide 9.3.3 → 9.4.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/index.d.ts +13 -5
- package/index.js +11 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ interface AutocompleteProps extends BaseInputProps$1 {
|
|
|
51
51
|
allowScroll?: boolean;
|
|
52
52
|
/** Delay before the input is re-focused after picking a value. Adjust if there are issues with the displayed input value after pick. Defaults to 100ms. */
|
|
53
53
|
onPickFocusWaitMs?: number;
|
|
54
|
-
onPick: (value: string | undefined) => void;
|
|
54
|
+
onPick: (value: string | undefined, index?: number) => void;
|
|
55
55
|
}
|
|
56
56
|
declare const Autocomplete: (p: AutocompleteProps) => JSX.Element;
|
|
57
57
|
|
|
@@ -566,12 +566,22 @@ interface Props<T> extends PagerStyleProps {
|
|
|
566
566
|
}
|
|
567
567
|
declare const BoundStaticPager: <T>(p: Props<T>) => JSX.Element;
|
|
568
568
|
|
|
569
|
+
interface PagedResultDto<T> {
|
|
570
|
+
total: number;
|
|
571
|
+
/** The zero-based page index. */
|
|
572
|
+
page: number;
|
|
573
|
+
limit: number;
|
|
574
|
+
items: T[];
|
|
575
|
+
}
|
|
576
|
+
|
|
569
577
|
/** A page of data with helpers props. */
|
|
570
578
|
declare class PagedResult<T> {
|
|
571
579
|
constructor(items?: T[], total?: number, page?: number, limit?: number);
|
|
580
|
+
/** @deprecated Use fromPagedResultDto going forward. */
|
|
572
581
|
static fromDto<T>(dto: {
|
|
573
582
|
[key: string]: any;
|
|
574
583
|
}): PagedResult<T>;
|
|
584
|
+
static fromPagedResultDto<TDto, TDomain>(dto: PagedResultDto<TDto>, convert?: (dto: TDto) => TDomain): PagedResult<TDomain>;
|
|
575
585
|
total: number;
|
|
576
586
|
/** The zero-based page index. */
|
|
577
587
|
page: number;
|
|
@@ -597,9 +607,7 @@ declare class PagedResult<T> {
|
|
|
597
607
|
getPreviousItem(fromItem: T): T | undefined;
|
|
598
608
|
getNextItem(fromItem: T): T | undefined;
|
|
599
609
|
getPagingRange(radius: number): number[];
|
|
600
|
-
toJSON():
|
|
601
|
-
[key: string]: any;
|
|
602
|
-
};
|
|
610
|
+
toJSON(): PagedResultDto<T>;
|
|
603
611
|
clone(newItems?: T[]): PagedResult<T>;
|
|
604
612
|
}
|
|
605
613
|
|
|
@@ -1136,4 +1144,4 @@ interface Entity<T extends string | number> {
|
|
|
1136
1144
|
name: string;
|
|
1137
1145
|
}
|
|
1138
1146
|
|
|
1139
|
-
export { Accordian, AccordianProps, Alignment, Autocomplete, AutocompleteController, AutocompleteEntityController, AutocompleteProps, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, ImageProps, InfoPanel, InfoTip, InfoTipProps, ItemPager, Label, LabelProps, Link, LinkProps, List, ListItem, ListItemProps, ListProps, MackinTheme, Modal, ModalProps, Nav, NormalizeCss, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerOption, PickerProps, PickerValue, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, SliderProps, SliderValue, TabContainer, TabContainerProps, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordianState, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
|
|
1147
|
+
export { Accordian, AccordianProps, Alignment, Autocomplete, AutocompleteController, AutocompleteEntityController, AutocompleteProps, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, ImageProps, InfoPanel, InfoTip, InfoTipProps, ItemPager, Label, LabelProps, Link, LinkProps, List, ListItem, ListItemProps, ListProps, MackinTheme, Modal, ModalProps, Nav, NormalizeCss, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, PagedResultDto, Pager, PagerProps, Picker, PickerOption, PickerProps, PickerValue, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, SliderProps, SliderValue, TabContainer, TabContainerProps, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordianState, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
|
package/index.js
CHANGED
|
@@ -966,7 +966,7 @@ const buttonMarkerClass = 'ListItem__button';
|
|
|
966
966
|
const defaultOnPickFocusMs = 100;
|
|
967
967
|
const Autocomplete = (p) => {
|
|
968
968
|
var _a;
|
|
969
|
-
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs"]);
|
|
969
|
+
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "listClassName", "listItemClassName", "listItemButtonClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs"]);
|
|
970
970
|
const theme = useThemeSafely();
|
|
971
971
|
const element = React__namespace.useRef(null);
|
|
972
972
|
const input = React__namespace.useRef(null);
|
|
@@ -1020,7 +1020,11 @@ const Autocomplete = (p) => {
|
|
|
1020
1020
|
setTimeout(() => {
|
|
1021
1021
|
// blur is now complete
|
|
1022
1022
|
var _a;
|
|
1023
|
-
p.
|
|
1023
|
+
let index = v ? p.options.findIndex(o => o === v) : undefined;
|
|
1024
|
+
if (index !== undefined && index < 0) {
|
|
1025
|
+
index = undefined;
|
|
1026
|
+
}
|
|
1027
|
+
p.onPick(v, index);
|
|
1024
1028
|
// wait for the re-render. the value will not update if the control has focus
|
|
1025
1029
|
setTimeout(() => {
|
|
1026
1030
|
var _a;
|
|
@@ -3223,9 +3227,14 @@ class PagedResult {
|
|
|
3223
3227
|
this.limit = limit;
|
|
3224
3228
|
this.total = total;
|
|
3225
3229
|
}
|
|
3230
|
+
/** @deprecated Use fromPagedResultDto going forward. */
|
|
3226
3231
|
static fromDto(dto) {
|
|
3227
3232
|
return new PagedResult(dto.items, dto.total, dto.page, dto.limit);
|
|
3228
3233
|
}
|
|
3234
|
+
static fromPagedResultDto(dto, convert) {
|
|
3235
|
+
const items = convert ? dto.items.map(convert) : dto.items;
|
|
3236
|
+
return new PagedResult(items, dto.total, dto.page, dto.limit);
|
|
3237
|
+
}
|
|
3229
3238
|
/** Helper for items.length */
|
|
3230
3239
|
get length() {
|
|
3231
3240
|
return this.items ? this.items.length : 0;
|