react-better-html 1.1.193 → 1.1.194

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 CHANGED
@@ -2,7 +2,7 @@ import { WebTarget } from 'styled-components';
2
2
  import * as react from 'react';
3
3
  import { ComponentProps, ReactNode } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { useNavigate, useLocation, useInRouterContext, useSearchParams } from 'react-router-dom';
5
+ import { useNavigate, useLocation, useInRouterContext, useSearchParams, createSearchParams } from 'react-router-dom';
6
6
 
7
7
  type PluginName = "alerts" | "react-router-dom" | "localStorage";
8
8
  type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
@@ -58,12 +58,13 @@ type PageHeaderProps = {
58
58
  imageUrl?: string;
59
59
  imageSize?: number;
60
60
  title?: string;
61
+ /** @default "h1" */
61
62
  titleAs?: TextAs;
62
- /** @default theme.colors.textPrimary */
63
+ /** @default textPrimary */
63
64
  titleColor?: React.CSSProperties["color"];
64
65
  titleRightElement?: React.ReactNode;
65
66
  description?: string;
66
- /** @default theme.colors.textSecondary */
67
+ /** @default textSecondary */
67
68
  descriptionColor?: React.CSSProperties["color"];
68
69
  textAlign?: React.CSSProperties["textAlign"];
69
70
  rightElement?: React.ReactNode;
@@ -910,7 +911,15 @@ type FoldableProps = {
910
911
  isOpen?: boolean;
911
912
  defaultOpen?: boolean;
912
913
  title?: string;
914
+ /** @default "h3" */
915
+ titleAs?: TextAs;
916
+ /** @default textPrimary */
917
+ titleColor?: React.CSSProperties["color"];
918
+ titleRightElement?: React.ReactNode;
913
919
  description?: string;
920
+ /** @default textSecondary */
921
+ descriptionColor?: React.CSSProperties["color"];
922
+ rightElement?: React.ReactNode;
914
923
  icon?: IconName | AnyOtherString;
915
924
  image?: AssetName | AnyOtherString;
916
925
  headerPaddingBlock?: React.CSSProperties["paddingBlock"];
@@ -1132,6 +1141,7 @@ type ReactRouterDomPluginOptions = {
1132
1141
  useLocation: typeof useLocation;
1133
1142
  useInRouterContext: typeof useInRouterContext;
1134
1143
  useSearchParams: typeof useSearchParams;
1144
+ createSearchParams: typeof createSearchParams;
1135
1145
  };
1136
1146
  declare const defaultReactRouterDomPluginOptions: Required<ReactRouterDomPluginOptions>;
1137
1147
  declare const reactRouterDomPlugin: BetterHtmlPluginConstructor<ReactRouterDomPluginOptions>;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { WebTarget } from 'styled-components';
2
2
  import * as react from 'react';
3
3
  import { ComponentProps, ReactNode } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { useNavigate, useLocation, useInRouterContext, useSearchParams } from 'react-router-dom';
5
+ import { useNavigate, useLocation, useInRouterContext, useSearchParams, createSearchParams } from 'react-router-dom';
6
6
 
7
7
  type PluginName = "alerts" | "react-router-dom" | "localStorage";
8
8
  type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
@@ -58,12 +58,13 @@ type PageHeaderProps = {
58
58
  imageUrl?: string;
59
59
  imageSize?: number;
60
60
  title?: string;
61
+ /** @default "h1" */
61
62
  titleAs?: TextAs;
62
- /** @default theme.colors.textPrimary */
63
+ /** @default textPrimary */
63
64
  titleColor?: React.CSSProperties["color"];
64
65
  titleRightElement?: React.ReactNode;
65
66
  description?: string;
66
- /** @default theme.colors.textSecondary */
67
+ /** @default textSecondary */
67
68
  descriptionColor?: React.CSSProperties["color"];
68
69
  textAlign?: React.CSSProperties["textAlign"];
69
70
  rightElement?: React.ReactNode;
@@ -910,7 +911,15 @@ type FoldableProps = {
910
911
  isOpen?: boolean;
911
912
  defaultOpen?: boolean;
912
913
  title?: string;
914
+ /** @default "h3" */
915
+ titleAs?: TextAs;
916
+ /** @default textPrimary */
917
+ titleColor?: React.CSSProperties["color"];
918
+ titleRightElement?: React.ReactNode;
913
919
  description?: string;
920
+ /** @default textSecondary */
921
+ descriptionColor?: React.CSSProperties["color"];
922
+ rightElement?: React.ReactNode;
914
923
  icon?: IconName | AnyOtherString;
915
924
  image?: AssetName | AnyOtherString;
916
925
  headerPaddingBlock?: React.CSSProperties["paddingBlock"];
@@ -1132,6 +1141,7 @@ type ReactRouterDomPluginOptions = {
1132
1141
  useLocation: typeof useLocation;
1133
1142
  useInRouterContext: typeof useInRouterContext;
1134
1143
  useSearchParams: typeof useSearchParams;
1144
+ createSearchParams: typeof createSearchParams;
1135
1145
  };
1136
1146
  declare const defaultReactRouterDomPluginOptions: Required<ReactRouterDomPluginOptions>;
1137
1147
  declare const reactRouterDomPlugin: BetterHtmlPluginConstructor<ReactRouterDomPluginOptions>;
package/dist/index.js CHANGED
@@ -106,7 +106,6 @@ var isMobileDevice = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Op
106
106
 
107
107
  // src/utils/hooks.ts
108
108
  var import_react10 = require("react");
109
- var import_react_router_dom2 = require("react-router-dom");
110
109
 
111
110
  // src/constants/css.ts
112
111
  var cssProps = {
@@ -1650,7 +1649,8 @@ var defaultReactRouterDomPluginOptions = {
1650
1649
  useNavigate: import_react_router_dom.useNavigate,
1651
1650
  useLocation: import_react_router_dom.useLocation,
1652
1651
  useInRouterContext: import_react_router_dom.useInRouterContext,
1653
- useSearchParams: import_react_router_dom.useSearchParams
1652
+ useSearchParams: import_react_router_dom.useSearchParams,
1653
+ createSearchParams: import_react_router_dom.createSearchParams
1654
1654
  };
1655
1655
  var reactRouterDomPlugin = (options) => ({
1656
1656
  name: "react-router-dom",
@@ -3210,6 +3210,7 @@ function useUrlQuery() {
3210
3210
  }
3211
3211
  const navigate = reactRouterDomPluginConfig.useNavigate();
3212
3212
  const [searchParams] = reactRouterDomPluginConfig.useSearchParams();
3213
+ const createSearchParams2 = reactRouterDomPluginConfig.createSearchParams;
3213
3214
  const setQuery = (0, import_react10.useCallback)(
3214
3215
  (query, keepHistory = true) => {
3215
3216
  const currentSearchParams = {};
@@ -3218,7 +3219,7 @@ function useUrlQuery() {
3218
3219
  });
3219
3220
  navigate(
3220
3221
  {
3221
- search: (0, import_react_router_dom2.createSearchParams)({
3222
+ search: createSearchParams2({
3222
3223
  ...currentSearchParams,
3223
3224
  ...Object.fromEntries(Object.entries(query).map(([key, value]) => [key, value.toString()]))
3224
3225
  }).toString()
@@ -3291,7 +3292,7 @@ var PageHeaderComponent = (0, import_react12.forwardRef)(function PageHeader({
3291
3292
  imageUrl,
3292
3293
  imageSize = 60,
3293
3294
  title,
3294
- titleAs,
3295
+ titleAs = "h1",
3295
3296
  titleColor,
3296
3297
  titleRightElement,
3297
3298
  description,
@@ -3330,7 +3331,7 @@ var PageHeaderComponent = (0, import_react12.forwardRef)(function PageHeader({
3330
3331
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3331
3332
  Text_default,
3332
3333
  {
3333
- as: titleAs ?? "h1",
3334
+ as: titleAs,
3334
3335
  textAlign,
3335
3336
  color: titleColor ?? (lightMode ? theme2.colors.base : theme2.colors.textPrimary),
3336
3337
  children: title
@@ -9293,7 +9294,12 @@ var FoldableComponent = (0, import_react29.forwardRef)(function Foldable({
9293
9294
  isOpen: controlledIsOpen,
9294
9295
  defaultOpen = false,
9295
9296
  title,
9297
+ titleAs = "h3",
9298
+ titleColor,
9299
+ titleRightElement,
9296
9300
  description,
9301
+ descriptionColor,
9302
+ rightElement,
9297
9303
  icon,
9298
9304
  image,
9299
9305
  headerPaddingBlock,
@@ -9361,7 +9367,7 @@ var FoldableComponent = (0, import_react29.forwardRef)(function Foldable({
9361
9367
  {
9362
9368
  width: "100%",
9363
9369
  alignItems: "center",
9364
- gap: theme2.styles.gap,
9370
+ gap: theme2.styles.space,
9365
9371
  paddingBlock: headerPaddingBlock ?? theme2.styles.gap,
9366
9372
  paddingInline: headerPaddingInline,
9367
9373
  cursor: "pointer",
@@ -9372,10 +9378,23 @@ var FoldableComponent = (0, import_react29.forwardRef)(function Foldable({
9372
9378
  icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
9373
9379
  image && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
9374
9380
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
9375
- title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
9376
- description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: theme2.colors.textSecondary, children: description })
9381
+ title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.space, children: [
9382
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9383
+ Text_default,
9384
+ {
9385
+ as: titleAs,
9386
+ fontWeight: 700,
9387
+ lineHeight: "20px",
9388
+ color: titleColor ?? theme2.colors.textPrimary,
9389
+ children: title
9390
+ }
9391
+ ),
9392
+ titleRightElement
9393
+ ] }),
9394
+ description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: descriptionColor ?? theme2.colors.textSecondary, children: description })
9377
9395
  ] })
9378
9396
  ] }),
9397
+ rightElement,
9379
9398
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9380
9399
  Icon_default,
9381
9400
  {