@plasmicapp/react-web 0.2.82 → 0.2.89
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/all.d.ts +92 -6
- package/dist/index.d.ts +2 -0
- package/dist/plume/button/index.d.ts +36 -0
- package/dist/plume/text-input/index.d.ts +36 -0
- package/dist/react-utils.d.ts +1 -1
- package/dist/react-web.cjs.development.js +248 -42
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +247 -43
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +22 -4
- package/dist/stories/PlasmicImg.stories.d.ts +2 -2
- package/lib/plasmic.css +0 -3
- package/package.json +1 -1
- package/skinny/dist/collection-utils-3487dd27.js +238 -0
- package/skinny/dist/collection-utils-3487dd27.js.map +1 -0
- package/skinny/dist/index.d.ts +2 -0
- package/skinny/dist/plume/button/index.d.ts +36 -0
- package/skinny/dist/plume/button/index.js +27 -0
- package/skinny/dist/plume/button/index.js.map +1 -0
- package/skinny/dist/plume/checkbox/index.js +2 -1
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/menu/index.js +3 -2
- package/skinny/dist/plume/menu/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/index.js +2 -1
- package/skinny/dist/plume/menu-button/index.js.map +1 -1
- package/skinny/dist/plume/select/index.js +3 -2
- package/skinny/dist/plume/select/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.js +2 -1
- package/skinny/dist/plume/switch/index.js.map +1 -1
- package/skinny/dist/plume/text-input/index.d.ts +36 -0
- package/skinny/dist/plume/text-input/index.js +51 -0
- package/skinny/dist/plume/text-input/index.js.map +1 -0
- package/skinny/dist/plume/triggered-overlay/index.js +3 -3
- package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
- package/skinny/dist/plume-utils-27cd384f.js +35 -0
- package/skinny/dist/plume-utils-27cd384f.js.map +1 -0
- package/skinny/dist/props-utils-7c02c0a8.js +8 -0
- package/skinny/dist/props-utils-7c02c0a8.js.map +1 -0
- package/skinny/dist/react-utils-7c01e440.js.map +1 -1
- package/skinny/dist/react-utils.d.ts +1 -1
- package/skinny/dist/render/PlasmicImg/index.d.ts +22 -4
- package/skinny/dist/render/PlasmicImg/index.js +100 -27
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
- package/skinny/dist/stories/PlasmicImg.stories.d.ts +2 -2
|
@@ -21,6 +21,7 @@ export interface PlasmicImgProps extends ImgTagProps {
|
|
|
21
21
|
src: string;
|
|
22
22
|
fullHeight: number;
|
|
23
23
|
fullWidth: number;
|
|
24
|
+
aspectRatio?: number;
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* className applied to the wrapper element if one is used.
|
|
@@ -34,6 +35,22 @@ export interface PlasmicImgProps extends ImgTagProps {
|
|
|
34
35
|
* css height
|
|
35
36
|
*/
|
|
36
37
|
displayHeight?: number | string;
|
|
38
|
+
/**
|
|
39
|
+
* css min-width
|
|
40
|
+
*/
|
|
41
|
+
displayMinWidth?: number | string;
|
|
42
|
+
/**
|
|
43
|
+
* css min-height
|
|
44
|
+
*/
|
|
45
|
+
displayMinHeight?: number | string;
|
|
46
|
+
/**
|
|
47
|
+
* css max-width
|
|
48
|
+
*/
|
|
49
|
+
displayMaxWidth?: number | string;
|
|
50
|
+
/**
|
|
51
|
+
* css max-height
|
|
52
|
+
*/
|
|
53
|
+
displayMaxHeight?: number | string;
|
|
37
54
|
/**
|
|
38
55
|
* For variable quality formats like jpg, the quality from 0 to 100
|
|
39
56
|
*/
|
|
@@ -49,10 +66,11 @@ export interface PlasmicImgProps extends ImgTagProps {
|
|
|
49
66
|
*/
|
|
50
67
|
style?: React.CSSProperties;
|
|
51
68
|
/**
|
|
52
|
-
* Ref for the
|
|
53
|
-
* prop gives
|
|
69
|
+
* Ref for the img element. The normal <PlasmicImg ref={...} />
|
|
70
|
+
* prop gives the root element instead, which may be the img element
|
|
71
|
+
* or a wrapper element
|
|
54
72
|
*/
|
|
55
|
-
|
|
73
|
+
imgRef?: React.Ref<HTMLImageElement>;
|
|
56
74
|
}
|
|
57
|
-
export declare const PlasmicImg: React.ForwardRefExoticComponent<PlasmicImgProps & React.RefAttributes<
|
|
75
|
+
export declare const PlasmicImg: React.ForwardRefExoticComponent<PlasmicImgProps & React.RefAttributes<HTMLElement>>;
|
|
58
76
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "../styles/plasmic.css";
|
|
3
|
-
export declare const Base: import("@storybook/react").Story<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<
|
|
4
|
-
declare const _default: import("@storybook/react").Meta<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<
|
|
3
|
+
export declare const Base: import("@storybook/react").Story<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>;
|
|
4
|
+
declare const _default: import("@storybook/react").Meta<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>;
|
|
5
5
|
export default _default;
|
package/lib/plasmic.css
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { a as __assign, d as isString } from './tslib.es6-d26ffe68.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { Item, Section } from 'react-stately';
|
|
4
|
+
import { t as toChildArray, g as getElementTypeName } from './react-utils-7c01e440.js';
|
|
5
|
+
import { g as getPlumeType, P as PLUME_STRICT_MODE } from './plume-utils-27cd384f.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* In general, we try not to expose react-aria's Collections API to Plume users.
|
|
9
|
+
* The Collections API is how react-aria users pass data about collections of
|
|
10
|
+
* things using the built-in Item and Section components, which are abstract,
|
|
11
|
+
* metadata-only components that don't render anything but only serve to specify
|
|
12
|
+
* data. For example, here's how you would use react-spectrum's Picker:
|
|
13
|
+
*
|
|
14
|
+
* <Picker>
|
|
15
|
+
* <Section title="Asia">
|
|
16
|
+
* <Item key="taiwan">Taiwan</Item>
|
|
17
|
+
* <Item key="japan">Japan</Item>
|
|
18
|
+
* <Item key="china">China</Item>
|
|
19
|
+
* </Section>
|
|
20
|
+
* <Section title="Europe">
|
|
21
|
+
* <Item key="germany">Germany</Item>
|
|
22
|
+
* <Item key="france">France</Item>
|
|
23
|
+
* </Section>
|
|
24
|
+
* </Picker>
|
|
25
|
+
*
|
|
26
|
+
* You would re-use this same Item/Section components to pass similar things to
|
|
27
|
+
* Menu, Tabs, etc.
|
|
28
|
+
*
|
|
29
|
+
* For Plasmic, this API is too abstract. The user has explicitly designed components
|
|
30
|
+
* like Select.Option and Select.OptionGroup, and it is weird that they don't actually
|
|
31
|
+
* use these components. It is more natural to do:
|
|
32
|
+
*
|
|
33
|
+
* <Select>
|
|
34
|
+
* <Select.OptionGroup title="Asia">
|
|
35
|
+
* <Select.Option key="taiwan">Taiwan</Select>
|
|
36
|
+
* </Select.OptionGroup>
|
|
37
|
+
* </Select>
|
|
38
|
+
*
|
|
39
|
+
* For Plume, we let users directly use the components they designed, both to collect
|
|
40
|
+
* information and to perform actual rendering. For example, for Plume,
|
|
41
|
+
* you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.
|
|
42
|
+
* This means that the Select.Option props will collect the same information Item
|
|
43
|
+
* does.
|
|
44
|
+
*
|
|
45
|
+
* A component like Select.Option then serves two purposes:
|
|
46
|
+
*
|
|
47
|
+
* 1. Allow users to specify the collection of data, like in the above example
|
|
48
|
+
* Here, we're mainly interested in the props in those ReactElements so
|
|
49
|
+
* we can pass the Item/Section data onto react-aria's APIs. We are not
|
|
50
|
+
* actually rendering these elements.
|
|
51
|
+
* 2. Once react-aria's Collections API has gone through them and built
|
|
52
|
+
* Collection "nodes", we then create cloned versions of these elements
|
|
53
|
+
* with the corresponding node passed in as a secret prop. These ReactElements
|
|
54
|
+
* are then actually used to _render_ the corresponding Option / OptionGroup.
|
|
55
|
+
*
|
|
56
|
+
* This file contains helper functions to help with implementing the above.
|
|
57
|
+
*
|
|
58
|
+
* Note also that most of the collections-based react-aria components expose
|
|
59
|
+
* a parallel API that accepts a list of "items" and a render prop, instead
|
|
60
|
+
* of list of Item/Section elements. This is for efficiency, but we are opting
|
|
61
|
+
* to only support the composite-component pattern for now for simplicity.
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* Given children of a component like Select or Menu, derive the items
|
|
65
|
+
* that we will pass into the Collections API. These will be
|
|
66
|
+
* ReactElement<ItemLikeProps|SectionLikeProps>[].
|
|
67
|
+
*
|
|
68
|
+
* Will also assign keys to items by their index in the collection,
|
|
69
|
+
* and collect the keys of disabled items.
|
|
70
|
+
*/
|
|
71
|
+
function deriveItemsFromChildren(children, opts) {
|
|
72
|
+
if (!children) {
|
|
73
|
+
return {
|
|
74
|
+
items: [],
|
|
75
|
+
disabledKeys: [],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
var itemPlumeType = opts.itemPlumeType, sectionPlumeType = opts.sectionPlumeType, invalidChildError = opts.invalidChildError;
|
|
79
|
+
// For Plume items without an explicit key, we assign a key as the index
|
|
80
|
+
// of the collection.
|
|
81
|
+
var itemCount = 0;
|
|
82
|
+
var sectionCount = 0;
|
|
83
|
+
var ensureValue = function (element) {
|
|
84
|
+
if (!propInChild(element, "value")) {
|
|
85
|
+
if (opts.requireItemValue && PLUME_STRICT_MODE) {
|
|
86
|
+
throw new Error("Must specify a \"value\" prop for " + getElementTypeName(element));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return cloneChild(element, { value: "" + itemCount++ });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Still increment count even if key is present, so that the
|
|
94
|
+
// auto-assigned key really reflects the index
|
|
95
|
+
itemCount++;
|
|
96
|
+
return element;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var disabledKeys = [];
|
|
100
|
+
var flattenedChildren = function (children) {
|
|
101
|
+
return toChildArray(children).flatMap(function (child) {
|
|
102
|
+
var _a;
|
|
103
|
+
if (React__default.isValidElement(child)) {
|
|
104
|
+
if (child.type === React__default.Fragment) {
|
|
105
|
+
return flattenedChildren(child.props.children);
|
|
106
|
+
}
|
|
107
|
+
var type = getPlumeType(child);
|
|
108
|
+
if (type === itemPlumeType) {
|
|
109
|
+
child = ensureValue(child);
|
|
110
|
+
var childKey = getItemLikeKey(child);
|
|
111
|
+
if (getChildProp(child, "isDisabled") && !!childKey) {
|
|
112
|
+
disabledKeys.push(childKey);
|
|
113
|
+
}
|
|
114
|
+
return [child];
|
|
115
|
+
}
|
|
116
|
+
if (type === sectionPlumeType) {
|
|
117
|
+
return [
|
|
118
|
+
cloneChild(child, {
|
|
119
|
+
// key of section doesn't actually matter, just needs
|
|
120
|
+
// to be unique
|
|
121
|
+
key: (_a = child.key) !== null && _a !== void 0 ? _a : "section-" + sectionCount++,
|
|
122
|
+
children: flattenedChildren(getChildProp(child, "children")),
|
|
123
|
+
}),
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
{
|
|
128
|
+
throw new Error(invalidChildError !== null && invalidChildError !== void 0 ? invalidChildError : "Unexpected child");
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
return { items: flattenedChildren(children), disabledKeys: disabledKeys };
|
|
133
|
+
}
|
|
134
|
+
function useDerivedItemsFromChildren(children, opts) {
|
|
135
|
+
var itemPlumeType = opts.itemPlumeType, sectionPlumeType = opts.sectionPlumeType, invalidChildError = opts.invalidChildError, requireItemValue = opts.requireItemValue;
|
|
136
|
+
return React__default.useMemo(function () {
|
|
137
|
+
return deriveItemsFromChildren(children, {
|
|
138
|
+
itemPlumeType: itemPlumeType,
|
|
139
|
+
sectionPlumeType: sectionPlumeType,
|
|
140
|
+
invalidChildError: invalidChildError,
|
|
141
|
+
requireItemValue: requireItemValue,
|
|
142
|
+
});
|
|
143
|
+
}, [
|
|
144
|
+
children,
|
|
145
|
+
itemPlumeType,
|
|
146
|
+
sectionPlumeType,
|
|
147
|
+
invalidChildError,
|
|
148
|
+
requireItemValue,
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Given a Collection node, create the React element that we should use
|
|
153
|
+
* to render it.
|
|
154
|
+
*/
|
|
155
|
+
function renderCollectionNode(node) {
|
|
156
|
+
// node.rendered should already have our item-like or section-like Plume
|
|
157
|
+
// component elements, so we just need to clone them with a secret
|
|
158
|
+
// _node prop that we use to render.
|
|
159
|
+
return cloneChild(node.rendered, {
|
|
160
|
+
_node: node,
|
|
161
|
+
key: node.key,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Renders a item-like or section-like Plume component element into an
|
|
166
|
+
* Item or a Section element.
|
|
167
|
+
*/
|
|
168
|
+
function renderAsCollectionChild(child, opts) {
|
|
169
|
+
var _a;
|
|
170
|
+
var plumeType = getPlumeType(child);
|
|
171
|
+
if (plumeType === opts.itemPlumeType) {
|
|
172
|
+
var option = child;
|
|
173
|
+
// We look at the children passed to the item-like element, and derive key
|
|
174
|
+
// or textValue from it if it is a string
|
|
175
|
+
var content = getChildProp(option, "children");
|
|
176
|
+
// The children render prop needs to return an <Item/>
|
|
177
|
+
return (React__default.createElement(Item
|
|
178
|
+
// We use ItemLike.value if the user explicitly specified a value,
|
|
179
|
+
// and we fallback to key. If the user specified neither, then
|
|
180
|
+
// the Collections API will generate a unique key for this item.
|
|
181
|
+
, {
|
|
182
|
+
// We use ItemLike.value if the user explicitly specified a value,
|
|
183
|
+
// and we fallback to key. If the user specified neither, then
|
|
184
|
+
// the Collections API will generate a unique key for this item.
|
|
185
|
+
key: getItemLikeKey(option),
|
|
186
|
+
// textValue is either explicitly specified by the user, or we
|
|
187
|
+
// try to derive it if `content` is a string.
|
|
188
|
+
textValue: (_a = getChildProp(option, "textValue")) !== null && _a !== void 0 ? _a : (isString(content)
|
|
189
|
+
? content
|
|
190
|
+
: propInChild(option, "value")
|
|
191
|
+
? getChildProp(option, "value")
|
|
192
|
+
: option.key), "aria-label": getChildProp(option, "aria-label") }, option));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
var group = child;
|
|
196
|
+
return (React__default.createElement(Section
|
|
197
|
+
// Note that we are using the whole section-like element as the title
|
|
198
|
+
// here, and not group.props.title; we want the entire section-like
|
|
199
|
+
// Plume element to end up as Node.rendered.
|
|
200
|
+
, {
|
|
201
|
+
// Note that we are using the whole section-like element as the title
|
|
202
|
+
// here, and not group.props.title; we want the entire section-like
|
|
203
|
+
// Plume element to end up as Node.rendered.
|
|
204
|
+
title: group, "aria-label": getChildProp(group, "aria-label"),
|
|
205
|
+
// We are flattening and deriving the descendant Options as items here.
|
|
206
|
+
// group.props.children should've already been cleaned up by
|
|
207
|
+
// deriveItemsFromChildren()
|
|
208
|
+
items: getChildProp(group, "children") }, function (c) { return renderAsCollectionChild(c, opts); }));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function getItemLikeKey(element) {
|
|
212
|
+
var _a;
|
|
213
|
+
return (_a = getChildProp(element, "value")) !== null && _a !== void 0 ? _a : element.key;
|
|
214
|
+
}
|
|
215
|
+
// PlasmicLoader-aware function to get prop from child.
|
|
216
|
+
function getChildProp(child, prop) {
|
|
217
|
+
return "componentProps" in child.props
|
|
218
|
+
? child.props.componentProps[prop]
|
|
219
|
+
: child.props[prop];
|
|
220
|
+
}
|
|
221
|
+
// PlasmicLoader-aware function to check `if (prop in element.props)`.
|
|
222
|
+
function propInChild(child, prop) {
|
|
223
|
+
return "componentProps" in child.props
|
|
224
|
+
? prop in child.props.componentProps
|
|
225
|
+
: prop in child.props;
|
|
226
|
+
}
|
|
227
|
+
// PlasmicLoader-aware function to clone React element.
|
|
228
|
+
function cloneChild(child, props) {
|
|
229
|
+
if (child.type.getPlumeType) {
|
|
230
|
+
// If React element has getPlumeType(), assume that it is PlasmicLoader,
|
|
231
|
+
// so add nodeProps to componentProps instead of element props.
|
|
232
|
+
return React__default.cloneElement(child, __assign({ componentProps: __assign(__assign({}, child.props.componentProps), props) }, (props.key ? { key: props.key } : {})));
|
|
233
|
+
}
|
|
234
|
+
return React__default.cloneElement(child, props);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export { renderAsCollectionChild as a, getChildProp as g, renderCollectionNode as r, useDerivedItemsFromChildren as u };
|
|
238
|
+
//# sourceMappingURL=collection-utils-3487dd27.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-utils-3487dd27.js","sources":["../../src/plume/collection-utils.tsx"],"sourcesContent":["/**\n * In general, we try not to expose react-aria's Collections API to Plume users.\n * The Collections API is how react-aria users pass data about collections of\n * things using the built-in Item and Section components, which are abstract,\n * metadata-only components that don't render anything but only serve to specify\n * data. For example, here's how you would use react-spectrum's Picker:\n *\n * <Picker>\n * <Section title=\"Asia\">\n * <Item key=\"taiwan\">Taiwan</Item>\n * <Item key=\"japan\">Japan</Item>\n * <Item key=\"china\">China</Item>\n * </Section>\n * <Section title=\"Europe\">\n * <Item key=\"germany\">Germany</Item>\n * <Item key=\"france\">France</Item>\n * </Section>\n * </Picker>\n *\n * You would re-use this same Item/Section components to pass similar things to\n * Menu, Tabs, etc.\n *\n * For Plasmic, this API is too abstract. The user has explicitly designed components\n * like Select.Option and Select.OptionGroup, and it is weird that they don't actually\n * use these components. It is more natural to do:\n *\n * <Select>\n * <Select.OptionGroup title=\"Asia\">\n * <Select.Option key=\"taiwan\">Taiwan</Select>\n * </Select.OptionGroup>\n * </Select>\n *\n * For Plume, we let users directly use the components they designed, both to collect\n * information and to perform actual rendering. For example, for Plume,\n * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.\n * This means that the Select.Option props will collect the same information Item\n * does.\n *\n * A component like Select.Option then serves two purposes:\n *\n * 1. Allow users to specify the collection of data, like in the above example\n * Here, we're mainly interested in the props in those ReactElements so\n * we can pass the Item/Section data onto react-aria's APIs. We are not\n * actually rendering these elements.\n * 2. Once react-aria's Collections API has gone through them and built\n * Collection \"nodes\", we then create cloned versions of these elements\n * with the corresponding node passed in as a secret prop. These ReactElements\n * are then actually used to _render_ the corresponding Option / OptionGroup.\n *\n * This file contains helper functions to help with implementing the above.\n *\n * Note also that most of the collections-based react-aria components expose\n * a parallel API that accepts a list of \"items\" and a render prop, instead\n * of list of Item/Section elements. This is for efficiency, but we are opting\n * to only support the composite-component pattern for now for simplicity.\n */\n\nimport { Node } from \"@react-types/shared\";\nimport React from \"react\";\nimport { Item, Section } from \"react-stately\";\nimport { isString } from \"../common\";\nimport { getElementTypeName, toChildArray } from \"../react-utils\";\nimport { getPlumeType, PLUME_STRICT_MODE } from \"./plume-utils\";\n\nexport interface PlasmicLoaderProps<T> {\n component: string;\n componentProps: T;\n}\n\n/**\n * Props for a Plume component that corresponds to an Item\n */\nexport interface ItemLikeProps {\n /**\n * value key corresponding to this item. Not required if you use the\n * `key` prop instead.\n */\n value?: string | null;\n\n /**\n * The text string value corresponding to this item. Used to support\n * keyboard type-ahead. If not specified, then will be derived from\n * `children` if it is a string, or the `value` or `key`.\n */\n textValue?: string;\n\n /**\n * aria-label for this item.\n */\n \"aria-label\"?: string;\n\n /**\n * Primary content label for this item.\n */\n children?: React.ReactNode;\n\n /**\n * If true, this item will not be selectable.\n */\n isDisabled?: boolean;\n}\n\ntype LoaderAwareItemLikeProps =\n | ItemLikeProps\n | PlasmicLoaderProps<ItemLikeProps>;\n\n/**\n * Props for a Plume component that corresponds to a Section\n */\nexport interface SectionLikeProps {\n /**\n * Heading content of the title\n */\n title?: React.ReactNode;\n\n /**\n * aria-label for this section\n */\n \"aria-label\"?: string;\n\n /**\n * A list of items that belong in this group\n */\n children?: React.ReactNode;\n}\n\ntype LoaderAwareSectionLikeProps =\n | SectionLikeProps\n | PlasmicLoaderProps<SectionLikeProps>;\n\n/**\n * Given children of a component like Select or Menu, derive the items\n * that we will pass into the Collections API. These will be\n * ReactElement<ItemLikeProps|SectionLikeProps>[].\n *\n * Will also assign keys to items by their index in the collection,\n * and collect the keys of disabled items.\n */\nexport function deriveItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n if (!children) {\n return {\n items: [] as T[],\n disabledKeys: [] as React.Key[],\n };\n }\n\n const { itemPlumeType, sectionPlumeType, invalidChildError } = opts;\n\n // For Plume items without an explicit key, we assign a key as the index\n // of the collection.\n let itemCount = 0;\n let sectionCount = 0;\n\n const ensureValue = (element: React.ReactElement) => {\n if (!propInChild(element, \"value\")) {\n if (opts.requireItemValue && PLUME_STRICT_MODE) {\n throw new Error(\n `Must specify a \"value\" prop for ${getElementTypeName(element)}`\n );\n } else {\n return cloneChild(element, { value: `${itemCount++}` });\n }\n } else {\n // Still increment count even if key is present, so that the\n // auto-assigned key really reflects the index\n itemCount++;\n return element;\n }\n };\n\n const disabledKeys: React.Key[] = [];\n\n const flattenedChildren = (\n children: React.ReactNode\n ): React.ReactElement[] => {\n return toChildArray(children).flatMap((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return flattenedChildren(child.props.children);\n }\n const type = getPlumeType(child);\n if (type === itemPlumeType) {\n child = ensureValue(child);\n const childKey = getItemLikeKey(child);\n if (getChildProp(child, \"isDisabled\") && !!childKey) {\n disabledKeys.push(childKey);\n }\n return [child];\n }\n if (type === sectionPlumeType) {\n return [\n cloneChild(child, {\n // key of section doesn't actually matter, just needs\n // to be unique\n key: child.key ?? `section-${sectionCount++}`,\n children: flattenedChildren(getChildProp(child, \"children\")),\n }),\n ];\n }\n }\n\n if (PLUME_STRICT_MODE) {\n throw new Error(invalidChildError ?? `Unexpected child`);\n } else {\n return [];\n }\n });\n };\n\n return { items: flattenedChildren(children) as T[], disabledKeys };\n}\n\nexport function useDerivedItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n } = opts;\n return React.useMemo(() => {\n return deriveItemsFromChildren<T>(children, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n });\n }, [\n children,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ]);\n}\n\n/**\n * Given a Collection node, create the React element that we should use\n * to render it.\n */\nexport function renderCollectionNode(node: Node<any>) {\n // node.rendered should already have our item-like or section-like Plume\n // component elements, so we just need to clone them with a secret\n // _node prop that we use to render.\n return cloneChild(node.rendered as React.ReactElement, {\n _node: node,\n key: node.key,\n });\n}\n\n/**\n * Renders a item-like or section-like Plume component element into an\n * Item or a Section element.\n */\nexport function renderAsCollectionChild<\n T extends React.ReactElement<\n LoaderAwareItemLikeProps | LoaderAwareSectionLikeProps\n >\n>(\n child: T,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n }\n) {\n const plumeType = getPlumeType(child);\n if (plumeType === opts.itemPlumeType) {\n const option = child as React.ReactElement<LoaderAwareItemLikeProps>;\n\n // We look at the children passed to the item-like element, and derive key\n // or textValue from it if it is a string\n const content = getChildProp(option, \"children\");\n\n // The children render prop needs to return an <Item/>\n return (\n <Item\n // We use ItemLike.value if the user explicitly specified a value,\n // and we fallback to key. If the user specified neither, then\n // the Collections API will generate a unique key for this item.\n key={getItemLikeKey(option)}\n // textValue is either explicitly specified by the user, or we\n // try to derive it if `content` is a string.\n textValue={\n getChildProp(option, \"textValue\") ??\n (isString(content)\n ? content\n : propInChild(option, \"value\")\n ? getChildProp(option, \"value\")\n : option.key)\n }\n aria-label={getChildProp(option, \"aria-label\")}\n >\n {\n // Note that what we setting the item-like element as the children\n // here, and not content; we want the entire item-like Plume element to\n // end up as Node.rendered.\n }\n {option}\n </Item>\n );\n } else {\n const group = child as React.ReactElement<LoaderAwareSectionLikeProps>;\n return (\n <Section\n // Note that we are using the whole section-like element as the title\n // here, and not group.props.title; we want the entire section-like\n // Plume element to end up as Node.rendered.\n title={group}\n aria-label={getChildProp(group, \"aria-label\")}\n // We are flattening and deriving the descendant Options as items here.\n // group.props.children should've already been cleaned up by\n // deriveItemsFromChildren()\n items={getChildProp(group, \"children\") as React.ReactElement[]}\n >\n {\n // We use the same render function to turn descendent Options into Items\n }\n {(c: React.ReactElement) => renderAsCollectionChild(c, opts)}\n </Section>\n );\n }\n}\n\nfunction getItemLikeKey(element: React.ReactElement<LoaderAwareItemLikeProps>) {\n return getChildProp(element, \"value\") ?? element.key;\n}\n\n// PlasmicLoader-aware function to get prop from child.\nexport function getChildProp(child: React.ReactElement, prop: string) {\n return \"componentProps\" in child.props\n ? child.props.componentProps[prop]\n : child.props[prop];\n}\n\n// PlasmicLoader-aware function to check `if (prop in element.props)`.\nfunction propInChild(child: React.ReactElement, prop: string): boolean {\n return \"componentProps\" in child.props\n ? prop in child.props.componentProps\n : prop in child.props;\n}\n\n// PlasmicLoader-aware function to clone React element.\nfunction cloneChild(child: React.ReactElement, props: Record<string, any>) {\n if ((child.type as any).getPlumeType) {\n // If React element has getPlumeType(), assume that it is PlasmicLoader,\n // so add nodeProps to componentProps instead of element props.\n return React.cloneElement(child, {\n componentProps: {\n ...child.props.componentProps,\n ...props,\n },\n ...(props.key ? { key: props.key } : {}),\n });\n }\n\n return React.cloneElement(child, props);\n}\n"],"names":["React"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA;;;;;;;;SAQgB,uBAAuB,CACrC,QAAyB,EACzB,IAKC;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO;YACL,KAAK,EAAE,EAAS;YAChB,YAAY,EAAE,EAAiB;SAChC,CAAC;KACH;IAEO,IAAA,aAAa,GAA0C,IAAI,cAA9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CAAC,CAAC;AACxB,CAAC;AAED;AACA,SAAS,WAAW,CAAC,KAAyB,EAAE,IAAY;IAC1D,OAAO,gBAAgB,IAAI,KAAK,CAAC,KAAK;UAClC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc;UAClC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAC1B,CAAC;AAED;AACA,SAAS,UAAU,CAAC,KAAyB,EAAE,KAA0B;IACvE,IAAK,KAAK,CAAC,IAAY,CAAC,YAAY,EAAE;;;QAGpC,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,aAC7B,cAAc,wBACT,KAAK,CAAC,KAAK,CAAC,cAAc,GAC1B,KAAK,MAEN,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GACvC,CAAC;KACJ;IAED,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C;;;;"}
|
package/skinny/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./index-common";
|
|
2
|
+
export * from "./plume/button";
|
|
2
3
|
export * from "./plume/checkbox";
|
|
3
4
|
export * from "./plume/menu";
|
|
4
5
|
export * from "./plume/menu-button";
|
|
@@ -6,4 +7,5 @@ export { setPlumeStrictMode } from "./plume/plume-utils";
|
|
|
6
7
|
export { getDataProps } from "./plume/props-utils";
|
|
7
8
|
export * from "./plume/select";
|
|
8
9
|
export * from "./plume/switch";
|
|
10
|
+
export * from "./plume/text-input";
|
|
9
11
|
export * from "./plume/triggered-overlay";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
|
|
3
|
+
interface CommonProps {
|
|
4
|
+
showStartIcon?: boolean;
|
|
5
|
+
showEndIcon?: boolean;
|
|
6
|
+
startIcon?: React.ReactNode;
|
|
7
|
+
endIcon?: React.ReactNode;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
|
|
12
|
+
}
|
|
13
|
+
interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
|
|
14
|
+
link?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
|
|
17
|
+
export declare type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
|
|
18
|
+
export declare type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
|
|
19
|
+
export declare type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
20
|
+
interface ButtonConfig<C extends AnyPlasmicClass> {
|
|
21
|
+
showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
|
|
22
|
+
showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
23
|
+
isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
24
|
+
startIconSlot?: keyof PlasmicClassArgs<C>;
|
|
25
|
+
endIconSlot?: keyof PlasmicClassArgs<C>;
|
|
26
|
+
contentSlot: keyof PlasmicClassArgs<C>;
|
|
27
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
28
|
+
}
|
|
29
|
+
export declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
|
|
30
|
+
plasmicProps: {
|
|
31
|
+
variants: PlasmicClassVariants<C>;
|
|
32
|
+
args: PlasmicClassArgs<C>;
|
|
33
|
+
overrides: PlasmicClassOverrides<C>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, p as pick, b as __spreadArray } from '../../tslib.es6-d26ffe68.js';
|
|
2
|
+
import { m as mergeVariantToggles } from '../../plume-utils-27cd384f.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
function useButton(plasmicClass, props, config, ref) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
if (ref === void 0) { ref = null; }
|
|
8
|
+
var link = props.link, isDisabled = props.isDisabled, startIcon = props.startIcon, endIcon = props.endIcon, showStartIcon = props.showStartIcon, showEndIcon = props.showEndIcon, children = props.children, rest = __rest(props, ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children"]);
|
|
9
|
+
var variants = __assign(__assign({}, pick.apply(void 0, __spreadArray([props], plasmicClass.internalVariantProps))), mergeVariantToggles({ def: config.showStartIconVariant, active: showStartIcon }, { def: config.showEndIconVariant, active: showEndIcon }, { def: config.isDisabledVariant, active: isDisabled }));
|
|
10
|
+
var args = __assign(__assign(__assign(__assign({}, pick.apply(void 0, __spreadArray([props], plasmicClass.internalArgProps))), (config.startIconSlot && (_a = {}, _a[config.startIconSlot] = startIcon, _a))), (config.endIconSlot && (_b = {}, _b[config.endIconSlot] = endIcon, _b))), (_c = {}, _c[config.contentSlot] = children, _c));
|
|
11
|
+
var overrides = (_d = {},
|
|
12
|
+
_d[config.root] = {
|
|
13
|
+
as: !!link ? "a" : "button",
|
|
14
|
+
props: __assign(__assign({ ref: ref, disabled: isDisabled }, (!!link && { href: link })), rest),
|
|
15
|
+
},
|
|
16
|
+
_d);
|
|
17
|
+
return {
|
|
18
|
+
plasmicProps: {
|
|
19
|
+
variants: variants,
|
|
20
|
+
args: args,
|
|
21
|
+
overrides: overrides,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useButton };
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/plume/button/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { pick } from \"../../common\";\nimport { Overrides } from \"../../render/elements\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n VariantDef,\n} from \"../plume-utils\";\n\ninterface CommonProps {\n showStartIcon?: boolean;\n showEndIcon?: boolean;\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n children?: React.ReactNode;\n isDisabled?: boolean;\n}\n\ninterface HtmlButtonProps\n extends Omit<React.ComponentProps<\"button\">, \"ref\" | \"disabled\"> {}\n\ninterface HtmlAnchorProps\n extends Omit<React.ComponentProps<\"a\">, \"ref\" | \"href\"> {\n link?: string;\n}\n\nexport type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;\n\nexport type HtmlAnchorOnlyProps = Exclude<\n keyof HtmlAnchorProps,\n keyof HtmlButtonProps\n>;\nexport type HtmlButtonOnlyProps = Exclude<\n keyof HtmlButtonProps,\n keyof HtmlAnchorProps\n>;\n\nexport type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;\n\ninterface ButtonConfig<C extends AnyPlasmicClass> {\n showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;\n showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;\n isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;\n startIconSlot?: keyof PlasmicClassArgs<C>;\n endIconSlot?: keyof PlasmicClassArgs<C>;\n contentSlot: keyof PlasmicClassArgs<C>;\n root: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: P,\n config: ButtonConfig<C>,\n ref: ButtonRef = null\n) {\n const {\n link,\n isDisabled,\n startIcon,\n endIcon,\n showStartIcon,\n showEndIcon,\n children,\n ...rest\n } = props;\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n { def: config.showStartIconVariant, active: showStartIcon },\n { def: config.showEndIconVariant, active: showEndIcon },\n { def: config.isDisabledVariant, active: isDisabled }\n ),\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n ...(config.startIconSlot && { [config.startIconSlot]: startIcon }),\n ...(config.endIconSlot && { [config.endIconSlot]: endIcon }),\n [config.contentSlot]: children,\n };\n\n const overrides: Overrides = {\n [config.root]: {\n as: !!link ? \"a\" : \"button\",\n props: {\n ref: ref,\n disabled: isDisabled,\n ...(!!link && { href: link }),\n ...rest,\n },\n },\n };\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n };\n}\n"],"names":[],"mappings":";;;;SAoDgB,SAAS,CACvB,YAAe,EACf,KAAQ,EACR,MAAuB,EACvB,GAAqB;;IAArB,oBAAA,EAAA,UAAqB;IAGnB,IAAA,IAAI,GAQF,KAAK,KARH,EACJ,UAAU,GAOR,KAAK,WAPG,EACV,SAAS,GAMP,KAAK,UANE,EACT,OAAO,GAKL,KAAK,QALA,EACP,aAAa,GAIX,KAAK,cAJM,EACb,WAAW,GAGT,KAAK,YAHI,EACX,QAAQ,GAEN,KAAK,SAFC,EACL,IAAI,UACL,KAAK,EATH,0FASL,CADQ,CACC;IACV,IAAM,QAAQ,yBACT,IAAI,8BAAC,KAAK,GAAK,YAAY,CAAC,oBAAoB,KAChD,mBAAmB,CACpB,EAAE,GAAG,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,EAC3D,EAAE,GAAG,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,EACvD,EAAE,GAAG,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,CACtD,CACF,CAAC;IAEF,IAAM,IAAI,2CACL,IAAI,8BAAC,KAAK,GAAK,YAAY,CAAC,gBAAgB,MAC3C,MAAM,CAAC,aAAa,cAAM,GAAC,MAAM,CAAC,aAAa,IAAG,SAAS,KAAE,KAC7D,MAAM,CAAC,WAAW,cAAM,GAAC,MAAM,CAAC,WAAW,IAAG,OAAO,KAAE,iBAC1D,MAAM,CAAC,WAAW,IAAG,QAAQ,MAC/B,CAAC;IAEF,IAAM,SAAS;QACb,GAAC,MAAM,CAAC,IAAI,IAAG;YACb,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ;YAC3B,KAAK,sBACH,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,UAAU,KAChB,CAAC,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IACzB,IAAI,CACR;SACF;WACF,CAAC;IAEF,OAAO;QACL,YAAY,EAAE;YACZ,QAAQ,EAAE,QAAmC;YAC7C,IAAI,EAAE,IAA2B;YACjC,SAAS,EAAE,SAAqC;SACjD;KACF,CAAC;AACJ;;;;"}
|
|
@@ -4,7 +4,8 @@ import { useCheckbox as useCheckbox$1, VisuallyHidden } from 'react-aria';
|
|
|
4
4
|
import { useToggleState } from 'react-stately';
|
|
5
5
|
import { m as mergeProps } from '../../react-utils-7c01e440.js';
|
|
6
6
|
import { a as useEnsureSSRProvider } from '../../ssr-d2fd94f2.js';
|
|
7
|
-
import { m as mergeVariantToggles
|
|
7
|
+
import { m as mergeVariantToggles } from '../../plume-utils-27cd384f.js';
|
|
8
|
+
import { g as getStyleProps } from '../../props-utils-7c02c0a8.js';
|
|
8
9
|
import 'classnames';
|
|
9
10
|
|
|
10
11
|
function asAriaCheckboxProps(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/plume/checkbox/index.tsx"],"sourcesContent":["import { AriaCheckboxProps } from \"@react-types/checkbox\";\nimport * as React from \"react\";\nimport { useCheckbox as useAriaCheckbox, VisuallyHidden } from \"react-aria\";\nimport { useToggleState } from \"react-stately\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { useEnsureSSRProvider } from \"../../render/ssr\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n VariantDef,\n} from \"../plume-utils\";\nimport { getStyleProps, StyleProps } from \"../props-utils\";\n\nexport type CheckboxRef = React.Ref<CheckboxRefValue>;\nexport interface CheckboxRefValue extends CheckboxState {\n getRoot: () => HTMLElement | null;\n focus: () => void;\n blur: () => void;\n}\n\ninterface CheckboxState {\n setChecked: (checked: boolean) => void;\n}\n\nexport interface CheckboxProps\n extends Omit<AriaCheckboxProps, \"isSelected\" | \"defaultSelected\">,\n StyleProps {\n /**\n * Whether the Checkbox is checked or not; controlled\n */\n isChecked?: boolean;\n\n /**\n * Whether the Checkbox is checked by default; uncontrolled\n */\n defaultChecked?: boolean;\n\n /**\n * Whether the Checkbox is in an \"indeterminate\" state; this usually\n * refers to a \"check all\" that is used to check / uncheck many other\n * checkboxes, and is visually indeterminate if some of its controlled\n * checkboxes are checked and some are not.\n */\n isIndeterminate?: boolean;\n}\n\nfunction asAriaCheckboxProps(props: CheckboxProps) {\n const ariaProps = {\n ...props,\n isSelected: props.isChecked,\n defaultSelected: props.defaultChecked,\n };\n delete ariaProps[\"isChecked\"];\n delete ariaProps[\"defaultChecked\"];\n return ariaProps;\n}\n\ninterface CheckboxConfig<C extends AnyPlasmicClass> {\n isCheckedVariant: VariantDef<PlasmicClassVariants<C>>;\n isIndeterminateVariant?: VariantDef<PlasmicClassVariants<C>>;\n isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;\n noLabelVariant?: VariantDef<PlasmicClassVariants<C>>;\n labelSlot?: keyof PlasmicClassArgs<C>;\n root: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useCheckbox<P extends CheckboxProps, C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: P,\n config: CheckboxConfig<C>,\n ref: CheckboxRef = null\n) {\n const { children, isDisabled, isIndeterminate } = props;\n useEnsureSSRProvider();\n const inputRef = React.useRef<HTMLInputElement>(null);\n const rootRef = React.useRef<HTMLElement>(null);\n const ariaProps = asAriaCheckboxProps(props);\n const state = useToggleState(ariaProps);\n const { inputProps } = useAriaCheckbox(ariaProps, state, inputRef);\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n {\n def: config.isDisabledVariant,\n active: isDisabled,\n },\n {\n def: config.isCheckedVariant,\n active: state.isSelected,\n },\n {\n def: config.isIndeterminateVariant,\n active: isIndeterminate,\n },\n {\n def: config.noLabelVariant,\n active: !children,\n }\n ),\n };\n const overrides: Overrides = {\n [config.root]: {\n as: \"label\",\n props: mergeProps(getStyleProps(props), {\n ref: rootRef,\n }),\n wrapChildren: (children) => (\n <>\n <VisuallyHidden isFocusable>\n <input {...inputProps} ref={inputRef} />\n </VisuallyHidden>\n {children}\n </>\n ),\n },\n };\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n ...(config.labelSlot ? { [config.labelSlot]: children } : {}),\n };\n\n const plumeState: CheckboxState = React.useMemo(\n () => ({\n setChecked: (checked: boolean) => state.setSelected(checked),\n }),\n [state]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n getRoot: () => rootRef.current,\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n setChecked: (checked) => plumeState.setChecked(checked),\n }),\n [rootRef, inputRef, plumeState]\n );\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n args: args as PlasmicClassArgs<C>,\n },\n state: plumeState,\n };\n}\n"],"names":["useAriaCheckbox"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/plume/checkbox/index.tsx"],"sourcesContent":["import { AriaCheckboxProps } from \"@react-types/checkbox\";\nimport * as React from \"react\";\nimport { useCheckbox as useAriaCheckbox, VisuallyHidden } from \"react-aria\";\nimport { useToggleState } from \"react-stately\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { useEnsureSSRProvider } from \"../../render/ssr\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n VariantDef,\n} from \"../plume-utils\";\nimport { getStyleProps, StyleProps } from \"../props-utils\";\n\nexport type CheckboxRef = React.Ref<CheckboxRefValue>;\nexport interface CheckboxRefValue extends CheckboxState {\n getRoot: () => HTMLElement | null;\n focus: () => void;\n blur: () => void;\n}\n\ninterface CheckboxState {\n setChecked: (checked: boolean) => void;\n}\n\nexport interface CheckboxProps\n extends Omit<AriaCheckboxProps, \"isSelected\" | \"defaultSelected\">,\n StyleProps {\n /**\n * Whether the Checkbox is checked or not; controlled\n */\n isChecked?: boolean;\n\n /**\n * Whether the Checkbox is checked by default; uncontrolled\n */\n defaultChecked?: boolean;\n\n /**\n * Whether the Checkbox is in an \"indeterminate\" state; this usually\n * refers to a \"check all\" that is used to check / uncheck many other\n * checkboxes, and is visually indeterminate if some of its controlled\n * checkboxes are checked and some are not.\n */\n isIndeterminate?: boolean;\n}\n\nfunction asAriaCheckboxProps(props: CheckboxProps) {\n const ariaProps = {\n ...props,\n isSelected: props.isChecked,\n defaultSelected: props.defaultChecked,\n };\n delete ariaProps[\"isChecked\"];\n delete ariaProps[\"defaultChecked\"];\n return ariaProps;\n}\n\ninterface CheckboxConfig<C extends AnyPlasmicClass> {\n isCheckedVariant: VariantDef<PlasmicClassVariants<C>>;\n isIndeterminateVariant?: VariantDef<PlasmicClassVariants<C>>;\n isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;\n noLabelVariant?: VariantDef<PlasmicClassVariants<C>>;\n labelSlot?: keyof PlasmicClassArgs<C>;\n root: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useCheckbox<P extends CheckboxProps, C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: P,\n config: CheckboxConfig<C>,\n ref: CheckboxRef = null\n) {\n const { children, isDisabled, isIndeterminate } = props;\n useEnsureSSRProvider();\n const inputRef = React.useRef<HTMLInputElement>(null);\n const rootRef = React.useRef<HTMLElement>(null);\n const ariaProps = asAriaCheckboxProps(props);\n const state = useToggleState(ariaProps);\n const { inputProps } = useAriaCheckbox(ariaProps, state, inputRef);\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n {\n def: config.isDisabledVariant,\n active: isDisabled,\n },\n {\n def: config.isCheckedVariant,\n active: state.isSelected,\n },\n {\n def: config.isIndeterminateVariant,\n active: isIndeterminate,\n },\n {\n def: config.noLabelVariant,\n active: !children,\n }\n ),\n };\n const overrides: Overrides = {\n [config.root]: {\n as: \"label\",\n props: mergeProps(getStyleProps(props), {\n ref: rootRef,\n }),\n wrapChildren: (children) => (\n <>\n <VisuallyHidden isFocusable>\n <input {...inputProps} ref={inputRef} />\n </VisuallyHidden>\n {children}\n </>\n ),\n },\n };\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n ...(config.labelSlot ? { [config.labelSlot]: children } : {}),\n };\n\n const plumeState: CheckboxState = React.useMemo(\n () => ({\n setChecked: (checked: boolean) => state.setSelected(checked),\n }),\n [state]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n getRoot: () => rootRef.current,\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n setChecked: (checked) => plumeState.setChecked(checked),\n }),\n [rootRef, inputRef, plumeState]\n );\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n args: args as PlasmicClassArgs<C>,\n },\n state: plumeState,\n };\n}\n"],"names":["useAriaCheckbox"],"mappings":";;;;;;;;;;AAmDA,SAAS,mBAAmB,CAAC,KAAoB;IAC/C,IAAM,SAAS,yBACV,KAAK,KACR,UAAU,EAAE,KAAK,CAAC,SAAS,EAC3B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 import { useMenu as useMenu$1, useMenuSection, useSeparator, useMenuItem as useM
|
|
|
4
4
|
import { useTreeState } from 'react-stately';
|
|
5
5
|
import { m as mergeProps } from '../../react-utils-7c01e440.js';
|
|
6
6
|
import { a as useEnsureSSRProvider } from '../../ssr-d2fd94f2.js';
|
|
7
|
-
import { r as renderCollectionNode, u as useDerivedItemsFromChildren, a as renderAsCollectionChild } from '../../collection-utils-
|
|
8
|
-
import {
|
|
7
|
+
import { r as renderCollectionNode, u as useDerivedItemsFromChildren, a as renderAsCollectionChild } from '../../collection-utils-3487dd27.js';
|
|
8
|
+
import { n as noOutline, m as mergeVariantToggles } from '../../plume-utils-27cd384f.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-7c02c0a8.js';
|
|
9
10
|
import { T as TriggeredOverlayContext } from '../../context-034b8d25.js';
|
|
10
11
|
import 'classnames';
|
|
11
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/plume/menu/context.tsx","../../../../src/plume/menu/menu.tsx","../../../../src/plume/menu/menu-group.tsx","../../../../src/plume/menu/menu-item.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { TreeState } from \"react-stately\";\nimport { BaseMenuProps } from \"./menu\";\n\nexport interface MenuContextValue {\n menuProps: BaseMenuProps;\n state: TreeState<any>;\n}\n\nexport const MenuContext = React.createContext<MenuContextValue | undefined>(\n undefined\n);\n","import { AriaMenuProps } from \"@react-types/menu\";\nimport { AriaLabelingProps, DOMProps } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenu as useAriaMenu } from \"react-aria\";\nimport { useTreeState } from \"react-stately\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { useEnsureSSRProvider } from \"../../render/ssr\";\nimport {\n renderAsCollectionChild,\n renderCollectionNode,\n useDerivedItemsFromChildren,\n} from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n noOutline,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n VariantDef,\n} from \"../plume-utils\";\nimport { getStyleProps, StyleProps } from \"../props-utils\";\nimport { TriggeredOverlayContext } from \"../triggered-overlay/context\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuProps extends DOMProps, AriaLabelingProps, StyleProps {\n /**\n * List of `Menu.Item`s or `Menu.Group`s that make up the menu\n */\n children?: React.ReactNode;\n\n /**\n * Called with the value of a `Menu.Item` when it is selected.\n */\n onAction?: (value: string) => void;\n}\n\nexport type MenuRef = React.Ref<MenuRefValue>;\nexport interface MenuRefValue extends MenuState {\n getRoot: () => HTMLElement | null;\n}\n\nconst COLLECTION_OPTS = {\n itemPlumeType: \"menu-item\",\n sectionPlumeType: \"menu-group\",\n};\n\nexport interface MenuConfig<C extends AnyPlasmicClass> {\n isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;\n\n itemsSlot: keyof PlasmicClassArgs<C>;\n itemsContainer: keyof PlasmicClassOverrides<C>;\n root: keyof PlasmicClassOverrides<C>;\n}\n\n/**\n * Converts props from BaseMenuProps to react-aria's useMenu() props.\n */\nfunction asAriaMenuProps(props: BaseMenuProps) {\n const { children, ...rest } = props;\n const { items, disabledKeys } = useDerivedItemsFromChildren(children, {\n ...COLLECTION_OPTS,\n invalidChildError: `Can only use Menu.Item and Menu.Group as children to Menu`,\n requireItemValue: false,\n });\n\n const collectionChildRenderer = React.useCallback(\n (child) => renderAsCollectionChild(child, COLLECTION_OPTS),\n []\n );\n\n return {\n ariaProps: {\n ...rest,\n children: collectionChildRenderer,\n items,\n disabledKeys,\n } as AriaMenuProps<any>,\n };\n}\n\nexport interface MenuState {\n getFocusedValue: () => string | null;\n setFocusedValue: (value: string) => void;\n}\n\nexport function useMenu<P extends BaseMenuProps, C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: P,\n config: MenuConfig<C>,\n ref: MenuRef = null\n) {\n useEnsureSSRProvider();\n const { ariaProps } = asAriaMenuProps(props);\n const triggerContext = React.useContext(TriggeredOverlayContext);\n const rootRef = React.useRef<HTMLElement>(null);\n\n const state = useTreeState(ariaProps);\n\n const menuListRef = React.useRef<HTMLUListElement>(null);\n\n const { menuProps } = useAriaMenu(\n {\n ...ariaProps,\n autoFocus: triggerContext?.autoFocus,\n },\n state,\n menuListRef\n );\n\n const contextValue = React.useMemo(\n () => ({ state, menuProps: props }),\n [state, props]\n );\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n };\n\n const overrides: Overrides = {\n [config.root]: {\n props: mergeProps(getStyleProps(props), {\n ref: rootRef,\n }),\n },\n [config.itemsContainer]: {\n as: \"ul\",\n props: mergeProps(menuProps, {\n ref: menuListRef,\n style: {\n ...noOutline(),\n },\n }),\n },\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.itemsSlot]: (\n <MenuContext.Provider value={contextValue}>\n {Array.from(state.collection).map((node) => renderCollectionNode(node))}\n </MenuContext.Provider>\n ),\n };\n\n const plumeState: MenuState = React.useMemo(\n () => ({\n getFocusedValue: () => state.selectionManager.focusedKey as string | null,\n setFocusedValue: (value: string) =>\n state.selectionManager.setFocusedKey(value),\n }),\n [state]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n getRoot: () => rootRef.current,\n getFocusedValue: () => plumeState.getFocusedValue(),\n setFocusedValue: (key) => plumeState.setFocusedValue(key),\n }),\n [rootRef, plumeState]\n );\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n state: plumeState,\n };\n}\n","import { Node } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenuSection, useSeparator } from \"react-aria\";\nimport { pick } from \"../../common\";\nimport { Overrides } from \"../../render/elements\";\nimport { renderCollectionNode, SectionLikeProps } from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n PLUME_STRICT_MODE,\n} from \"../plume-utils\";\nimport {\n getDefaultPlasmicProps,\n getStyleProps,\n StyleProps,\n} from \"../props-utils\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuGroupProps extends SectionLikeProps, StyleProps {}\n\ninterface MenuGroupConfig<C extends AnyPlasmicClass> {\n noTitleVariant: PlasmicClassVariants<C>;\n isFirstVariant: PlasmicClassVariants<C>;\n\n itemsSlot: keyof PlasmicClassArgs<C>;\n titleSlot: keyof PlasmicClassArgs<C>;\n\n root: keyof PlasmicClassOverrides<C>;\n separator: keyof PlasmicClassOverrides<C>;\n titleContainer: keyof PlasmicClassOverrides<C>;\n itemsContainer: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useMenuGroup<\n P extends BaseMenuGroupProps,\n C extends AnyPlasmicClass\n>(plasmicClass: C, props: P, config: MenuGroupConfig<C>) {\n const context = React.useContext(MenuContext);\n\n const node = (props as any)._node as\n | Node<React.ReactElement<BaseMenuGroupProps>>\n | undefined;\n\n if (!context || !node) {\n if (PLUME_STRICT_MODE) {\n throw new Error(\"You can only use a Menu.Group within a Menu component.\");\n }\n return getDefaultPlasmicProps(plasmicClass, props);\n }\n\n const { headingProps, groupProps } = useMenuSection({\n heading: props.title,\n \"aria-label\": props[\"aria-label\"],\n });\n\n const { separatorProps } = useSeparator({\n elementType: \"li\",\n });\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n { def: config.noTitleVariant, active: !props.title },\n {\n def: config.isFirstVariant,\n active: context.state.collection.getFirstKey() === node.key,\n }\n ),\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.titleSlot]: props.title,\n [config.itemsSlot]: Array.from(node.childNodes).map((childNode) =>\n renderCollectionNode(childNode)\n ),\n };\n\n const overrides: Overrides = {\n [config.root]: {\n props: getStyleProps(props),\n },\n [config.separator]: {\n props: {\n ...separatorProps,\n },\n as: \"li\",\n },\n [config.titleContainer]: {\n props: {\n role: \"presentation\",\n ...headingProps,\n },\n ...(!props.title && {\n render: () => null,\n }),\n },\n [config.itemsContainer]: {\n props: {\n ...groupProps,\n },\n as: \"ul\",\n },\n };\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n };\n}\n","import { Node } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenuItem as useAriaMenuItem } from \"react-aria\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { ItemLikeProps } from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n noOutline,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n PLUME_STRICT_MODE,\n VariantDef,\n} from \"../plume-utils\";\nimport { getDefaultPlasmicProps } from \"../props-utils\";\nimport { TriggeredOverlayContext } from \"../triggered-overlay/context\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuItemProps extends ItemLikeProps {\n /**\n * Called when this item is selected\n */\n onAction?: (key: string) => void;\n}\n\ninterface MenuItemConfig<C extends AnyPlasmicClass> {\n isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;\n isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;\n\n labelSlot: keyof PlasmicClassArgs<C>;\n\n root: keyof PlasmicClassOverrides<C>;\n labelContainer: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useMenuItem<\n P extends BaseMenuItemProps,\n C extends AnyPlasmicClass\n>(plasmicClass: C, props: P, config: MenuItemConfig<C>) {\n const menuContext = React.useContext(MenuContext);\n const triggerContext = React.useContext(TriggeredOverlayContext);\n\n if (!menuContext) {\n if (PLUME_STRICT_MODE) {\n throw new Error(\"You can only use a Menu.Item within a Menu component.\");\n }\n\n return getDefaultPlasmicProps(plasmicClass, props);\n }\n\n const { children, onAction } = props;\n\n const { state, menuProps } = menuContext;\n\n // We pass in the Node secretly as an undocumented prop from <Select />\n const node = (props as any)._node as Node<\n React.ReactElement<BaseMenuItemProps>\n >;\n\n const isDisabled = state.disabledKeys.has(node.key);\n const isHighlighted =\n state.selectionManager.isFocused &&\n state.selectionManager.focusedKey === node.key;\n\n const ref = React.useRef<HTMLLIElement>(null);\n\n const { menuItemProps, labelProps } = useAriaMenuItem(\n mergeProps(\n {\n // We need to merge both the onAction on MenuItem and the onAction\n // on Menu\n onAction,\n },\n {\n onAction: menuProps.onAction,\n onClose: triggerContext?.state.close,\n },\n {\n isDisabled,\n \"aria-label\": node && node[\"aria-label\"],\n key: node.key,\n isVirtualized: false,\n closeOnSelect: true,\n }\n ),\n state,\n ref\n );\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n { def: config.isDisabledVariant, active: isDisabled },\n { def: config.isHighlightedVariant, active: isHighlighted }\n ),\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.labelSlot]: children,\n };\n\n const overrides: Overrides = {\n [config.root]: {\n as: \"li\",\n props: mergeProps(menuItemProps, { ref, style: noOutline() }),\n },\n [config.labelContainer]: {\n props: { ...labelProps },\n },\n };\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n };\n}\n"],"names":["useAriaMenu","useAriaMenuItem"],"mappings":";;;;;;;;;;;AASO,IAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAC5C,SAAS,CACV;;ACgCD,IAAM,eAAe,GAAG;IACtB,aAAa,EAAE,WAAW;IAC1B,gBAAgB,EAAE,YAAY;CAC/B,CAAC;AAaF;;;AAGA,SAAS,eAA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AI,IAAG;YACb,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,EAAE,GAAG,KAAA,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC;SAC9D;QACD,GAAC,MAAM,CAAC,cAAc,IAAG;YACvB,KAAK,eAAO,UAAU,CAAE;SACzB;WACF,CAAC;IAEF,OAAO;QACL,YAAY,EAAE;YACZ,QAAQ,EAAE,QAAmC;YAC7C,IAAI,EAAE,IAA2B;YACjC,SAAS,EAAE,SAAqC;SACjD;KACF,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/plume/menu/context.tsx","../../../../src/plume/menu/menu.tsx","../../../../src/plume/menu/menu-group.tsx","../../../../src/plume/menu/menu-item.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { TreeState } from \"react-stately\";\nimport { BaseMenuProps } from \"./menu\";\n\nexport interface MenuContextValue {\n menuProps: BaseMenuProps;\n state: TreeState<any>;\n}\n\nexport const MenuContext = React.createContext<MenuContextValue | undefined>(\n undefined\n);\n","import { AriaMenuProps } from \"@react-types/menu\";\nimport { AriaLabelingProps, DOMProps } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenu as useAriaMenu } from \"react-aria\";\nimport { useTreeState } from \"react-stately\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { useEnsureSSRProvider } from \"../../render/ssr\";\nimport {\n renderAsCollectionChild,\n renderCollectionNode,\n useDerivedItemsFromChildren,\n} from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n noOutline,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n VariantDef,\n} from \"../plume-utils\";\nimport { getStyleProps, StyleProps } from \"../props-utils\";\nimport { TriggeredOverlayContext } from \"../triggered-overlay/context\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuProps extends DOMProps, AriaLabelingProps, StyleProps {\n /**\n * List of `Menu.Item`s or `Menu.Group`s that make up the menu\n */\n children?: React.ReactNode;\n\n /**\n * Called with the value of a `Menu.Item` when it is selected.\n */\n onAction?: (value: string) => void;\n}\n\nexport type MenuRef = React.Ref<MenuRefValue>;\nexport interface MenuRefValue extends MenuState {\n getRoot: () => HTMLElement | null;\n}\n\nconst COLLECTION_OPTS = {\n itemPlumeType: \"menu-item\",\n sectionPlumeType: \"menu-group\",\n};\n\nexport interface MenuConfig<C extends AnyPlasmicClass> {\n isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;\n isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;\n\n itemsSlot: keyof PlasmicClassArgs<C>;\n itemsContainer: keyof PlasmicClassOverrides<C>;\n root: keyof PlasmicClassOverrides<C>;\n}\n\n/**\n * Converts props from BaseMenuProps to react-aria's useMenu() props.\n */\nfunction asAriaMenuProps(props: BaseMenuProps) {\n const { children, ...rest } = props;\n const { items, disabledKeys } = useDerivedItemsFromChildren(children, {\n ...COLLECTION_OPTS,\n invalidChildError: `Can only use Menu.Item and Menu.Group as children to Menu`,\n requireItemValue: false,\n });\n\n const collectionChildRenderer = React.useCallback(\n (child) => renderAsCollectionChild(child, COLLECTION_OPTS),\n []\n );\n\n return {\n ariaProps: {\n ...rest,\n children: collectionChildRenderer,\n items,\n disabledKeys,\n } as AriaMenuProps<any>,\n };\n}\n\nexport interface MenuState {\n getFocusedValue: () => string | null;\n setFocusedValue: (value: string) => void;\n}\n\nexport function useMenu<P extends BaseMenuProps, C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: P,\n config: MenuConfig<C>,\n ref: MenuRef = null\n) {\n useEnsureSSRProvider();\n const { ariaProps } = asAriaMenuProps(props);\n const triggerContext = React.useContext(TriggeredOverlayContext);\n const rootRef = React.useRef<HTMLElement>(null);\n\n const state = useTreeState(ariaProps);\n\n const menuListRef = React.useRef<HTMLUListElement>(null);\n\n const { menuProps } = useAriaMenu(\n {\n ...ariaProps,\n autoFocus: triggerContext?.autoFocus,\n },\n state,\n menuListRef\n );\n\n const contextValue = React.useMemo(\n () => ({ state, menuProps: props }),\n [state, props]\n );\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n };\n\n const overrides: Overrides = {\n [config.root]: {\n props: mergeProps(getStyleProps(props), {\n ref: rootRef,\n }),\n },\n [config.itemsContainer]: {\n as: \"ul\",\n props: mergeProps(menuProps, {\n ref: menuListRef,\n style: {\n ...noOutline(),\n },\n }),\n },\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.itemsSlot]: (\n <MenuContext.Provider value={contextValue}>\n {Array.from(state.collection).map((node) => renderCollectionNode(node))}\n </MenuContext.Provider>\n ),\n };\n\n const plumeState: MenuState = React.useMemo(\n () => ({\n getFocusedValue: () => state.selectionManager.focusedKey as string | null,\n setFocusedValue: (value: string) =>\n state.selectionManager.setFocusedKey(value),\n }),\n [state]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n getRoot: () => rootRef.current,\n getFocusedValue: () => plumeState.getFocusedValue(),\n setFocusedValue: (key) => plumeState.setFocusedValue(key),\n }),\n [rootRef, plumeState]\n );\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n state: plumeState,\n };\n}\n","import { Node } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenuSection, useSeparator } from \"react-aria\";\nimport { pick } from \"../../common\";\nimport { Overrides } from \"../../render/elements\";\nimport { renderCollectionNode, SectionLikeProps } from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n PLUME_STRICT_MODE,\n} from \"../plume-utils\";\nimport {\n getDefaultPlasmicProps,\n getStyleProps,\n StyleProps,\n} from \"../props-utils\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuGroupProps extends SectionLikeProps, StyleProps {}\n\ninterface MenuGroupConfig<C extends AnyPlasmicClass> {\n noTitleVariant: PlasmicClassVariants<C>;\n isFirstVariant: PlasmicClassVariants<C>;\n\n itemsSlot: keyof PlasmicClassArgs<C>;\n titleSlot: keyof PlasmicClassArgs<C>;\n\n root: keyof PlasmicClassOverrides<C>;\n separator: keyof PlasmicClassOverrides<C>;\n titleContainer: keyof PlasmicClassOverrides<C>;\n itemsContainer: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useMenuGroup<\n P extends BaseMenuGroupProps,\n C extends AnyPlasmicClass\n>(plasmicClass: C, props: P, config: MenuGroupConfig<C>) {\n const context = React.useContext(MenuContext);\n\n const node = (props as any)._node as\n | Node<React.ReactElement<BaseMenuGroupProps>>\n | undefined;\n\n if (!context || !node) {\n if (PLUME_STRICT_MODE) {\n throw new Error(\"You can only use a Menu.Group within a Menu component.\");\n }\n return getDefaultPlasmicProps(plasmicClass, props);\n }\n\n const { headingProps, groupProps } = useMenuSection({\n heading: props.title,\n \"aria-label\": props[\"aria-label\"],\n });\n\n const { separatorProps } = useSeparator({\n elementType: \"li\",\n });\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n { def: config.noTitleVariant, active: !props.title },\n {\n def: config.isFirstVariant,\n active: context.state.collection.getFirstKey() === node.key,\n }\n ),\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.titleSlot]: props.title,\n [config.itemsSlot]: Array.from(node.childNodes).map((childNode) =>\n renderCollectionNode(childNode)\n ),\n };\n\n const overrides: Overrides = {\n [config.root]: {\n props: getStyleProps(props),\n },\n [config.separator]: {\n props: {\n ...separatorProps,\n },\n as: \"li\",\n },\n [config.titleContainer]: {\n props: {\n role: \"presentation\",\n ...headingProps,\n },\n ...(!props.title && {\n render: () => null,\n }),\n },\n [config.itemsContainer]: {\n props: {\n ...groupProps,\n },\n as: \"ul\",\n },\n };\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n };\n}\n","import { Node } from \"@react-types/shared\";\nimport * as React from \"react\";\nimport { useMenuItem as useAriaMenuItem } from \"react-aria\";\nimport { pick } from \"../../common\";\nimport { mergeProps } from \"../../react-utils\";\nimport { Overrides } from \"../../render/elements\";\nimport { ItemLikeProps } from \"../collection-utils\";\nimport {\n AnyPlasmicClass,\n mergeVariantToggles,\n noOutline,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n PLUME_STRICT_MODE,\n VariantDef,\n} from \"../plume-utils\";\nimport { getDefaultPlasmicProps } from \"../props-utils\";\nimport { TriggeredOverlayContext } from \"../triggered-overlay/context\";\nimport { MenuContext } from \"./context\";\n\nexport interface BaseMenuItemProps extends ItemLikeProps {\n /**\n * Called when this item is selected\n */\n onAction?: (key: string) => void;\n}\n\ninterface MenuItemConfig<C extends AnyPlasmicClass> {\n isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;\n isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;\n\n labelSlot: keyof PlasmicClassArgs<C>;\n\n root: keyof PlasmicClassOverrides<C>;\n labelContainer: keyof PlasmicClassOverrides<C>;\n}\n\nexport function useMenuItem<\n P extends BaseMenuItemProps,\n C extends AnyPlasmicClass\n>(plasmicClass: C, props: P, config: MenuItemConfig<C>) {\n const menuContext = React.useContext(MenuContext);\n const triggerContext = React.useContext(TriggeredOverlayContext);\n\n if (!menuContext) {\n if (PLUME_STRICT_MODE) {\n throw new Error(\"You can only use a Menu.Item within a Menu component.\");\n }\n\n return getDefaultPlasmicProps(plasmicClass, props);\n }\n\n const { children, onAction } = props;\n\n const { state, menuProps } = menuContext;\n\n // We pass in the Node secretly as an undocumented prop from <Select />\n const node = (props as any)._node as Node<\n React.ReactElement<BaseMenuItemProps>\n >;\n\n const isDisabled = state.disabledKeys.has(node.key);\n const isHighlighted =\n state.selectionManager.isFocused &&\n state.selectionManager.focusedKey === node.key;\n\n const ref = React.useRef<HTMLLIElement>(null);\n\n const { menuItemProps, labelProps } = useAriaMenuItem(\n mergeProps(\n {\n // We need to merge both the onAction on MenuItem and the onAction\n // on Menu\n onAction,\n },\n {\n onAction: menuProps.onAction,\n onClose: triggerContext?.state.close,\n },\n {\n isDisabled,\n \"aria-label\": node && node[\"aria-label\"],\n key: node.key,\n isVirtualized: false,\n closeOnSelect: true,\n }\n ),\n state,\n ref\n );\n\n const variants = {\n ...pick(props, ...plasmicClass.internalVariantProps),\n ...mergeVariantToggles(\n { def: config.isDisabledVariant, active: isDisabled },\n { def: config.isHighlightedVariant, active: isHighlighted }\n ),\n };\n\n const args = {\n ...pick(props, ...plasmicClass.internalArgProps),\n [config.labelSlot]: children,\n };\n\n const overrides: Overrides = {\n [config.root]: {\n as: \"li\",\n props: mergeProps(menuItemProps, { ref, style: noOutline() }),\n },\n [config.labelContainer]: {\n props: { ...labelProps },\n },\n };\n\n return {\n plasmicProps: {\n variants: variants as PlasmicClassVariants<C>,\n args: args as PlasmicClassArgs<C>,\n overrides: overrides as PlasmicClassOverrides<C>,\n },\n };\n}\n"],"names":["useAriaMenu","useAriaMenuItem"],"mappings":";;;;;;;;;;;;AASO,IAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAC5C,SAAS,CACV;;ACgCD,IAAM,eAAe,GAAG;IACtB,aAAa,EAAE,WAAW;IAC1B,gBAAgB,EAAE,YAAY;CAC/B,CAAC;AAaF;;;AAGA,SAAS,eAAe,CAAC,KAAoB;IACnC,IAAA,QAAQ,GAAc,KAAK,SAAnB,EAAK,IAAI,UAAK,KAAK,EAA7B,YAAqB,CAAF,CAAW;IAC9B,IAAA,KAA0B,2BAA2B,CAAC,QAAQ,wBAC/D,eAAe,KAClB,iBAAiB,EAAE,2DAA2D,EAC9E,gBAAgB,EAAE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;WACF,CAAC;IAEF,OAAO;QACL,YAAY,EAAE;YACZ,QAAQ,EAAE,QAAmC;YAC7C,IAAI,EAAE,IAA2B;YACjC,SAAS,EAAE,SAAqC;SACjD;KACF,CAAC;AACJ;;;;"}
|
|
@@ -4,8 +4,9 @@ import { m as mergeProps } from '../../react-utils-7c01e440.js';
|
|
|
4
4
|
import { T as TriggeredOverlayContext } from '../../context-034b8d25.js';
|
|
5
5
|
import { a as __assign, p as pick, b as __spreadArray } from '../../tslib.es6-d26ffe68.js';
|
|
6
6
|
import { useMenuTrigger as useMenuTrigger$1, usePress, useFocusable } from 'react-aria';
|
|
7
|
-
import {
|
|
7
|
+
import { g as getPlumeType, m as mergeVariantToggles } from '../../plume-utils-27cd384f.js';
|
|
8
8
|
import { a as useEnsureSSRProvider } from '../../ssr-d2fd94f2.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-7c02c0a8.js';
|
|
9
10
|
import 'classnames';
|
|
10
11
|
|
|
11
12
|
/**
|