@plasmicapp/react-web 0.2.219 → 0.2.221

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.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
3
- interface CommonProps {
3
+ interface PlumeCommonProps {
4
4
  showStartIcon?: boolean;
5
5
  showEndIcon?: boolean;
6
6
  startIcon?: React.ReactNode;
@@ -9,15 +9,22 @@ interface CommonProps {
9
9
  isDisabled?: boolean;
10
10
  }
11
11
  interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
12
- submitsForm?: boolean;
13
12
  }
14
13
  interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href" | "target"> {
14
+ }
15
+ interface PlumeActualButtonProps {
16
+ submitsForm?: boolean;
17
+ }
18
+ interface PlumeAnchorProps {
15
19
  link?: string;
16
20
  target?: React.ComponentProps<"a">["target"] | boolean;
17
21
  }
18
- export type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
19
- export type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
20
- export type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
22
+ export type PlumeButtonProps = PlumeCommonProps & PlumeActualButtonProps & PlumeAnchorProps;
23
+ export type BaseButtonProps = PlumeButtonProps & HtmlButtonProps & HtmlAnchorProps;
24
+ type AllButtonProps = PlumeCommonProps & PlumeActualButtonProps & HtmlButtonProps;
25
+ type AllAnchorProps = PlumeCommonProps & PlumeAnchorProps & HtmlAnchorProps;
26
+ export type HtmlAnchorOnlyProps = Exclude<keyof AllAnchorProps, keyof AllButtonProps>;
27
+ export type HtmlButtonOnlyProps = Exclude<keyof AllButtonProps, keyof AllAnchorProps>;
21
28
  export type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
22
29
  interface ButtonConfig<C extends AnyPlasmicClass> {
23
30
  showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
@@ -28,7 +35,7 @@ interface ButtonConfig<C extends AnyPlasmicClass> {
28
35
  contentSlot: keyof PlasmicClassArgs<C>;
29
36
  root: keyof PlasmicClassOverrides<C>;
30
37
  }
31
- export declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
38
+ export declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
32
39
  plasmicProps: {
33
40
  variants: PlasmicClassVariants<C>;
34
41
  args: PlasmicClassArgs<C>;
@@ -1,6 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
3
- export interface BaseTextInputProps extends Omit<React.ComponentProps<"input">, "type" | "disabled"> {
3
+ export interface BaseTextInputProps extends Omit<React.ComponentProps<"input">, "type" | "disabled">, PlumeTextInputProps {
4
+ }
5
+ export interface PlumeTextInputProps {
4
6
  showStartIcon?: boolean;
5
7
  showEndIcon?: boolean;
6
8
  startIcon?: React.ReactNode;
@@ -9,6 +11,8 @@ export interface BaseTextInputProps extends Omit<React.ComponentProps<"input">,
9
11
  type?: "text" | "password" | "email" | "url" | string;
10
12
  inputClassName?: string;
11
13
  inputStyle?: React.CSSProperties;
14
+ className?: string;
15
+ style?: React.CSSProperties;
12
16
  }
13
17
  export interface TextInputRefValue {
14
18
  focus: () => void;
@@ -26,7 +30,7 @@ interface TextInputConfig<C extends AnyPlasmicClass> {
26
30
  root: keyof PlasmicClassOverrides<C>;
27
31
  input: keyof PlasmicClassOverrides<C>;
28
32
  }
29
- export declare function useTextInput<P extends BaseTextInputProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TextInputConfig<C>, ref?: TextInputRef): {
33
+ export declare function useTextInput<P extends PlumeTextInputProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TextInputConfig<C>, ref?: TextInputRef): {
30
34
  plasmicProps: {
31
35
  variants: PlasmicClassVariants<C>;
32
36
  args: PlasmicClassArgs<C>;
@@ -9,6 +9,7 @@ export { default as get } from 'dlv';
9
9
  import * as ReactDOM from 'react-dom';
10
10
  import ReactDOM__default from 'react-dom';
11
11
  import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
12
+ import { DataProvider, usePlasmicCanvasContext } from '@plasmicapp/host';
12
13
  import { useFocusRing, useFocusable, FocusScope } from '@react-aria/focus';
13
14
  import { proxy, ref, useSnapshot, getVersion, subscribe } from 'valtio';
14
15
  import clone from 'clone';
@@ -22,7 +23,6 @@ import { Item, Section } from '@react-stately/collections';
22
23
  import { useSeparator } from '@react-aria/separator';
23
24
  import { useMenuTriggerState } from '@react-stately/menu';
24
25
  import { usePress } from '@react-aria/interactions';
25
- import { usePlasmicCanvasContext } from '@plasmicapp/host';
26
26
  import { useListBox, useOption, useListBoxSection } from '@react-aria/listbox';
27
27
  import { useSelect as useSelect$1, HiddenSelect } from '@react-aria/select';
28
28
  import { useSelectState } from '@react-stately/select';
@@ -1603,7 +1603,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1603
1603
 
1604
1604
  var PlasmicRootContext = React.createContext(undefined);
1605
1605
  function PlasmicRootProvider(props) {
1606
- var platform = props.platform, children = props.children, userAuthToken = props.userAuthToken, isUserLoading = props.isUserLoading, authRedirectUri = props.authRedirectUri, user = props.user;
1606
+ var platform = props.platform, children = props.children, userAuthToken = props.userAuthToken, isUserLoading = props.isUserLoading, authRedirectUri = props.authRedirectUri, user = props.user, disableLoadingBoundary = props.disableLoadingBoundary, suspenseFallback = props.suspenseFallback;
1607
1607
  var context = React.useMemo(function () { return ({
1608
1608
  platform: platform,
1609
1609
  }); }, [platform]);
@@ -1613,11 +1613,14 @@ function PlasmicRootProvider(props) {
1613
1613
  isUserLoading: isUserLoading,
1614
1614
  authRedirectUri: authRedirectUri,
1615
1615
  }); }, [userAuthToken, isUserLoading, user, authRedirectUri]);
1616
- return (React.createElement(PlasmicRootContext.Provider, { value: context },
1617
- React.createElement(SSRProvider, null,
1618
- React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1619
- React.createElement(PlasmicTranslatorContext.Provider, { value: props.translator },
1620
- React.createElement(PlasmicHeadContext.Provider, { value: props.Head }, children))))));
1616
+ var reactMajorVersion = +React.version.split(".")[0];
1617
+ return (React.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (children) { return (React.createElement(DataProvider, { name: "plasmicInternalEnableLoadingBoundary", hidden: true, data: true },
1618
+ React.createElement(React.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." }, children))); } },
1619
+ React.createElement(PlasmicRootContext.Provider, { value: context },
1620
+ React.createElement(SSRProvider, null,
1621
+ React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1622
+ React.createElement(PlasmicTranslatorContext.Provider, { value: props.translator },
1623
+ React.createElement(PlasmicHeadContext.Provider, { value: props.Head }, children)))))));
1621
1624
  }
1622
1625
  var useIsSSR = useIsSSR$1;
1623
1626
  function useHasPlasmicRoot() {
@@ -1635,6 +1638,9 @@ function useEnsureSSRProvider() {
1635
1638
  hasWarnedSSR = true;
1636
1639
  console.warn("Plasmic: To ensure your components work correctly with server-side rendering, please use PlasmicRootProvider at the root of your application. See https://docs.plasmic.app/learn/ssr");
1637
1640
  }
1641
+ function MaybeWrap(props) {
1642
+ return props.cond ? props.wrapper(props.children) : props.children;
1643
+ }
1638
1644
 
1639
1645
  function useFocused(opts) {
1640
1646
  var _a = useFocusRing({