@apia/components 3.0.17 → 3.0.20
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 +8 -2
- package/dist/index.js +82 -26
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode, Ref, RefObject, ChangeEventHandler, MouseEvent as MouseEvent$1, KeyboardEvent, FC, FunctionComponent, ForwardedRef, ComponentType, ReactElement } from 'react';
|
|
2
|
+
import React__default, { ReactNode, Ref, RefObject, ChangeEventHandler, DetailedHTMLProps, TextareaHTMLAttributes, MouseEvent as MouseEvent$1, KeyboardEvent, FC, FunctionComponent, ForwardedRef, ComponentType, ReactElement } from 'react';
|
|
3
3
|
import * as _apia_util from '@apia/util';
|
|
4
4
|
import { IOnFocusConfiguration, TFocusRetriever, TId as TId$1, EventEmitter, StatefulEmitter, TModify, TApiaFilter, TApiaFilterValue } from '@apia/util';
|
|
5
5
|
import { BoxProps, TPalette, ThemeUIStyleObject, IconButtonProps, ButtonProps, ThemeUICSSObject, InputProps, SelectProps } from '@apia/theme';
|
|
@@ -1085,6 +1085,12 @@ declare const FieldLabel: React$1.ForwardRefExoticComponent<{
|
|
|
1085
1085
|
requiredMarkPosition?: "after" | "before" | undefined;
|
|
1086
1086
|
} & BoxProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1087
1087
|
|
|
1088
|
+
declare const AutogrowTextarea: ((props: DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
|
|
1089
|
+
error?: boolean;
|
|
1090
|
+
}) => React$1.JSX.Element) & {
|
|
1091
|
+
displayName: string;
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1088
1094
|
interface IAccordionItemButton {
|
|
1089
1095
|
ariaLabel: string;
|
|
1090
1096
|
/**
|
|
@@ -1786,5 +1792,5 @@ declare const SortableList: ((props: {
|
|
|
1786
1792
|
displayName: string;
|
|
1787
1793
|
};
|
|
1788
1794
|
|
|
1789
|
-
export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, type AutocompleteCmpProps, AutocompleteController, type AutocompleteOption, type AutocompleteProps, BaseButton, CalendarModal, Captcha, Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultAccordionItemButton, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, type IAccordionItemButton, type IAccordionItemProps, type IAccordionProps, type IAlert, type IApiaFilter, type ICalendarModal, type IConfirm, type IDialogButtonBar, type IDialogHeader, type IField, type IFieldErrorMessage, type IIconInput, type IOverlay, type IRequiredMark, type IResponsiveComponent, type ISimpleButton, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, type TAccordionHandler, type TAccordionItemButton, type TApiaButtonType, type TApiaIconButton, type TCheckbox, type TDateProps, type TFieldLabel, type TGetTabsController, type TIcon, type TIconButton, type TIconRenderer, type TIconSize, type TIconsList, type TListbox, type TMenuItem, type TModal, type TModalSize, type TNumberInput, type TNumberInputChangeEvent, type TOnClickNode, type TOnConfirmSelection, type TOnSelectionChange, type TOpenModal, type TSubmenu, type TTab, type TTabLabelRenderer as TTabRenderer, type TToolbarIconButton as TToolDefinition, type TTooltip, type TUseModalConfiguration, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
|
|
1795
|
+
export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, type AutocompleteCmpProps, AutocompleteController, type AutocompleteOption, type AutocompleteProps, AutogrowTextarea, BaseButton, CalendarModal, Captcha, Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultAccordionItemButton, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, type IAccordionItemButton, type IAccordionItemProps, type IAccordionProps, type IAlert, type IApiaFilter, type ICalendarModal, type IConfirm, type IDialogButtonBar, type IDialogHeader, type IField, type IFieldErrorMessage, type IIconInput, type IOverlay, type IRequiredMark, type IResponsiveComponent, type ISimpleButton, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, type TAccordionHandler, type TAccordionItemButton, type TApiaButtonType, type TApiaIconButton, type TCheckbox, type TDateProps, type TFieldLabel, type TGetTabsController, type TIcon, type TIconButton, type TIconRenderer, type TIconSize, type TIconsList, type TListbox, type TMenuItem, type TModal, type TModalSize, type TNumberInput, type TNumberInputChangeEvent, type TOnClickNode, type TOnConfirmSelection, type TOnSelectionChange, type TOpenModal, type TSubmenu, type TTab, type TTabLabelRenderer as TTabRenderer, type TToolbarIconButton as TToolDefinition, type TTooltip, type TUseModalConfiguration, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
|
|
1790
1796
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1722,7 +1722,7 @@ const Item = observer(({ tab }) => {
|
|
|
1722
1722
|
"aria-controls": `tabpanel-${tab.controller.id}-${tab.state.id}`,
|
|
1723
1723
|
"aria-selected": tab.state.isOpen ?? false,
|
|
1724
1724
|
id: `tab-${tab.controller.id}-${tab.id}`,
|
|
1725
|
-
tabIndex: tab.state.
|
|
1725
|
+
tabIndex: tab.state.isOpen ? 0 : -1,
|
|
1726
1726
|
role: "tab",
|
|
1727
1727
|
variant: "inherit"
|
|
1728
1728
|
};
|
|
@@ -1730,31 +1730,37 @@ const Item = observer(({ tab }) => {
|
|
|
1730
1730
|
});
|
|
1731
1731
|
var Item$1 = Item;
|
|
1732
1732
|
|
|
1733
|
+
function useShowScrollButtons() {
|
|
1734
|
+
const [showScrollButtons, setShowScrollButtons] = useState(false);
|
|
1735
|
+
const [ref, setRef] = useState(null);
|
|
1736
|
+
const controller = useTabsContext();
|
|
1737
|
+
useEffect(() => {
|
|
1738
|
+
if (ref && controller) {
|
|
1739
|
+
const observer = new MutationObserver(([{ addedNodes }]) => {
|
|
1740
|
+
const fixedTabsElement = ref.querySelector(".tabsList__fixedTabs");
|
|
1741
|
+
const hasFixedTabsScroll = (fixedTabsElement?.clientWidth ?? 0) < (fixedTabsElement?.scrollWidth ?? 0);
|
|
1742
|
+
const nonFixedTabsElement = ref.querySelector(".tabs__list");
|
|
1743
|
+
const hasFixedNonTabsScroll = (nonFixedTabsElement?.clientWidth ?? 0) < (nonFixedTabsElement?.scrollWidth ?? 0);
|
|
1744
|
+
setShowScrollButtons(hasFixedTabsScroll || hasFixedNonTabsScroll);
|
|
1745
|
+
if (addedNodes) {
|
|
1746
|
+
ref.querySelector(".tabs__list").scrollLeft = 9999999;
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
observer.observe(ref, { childList: true, subtree: true });
|
|
1750
|
+
return () => {
|
|
1751
|
+
observer.disconnect();
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
return () => {
|
|
1755
|
+
};
|
|
1756
|
+
}, [controller, ref]);
|
|
1757
|
+
return [showScrollButtons, setRef];
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1733
1760
|
const TabsList = observer(
|
|
1734
1761
|
({ arrowsBehavior = "focus" }) => {
|
|
1735
1762
|
const controller = useTabsContext();
|
|
1736
|
-
const [showScrollButtons,
|
|
1737
|
-
const [ref, setRef] = React__default.useState(null);
|
|
1738
|
-
React__default.useEffect(() => {
|
|
1739
|
-
if (ref && controller) {
|
|
1740
|
-
const observer2 = new MutationObserver(([{ addedNodes }]) => {
|
|
1741
|
-
const fixedTabsElement = ref.querySelector(".tabsList__fixedTabs");
|
|
1742
|
-
const hasFixedTabsScroll = (fixedTabsElement?.clientWidth ?? 0) < (fixedTabsElement?.scrollWidth ?? 0);
|
|
1743
|
-
const nonFixedTabsElement = ref.querySelector(".tabs__list");
|
|
1744
|
-
const hasFixedNonTabsScroll = (nonFixedTabsElement?.clientWidth ?? 0) < (nonFixedTabsElement?.scrollWidth ?? 0);
|
|
1745
|
-
setShowScrollButtons(hasFixedTabsScroll || hasFixedNonTabsScroll);
|
|
1746
|
-
if (addedNodes) {
|
|
1747
|
-
ref.querySelector(".tabs__list").scrollLeft = 9999999;
|
|
1748
|
-
}
|
|
1749
|
-
});
|
|
1750
|
-
observer2.observe(ref, { childList: true, subtree: true });
|
|
1751
|
-
return () => {
|
|
1752
|
-
observer2.disconnect();
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
return () => {
|
|
1756
|
-
};
|
|
1757
|
-
}, [controller, ref]);
|
|
1763
|
+
const [showScrollButtons, setRef] = useShowScrollButtons();
|
|
1758
1764
|
const onClickPrev = React__default.useCallback(() => {
|
|
1759
1765
|
if (arrowsBehavior === "focus")
|
|
1760
1766
|
controller?.focusPreviousTab();
|
|
@@ -1993,7 +1999,7 @@ class TabsController {
|
|
|
1993
1999
|
}
|
|
1994
2000
|
}
|
|
1995
2001
|
this.state.openTabs.delete(tab);
|
|
1996
|
-
this.getActiveTab()
|
|
2002
|
+
this.getActiveTab()?.open();
|
|
1997
2003
|
this.state.tabs.delete(tab.id);
|
|
1998
2004
|
this.props?.onCloseTab?.(tab);
|
|
1999
2005
|
}
|
|
@@ -2118,6 +2124,8 @@ class TabsController {
|
|
|
2118
2124
|
} catch (e) {
|
|
2119
2125
|
}
|
|
2120
2126
|
tab.state.isOpen = true;
|
|
2127
|
+
tab.state.isFocused = true;
|
|
2128
|
+
document.querySelector(`.tabs__item__wrapper[data-id="${tab.id}"]`)?.focus();
|
|
2121
2129
|
tab.state.onFocus?.(tab);
|
|
2122
2130
|
if (this.state.openTabs.has(tab)) {
|
|
2123
2131
|
this.state.openTabs.delete(tab);
|
|
@@ -4800,7 +4808,9 @@ const DateInput = React__default.forwardRef(
|
|
|
4800
4808
|
`#DateInput${id} input`
|
|
4801
4809
|
)?.focus();
|
|
4802
4810
|
},
|
|
4803
|
-
type: "button"
|
|
4811
|
+
type: "button",
|
|
4812
|
+
title: getLabel("btnAiDelete").text,
|
|
4813
|
+
"aria-label": getLabel("btnAiDelete").text
|
|
4804
4814
|
}
|
|
4805
4815
|
),
|
|
4806
4816
|
[id, onDelete, setCalendarValue]
|
|
@@ -5072,6 +5082,52 @@ const FieldLabel = forwardRef(
|
|
|
5072
5082
|
);
|
|
5073
5083
|
FieldLabel.displayName = "FieldLabel";
|
|
5074
5084
|
|
|
5085
|
+
const AutogrowTextarea = observer(
|
|
5086
|
+
(props) => {
|
|
5087
|
+
const updateHeight = (el) => {
|
|
5088
|
+
const update = () => {
|
|
5089
|
+
const bounding = el.getBoundingClientRect();
|
|
5090
|
+
if (bounding.width > 0) {
|
|
5091
|
+
clearInterval(interval);
|
|
5092
|
+
const copy = el.cloneNode(true);
|
|
5093
|
+
copy.style.opacity = "0";
|
|
5094
|
+
copy.style.position = "fixed";
|
|
5095
|
+
copy.style.left = "-9999px";
|
|
5096
|
+
copy.style.width = `${bounding.width}px`;
|
|
5097
|
+
copy.style.height = "1px";
|
|
5098
|
+
document.body.append(copy);
|
|
5099
|
+
el.style.height = `${copy.scrollHeight}px`;
|
|
5100
|
+
copy.remove();
|
|
5101
|
+
}
|
|
5102
|
+
};
|
|
5103
|
+
const interval = setInterval(update, 100);
|
|
5104
|
+
update();
|
|
5105
|
+
};
|
|
5106
|
+
return /* @__PURE__ */ jsx(
|
|
5107
|
+
"textarea",
|
|
5108
|
+
{
|
|
5109
|
+
...props,
|
|
5110
|
+
className: `${props.className ?? ""} autogrow_textarea ${props.error ? "invalid_field" : ""}`,
|
|
5111
|
+
onKeyDown: (ev) => {
|
|
5112
|
+
props?.onKeyDown?.(ev);
|
|
5113
|
+
if (!ev.isDefaultPrevented() && ev.code === "Enter" && ev.ctrlKey) {
|
|
5114
|
+
ev.target.closest("form")?.querySelector('button[type="submit"]')?.click();
|
|
5115
|
+
}
|
|
5116
|
+
},
|
|
5117
|
+
ref: (el) => {
|
|
5118
|
+
if (el instanceof HTMLTextAreaElement) {
|
|
5119
|
+
updateHeight(el);
|
|
5120
|
+
}
|
|
5121
|
+
},
|
|
5122
|
+
onChange: (ev) => {
|
|
5123
|
+
props?.onChange?.(ev);
|
|
5124
|
+
updateHeight(ev.target);
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
5127
|
+
);
|
|
5128
|
+
}
|
|
5129
|
+
);
|
|
5130
|
+
|
|
5075
5131
|
const Checkbox = (props) => {
|
|
5076
5132
|
return /* @__PURE__ */ jsx(
|
|
5077
5133
|
Box,
|
|
@@ -7884,5 +7940,5 @@ const SortableList = makeStyledComponent(
|
|
|
7884
7940
|
UnstyledSortableList
|
|
7885
7941
|
);
|
|
7886
7942
|
|
|
7887
|
-
export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, BaseButton, CalendarModal, Captcha, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, IconButton, IconInput, IconsList, LabelBox, LinearLoader$1 as LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner$1 as LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar$1 as ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
|
|
7943
|
+
export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, BaseButton, CalendarModal, Captcha, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, IconButton, IconInput, IconsList, LabelBox, LinearLoader$1 as LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner$1 as LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar$1 as ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
|
|
7888
7944
|
//# sourceMappingURL=index.js.map
|