react-better-html 1.1.246 → 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 +19 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -17
- 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
|
@@ -4472,11 +4472,13 @@ var TextareaElement = import_styled_components11.default.textarea.withConfig({
|
|
|
4472
4472
|
color: ${(props) => props.theme.colors.textSecondary}80;
|
|
4473
4473
|
}
|
|
4474
4474
|
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4475
|
+
&:focus {
|
|
4476
|
+
${(props) => props.withNoBorder ? import_styled_components11.css`
|
|
4477
|
+
filter: ${props.hoverStyle.filter ?? filterHover().z1};
|
|
4478
|
+
` : import_styled_components11.css`
|
|
4479
|
+
border-color: ${props.theme.colors.primary};
|
|
4480
|
+
`}
|
|
4481
|
+
}
|
|
4480
4482
|
|
|
4481
4483
|
${(props) => props.style}
|
|
4482
4484
|
|
|
@@ -7402,23 +7404,23 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7402
7404
|
const firstRenderPassedRef = (0, import_react29.useRef)(false);
|
|
7403
7405
|
const tabsRef = (0, import_react29.useRef)({});
|
|
7404
7406
|
const [selectedTab, setSelectedTab] = (0, import_react29.useState)(() => {
|
|
7405
|
-
const
|
|
7407
|
+
const selectedTabId = tabs[0]?.id ?? "";
|
|
7406
7408
|
if (urlQuery) {
|
|
7407
7409
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
7408
|
-
if (!tabQueryValue) return
|
|
7409
|
-
if (tabs.
|
|
7410
|
+
if (!tabQueryValue) return selectedTabId;
|
|
7411
|
+
if (tabs.some((tab) => tab.id === tabQueryValue)) return tabQueryValue;
|
|
7410
7412
|
}
|
|
7411
|
-
return
|
|
7413
|
+
return selectedTabId;
|
|
7412
7414
|
});
|
|
7413
7415
|
const [rerenderState, setRerenderState] = (0, import_react29.useState)(0);
|
|
7414
7416
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7415
7417
|
const onClickTab = (0, import_react29.useCallback)(
|
|
7416
7418
|
(tab) => {
|
|
7417
|
-
setSelectedTab(tab);
|
|
7419
|
+
setSelectedTab(tab.id);
|
|
7418
7420
|
onChange?.(tab);
|
|
7419
7421
|
if (urlQuery) {
|
|
7420
7422
|
urlQuery.setQuery({
|
|
7421
|
-
[name ?? defaultTabName]: tab
|
|
7423
|
+
[name ?? defaultTabName]: tab.id
|
|
7422
7424
|
});
|
|
7423
7425
|
}
|
|
7424
7426
|
},
|
|
@@ -7429,7 +7431,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7429
7431
|
[rerenderState, selectedTab]
|
|
7430
7432
|
);
|
|
7431
7433
|
const leftSpacing = (0, import_react29.useMemo)(() => {
|
|
7432
|
-
const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
|
|
7434
|
+
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab);
|
|
7433
7435
|
let spacing = 0;
|
|
7434
7436
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
7435
7437
|
if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
|
|
@@ -7488,7 +7490,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7488
7490
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7489
7491
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
7490
7492
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7491
|
-
const selected = tab === selectedTab;
|
|
7493
|
+
const selected = tab.id === selectedTab;
|
|
7492
7494
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7493
7495
|
Div_default,
|
|
7494
7496
|
{
|
|
@@ -7507,10 +7509,10 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7507
7509
|
isTabAccessed: true,
|
|
7508
7510
|
onClickWithValue: onClickTab,
|
|
7509
7511
|
ref: (ref2) => {
|
|
7510
|
-
tabsRef.current[tab] = ref2;
|
|
7512
|
+
tabsRef.current[tab.id] = ref2;
|
|
7511
7513
|
},
|
|
7512
7514
|
children: [
|
|
7513
|
-
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7515
|
+
componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7514
7516
|
Div_default,
|
|
7515
7517
|
{
|
|
7516
7518
|
position: "absolute",
|
|
@@ -7530,12 +7532,12 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7530
7532
|
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
7531
7533
|
transition: theme2.styles.transition,
|
|
7532
7534
|
whiteSpace: "nowrap",
|
|
7533
|
-
children: tab
|
|
7535
|
+
children: tab.label ?? tab.id
|
|
7534
7536
|
}
|
|
7535
7537
|
)
|
|
7536
7538
|
]
|
|
7537
7539
|
},
|
|
7538
|
-
tab
|
|
7540
|
+
tab.id
|
|
7539
7541
|
);
|
|
7540
7542
|
}) }),
|
|
7541
7543
|
style !== "box" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|