@plasmicapp/react-web 0.2.220 → 0.2.222

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';
@@ -1395,10 +1395,11 @@ var PlasmicTranslatorContext = React__default.createContext(undefined);
1395
1395
  function isIterable(val) {
1396
1396
  return val != null && typeof val[Symbol.iterator] === "function";
1397
1397
  }
1398
- function genTranslatableString(elt) {
1398
+ function genTranslatableString(elt, opts) {
1399
1399
  var components = {};
1400
1400
  var componentsCount = 0;
1401
1401
  var getText = function (node) {
1402
+ var _a;
1402
1403
  if (!node) {
1403
1404
  return "";
1404
1405
  }
@@ -1428,7 +1429,8 @@ function genTranslatableString(elt) {
1428
1429
  if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
1429
1430
  return contents;
1430
1431
  }
1431
- var componentId = componentsCount + 1;
1432
+ var prefix = (_a = opts === null || opts === void 0 ? void 0 : opts.tagPrefix) !== null && _a !== void 0 ? _a : "";
1433
+ var componentId = "".concat(prefix).concat(componentsCount + 1);
1432
1434
  componentsCount++;
1433
1435
  components[componentId] = React__default.isValidElement(node)
1434
1436
  ? React__default.cloneElement(node, {
@@ -1603,7 +1605,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
1603
1605
 
1604
1606
  var PlasmicRootContext = React.createContext(undefined);
1605
1607
  function PlasmicRootProvider(props) {
1606
- var platform = props.platform, children = props.children, userAuthToken = props.userAuthToken, isUserLoading = props.isUserLoading, authRedirectUri = props.authRedirectUri, user = props.user;
1608
+ 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
1609
  var context = React.useMemo(function () { return ({
1608
1610
  platform: platform,
1609
1611
  }); }, [platform]);
@@ -1613,11 +1615,14 @@ function PlasmicRootProvider(props) {
1613
1615
  isUserLoading: isUserLoading,
1614
1616
  authRedirectUri: authRedirectUri,
1615
1617
  }); }, [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))))));
1618
+ var reactMajorVersion = +React.version.split(".")[0];
1619
+ return (React.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (children) { return (React.createElement(DataProvider, { name: "plasmicInternalEnableLoadingBoundary", hidden: true, data: true },
1620
+ React.createElement(React.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." }, children))); } },
1621
+ React.createElement(PlasmicRootContext.Provider, { value: context },
1622
+ React.createElement(SSRProvider, null,
1623
+ React.createElement(PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
1624
+ React.createElement(PlasmicTranslatorContext.Provider, { value: props.translator },
1625
+ React.createElement(PlasmicHeadContext.Provider, { value: props.Head }, children)))))));
1621
1626
  }
1622
1627
  var useIsSSR = useIsSSR$1;
1623
1628
  function useHasPlasmicRoot() {
@@ -1635,6 +1640,9 @@ function useEnsureSSRProvider() {
1635
1640
  hasWarnedSSR = true;
1636
1641
  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
1642
  }
1643
+ function MaybeWrap(props) {
1644
+ return props.cond ? props.wrapper(props.children) : props.children;
1645
+ }
1638
1646
 
1639
1647
  function useFocused(opts) {
1640
1648
  var _a = useFocusRing({