react-better-html 1.1.247 → 1.1.248
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.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -497,21 +497,25 @@ type Alert = {
|
|
|
497
497
|
onClose?: (alert: Alert) => void;
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
+
type Tab = {
|
|
501
|
+
id: string;
|
|
502
|
+
label?: string;
|
|
503
|
+
};
|
|
500
504
|
type TabGroup = {
|
|
501
505
|
name: string;
|
|
502
506
|
selectedTab: string;
|
|
503
507
|
};
|
|
504
508
|
type TabsProps = {
|
|
505
|
-
tabs:
|
|
509
|
+
tabs: Tab[];
|
|
506
510
|
name?: string;
|
|
507
511
|
accentColor?: Color;
|
|
508
512
|
style?: "default" | "borderRadiusTop" | "box";
|
|
509
|
-
onChange?: (tab:
|
|
513
|
+
onChange?: (tab: Tab) => void;
|
|
510
514
|
children?: React.ReactNode;
|
|
511
515
|
} & ComponentMarginProps;
|
|
512
516
|
type TabsRef = {
|
|
513
517
|
selectedTab: string;
|
|
514
|
-
selectTab: (tab:
|
|
518
|
+
selectTab: (tab: Tab) => void;
|
|
515
519
|
};
|
|
516
520
|
type TabsComponent = {
|
|
517
521
|
(props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
|
|
@@ -1179,4 +1183,4 @@ type LocalStoragePluginOptions = {
|
|
|
1179
1183
|
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1180
1184
|
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1181
1185
|
|
|
1182
|
-
export { type Alert, type AlertDisplay, type AlertDuration, type AlertType, type AlertsPluginOptions, type AppConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default$1 as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, type BurgerButtonProps, Button, type ButtonProps, Chip, type ChipProps, ColorThemeSwitch, type ColorThemeSwitchProps, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, Div, type DivProps, _default$4 as Divider, Dropdown, type DropdownOption, type DropdownProps, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default as Icon, type IconProps, _default$2 as Image, type ImageProps, InputField, type InputFieldProps, _default$3 as Label, type LabelProps, Loader, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type SideMenuProps, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, _default$5 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, filterHover, generateLocalStorage, getBrowser, getFormErrorObject, isMobileDevice, localStoragePlugin, reactRouterDomPlugin, sideMenuControls, useAlertControls, useBetterHtmlContext, useForm, useMediaQuery, usePageResize, usePageScroll, useUrlQuery };
|
|
1186
|
+
export { type Alert, type AlertDisplay, type AlertDuration, type AlertType, type AlertsPluginOptions, type AppConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default$1 as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, type BurgerButtonProps, Button, type ButtonProps, Chip, type ChipProps, ColorThemeSwitch, type ColorThemeSwitchProps, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, Div, type DivProps, _default$4 as Divider, Dropdown, type DropdownOption, type DropdownProps, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default as Icon, type IconProps, _default$2 as Image, type ImageProps, InputField, type InputFieldProps, _default$3 as Label, type LabelProps, Loader, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type SideMenuProps, type Tab, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, _default$5 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, filterHover, generateLocalStorage, getBrowser, getFormErrorObject, isMobileDevice, localStoragePlugin, reactRouterDomPlugin, sideMenuControls, useAlertControls, useBetterHtmlContext, useForm, useMediaQuery, usePageResize, usePageScroll, useUrlQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -497,21 +497,25 @@ type Alert = {
|
|
|
497
497
|
onClose?: (alert: Alert) => void;
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
+
type Tab = {
|
|
501
|
+
id: string;
|
|
502
|
+
label?: string;
|
|
503
|
+
};
|
|
500
504
|
type TabGroup = {
|
|
501
505
|
name: string;
|
|
502
506
|
selectedTab: string;
|
|
503
507
|
};
|
|
504
508
|
type TabsProps = {
|
|
505
|
-
tabs:
|
|
509
|
+
tabs: Tab[];
|
|
506
510
|
name?: string;
|
|
507
511
|
accentColor?: Color;
|
|
508
512
|
style?: "default" | "borderRadiusTop" | "box";
|
|
509
|
-
onChange?: (tab:
|
|
513
|
+
onChange?: (tab: Tab) => void;
|
|
510
514
|
children?: React.ReactNode;
|
|
511
515
|
} & ComponentMarginProps;
|
|
512
516
|
type TabsRef = {
|
|
513
517
|
selectedTab: string;
|
|
514
|
-
selectTab: (tab:
|
|
518
|
+
selectTab: (tab: Tab) => void;
|
|
515
519
|
};
|
|
516
520
|
type TabsComponent = {
|
|
517
521
|
(props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
|
|
@@ -1179,4 +1183,4 @@ type LocalStoragePluginOptions = {
|
|
|
1179
1183
|
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1180
1184
|
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1181
1185
|
|
|
1182
|
-
export { type Alert, type AlertDisplay, type AlertDuration, type AlertType, type AlertsPluginOptions, type AppConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default$1 as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, type BurgerButtonProps, Button, type ButtonProps, Chip, type ChipProps, ColorThemeSwitch, type ColorThemeSwitchProps, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, Div, type DivProps, _default$4 as Divider, Dropdown, type DropdownOption, type DropdownProps, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default as Icon, type IconProps, _default$2 as Image, type ImageProps, InputField, type InputFieldProps, _default$3 as Label, type LabelProps, Loader, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type SideMenuProps, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, _default$5 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, filterHover, generateLocalStorage, getBrowser, getFormErrorObject, isMobileDevice, localStoragePlugin, reactRouterDomPlugin, sideMenuControls, useAlertControls, useBetterHtmlContext, useForm, useMediaQuery, usePageResize, usePageScroll, useUrlQuery };
|
|
1186
|
+
export { type Alert, type AlertDisplay, type AlertDuration, type AlertType, type AlertsPluginOptions, type AppConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default$1 as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, type BurgerButtonProps, Button, type ButtonProps, Chip, type ChipProps, ColorThemeSwitch, type ColorThemeSwitchProps, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, Div, type DivProps, _default$4 as Divider, Dropdown, type DropdownOption, type DropdownProps, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default as Icon, type IconProps, _default$2 as Image, type ImageProps, InputField, type InputFieldProps, _default$3 as Label, type LabelProps, Loader, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type SideMenuProps, type Tab, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, _default$5 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, filterHover, generateLocalStorage, getBrowser, getFormErrorObject, isMobileDevice, localStoragePlugin, reactRouterDomPlugin, sideMenuControls, useAlertControls, useBetterHtmlContext, useForm, useMediaQuery, usePageResize, usePageScroll, useUrlQuery };
|
package/dist/index.js
CHANGED
|
@@ -7404,23 +7404,23 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7404
7404
|
const firstRenderPassedRef = (0, import_react29.useRef)(false);
|
|
7405
7405
|
const tabsRef = (0, import_react29.useRef)({});
|
|
7406
7406
|
const [selectedTab, setSelectedTab] = (0, import_react29.useState)(() => {
|
|
7407
|
-
const
|
|
7407
|
+
const selectedTabId = tabs[0]?.id ?? "";
|
|
7408
7408
|
if (urlQuery) {
|
|
7409
7409
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
7410
|
-
if (!tabQueryValue) return
|
|
7411
|
-
if (tabs.
|
|
7410
|
+
if (!tabQueryValue) return selectedTabId;
|
|
7411
|
+
if (tabs.some((tab) => tab.id === tabQueryValue)) return tabQueryValue;
|
|
7412
7412
|
}
|
|
7413
|
-
return
|
|
7413
|
+
return selectedTabId;
|
|
7414
7414
|
});
|
|
7415
7415
|
const [rerenderState, setRerenderState] = (0, import_react29.useState)(0);
|
|
7416
7416
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7417
7417
|
const onClickTab = (0, import_react29.useCallback)(
|
|
7418
7418
|
(tab) => {
|
|
7419
|
-
setSelectedTab(tab);
|
|
7419
|
+
setSelectedTab(tab.id);
|
|
7420
7420
|
onChange?.(tab);
|
|
7421
7421
|
if (urlQuery) {
|
|
7422
7422
|
urlQuery.setQuery({
|
|
7423
|
-
[name ?? defaultTabName]: tab
|
|
7423
|
+
[name ?? defaultTabName]: tab.id
|
|
7424
7424
|
});
|
|
7425
7425
|
}
|
|
7426
7426
|
},
|
|
@@ -7431,7 +7431,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7431
7431
|
[rerenderState, selectedTab]
|
|
7432
7432
|
);
|
|
7433
7433
|
const leftSpacing = (0, import_react29.useMemo)(() => {
|
|
7434
|
-
const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
|
|
7434
|
+
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab);
|
|
7435
7435
|
let spacing = 0;
|
|
7436
7436
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
7437
7437
|
if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
|
|
@@ -7490,7 +7490,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7490
7490
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7491
7491
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
7492
7492
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7493
|
-
const selected = tab === selectedTab;
|
|
7493
|
+
const selected = tab.id === selectedTab;
|
|
7494
7494
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7495
7495
|
Div_default,
|
|
7496
7496
|
{
|
|
@@ -7509,10 +7509,10 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7509
7509
|
isTabAccessed: true,
|
|
7510
7510
|
onClickWithValue: onClickTab,
|
|
7511
7511
|
ref: (ref2) => {
|
|
7512
|
-
tabsRef.current[tab] = ref2;
|
|
7512
|
+
tabsRef.current[tab.id] = ref2;
|
|
7513
7513
|
},
|
|
7514
7514
|
children: [
|
|
7515
|
-
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7515
|
+
componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7516
7516
|
Div_default,
|
|
7517
7517
|
{
|
|
7518
7518
|
position: "absolute",
|
|
@@ -7532,12 +7532,12 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7532
7532
|
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
7533
7533
|
transition: theme2.styles.transition,
|
|
7534
7534
|
whiteSpace: "nowrap",
|
|
7535
|
-
children: tab
|
|
7535
|
+
children: tab.label ?? tab.id
|
|
7536
7536
|
}
|
|
7537
7537
|
)
|
|
7538
7538
|
]
|
|
7539
7539
|
},
|
|
7540
|
-
tab
|
|
7540
|
+
tab.id
|
|
7541
7541
|
);
|
|
7542
7542
|
}) }),
|
|
7543
7543
|
style !== "box" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|