react-better-html 1.1.262 → 1.1.263

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
@@ -1,8 +1,7 @@
1
- import { IconName, AnyOtherString, AssetName, LoaderName, OmitProps, Country, Color, BetterCoreProviderConfig, DeepPartialRecord, BetterCoreConfig, PartialRecord, PickValue } from 'react-better-core';
2
- export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
1
+ import { OmitProps, IconName, AnyOtherString, AssetName, LoaderName, Country, Color, BetterCoreProviderConfig, DeepPartialRecord, BetterCoreConfig, PartialRecord, PickValue } from 'react-better-core';
2
+ export { API, APIConfigItem, APIEndpointConfig, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
3
3
  import * as react from 'react';
4
4
  import { ComponentProps, ReactNode } from 'react';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import { WebTarget } from 'styled-components';
7
6
  import { Location, useNavigate, useLocation, useInRouterContext, useSearchParams, createSearchParams } from 'react-router-dom';
8
7
 
@@ -24,7 +23,7 @@ type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
24
23
  ref?: React.Ref<ComponentRef>;
25
24
  };
26
25
 
27
- type ButtonProps<Value = unknown> = {
26
+ type InternalButtonProps<Value = unknown> = {
28
27
  text?: string;
29
28
  value?: Value;
30
29
  href?: string;
@@ -55,8 +54,10 @@ type ButtonProps<Value = unknown> = {
55
54
  isSmall?: boolean;
56
55
  /** @default false */
57
56
  isSubmit?: boolean;
57
+ fromSubcomponent?: boolean;
58
58
  onClickWithValue?: (value: Value) => void;
59
59
  } & OmitProps<React.ComponentProps<"button">, "style" | "defaultValue" | "translate" | "value"> & ComponentStyle & ComponentHoverStyle;
60
+ type ButtonProps<Value = unknown> = OmitProps<InternalButtonProps<Value>, "fromSubcomponent">;
60
61
  type ButtonComponent = {
61
62
  <Value>(props: ButtonProps<Value>): React.ReactElement;
62
63
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
@@ -422,7 +423,7 @@ type LabelProps = {
422
423
  color?: React.CSSProperties["color"];
423
424
  htmlFor?: string;
424
425
  };
425
- declare function Label(labelProps: LabelProps): react_jsx_runtime.JSX.Element;
426
+ declare function Label(labelProps: LabelProps): react.JSX.Element;
426
427
  declare const _default$3: react.MemoExoticComponent<typeof Label>;
427
428
 
428
429
  type ImageProps = {
@@ -556,7 +557,7 @@ type BetterHtmlProviderConfig = BetterCoreProviderConfig & BetterHtmlProviderInt
556
557
  type BetterHtmlProviderProps = BetterProviderCommonProps & {
557
558
  config?: BetterHtmlProviderConfig;
558
559
  };
559
- declare function BetterHtmlProvider({ config, ...props }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
560
+ declare function BetterHtmlProvider({ config, ...props }: BetterHtmlProviderProps): react.JSX.Element;
560
561
  declare const _default$1: react.MemoExoticComponent<typeof BetterHtmlProvider>;
561
562
 
562
563
  declare const isMobileDevice: boolean;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { IconName, AnyOtherString, AssetName, LoaderName, OmitProps, Country, Color, BetterCoreProviderConfig, DeepPartialRecord, BetterCoreConfig, PartialRecord, PickValue } from 'react-better-core';
2
- export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
1
+ import { OmitProps, IconName, AnyOtherString, AssetName, LoaderName, Country, Color, BetterCoreProviderConfig, DeepPartialRecord, BetterCoreConfig, PartialRecord, PickValue } from 'react-better-core';
2
+ export { API, APIConfigItem, APIEndpointConfig, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
3
3
  import * as react from 'react';
4
4
  import { ComponentProps, ReactNode } from 'react';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import { WebTarget } from 'styled-components';
7
6
  import { Location, useNavigate, useLocation, useInRouterContext, useSearchParams, createSearchParams } from 'react-router-dom';
8
7
 
@@ -24,7 +23,7 @@ type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
24
23
  ref?: React.Ref<ComponentRef>;
25
24
  };
26
25
 
27
- type ButtonProps<Value = unknown> = {
26
+ type InternalButtonProps<Value = unknown> = {
28
27
  text?: string;
29
28
  value?: Value;
30
29
  href?: string;
@@ -55,8 +54,10 @@ type ButtonProps<Value = unknown> = {
55
54
  isSmall?: boolean;
56
55
  /** @default false */
57
56
  isSubmit?: boolean;
57
+ fromSubcomponent?: boolean;
58
58
  onClickWithValue?: (value: Value) => void;
59
59
  } & OmitProps<React.ComponentProps<"button">, "style" | "defaultValue" | "translate" | "value"> & ComponentStyle & ComponentHoverStyle;
60
+ type ButtonProps<Value = unknown> = OmitProps<InternalButtonProps<Value>, "fromSubcomponent">;
60
61
  type ButtonComponent = {
61
62
  <Value>(props: ButtonProps<Value>): React.ReactElement;
62
63
  secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
@@ -422,7 +423,7 @@ type LabelProps = {
422
423
  color?: React.CSSProperties["color"];
423
424
  htmlFor?: string;
424
425
  };
425
- declare function Label(labelProps: LabelProps): react_jsx_runtime.JSX.Element;
426
+ declare function Label(labelProps: LabelProps): react.JSX.Element;
426
427
  declare const _default$3: react.MemoExoticComponent<typeof Label>;
427
428
 
428
429
  type ImageProps = {
@@ -556,7 +557,7 @@ type BetterHtmlProviderConfig = BetterCoreProviderConfig & BetterHtmlProviderInt
556
557
  type BetterHtmlProviderProps = BetterProviderCommonProps & {
557
558
  config?: BetterHtmlProviderConfig;
558
559
  };
559
- declare function BetterHtmlProvider({ config, ...props }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
560
+ declare function BetterHtmlProvider({ config, ...props }: BetterHtmlProviderProps): react.JSX.Element;
560
561
  declare const _default$1: react.MemoExoticComponent<typeof BetterHtmlProvider>;
561
562
 
562
563
  declare const isMobileDevice: boolean;
package/dist/index.js CHANGED
@@ -2124,6 +2124,9 @@ var Loader_default = Loader2;
2124
2124
 
2125
2125
  // src/components/Button.tsx
2126
2126
  var import_jsx_runtime8 = require("react/jsx-runtime");
2127
+ var fromSubcomponentProps = {
2128
+ fromSubcomponent: true
2129
+ };
2127
2130
  var ButtonElement = import_styled_components6.default.button.withConfig({
2128
2131
  shouldForwardProp: (prop) => !["theme", "colorTheme", "style", "hoverStyle", "isSmall", "withText", "isLoading", "withNoBorder"].includes(
2129
2132
  prop
@@ -2206,7 +2209,7 @@ var ButtonComponent = function Button(buttonProps) {
2206
2209
  onClickWithValue,
2207
2210
  ...props
2208
2211
  } = useComponentsPropsMerger(
2209
- betterHtmlContextInternal.components.button?.style?.default,
2212
+ !buttonProps.fromSubcomponent ? betterHtmlContextInternal.components.button?.style?.default : {},
2210
2213
  buttonProps
2211
2214
  );
2212
2215
  const theme2 = (0, import_react_better_core9.useTheme)();
@@ -2331,6 +2334,7 @@ ButtonComponent.secondary = function Secondary(buttonProps) {
2331
2334
  {
2332
2335
  className: `secondary${className ? ` ${className}` : ""}`,
2333
2336
  color: theme2.colors.textPrimary,
2337
+ ...fromSubcomponentProps,
2334
2338
  ...props
2335
2339
  }
2336
2340
  );
@@ -2342,7 +2346,15 @@ ButtonComponent.destructive = function Destructive(buttonProps) {
2342
2346
  buttonProps
2343
2347
  );
2344
2348
  const theme2 = (0, import_react_better_core9.useTheme)();
2345
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ButtonComponent, { backgroundColor: theme2.colors.error, color: theme2.colors.base, ...props });
2349
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2350
+ ButtonComponent,
2351
+ {
2352
+ backgroundColor: theme2.colors.error,
2353
+ color: theme2.colors.base,
2354
+ ...fromSubcomponentProps,
2355
+ ...props
2356
+ }
2357
+ );
2346
2358
  };
2347
2359
  ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...buttonProps }) {
2348
2360
  const betterHtmlContextInternal = useBetterHtmlContextInternal();
@@ -2356,7 +2368,6 @@ ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonC
2356
2368
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2357
2369
  ButtonComponent,
2358
2370
  {
2359
- ...betterHtmlContextInternal.components.button?.style?.icon,
2360
2371
  width: readyButtonSize,
2361
2372
  height: readyButtonSize,
2362
2373
  color: theme2.colors.textPrimary,
@@ -2369,6 +2380,7 @@ ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonC
2369
2380
  border: "none",
2370
2381
  padding: 0,
2371
2382
  filterHover: "none !important",
2383
+ ...fromSubcomponentProps,
2372
2384
  ...props
2373
2385
  }
2374
2386
  );
@@ -2392,10 +2404,10 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...button
2392
2404
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2393
2405
  ButtonComponent,
2394
2406
  {
2395
- ...betterHtmlContextInternal.components.button?.style?.upload,
2396
2407
  text: "Upload",
2397
2408
  icon: "uploadCloud",
2398
2409
  onClick: onClickElement,
2410
+ ...fromSubcomponentProps,
2399
2411
  ...props
2400
2412
  }
2401
2413
  );