@plasmicapp/react-web 1.0.37 → 1.0.38
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/README.internal +10 -26
- package/dist/all.d.ts +130 -3
- package/dist/index.cjs.js +5 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/plume/checkbox/index.d.ts +1 -1
- package/dist/plume/switch/index.d.ts +1 -1
- package/dist/react-web.esm.js +5 -8
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +10 -11
- package/skinny/dist/plume/checkbox/index.d.ts +1 -1
- package/skinny/dist/plume/checkbox/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/menu/index.js +1 -4
- package/skinny/dist/plume/menu/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.d.ts +1 -1
- package/skinny/dist/plume/switch/index.js +2 -2
- package/skinny/dist/plume/switch/index.js.map +1 -1
package/README.internal
CHANGED
|
@@ -3,34 +3,18 @@ and type definitions used by generated blackbox presentational code.
|
|
|
3
3
|
|
|
4
4
|
If you want to use this for yourself, then first build the output:
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
pnpm --filter @plasmicapp/react-web build
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
For fast local iteration in a pnpm consumer, use the workspace's link scripts:
|
|
9
9
|
|
|
10
|
+
pnpm local-link:setup @plasmicapp/react-web ~/path/to/consumer
|
|
11
|
+
pnpm local-link:build @plasmicapp/react-web
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
Restart the consumer after rebuilding. When finished, restore registry
|
|
14
|
+
dependencies before deleting its `node_modules`:
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
pnpm local-link:teardown ~/path/to/consumer
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
yarn link @plasmicapp/react-web
|
|
21
|
-
|
|
22
|
-
This basically symlinks a folder in your consumer node_modules folder that links back
|
|
23
|
-
to the output from `yarn build`. If you update any file here, be sure to run `yarn build`
|
|
24
|
-
again so your updates are reflected in consuming packages.
|
|
25
|
-
|
|
26
|
-
Usage 2 - via package.json
|
|
27
|
-
==========================
|
|
28
|
-
|
|
29
|
-
Then create a link to this:
|
|
30
|
-
|
|
31
|
-
yarn add link:<path to @plasmicapp/react-web directory>
|
|
32
|
-
|
|
33
|
-
This avoids the problem of multiple `yarn link` that may conflict with each other.
|
|
34
|
-
|
|
35
|
-
plasmic/wab uses this approach. So you don't have to do anything except for `yarn build` to
|
|
36
|
-
use the latest @plasmicapp/react-web package for plasmic/wab.
|
|
18
|
+
Avoid raw package-manager links: they can resolve React and other peer dependencies
|
|
19
|
+
from this monorepo instead of the consumer. See the root `CONTRIBUTING.md` for the
|
|
20
|
+
full local-link and Verdaccio workflows.
|
package/dist/all.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties as CSSProperties$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
|
|
4
|
-
import { AriaCheckboxProps } from '@react-types/checkbox';
|
|
5
|
-
import { AriaSwitchProps } from '@react-types/switch';
|
|
3
|
+
import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties as CSSProperties$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, MouseEvent, SyntheticEvent } from 'react';
|
|
6
4
|
|
|
7
5
|
declare global {
|
|
8
6
|
interface Window {
|
|
@@ -13975,6 +13973,34 @@ declare function Trans({ transKey, children }: TransProps): React__default.React
|
|
|
13975
13973
|
|
|
13976
13974
|
|
|
13977
13975
|
|
|
13976
|
+
type ValidationState = 'valid' | 'invalid';
|
|
13977
|
+
|
|
13978
|
+
type ValidationError = string | string[];
|
|
13979
|
+
|
|
13980
|
+
interface Validation<T = unknown> {
|
|
13981
|
+
/** Whether user input is required on the input before form submission. */
|
|
13982
|
+
isRequired?: boolean;
|
|
13983
|
+
/** Whether the input value is invalid. */
|
|
13984
|
+
isInvalid?: boolean;
|
|
13985
|
+
/** @deprecated Use `isInvalid` instead. */
|
|
13986
|
+
validationState?: ValidationState;
|
|
13987
|
+
/**
|
|
13988
|
+
* Whether to use native HTML form validation to prevent form submission
|
|
13989
|
+
* when the value is missing or invalid, or mark the field as required
|
|
13990
|
+
* or invalid via ARIA.
|
|
13991
|
+
*
|
|
13992
|
+
* @default 'aria'
|
|
13993
|
+
*/
|
|
13994
|
+
validationBehavior?: 'aria' | 'native';
|
|
13995
|
+
/**
|
|
13996
|
+
* A function that returns an error message if a given value is invalid.
|
|
13997
|
+
* Validation errors are displayed to the user when the form is submitted
|
|
13998
|
+
* if `validationBehavior="native"`. For realtime validation, use the `isInvalid`
|
|
13999
|
+
* prop instead.
|
|
14000
|
+
*/
|
|
14001
|
+
validate?: (value: T) => ValidationError | true | null | undefined;
|
|
14002
|
+
}
|
|
14003
|
+
|
|
13978
14004
|
interface InputBase {
|
|
13979
14005
|
/** Whether the input is disabled. */
|
|
13980
14006
|
isDisabled?: boolean;
|
|
@@ -14019,6 +14045,14 @@ interface AriaLabelingProps {
|
|
|
14019
14045
|
'aria-details'?: string;
|
|
14020
14046
|
}
|
|
14021
14047
|
|
|
14048
|
+
interface AriaValidationProps {
|
|
14049
|
+
// https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage
|
|
14050
|
+
/**
|
|
14051
|
+
* Identifies the element that provides an error message for the object.
|
|
14052
|
+
*/
|
|
14053
|
+
'aria-errormessage'?: string;
|
|
14054
|
+
}
|
|
14055
|
+
|
|
14022
14056
|
// A set of common DOM props that are allowed on any component
|
|
14023
14057
|
// Ensure this is synced with DOMPropNames in filterDOMProps
|
|
14024
14058
|
interface DOMProps {
|
|
@@ -14039,6 +14073,20 @@ interface FocusableDOMProps extends DOMProps {
|
|
|
14039
14073
|
excludeFromTabOrder?: boolean;
|
|
14040
14074
|
}
|
|
14041
14075
|
|
|
14076
|
+
interface InputDOMProps {
|
|
14077
|
+
/**
|
|
14078
|
+
* The name of the input element, used when submitting an HTML form. See
|
|
14079
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
|
|
14080
|
+
*/
|
|
14081
|
+
name?: string;
|
|
14082
|
+
/**
|
|
14083
|
+
* The `<form>` element to associate the input with.
|
|
14084
|
+
* The value of this attribute must be the id of a `<form>` in the same document.
|
|
14085
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).
|
|
14086
|
+
*/
|
|
14087
|
+
form?: string;
|
|
14088
|
+
}
|
|
14089
|
+
|
|
14042
14090
|
/** Any focusable element, including both HTML and SVG elements. */
|
|
14043
14091
|
interface FocusableElement extends Element, HTMLOrSVGElement {}
|
|
14044
14092
|
|
|
@@ -14277,6 +14325,31 @@ interface FocusEvents<Target = Element> {
|
|
|
14277
14325
|
onFocusChange?: (isFocused: boolean) => void;
|
|
14278
14326
|
}
|
|
14279
14327
|
|
|
14328
|
+
interface PressEvents {
|
|
14329
|
+
/** Handler that is called when the press is released over the target. */
|
|
14330
|
+
onPress?: (e: PressEvent) => void;
|
|
14331
|
+
/** Handler that is called when a press interaction starts. */
|
|
14332
|
+
onPressStart?: (e: PressEvent) => void;
|
|
14333
|
+
/**
|
|
14334
|
+
* Handler that is called when a press interaction ends, either
|
|
14335
|
+
* over the target or when the pointer leaves the target.
|
|
14336
|
+
*/
|
|
14337
|
+
onPressEnd?: (e: PressEvent) => void;
|
|
14338
|
+
/** Handler that is called when the press state changes. */
|
|
14339
|
+
onPressChange?: (isPressed: boolean) => void;
|
|
14340
|
+
/**
|
|
14341
|
+
* Handler that is called when a press is released over the target, regardless of
|
|
14342
|
+
* whether it started on the target or not.
|
|
14343
|
+
*/
|
|
14344
|
+
onPressUp?: (e: PressEvent) => void;
|
|
14345
|
+
/**
|
|
14346
|
+
* **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress`
|
|
14347
|
+
* provided for compatibility with other libraries. `onPress` provides
|
|
14348
|
+
* additional event details for non-mouse interactions.
|
|
14349
|
+
*/
|
|
14350
|
+
onClick?: (e: MouseEvent<FocusableElement>) => void;
|
|
14351
|
+
}
|
|
14352
|
+
|
|
14280
14353
|
interface FocusableProps<Target = Element> extends FocusEvents<Target>, KeyboardEvents {
|
|
14281
14354
|
/** Whether the element should receive focus on render. */
|
|
14282
14355
|
autoFocus?: boolean;
|
|
@@ -14437,6 +14510,50 @@ declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass
|
|
|
14437
14510
|
};
|
|
14438
14511
|
};
|
|
14439
14512
|
|
|
14513
|
+
interface ToggleStateOptions extends InputBase {
|
|
14514
|
+
/**
|
|
14515
|
+
* Whether the element should be selected (uncontrolled).
|
|
14516
|
+
*/
|
|
14517
|
+
defaultSelected?: boolean;
|
|
14518
|
+
/**
|
|
14519
|
+
* Whether the element should be selected (controlled).
|
|
14520
|
+
*/
|
|
14521
|
+
isSelected?: boolean;
|
|
14522
|
+
/**
|
|
14523
|
+
* Handler that is called when the element's selection state changes.
|
|
14524
|
+
*/
|
|
14525
|
+
onChange?: (isSelected: boolean) => void;
|
|
14526
|
+
}
|
|
14527
|
+
interface ToggleProps extends ToggleStateOptions, Validation<boolean>, FocusableProps {
|
|
14528
|
+
/**
|
|
14529
|
+
* The label for the element.
|
|
14530
|
+
*/
|
|
14531
|
+
children?: ReactNode;
|
|
14532
|
+
/**
|
|
14533
|
+
* The value of the input element, used when submitting an HTML form. See
|
|
14534
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).
|
|
14535
|
+
*/
|
|
14536
|
+
value?: string;
|
|
14537
|
+
}
|
|
14538
|
+
|
|
14539
|
+
interface AriaToggleProps extends ToggleProps, FocusableDOMProps, AriaLabelingProps, AriaValidationProps, InputDOMProps, PressEvents {
|
|
14540
|
+
/**
|
|
14541
|
+
* Identifies the element (or elements) whose contents or presence are controlled by the current
|
|
14542
|
+
* element.
|
|
14543
|
+
*/
|
|
14544
|
+
'aria-controls'?: string;
|
|
14545
|
+
}
|
|
14546
|
+
|
|
14547
|
+
interface CheckboxProps$1 extends ToggleProps {
|
|
14548
|
+
/**
|
|
14549
|
+
* Indeterminism is presentational only.
|
|
14550
|
+
* The indeterminate visual representation remains regardless of user interaction.
|
|
14551
|
+
*/
|
|
14552
|
+
isIndeterminate?: boolean;
|
|
14553
|
+
}
|
|
14554
|
+
interface AriaCheckboxProps extends CheckboxProps$1, InputDOMProps, AriaToggleProps {
|
|
14555
|
+
}
|
|
14556
|
+
|
|
14440
14557
|
interface StyleProps {
|
|
14441
14558
|
className?: string;
|
|
14442
14559
|
style?: React$1.CSSProperties;
|
|
@@ -15156,6 +15273,16 @@ interface ListState<T> {
|
|
|
15156
15273
|
|
|
15157
15274
|
declare const SelectContext: React$1.Context<ListState<any> | undefined>;
|
|
15158
15275
|
|
|
15276
|
+
interface SwitchProps$1 extends ToggleProps {
|
|
15277
|
+
}
|
|
15278
|
+
interface AriaSwitchProps extends SwitchProps$1, InputDOMProps, AriaToggleProps {
|
|
15279
|
+
/**
|
|
15280
|
+
* Identifies the element (or elements) whose contents or presence are controlled by the current
|
|
15281
|
+
* element.
|
|
15282
|
+
*/
|
|
15283
|
+
'aria-controls'?: string;
|
|
15284
|
+
}
|
|
15285
|
+
|
|
15159
15286
|
type SwitchRef = React$1.Ref<SwitchRefValue>;
|
|
15160
15287
|
interface SwitchRefValue extends SwitchState {
|
|
15161
15288
|
getRoot: () => HTMLElement | null;
|
package/dist/index.cjs.js
CHANGED
|
@@ -3243,10 +3243,10 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
3243
3243
|
props: mergeProps(getStyleProps(props), {
|
|
3244
3244
|
ref: rootRef,
|
|
3245
3245
|
}),
|
|
3246
|
-
wrapChildren: function (
|
|
3246
|
+
wrapChildren: function (renderedChildren) { return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
3247
3247
|
React__namespace.createElement(visuallyHidden.VisuallyHidden, null,
|
|
3248
3248
|
React__namespace.createElement("input", __assign({}, inputProps, { ref: inputRef }))),
|
|
3249
|
-
|
|
3249
|
+
renderedChildren)); },
|
|
3250
3250
|
},
|
|
3251
3251
|
_a);
|
|
3252
3252
|
var args = __assign(__assign({}, pick.apply(void 0, __spreadArray([props], __read(plasmicClass.internalArgProps), false))), (config.labelSlot ? (_b = {}, _b[config.labelSlot] = children, _b) : {}));
|
|
@@ -3596,10 +3596,7 @@ function useMenu(plasmicClass, props, config, ref) {
|
|
|
3596
3596
|
var state = tree.useTreeState(ariaProps);
|
|
3597
3597
|
var menuListRef = React__namespace.useRef(null);
|
|
3598
3598
|
var menuProps = menu.useMenu(__assign(__assign({}, ariaProps), { autoFocus: triggerContext === null || triggerContext === void 0 ? void 0 : triggerContext.autoFocus }), state, menuListRef).menuProps;
|
|
3599
|
-
var contextValue = React__namespace.useMemo(function () { return ({ state: state, menuProps: props }); }, [
|
|
3600
|
-
state,
|
|
3601
|
-
props,
|
|
3602
|
-
]);
|
|
3599
|
+
var contextValue = React__namespace.useMemo(function () { return ({ state: state, menuProps: props }); }, [state, props]);
|
|
3603
3600
|
var variants = __assign({}, pick.apply(void 0, __spreadArray([props], __read(plasmicClass.internalVariantProps), false)));
|
|
3604
3601
|
var overrides = (_a = {},
|
|
3605
3602
|
_a[config.root] = {
|
|
@@ -4150,10 +4147,10 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
4150
4147
|
props: mergeProps(getStyleProps(props), {
|
|
4151
4148
|
ref: rootRef,
|
|
4152
4149
|
}),
|
|
4153
|
-
wrapChildren: function (
|
|
4150
|
+
wrapChildren: function (renderedChildren) { return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
4154
4151
|
React__namespace.createElement(visuallyHidden.VisuallyHidden, null,
|
|
4155
4152
|
React__namespace.createElement("input", __assign({}, inputProps, { ref: inputRef }))),
|
|
4156
|
-
|
|
4153
|
+
renderedChildren)); },
|
|
4157
4154
|
},
|
|
4158
4155
|
_a);
|
|
4159
4156
|
var args = __assign(__assign({}, pick.apply(void 0, __spreadArray([props], __read(plasmicClass.internalArgProps), false))), (config.labelSlot ? (_b = {}, _b[config.labelSlot] = children, _b) : {}));
|