@sproutsocial/seeds-react-menu 1.7.2 → 1.7.6
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/.turbo/turbo-build.log +19 -11
- package/BUNDLE_OPTIMIZATION.md +307 -0
- package/CHANGELOG.md +45 -0
- package/dist/esm/chunk-ROQATIB7.js +357 -0
- package/dist/esm/chunk-ROQATIB7.js.map +1 -0
- package/dist/esm/index.js +261 -2272
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v2/index.js +2000 -0
- package/dist/esm/v2/index.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +297 -1990
- package/dist/index.js.map +1 -1
- package/dist/v2/index.d.mts +96 -0
- package/dist/v2/index.d.ts +96 -0
- package/dist/v2/index.js +2191 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +30 -14
- package/src/MenuItem/styles.tsx +7 -0
- package/src/MenuRoot/MenuRoot.tsx +0 -1
- package/src/v2/Autocomplete/Autocomplete.stories.tsx +609 -0
- package/src/v2/Autocomplete/MultiAutocomplete.tsx +453 -0
- package/src/v2/Autocomplete/SingleAutocomplete.tsx +362 -0
- package/src/v2/Autocomplete/index.ts +2 -0
- package/src/v2/Common-V2/ComboboxContent.tsx +448 -0
- package/src/v2/Common-V2/MenuGroup.tsx +60 -0
- package/src/v2/Common-V2/MenuGroupTypes.ts +30 -0
- package/src/v2/Common-V2/MenuHeading.tsx +83 -0
- package/src/v2/Common-V2/MenuItem.tsx +138 -0
- package/src/v2/Common-V2/Popout.tsx +102 -0
- package/src/v2/Common-V2/PopoutTypes.tsx +92 -0
- package/src/v2/Common-V2/SelectToggleButton.tsx +99 -0
- package/src/v2/Common-V2/index.ts +11 -0
- package/src/v2/Common-V2/props.ts +74 -0
- package/src/v2/Common-V2/styles.tsx +41 -0
- package/src/v2/Common-V2/types.ts +16 -0
- package/src/v2/Common-V2/useHighlightedIndex.ts +62 -0
- package/src/v2/Common-V2/utils.ts +238 -0
- package/src/v2/SearchableSelect/AutocompleteContent.tsx +325 -0
- package/src/v2/SearchableSelect/SearchableMultiSelect.tsx +521 -0
- package/src/v2/SearchableSelect/SearchableSelect.tsx +389 -0
- package/src/v2/SearchableSelect/index.ts +12 -0
- package/src/v2/Select/MultiSelect.tsx +404 -0
- package/src/v2/Select/Select.stories.tsx +593 -0
- package/src/v2/Select/SingleSelect.tsx +272 -0
- package/src/v2/Select/index.ts +2 -0
- package/src/v2/index.ts +2 -0
- package/tsup.config.ts +14 -5
package/dist/esm/index.js
CHANGED
|
@@ -1,1891 +1,47 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../node_modules/object-assign/index.js
|
|
28
|
-
var require_object_assign = __commonJS({
|
|
29
|
-
"../../node_modules/object-assign/index.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
32
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
33
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
34
|
-
function toObject(val) {
|
|
35
|
-
if (val === null || val === void 0) {
|
|
36
|
-
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
37
|
-
}
|
|
38
|
-
return Object(val);
|
|
39
|
-
}
|
|
40
|
-
function shouldUseNative() {
|
|
41
|
-
try {
|
|
42
|
-
if (!Object.assign) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
var test1 = new String("abc");
|
|
46
|
-
test1[5] = "de";
|
|
47
|
-
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
var test2 = {};
|
|
51
|
-
for (var i = 0; i < 10; i++) {
|
|
52
|
-
test2["_" + String.fromCharCode(i)] = i;
|
|
53
|
-
}
|
|
54
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
55
|
-
return test2[n];
|
|
56
|
-
});
|
|
57
|
-
if (order2.join("") !== "0123456789") {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var test3 = {};
|
|
61
|
-
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
62
|
-
test3[letter] = letter;
|
|
63
|
-
});
|
|
64
|
-
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
} catch (err) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
module.exports = shouldUseNative() ? Object.assign : function(target, source) {
|
|
73
|
-
var from;
|
|
74
|
-
var to = toObject(target);
|
|
75
|
-
var symbols;
|
|
76
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
77
|
-
from = Object(arguments[s]);
|
|
78
|
-
for (var key in from) {
|
|
79
|
-
if (hasOwnProperty.call(from, key)) {
|
|
80
|
-
to[key] = from[key];
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (getOwnPropertySymbols) {
|
|
84
|
-
symbols = getOwnPropertySymbols(from);
|
|
85
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
86
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
87
|
-
to[symbols[i]] = from[symbols[i]];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return to;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// src/MenuContext.tsx
|
|
98
|
-
import React, { createContext, useMemo, useContext } from "react";
|
|
99
|
-
import { jsx } from "react/jsx-runtime";
|
|
100
|
-
var defaultMenuContext = {
|
|
101
|
-
items: [],
|
|
102
|
-
itemsMap: {},
|
|
103
|
-
isItemSelected: () => false,
|
|
104
|
-
getInputComponentProps: () => ({}),
|
|
105
|
-
hasVisibleItems: false,
|
|
106
|
-
isInitialized: false
|
|
107
|
-
};
|
|
108
|
-
var getSelectedItemIds = (selectedItems) => selectedItems?.reduce(
|
|
109
|
-
(selected, item) => ({ ...selected, [item.id]: true }),
|
|
110
|
-
{}
|
|
111
|
-
);
|
|
112
|
-
var checkIfItemSelected = ({
|
|
113
|
-
id,
|
|
114
|
-
selectedItem,
|
|
115
|
-
selectedItemIds
|
|
116
|
-
}) => selectedItemIds ? !!selectedItemIds[id] : selectedItem?.id === id;
|
|
117
|
-
var useMenu = ({
|
|
118
|
-
items = [],
|
|
119
|
-
isListbox = false,
|
|
120
|
-
isOpen = false,
|
|
121
|
-
itemsMap: itemsMapFromProps,
|
|
122
|
-
selectedItemIds: selectedItemIdsFromProps,
|
|
123
|
-
selectedItem,
|
|
124
|
-
selectedItems,
|
|
125
|
-
getInputProps,
|
|
126
|
-
contentRef: contentRefFromProps,
|
|
127
|
-
autoCloseOnEmpty,
|
|
128
|
-
hiddenItemsCount,
|
|
129
|
-
...rest
|
|
130
|
-
} = {}) => {
|
|
131
|
-
const contentRef = contentRefFromProps || React.createRef();
|
|
132
|
-
const menuProps = useMemo(() => ({ ...rest }), [rest]);
|
|
133
|
-
const itemsMap = useMemo(
|
|
134
|
-
() => itemsMapFromProps || items.reduce((map, item) => {
|
|
135
|
-
map[`${item.id}`] = {
|
|
136
|
-
...item
|
|
137
|
-
};
|
|
138
|
-
return map;
|
|
139
|
-
}, {}),
|
|
140
|
-
[items, itemsMapFromProps]
|
|
141
|
-
);
|
|
142
|
-
const selectedItemIds = useMemo(
|
|
143
|
-
() => selectedItemIdsFromProps || getSelectedItemIds(selectedItems),
|
|
144
|
-
[selectedItems, selectedItemIdsFromProps]
|
|
145
|
-
);
|
|
146
|
-
const isItemSelected = React.useCallback(
|
|
147
|
-
(id) => checkIfItemSelected({ id, selectedItem, selectedItemIds }),
|
|
148
|
-
[selectedItem?.id, selectedItemIds]
|
|
149
|
-
);
|
|
150
|
-
const getInputComponentProps = React.useCallback(
|
|
151
|
-
({ inputProps, ...props }) => {
|
|
152
|
-
if (!getInputProps) return {};
|
|
153
|
-
const {
|
|
154
|
-
["aria-activedescendant"]: activedescendant,
|
|
155
|
-
["aria-autocomplete"]: autocomplete,
|
|
156
|
-
["aria-controls"]: controls,
|
|
157
|
-
["aria-expanded"]: expanded,
|
|
158
|
-
["aria-labelledby"]: labelledby,
|
|
159
|
-
role,
|
|
160
|
-
autoComplete,
|
|
161
|
-
onClick,
|
|
162
|
-
value,
|
|
163
|
-
...restProps
|
|
164
|
-
} = getInputProps(props);
|
|
165
|
-
return {
|
|
166
|
-
...restProps,
|
|
167
|
-
inputProps: {
|
|
168
|
-
["aria-activedescendant"]: activedescendant,
|
|
169
|
-
["aria-autocomplete"]: autocomplete,
|
|
170
|
-
["aria-controls"]: controls,
|
|
171
|
-
["aria-expanded"]: expanded,
|
|
172
|
-
["aria-labelledby"]: labelledby,
|
|
173
|
-
role,
|
|
174
|
-
autoComplete,
|
|
175
|
-
onClick,
|
|
176
|
-
value,
|
|
177
|
-
...inputProps
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
},
|
|
181
|
-
[getInputProps]
|
|
182
|
-
);
|
|
183
|
-
const hasVisibleItems = useMemo(() => {
|
|
184
|
-
return (hiddenItemsCount ?? 0) < items.length;
|
|
185
|
-
}, [items, hiddenItemsCount]);
|
|
186
|
-
return {
|
|
187
|
-
isOpen,
|
|
188
|
-
isListbox,
|
|
189
|
-
items,
|
|
190
|
-
itemsMap,
|
|
191
|
-
selectedItem,
|
|
192
|
-
selectedItems,
|
|
193
|
-
selectedItemIds,
|
|
194
|
-
isItemSelected,
|
|
195
|
-
getInputProps,
|
|
196
|
-
getInputComponentProps,
|
|
197
|
-
contentRef,
|
|
198
|
-
hasVisibleItems,
|
|
199
|
-
autoCloseOnEmpty,
|
|
200
|
-
isInitialized: true,
|
|
201
|
-
...menuProps
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
var MenuToggleContext = createContext(defaultMenuContext);
|
|
205
|
-
var MenuToggleProvider = ({
|
|
206
|
-
children,
|
|
207
|
-
menuContext
|
|
208
|
-
}) => {
|
|
209
|
-
return /* @__PURE__ */ jsx(MenuToggleContext.Provider, { value: { ...menuContext }, children });
|
|
210
|
-
};
|
|
211
|
-
var useMenuToggleContext = () => {
|
|
212
|
-
const menuContextValue = useContext(MenuToggleContext);
|
|
213
|
-
if (menuContextValue === null) {
|
|
214
|
-
throw new Error(
|
|
215
|
-
"useMenuToggleContext must be used within a <MenuToggleContext.Provider />"
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
return menuContextValue;
|
|
219
|
-
};
|
|
220
|
-
var MenuContentContext = createContext(defaultMenuContext);
|
|
221
|
-
var MenuContentProvider = ({
|
|
222
|
-
children,
|
|
223
|
-
menuContext
|
|
224
|
-
}) => {
|
|
225
|
-
return /* @__PURE__ */ jsx(MenuContentContext.Provider, { value: { ...menuContext }, children });
|
|
226
|
-
};
|
|
227
|
-
var useMenuContentContext = () => {
|
|
228
|
-
const menuContextValue = useContext(MenuContentContext);
|
|
229
|
-
if (menuContextValue === null) {
|
|
230
|
-
throw new Error(
|
|
231
|
-
"useMenuContentContext must be used within a <MenuContentContext.Provider />"
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
return menuContextValue;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
// src/MenuItem/styles.tsx
|
|
238
|
-
import styled, { css as css4 } from "styled-components";
|
|
239
|
-
|
|
240
|
-
// ../../node_modules/@babel/runtime/helpers/esm/extends.js
|
|
241
|
-
function _extends() {
|
|
242
|
-
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
243
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
244
|
-
var t = arguments[e];
|
|
245
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
246
|
-
}
|
|
247
|
-
return n;
|
|
248
|
-
}, _extends.apply(null, arguments);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
252
|
-
function _assertThisInitialized(e) {
|
|
253
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
254
|
-
return e;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
258
|
-
function _setPrototypeOf(t, e) {
|
|
259
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
|
|
260
|
-
return t2.__proto__ = e2, t2;
|
|
261
|
-
}, _setPrototypeOf(t, e);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
265
|
-
function _inheritsLoose(t, o) {
|
|
266
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
|
|
270
|
-
function _getPrototypeOf(t) {
|
|
271
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
|
|
272
|
-
return t2.__proto__ || Object.getPrototypeOf(t2);
|
|
273
|
-
}, _getPrototypeOf(t);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
|
|
277
|
-
function _isNativeFunction(t) {
|
|
278
|
-
try {
|
|
279
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
280
|
-
} catch (n) {
|
|
281
|
-
return "function" == typeof t;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// ../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
|
|
286
|
-
function _isNativeReflectConstruct() {
|
|
287
|
-
try {
|
|
288
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
289
|
-
}));
|
|
290
|
-
} catch (t2) {
|
|
291
|
-
}
|
|
292
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
|
|
293
|
-
return !!t;
|
|
294
|
-
})();
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// ../../node_modules/@babel/runtime/helpers/esm/construct.js
|
|
298
|
-
function _construct(t, e, r) {
|
|
299
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
300
|
-
var o = [null];
|
|
301
|
-
o.push.apply(o, e);
|
|
302
|
-
var p = new (t.bind.apply(t, o))();
|
|
303
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
|
|
307
|
-
function _wrapNativeSuper(t) {
|
|
308
|
-
var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
|
|
309
|
-
return _wrapNativeSuper = function _wrapNativeSuper2(t2) {
|
|
310
|
-
if (null === t2 || !_isNativeFunction(t2)) return t2;
|
|
311
|
-
if ("function" != typeof t2) throw new TypeError("Super expression must either be null or a function");
|
|
312
|
-
if (void 0 !== r) {
|
|
313
|
-
if (r.has(t2)) return r.get(t2);
|
|
314
|
-
r.set(t2, Wrapper);
|
|
315
|
-
}
|
|
316
|
-
function Wrapper() {
|
|
317
|
-
return _construct(t2, arguments, _getPrototypeOf(this).constructor);
|
|
318
|
-
}
|
|
319
|
-
return Wrapper.prototype = Object.create(t2.prototype, {
|
|
320
|
-
constructor: {
|
|
321
|
-
value: Wrapper,
|
|
322
|
-
enumerable: false,
|
|
323
|
-
writable: true,
|
|
324
|
-
configurable: true
|
|
325
|
-
}
|
|
326
|
-
}), _setPrototypeOf(Wrapper, t2);
|
|
327
|
-
}, _wrapNativeSuper(t);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// ../../node_modules/polished/dist/polished.esm.js
|
|
331
|
-
var ERRORS = {
|
|
332
|
-
"1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
|
|
333
|
-
"2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
|
|
334
|
-
"3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
|
|
335
|
-
"4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
|
|
336
|
-
"5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
|
|
337
|
-
"6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
|
|
338
|
-
"7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
|
|
339
|
-
"8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
|
|
340
|
-
"9": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
341
|
-
"10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
342
|
-
"11": 'Invalid value passed as base to modularScale, expected number or em string but got "%s"\n\n',
|
|
343
|
-
"12": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.\n\n',
|
|
344
|
-
"13": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.\n\n',
|
|
345
|
-
"14": 'Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
|
|
346
|
-
"15": 'Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
|
|
347
|
-
"16": "You must provide a template to this method.\n\n",
|
|
348
|
-
"17": "You passed an unsupported selector state to this method.\n\n",
|
|
349
|
-
"18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
350
|
-
"19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
351
|
-
"20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
352
|
-
"21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
353
|
-
"22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
354
|
-
"23": "fontFace expects a name of a font-family.\n\n",
|
|
355
|
-
"24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
356
|
-
"25": "fontFace expects localFonts to be an array.\n\n",
|
|
357
|
-
"26": "fontFace expects fileFormats to be an array.\n\n",
|
|
358
|
-
"27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
359
|
-
"28": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
360
|
-
"29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
361
|
-
"30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
362
|
-
"31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
|
|
363
|
-
"32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
|
|
364
|
-
"33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
|
|
365
|
-
"34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
366
|
-
"35": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
|
|
367
|
-
"36": "Property must be a string value.\n\n",
|
|
368
|
-
"37": "Syntax Error at %s.\n\n",
|
|
369
|
-
"38": "Formula contains a function that needs parentheses at %s.\n\n",
|
|
370
|
-
"39": "Formula is missing closing parenthesis at %s.\n\n",
|
|
371
|
-
"40": "Formula has too many closing parentheses at %s.\n\n",
|
|
372
|
-
"41": "All values in a formula must have the same unit or be unitless.\n\n",
|
|
373
|
-
"42": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
374
|
-
"43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
375
|
-
"44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
|
|
376
|
-
"45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
|
|
377
|
-
"46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
|
|
378
|
-
"47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
379
|
-
"48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
380
|
-
"49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
381
|
-
"50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
|
|
382
|
-
"51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
|
|
383
|
-
"52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
384
|
-
"53": "fontFace expects localFonts to be an array.\n\n",
|
|
385
|
-
"54": "fontFace expects fileFormats to be an array.\n\n",
|
|
386
|
-
"55": "fontFace expects a name of a font-family.\n\n",
|
|
387
|
-
"56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
|
|
388
|
-
"57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
389
|
-
"58": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
390
|
-
"59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
391
|
-
"60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
392
|
-
"61": "Property must be a string value.\n\n",
|
|
393
|
-
"62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
394
|
-
"63": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
|
|
395
|
-
"64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
396
|
-
"65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
|
|
397
|
-
"66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
398
|
-
"67": "You must provide a template to this method.\n\n",
|
|
399
|
-
"68": "You passed an unsupported selector state to this method.\n\n",
|
|
400
|
-
"69": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.\n\n',
|
|
401
|
-
"70": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.\n\n',
|
|
402
|
-
"71": 'Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.\n\n',
|
|
403
|
-
"72": 'Passed invalid base value %s to %s(), please pass a value like "12px" or 12.\n\n',
|
|
404
|
-
"73": "Please provide a valid CSS variable.\n\n",
|
|
405
|
-
"74": "CSS variable not found.\n\n",
|
|
406
|
-
"75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
|
|
407
|
-
};
|
|
408
|
-
function format() {
|
|
409
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
410
|
-
args[_key] = arguments[_key];
|
|
411
|
-
}
|
|
412
|
-
var a = args[0];
|
|
413
|
-
var b = [];
|
|
414
|
-
var c;
|
|
415
|
-
for (c = 1; c < args.length; c += 1) {
|
|
416
|
-
b.push(args[c]);
|
|
417
|
-
}
|
|
418
|
-
b.forEach(function(d) {
|
|
419
|
-
a = a.replace(/%[a-z]/, d);
|
|
420
|
-
});
|
|
421
|
-
return a;
|
|
422
|
-
}
|
|
423
|
-
var PolishedError = /* @__PURE__ */ function(_Error) {
|
|
424
|
-
_inheritsLoose(PolishedError2, _Error);
|
|
425
|
-
function PolishedError2(code) {
|
|
426
|
-
var _this;
|
|
427
|
-
if (process.env.NODE_ENV === "production") {
|
|
428
|
-
_this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
|
|
429
|
-
} else {
|
|
430
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
431
|
-
args[_key2 - 1] = arguments[_key2];
|
|
432
|
-
}
|
|
433
|
-
_this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
|
|
434
|
-
}
|
|
435
|
-
return _assertThisInitialized(_this);
|
|
436
|
-
}
|
|
437
|
-
return PolishedError2;
|
|
438
|
-
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
439
|
-
function colorToInt(color2) {
|
|
440
|
-
return Math.round(color2 * 255);
|
|
441
|
-
}
|
|
442
|
-
function convertToInt(red, green, blue) {
|
|
443
|
-
return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
|
|
444
|
-
}
|
|
445
|
-
function hslToRgb(hue, saturation, lightness, convert) {
|
|
446
|
-
if (convert === void 0) {
|
|
447
|
-
convert = convertToInt;
|
|
448
|
-
}
|
|
449
|
-
if (saturation === 0) {
|
|
450
|
-
return convert(lightness, lightness, lightness);
|
|
451
|
-
}
|
|
452
|
-
var huePrime = (hue % 360 + 360) % 360 / 60;
|
|
453
|
-
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
454
|
-
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
455
|
-
var red = 0;
|
|
456
|
-
var green = 0;
|
|
457
|
-
var blue = 0;
|
|
458
|
-
if (huePrime >= 0 && huePrime < 1) {
|
|
459
|
-
red = chroma;
|
|
460
|
-
green = secondComponent;
|
|
461
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
|
462
|
-
red = secondComponent;
|
|
463
|
-
green = chroma;
|
|
464
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
|
465
|
-
green = chroma;
|
|
466
|
-
blue = secondComponent;
|
|
467
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
|
468
|
-
green = secondComponent;
|
|
469
|
-
blue = chroma;
|
|
470
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
|
471
|
-
red = secondComponent;
|
|
472
|
-
blue = chroma;
|
|
473
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
|
474
|
-
red = chroma;
|
|
475
|
-
blue = secondComponent;
|
|
476
|
-
}
|
|
477
|
-
var lightnessModification = lightness - chroma / 2;
|
|
478
|
-
var finalRed = red + lightnessModification;
|
|
479
|
-
var finalGreen = green + lightnessModification;
|
|
480
|
-
var finalBlue = blue + lightnessModification;
|
|
481
|
-
return convert(finalRed, finalGreen, finalBlue);
|
|
482
|
-
}
|
|
483
|
-
var namedColorMap = {
|
|
484
|
-
aliceblue: "f0f8ff",
|
|
485
|
-
antiquewhite: "faebd7",
|
|
486
|
-
aqua: "00ffff",
|
|
487
|
-
aquamarine: "7fffd4",
|
|
488
|
-
azure: "f0ffff",
|
|
489
|
-
beige: "f5f5dc",
|
|
490
|
-
bisque: "ffe4c4",
|
|
491
|
-
black: "000",
|
|
492
|
-
blanchedalmond: "ffebcd",
|
|
493
|
-
blue: "0000ff",
|
|
494
|
-
blueviolet: "8a2be2",
|
|
495
|
-
brown: "a52a2a",
|
|
496
|
-
burlywood: "deb887",
|
|
497
|
-
cadetblue: "5f9ea0",
|
|
498
|
-
chartreuse: "7fff00",
|
|
499
|
-
chocolate: "d2691e",
|
|
500
|
-
coral: "ff7f50",
|
|
501
|
-
cornflowerblue: "6495ed",
|
|
502
|
-
cornsilk: "fff8dc",
|
|
503
|
-
crimson: "dc143c",
|
|
504
|
-
cyan: "00ffff",
|
|
505
|
-
darkblue: "00008b",
|
|
506
|
-
darkcyan: "008b8b",
|
|
507
|
-
darkgoldenrod: "b8860b",
|
|
508
|
-
darkgray: "a9a9a9",
|
|
509
|
-
darkgreen: "006400",
|
|
510
|
-
darkgrey: "a9a9a9",
|
|
511
|
-
darkkhaki: "bdb76b",
|
|
512
|
-
darkmagenta: "8b008b",
|
|
513
|
-
darkolivegreen: "556b2f",
|
|
514
|
-
darkorange: "ff8c00",
|
|
515
|
-
darkorchid: "9932cc",
|
|
516
|
-
darkred: "8b0000",
|
|
517
|
-
darksalmon: "e9967a",
|
|
518
|
-
darkseagreen: "8fbc8f",
|
|
519
|
-
darkslateblue: "483d8b",
|
|
520
|
-
darkslategray: "2f4f4f",
|
|
521
|
-
darkslategrey: "2f4f4f",
|
|
522
|
-
darkturquoise: "00ced1",
|
|
523
|
-
darkviolet: "9400d3",
|
|
524
|
-
deeppink: "ff1493",
|
|
525
|
-
deepskyblue: "00bfff",
|
|
526
|
-
dimgray: "696969",
|
|
527
|
-
dimgrey: "696969",
|
|
528
|
-
dodgerblue: "1e90ff",
|
|
529
|
-
firebrick: "b22222",
|
|
530
|
-
floralwhite: "fffaf0",
|
|
531
|
-
forestgreen: "228b22",
|
|
532
|
-
fuchsia: "ff00ff",
|
|
533
|
-
gainsboro: "dcdcdc",
|
|
534
|
-
ghostwhite: "f8f8ff",
|
|
535
|
-
gold: "ffd700",
|
|
536
|
-
goldenrod: "daa520",
|
|
537
|
-
gray: "808080",
|
|
538
|
-
green: "008000",
|
|
539
|
-
greenyellow: "adff2f",
|
|
540
|
-
grey: "808080",
|
|
541
|
-
honeydew: "f0fff0",
|
|
542
|
-
hotpink: "ff69b4",
|
|
543
|
-
indianred: "cd5c5c",
|
|
544
|
-
indigo: "4b0082",
|
|
545
|
-
ivory: "fffff0",
|
|
546
|
-
khaki: "f0e68c",
|
|
547
|
-
lavender: "e6e6fa",
|
|
548
|
-
lavenderblush: "fff0f5",
|
|
549
|
-
lawngreen: "7cfc00",
|
|
550
|
-
lemonchiffon: "fffacd",
|
|
551
|
-
lightblue: "add8e6",
|
|
552
|
-
lightcoral: "f08080",
|
|
553
|
-
lightcyan: "e0ffff",
|
|
554
|
-
lightgoldenrodyellow: "fafad2",
|
|
555
|
-
lightgray: "d3d3d3",
|
|
556
|
-
lightgreen: "90ee90",
|
|
557
|
-
lightgrey: "d3d3d3",
|
|
558
|
-
lightpink: "ffb6c1",
|
|
559
|
-
lightsalmon: "ffa07a",
|
|
560
|
-
lightseagreen: "20b2aa",
|
|
561
|
-
lightskyblue: "87cefa",
|
|
562
|
-
lightslategray: "789",
|
|
563
|
-
lightslategrey: "789",
|
|
564
|
-
lightsteelblue: "b0c4de",
|
|
565
|
-
lightyellow: "ffffe0",
|
|
566
|
-
lime: "0f0",
|
|
567
|
-
limegreen: "32cd32",
|
|
568
|
-
linen: "faf0e6",
|
|
569
|
-
magenta: "f0f",
|
|
570
|
-
maroon: "800000",
|
|
571
|
-
mediumaquamarine: "66cdaa",
|
|
572
|
-
mediumblue: "0000cd",
|
|
573
|
-
mediumorchid: "ba55d3",
|
|
574
|
-
mediumpurple: "9370db",
|
|
575
|
-
mediumseagreen: "3cb371",
|
|
576
|
-
mediumslateblue: "7b68ee",
|
|
577
|
-
mediumspringgreen: "00fa9a",
|
|
578
|
-
mediumturquoise: "48d1cc",
|
|
579
|
-
mediumvioletred: "c71585",
|
|
580
|
-
midnightblue: "191970",
|
|
581
|
-
mintcream: "f5fffa",
|
|
582
|
-
mistyrose: "ffe4e1",
|
|
583
|
-
moccasin: "ffe4b5",
|
|
584
|
-
navajowhite: "ffdead",
|
|
585
|
-
navy: "000080",
|
|
586
|
-
oldlace: "fdf5e6",
|
|
587
|
-
olive: "808000",
|
|
588
|
-
olivedrab: "6b8e23",
|
|
589
|
-
orange: "ffa500",
|
|
590
|
-
orangered: "ff4500",
|
|
591
|
-
orchid: "da70d6",
|
|
592
|
-
palegoldenrod: "eee8aa",
|
|
593
|
-
palegreen: "98fb98",
|
|
594
|
-
paleturquoise: "afeeee",
|
|
595
|
-
palevioletred: "db7093",
|
|
596
|
-
papayawhip: "ffefd5",
|
|
597
|
-
peachpuff: "ffdab9",
|
|
598
|
-
peru: "cd853f",
|
|
599
|
-
pink: "ffc0cb",
|
|
600
|
-
plum: "dda0dd",
|
|
601
|
-
powderblue: "b0e0e6",
|
|
602
|
-
purple: "800080",
|
|
603
|
-
rebeccapurple: "639",
|
|
604
|
-
red: "f00",
|
|
605
|
-
rosybrown: "bc8f8f",
|
|
606
|
-
royalblue: "4169e1",
|
|
607
|
-
saddlebrown: "8b4513",
|
|
608
|
-
salmon: "fa8072",
|
|
609
|
-
sandybrown: "f4a460",
|
|
610
|
-
seagreen: "2e8b57",
|
|
611
|
-
seashell: "fff5ee",
|
|
612
|
-
sienna: "a0522d",
|
|
613
|
-
silver: "c0c0c0",
|
|
614
|
-
skyblue: "87ceeb",
|
|
615
|
-
slateblue: "6a5acd",
|
|
616
|
-
slategray: "708090",
|
|
617
|
-
slategrey: "708090",
|
|
618
|
-
snow: "fffafa",
|
|
619
|
-
springgreen: "00ff7f",
|
|
620
|
-
steelblue: "4682b4",
|
|
621
|
-
tan: "d2b48c",
|
|
622
|
-
teal: "008080",
|
|
623
|
-
thistle: "d8bfd8",
|
|
624
|
-
tomato: "ff6347",
|
|
625
|
-
turquoise: "40e0d0",
|
|
626
|
-
violet: "ee82ee",
|
|
627
|
-
wheat: "f5deb3",
|
|
628
|
-
white: "fff",
|
|
629
|
-
whitesmoke: "f5f5f5",
|
|
630
|
-
yellow: "ff0",
|
|
631
|
-
yellowgreen: "9acd32"
|
|
632
|
-
};
|
|
633
|
-
function nameToHex(color2) {
|
|
634
|
-
if (typeof color2 !== "string") return color2;
|
|
635
|
-
var normalizedColorName = color2.toLowerCase();
|
|
636
|
-
return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color2;
|
|
637
|
-
}
|
|
638
|
-
var hexRegex = /^#[a-fA-F0-9]{6}$/;
|
|
639
|
-
var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
|
|
640
|
-
var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
|
|
641
|
-
var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
|
|
642
|
-
var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
|
|
643
|
-
var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
644
|
-
var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
|
|
645
|
-
var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
646
|
-
function parseToRgb(color2) {
|
|
647
|
-
if (typeof color2 !== "string") {
|
|
648
|
-
throw new PolishedError(3);
|
|
649
|
-
}
|
|
650
|
-
var normalizedColor = nameToHex(color2);
|
|
651
|
-
if (normalizedColor.match(hexRegex)) {
|
|
652
|
-
return {
|
|
653
|
-
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
654
|
-
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
655
|
-
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
if (normalizedColor.match(hexRgbaRegex)) {
|
|
659
|
-
var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
|
|
660
|
-
return {
|
|
661
|
-
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
662
|
-
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
663
|
-
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
|
|
664
|
-
alpha
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
if (normalizedColor.match(reducedHexRegex)) {
|
|
668
|
-
return {
|
|
669
|
-
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
670
|
-
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
671
|
-
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
if (normalizedColor.match(reducedRgbaHexRegex)) {
|
|
675
|
-
var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
|
|
676
|
-
return {
|
|
677
|
-
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
678
|
-
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
679
|
-
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
|
|
680
|
-
alpha: _alpha
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
var rgbMatched = rgbRegex.exec(normalizedColor);
|
|
684
|
-
if (rgbMatched) {
|
|
685
|
-
return {
|
|
686
|
-
red: parseInt("" + rgbMatched[1], 10),
|
|
687
|
-
green: parseInt("" + rgbMatched[2], 10),
|
|
688
|
-
blue: parseInt("" + rgbMatched[3], 10)
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
|
|
692
|
-
if (rgbaMatched) {
|
|
693
|
-
return {
|
|
694
|
-
red: parseInt("" + rgbaMatched[1], 10),
|
|
695
|
-
green: parseInt("" + rgbaMatched[2], 10),
|
|
696
|
-
blue: parseInt("" + rgbaMatched[3], 10),
|
|
697
|
-
alpha: parseFloat("" + rgbaMatched[4])
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
var hslMatched = hslRegex.exec(normalizedColor);
|
|
701
|
-
if (hslMatched) {
|
|
702
|
-
var hue = parseInt("" + hslMatched[1], 10);
|
|
703
|
-
var saturation = parseInt("" + hslMatched[2], 10) / 100;
|
|
704
|
-
var lightness = parseInt("" + hslMatched[3], 10) / 100;
|
|
705
|
-
var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
|
|
706
|
-
var hslRgbMatched = rgbRegex.exec(rgbColorString);
|
|
707
|
-
if (!hslRgbMatched) {
|
|
708
|
-
throw new PolishedError(4, normalizedColor, rgbColorString);
|
|
709
|
-
}
|
|
710
|
-
return {
|
|
711
|
-
red: parseInt("" + hslRgbMatched[1], 10),
|
|
712
|
-
green: parseInt("" + hslRgbMatched[2], 10),
|
|
713
|
-
blue: parseInt("" + hslRgbMatched[3], 10)
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
|
|
717
|
-
if (hslaMatched) {
|
|
718
|
-
var _hue = parseInt("" + hslaMatched[1], 10);
|
|
719
|
-
var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
|
|
720
|
-
var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
|
|
721
|
-
var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
|
|
722
|
-
var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
|
|
723
|
-
if (!_hslRgbMatched) {
|
|
724
|
-
throw new PolishedError(4, normalizedColor, _rgbColorString);
|
|
725
|
-
}
|
|
726
|
-
return {
|
|
727
|
-
red: parseInt("" + _hslRgbMatched[1], 10),
|
|
728
|
-
green: parseInt("" + _hslRgbMatched[2], 10),
|
|
729
|
-
blue: parseInt("" + _hslRgbMatched[3], 10),
|
|
730
|
-
alpha: parseFloat("" + hslaMatched[4])
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
throw new PolishedError(5);
|
|
734
|
-
}
|
|
735
|
-
var reduceHexValue = function reduceHexValue2(value) {
|
|
736
|
-
if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
|
|
737
|
-
return "#" + value[1] + value[3] + value[5];
|
|
738
|
-
}
|
|
739
|
-
return value;
|
|
740
|
-
};
|
|
741
|
-
function numberToHex(value) {
|
|
742
|
-
var hex = value.toString(16);
|
|
743
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
744
|
-
}
|
|
745
|
-
function rgb(value, green, blue) {
|
|
746
|
-
if (typeof value === "number" && typeof green === "number" && typeof blue === "number") {
|
|
747
|
-
return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
|
|
748
|
-
} else if (typeof value === "object" && green === void 0 && blue === void 0) {
|
|
749
|
-
return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
|
|
750
|
-
}
|
|
751
|
-
throw new PolishedError(6);
|
|
752
|
-
}
|
|
753
|
-
function rgba(firstValue, secondValue, thirdValue, fourthValue) {
|
|
754
|
-
if (typeof firstValue === "string" && typeof secondValue === "number") {
|
|
755
|
-
var rgbValue = parseToRgb(firstValue);
|
|
756
|
-
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
|
757
|
-
} else if (typeof firstValue === "number" && typeof secondValue === "number" && typeof thirdValue === "number" && typeof fourthValue === "number") {
|
|
758
|
-
return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
|
759
|
-
} else if (typeof firstValue === "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0) {
|
|
760
|
-
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
|
761
|
-
}
|
|
762
|
-
throw new PolishedError(7);
|
|
763
|
-
}
|
|
764
|
-
function curried(f, length, acc) {
|
|
765
|
-
return function fn() {
|
|
766
|
-
var combined = acc.concat(Array.prototype.slice.call(arguments));
|
|
767
|
-
return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
function curry(f) {
|
|
771
|
-
return curried(f, f.length, []);
|
|
772
|
-
}
|
|
773
|
-
function guard(lowerBoundary, upperBoundary, value) {
|
|
774
|
-
return Math.max(lowerBoundary, Math.min(upperBoundary, value));
|
|
775
|
-
}
|
|
776
|
-
function transparentize(amount, color2) {
|
|
777
|
-
if (color2 === "transparent") return color2;
|
|
778
|
-
var parsedColor = parseToRgb(color2);
|
|
779
|
-
var alpha = typeof parsedColor.alpha === "number" ? parsedColor.alpha : 1;
|
|
780
|
-
var colorWithAlpha = _extends({}, parsedColor, {
|
|
781
|
-
alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
|
|
782
|
-
});
|
|
783
|
-
return rgba(colorWithAlpha);
|
|
784
|
-
}
|
|
785
|
-
var curriedTransparentize = /* @__PURE__ */ curry(transparentize);
|
|
786
|
-
|
|
787
|
-
// ../seeds-react-mixins/dist/esm/index.js
|
|
788
|
-
import { css } from "styled-components";
|
|
789
|
-
import { theme } from "@sproutsocial/seeds-react-theme";
|
|
790
|
-
var visuallyHidden = css`
|
|
791
|
-
position: absolute;
|
|
792
|
-
width: 1px;
|
|
793
|
-
height: 1px;
|
|
794
|
-
padding: 0;
|
|
795
|
-
margin: -1px;
|
|
796
|
-
overflow: hidden;
|
|
797
|
-
clip: rect(0 0 0 0);
|
|
798
|
-
border: 0;
|
|
799
|
-
`;
|
|
800
|
-
var focusRing = css`
|
|
801
|
-
box-shadow: 0 0 0 1px ${theme.colors.button.primary.background.base},
|
|
802
|
-
0 0px 0px 4px
|
|
803
|
-
${curriedTransparentize(0.7, theme.colors.button.primary.background.base)};
|
|
804
|
-
outline: none;
|
|
805
|
-
|
|
806
|
-
&::-moz-focus-inner {
|
|
807
|
-
border: 0;
|
|
808
|
-
}
|
|
809
|
-
`;
|
|
810
|
-
var pill = css`
|
|
811
|
-
min-width: ${theme.space[600]};
|
|
812
|
-
min-height: ${theme.space[600]};
|
|
813
|
-
padding: ${theme.space[300]};
|
|
814
|
-
border-radius: ${theme.radii.pill};
|
|
815
|
-
`;
|
|
816
|
-
var disabled = css`
|
|
817
|
-
opacity: 0.4;
|
|
818
|
-
pointer-events: none;
|
|
819
|
-
`;
|
|
820
|
-
|
|
821
|
-
// ../../node_modules/@styled-system/core/dist/index.esm.js
|
|
822
|
-
var import_object_assign = __toESM(require_object_assign());
|
|
823
|
-
var merge = function merge2(a, b) {
|
|
824
|
-
var result = (0, import_object_assign.default)({}, a, b);
|
|
825
|
-
for (var key in a) {
|
|
826
|
-
var _assign;
|
|
827
|
-
if (!a[key] || typeof b[key] !== "object") continue;
|
|
828
|
-
(0, import_object_assign.default)(result, (_assign = {}, _assign[key] = (0, import_object_assign.default)(a[key], b[key]), _assign));
|
|
829
|
-
}
|
|
830
|
-
return result;
|
|
831
|
-
};
|
|
832
|
-
var sort = function sort2(obj) {
|
|
833
|
-
var next = {};
|
|
834
|
-
Object.keys(obj).sort(function(a, b) {
|
|
835
|
-
return a.localeCompare(b, void 0, {
|
|
836
|
-
numeric: true,
|
|
837
|
-
sensitivity: "base"
|
|
838
|
-
});
|
|
839
|
-
}).forEach(function(key) {
|
|
840
|
-
next[key] = obj[key];
|
|
841
|
-
});
|
|
842
|
-
return next;
|
|
843
|
-
};
|
|
844
|
-
var defaults = {
|
|
845
|
-
breakpoints: [40, 52, 64].map(function(n) {
|
|
846
|
-
return n + "em";
|
|
847
|
-
})
|
|
848
|
-
};
|
|
849
|
-
var createMediaQuery = function createMediaQuery2(n) {
|
|
850
|
-
return "@media screen and (min-width: " + n + ")";
|
|
851
|
-
};
|
|
852
|
-
var getValue = function getValue2(n, scale) {
|
|
853
|
-
return get(scale, n, n);
|
|
854
|
-
};
|
|
855
|
-
var get = function get2(obj, key, def, p, undef) {
|
|
856
|
-
key = key && key.split ? key.split(".") : [key];
|
|
857
|
-
for (p = 0; p < key.length; p++) {
|
|
858
|
-
obj = obj ? obj[key[p]] : undef;
|
|
859
|
-
}
|
|
860
|
-
return obj === undef ? def : obj;
|
|
861
|
-
};
|
|
862
|
-
var createParser = function createParser2(config9) {
|
|
863
|
-
var cache = {};
|
|
864
|
-
var parse = function parse2(props) {
|
|
865
|
-
var styles = {};
|
|
866
|
-
var shouldSort = false;
|
|
867
|
-
var isCacheDisabled = props.theme && props.theme.disableStyledSystemCache;
|
|
868
|
-
for (var key in props) {
|
|
869
|
-
if (!config9[key]) continue;
|
|
870
|
-
var sx = config9[key];
|
|
871
|
-
var raw = props[key];
|
|
872
|
-
var scale = get(props.theme, sx.scale, sx.defaults);
|
|
873
|
-
if (typeof raw === "object") {
|
|
874
|
-
cache.breakpoints = !isCacheDisabled && cache.breakpoints || get(props.theme, "breakpoints", defaults.breakpoints);
|
|
875
|
-
if (Array.isArray(raw)) {
|
|
876
|
-
cache.media = !isCacheDisabled && cache.media || [null].concat(cache.breakpoints.map(createMediaQuery));
|
|
877
|
-
styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
|
|
878
|
-
continue;
|
|
879
|
-
}
|
|
880
|
-
if (raw !== null) {
|
|
881
|
-
styles = merge(styles, parseResponsiveObject(cache.breakpoints, sx, scale, raw, props));
|
|
882
|
-
shouldSort = true;
|
|
883
|
-
}
|
|
884
|
-
continue;
|
|
885
|
-
}
|
|
886
|
-
(0, import_object_assign.default)(styles, sx(raw, scale, props));
|
|
887
|
-
}
|
|
888
|
-
if (shouldSort) {
|
|
889
|
-
styles = sort(styles);
|
|
890
|
-
}
|
|
891
|
-
return styles;
|
|
892
|
-
};
|
|
893
|
-
parse.config = config9;
|
|
894
|
-
parse.propNames = Object.keys(config9);
|
|
895
|
-
parse.cache = cache;
|
|
896
|
-
var keys = Object.keys(config9).filter(function(k) {
|
|
897
|
-
return k !== "config";
|
|
898
|
-
});
|
|
899
|
-
if (keys.length > 1) {
|
|
900
|
-
keys.forEach(function(key) {
|
|
901
|
-
var _createParser;
|
|
902
|
-
parse[key] = createParser2((_createParser = {}, _createParser[key] = config9[key], _createParser));
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
return parse;
|
|
906
|
-
};
|
|
907
|
-
var parseResponsiveStyle = function parseResponsiveStyle2(mediaQueries, sx, scale, raw, _props) {
|
|
908
|
-
var styles = {};
|
|
909
|
-
raw.slice(0, mediaQueries.length).forEach(function(value, i) {
|
|
910
|
-
var media = mediaQueries[i];
|
|
911
|
-
var style = sx(value, scale, _props);
|
|
912
|
-
if (!media) {
|
|
913
|
-
(0, import_object_assign.default)(styles, style);
|
|
914
|
-
} else {
|
|
915
|
-
var _assign2;
|
|
916
|
-
(0, import_object_assign.default)(styles, (_assign2 = {}, _assign2[media] = (0, import_object_assign.default)({}, styles[media], style), _assign2));
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
return styles;
|
|
920
|
-
};
|
|
921
|
-
var parseResponsiveObject = function parseResponsiveObject2(breakpoints, sx, scale, raw, _props) {
|
|
922
|
-
var styles = {};
|
|
923
|
-
for (var key in raw) {
|
|
924
|
-
var breakpoint = breakpoints[key];
|
|
925
|
-
var value = raw[key];
|
|
926
|
-
var style = sx(value, scale, _props);
|
|
927
|
-
if (!breakpoint) {
|
|
928
|
-
(0, import_object_assign.default)(styles, style);
|
|
929
|
-
} else {
|
|
930
|
-
var _assign3;
|
|
931
|
-
var media = createMediaQuery(breakpoint);
|
|
932
|
-
(0, import_object_assign.default)(styles, (_assign3 = {}, _assign3[media] = (0, import_object_assign.default)({}, styles[media], style), _assign3));
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
return styles;
|
|
936
|
-
};
|
|
937
|
-
var createStyleFunction = function createStyleFunction2(_ref) {
|
|
938
|
-
var properties = _ref.properties, property = _ref.property, scale = _ref.scale, _ref$transform = _ref.transform, transform = _ref$transform === void 0 ? getValue : _ref$transform, defaultScale = _ref.defaultScale;
|
|
939
|
-
properties = properties || [property];
|
|
940
|
-
var sx = function sx2(value, scale2, _props) {
|
|
941
|
-
var result = {};
|
|
942
|
-
var n = transform(value, scale2, _props);
|
|
943
|
-
if (n === null) return;
|
|
944
|
-
properties.forEach(function(prop) {
|
|
945
|
-
result[prop] = n;
|
|
946
|
-
});
|
|
947
|
-
return result;
|
|
948
|
-
};
|
|
949
|
-
sx.scale = scale;
|
|
950
|
-
sx.defaults = defaultScale;
|
|
951
|
-
return sx;
|
|
952
|
-
};
|
|
953
|
-
var system = function system2(args) {
|
|
954
|
-
if (args === void 0) {
|
|
955
|
-
args = {};
|
|
956
|
-
}
|
|
957
|
-
var config9 = {};
|
|
958
|
-
Object.keys(args).forEach(function(key) {
|
|
959
|
-
var conf = args[key];
|
|
960
|
-
if (conf === true) {
|
|
961
|
-
config9[key] = createStyleFunction({
|
|
962
|
-
property: key,
|
|
963
|
-
scale: key
|
|
964
|
-
});
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
if (typeof conf === "function") {
|
|
968
|
-
config9[key] = conf;
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
config9[key] = createStyleFunction(conf);
|
|
972
|
-
});
|
|
973
|
-
var parser = createParser(config9);
|
|
974
|
-
return parser;
|
|
975
|
-
};
|
|
976
|
-
var compose = function compose2() {
|
|
977
|
-
var config9 = {};
|
|
978
|
-
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
979
|
-
parsers[_key] = arguments[_key];
|
|
980
|
-
}
|
|
981
|
-
parsers.forEach(function(parser2) {
|
|
982
|
-
if (!parser2 || !parser2.config) return;
|
|
983
|
-
(0, import_object_assign.default)(config9, parser2.config);
|
|
984
|
-
});
|
|
985
|
-
var parser = createParser(config9);
|
|
986
|
-
return parser;
|
|
987
|
-
};
|
|
988
|
-
|
|
989
|
-
// ../../node_modules/@styled-system/layout/dist/index.esm.js
|
|
990
|
-
var isNumber = function isNumber2(n) {
|
|
991
|
-
return typeof n === "number" && !isNaN(n);
|
|
992
|
-
};
|
|
993
|
-
var getWidth = function getWidth2(n, scale) {
|
|
994
|
-
return get(scale, n, !isNumber(n) || n > 1 ? n : n * 100 + "%");
|
|
995
|
-
};
|
|
996
|
-
var config = {
|
|
997
|
-
width: {
|
|
998
|
-
property: "width",
|
|
999
|
-
scale: "sizes",
|
|
1000
|
-
transform: getWidth
|
|
1001
|
-
},
|
|
1002
|
-
height: {
|
|
1003
|
-
property: "height",
|
|
1004
|
-
scale: "sizes"
|
|
1005
|
-
},
|
|
1006
|
-
minWidth: {
|
|
1007
|
-
property: "minWidth",
|
|
1008
|
-
scale: "sizes"
|
|
1009
|
-
},
|
|
1010
|
-
minHeight: {
|
|
1011
|
-
property: "minHeight",
|
|
1012
|
-
scale: "sizes"
|
|
1013
|
-
},
|
|
1014
|
-
maxWidth: {
|
|
1015
|
-
property: "maxWidth",
|
|
1016
|
-
scale: "sizes"
|
|
1017
|
-
},
|
|
1018
|
-
maxHeight: {
|
|
1019
|
-
property: "maxHeight",
|
|
1020
|
-
scale: "sizes"
|
|
1021
|
-
},
|
|
1022
|
-
size: {
|
|
1023
|
-
properties: ["width", "height"],
|
|
1024
|
-
scale: "sizes"
|
|
1025
|
-
},
|
|
1026
|
-
overflow: true,
|
|
1027
|
-
overflowX: true,
|
|
1028
|
-
overflowY: true,
|
|
1029
|
-
display: true,
|
|
1030
|
-
verticalAlign: true
|
|
1031
|
-
};
|
|
1032
|
-
var layout = system(config);
|
|
1033
|
-
var index_esm_default = layout;
|
|
1034
|
-
|
|
1035
|
-
// ../../node_modules/@styled-system/color/dist/index.esm.js
|
|
1036
|
-
var config2 = {
|
|
1037
|
-
color: {
|
|
1038
|
-
property: "color",
|
|
1039
|
-
scale: "colors"
|
|
1040
|
-
},
|
|
1041
|
-
backgroundColor: {
|
|
1042
|
-
property: "backgroundColor",
|
|
1043
|
-
scale: "colors"
|
|
1044
|
-
},
|
|
1045
|
-
opacity: true
|
|
1046
|
-
};
|
|
1047
|
-
config2.bg = config2.backgroundColor;
|
|
1048
|
-
var color = system(config2);
|
|
1049
|
-
var index_esm_default2 = color;
|
|
1050
|
-
|
|
1051
|
-
// ../../node_modules/@styled-system/typography/dist/index.esm.js
|
|
1052
|
-
var defaults2 = {
|
|
1053
|
-
fontSizes: [12, 14, 16, 20, 24, 32, 48, 64, 72]
|
|
1054
|
-
};
|
|
1055
|
-
var config3 = {
|
|
1056
|
-
fontFamily: {
|
|
1057
|
-
property: "fontFamily",
|
|
1058
|
-
scale: "fonts"
|
|
1059
|
-
},
|
|
1060
|
-
fontSize: {
|
|
1061
|
-
property: "fontSize",
|
|
1062
|
-
scale: "fontSizes",
|
|
1063
|
-
defaultScale: defaults2.fontSizes
|
|
1064
|
-
},
|
|
1065
|
-
fontWeight: {
|
|
1066
|
-
property: "fontWeight",
|
|
1067
|
-
scale: "fontWeights"
|
|
1068
|
-
},
|
|
1069
|
-
lineHeight: {
|
|
1070
|
-
property: "lineHeight",
|
|
1071
|
-
scale: "lineHeights"
|
|
1072
|
-
},
|
|
1073
|
-
letterSpacing: {
|
|
1074
|
-
property: "letterSpacing",
|
|
1075
|
-
scale: "letterSpacings"
|
|
1076
|
-
},
|
|
1077
|
-
textAlign: true,
|
|
1078
|
-
fontStyle: true
|
|
1079
|
-
};
|
|
1080
|
-
var typography = system(config3);
|
|
1081
|
-
var index_esm_default3 = typography;
|
|
1082
|
-
|
|
1083
|
-
// ../../node_modules/@styled-system/flexbox/dist/index.esm.js
|
|
1084
|
-
var config4 = {
|
|
1085
|
-
alignItems: true,
|
|
1086
|
-
alignContent: true,
|
|
1087
|
-
justifyItems: true,
|
|
1088
|
-
justifyContent: true,
|
|
1089
|
-
flexWrap: true,
|
|
1090
|
-
flexDirection: true,
|
|
1091
|
-
// item
|
|
1092
|
-
flex: true,
|
|
1093
|
-
flexGrow: true,
|
|
1094
|
-
flexShrink: true,
|
|
1095
|
-
flexBasis: true,
|
|
1096
|
-
justifySelf: true,
|
|
1097
|
-
alignSelf: true,
|
|
1098
|
-
order: true
|
|
1099
|
-
};
|
|
1100
|
-
var flexbox = system(config4);
|
|
1101
|
-
var index_esm_default4 = flexbox;
|
|
1102
|
-
|
|
1103
|
-
// ../../node_modules/@styled-system/grid/dist/index.esm.js
|
|
1104
|
-
var defaults3 = {
|
|
1105
|
-
space: [0, 4, 8, 16, 32, 64, 128, 256, 512]
|
|
1106
|
-
};
|
|
1107
|
-
var config5 = {
|
|
1108
|
-
gridGap: {
|
|
1109
|
-
property: "gridGap",
|
|
1110
|
-
scale: "space",
|
|
1111
|
-
defaultScale: defaults3.space
|
|
1112
|
-
},
|
|
1113
|
-
gridColumnGap: {
|
|
1114
|
-
property: "gridColumnGap",
|
|
1115
|
-
scale: "space",
|
|
1116
|
-
defaultScale: defaults3.space
|
|
1117
|
-
},
|
|
1118
|
-
gridRowGap: {
|
|
1119
|
-
property: "gridRowGap",
|
|
1120
|
-
scale: "space",
|
|
1121
|
-
defaultScale: defaults3.space
|
|
1122
|
-
},
|
|
1123
|
-
gridColumn: true,
|
|
1124
|
-
gridRow: true,
|
|
1125
|
-
gridAutoFlow: true,
|
|
1126
|
-
gridAutoColumns: true,
|
|
1127
|
-
gridAutoRows: true,
|
|
1128
|
-
gridTemplateColumns: true,
|
|
1129
|
-
gridTemplateRows: true,
|
|
1130
|
-
gridTemplateAreas: true,
|
|
1131
|
-
gridArea: true
|
|
1132
|
-
};
|
|
1133
|
-
var grid = system(config5);
|
|
1134
|
-
var index_esm_default5 = grid;
|
|
1135
|
-
|
|
1136
|
-
// ../../node_modules/@styled-system/border/dist/index.esm.js
|
|
1137
|
-
var config6 = {
|
|
1138
|
-
border: {
|
|
1139
|
-
property: "border",
|
|
1140
|
-
scale: "borders"
|
|
1141
|
-
},
|
|
1142
|
-
borderWidth: {
|
|
1143
|
-
property: "borderWidth",
|
|
1144
|
-
scale: "borderWidths"
|
|
1145
|
-
},
|
|
1146
|
-
borderStyle: {
|
|
1147
|
-
property: "borderStyle",
|
|
1148
|
-
scale: "borderStyles"
|
|
1149
|
-
},
|
|
1150
|
-
borderColor: {
|
|
1151
|
-
property: "borderColor",
|
|
1152
|
-
scale: "colors"
|
|
1153
|
-
},
|
|
1154
|
-
borderRadius: {
|
|
1155
|
-
property: "borderRadius",
|
|
1156
|
-
scale: "radii"
|
|
1157
|
-
},
|
|
1158
|
-
borderTop: {
|
|
1159
|
-
property: "borderTop",
|
|
1160
|
-
scale: "borders"
|
|
1161
|
-
},
|
|
1162
|
-
borderTopLeftRadius: {
|
|
1163
|
-
property: "borderTopLeftRadius",
|
|
1164
|
-
scale: "radii"
|
|
1165
|
-
},
|
|
1166
|
-
borderTopRightRadius: {
|
|
1167
|
-
property: "borderTopRightRadius",
|
|
1168
|
-
scale: "radii"
|
|
1169
|
-
},
|
|
1170
|
-
borderRight: {
|
|
1171
|
-
property: "borderRight",
|
|
1172
|
-
scale: "borders"
|
|
1173
|
-
},
|
|
1174
|
-
borderBottom: {
|
|
1175
|
-
property: "borderBottom",
|
|
1176
|
-
scale: "borders"
|
|
1177
|
-
},
|
|
1178
|
-
borderBottomLeftRadius: {
|
|
1179
|
-
property: "borderBottomLeftRadius",
|
|
1180
|
-
scale: "radii"
|
|
1181
|
-
},
|
|
1182
|
-
borderBottomRightRadius: {
|
|
1183
|
-
property: "borderBottomRightRadius",
|
|
1184
|
-
scale: "radii"
|
|
1185
|
-
},
|
|
1186
|
-
borderLeft: {
|
|
1187
|
-
property: "borderLeft",
|
|
1188
|
-
scale: "borders"
|
|
1189
|
-
},
|
|
1190
|
-
borderX: {
|
|
1191
|
-
properties: ["borderLeft", "borderRight"],
|
|
1192
|
-
scale: "borders"
|
|
1193
|
-
},
|
|
1194
|
-
borderY: {
|
|
1195
|
-
properties: ["borderTop", "borderBottom"],
|
|
1196
|
-
scale: "borders"
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
config6.borderTopWidth = {
|
|
1200
|
-
property: "borderTopWidth",
|
|
1201
|
-
scale: "borderWidths"
|
|
1202
|
-
};
|
|
1203
|
-
config6.borderTopColor = {
|
|
1204
|
-
property: "borderTopColor",
|
|
1205
|
-
scale: "colors"
|
|
1206
|
-
};
|
|
1207
|
-
config6.borderTopStyle = {
|
|
1208
|
-
property: "borderTopStyle",
|
|
1209
|
-
scale: "borderStyles"
|
|
1210
|
-
};
|
|
1211
|
-
config6.borderTopLeftRadius = {
|
|
1212
|
-
property: "borderTopLeftRadius",
|
|
1213
|
-
scale: "radii"
|
|
1214
|
-
};
|
|
1215
|
-
config6.borderTopRightRadius = {
|
|
1216
|
-
property: "borderTopRightRadius",
|
|
1217
|
-
scale: "radii"
|
|
1218
|
-
};
|
|
1219
|
-
config6.borderBottomWidth = {
|
|
1220
|
-
property: "borderBottomWidth",
|
|
1221
|
-
scale: "borderWidths"
|
|
1222
|
-
};
|
|
1223
|
-
config6.borderBottomColor = {
|
|
1224
|
-
property: "borderBottomColor",
|
|
1225
|
-
scale: "colors"
|
|
1226
|
-
};
|
|
1227
|
-
config6.borderBottomStyle = {
|
|
1228
|
-
property: "borderBottomStyle",
|
|
1229
|
-
scale: "borderStyles"
|
|
1230
|
-
};
|
|
1231
|
-
config6.borderBottomLeftRadius = {
|
|
1232
|
-
property: "borderBottomLeftRadius",
|
|
1233
|
-
scale: "radii"
|
|
1234
|
-
};
|
|
1235
|
-
config6.borderBottomRightRadius = {
|
|
1236
|
-
property: "borderBottomRightRadius",
|
|
1237
|
-
scale: "radii"
|
|
1238
|
-
};
|
|
1239
|
-
config6.borderLeftWidth = {
|
|
1240
|
-
property: "borderLeftWidth",
|
|
1241
|
-
scale: "borderWidths"
|
|
1242
|
-
};
|
|
1243
|
-
config6.borderLeftColor = {
|
|
1244
|
-
property: "borderLeftColor",
|
|
1245
|
-
scale: "colors"
|
|
1246
|
-
};
|
|
1247
|
-
config6.borderLeftStyle = {
|
|
1248
|
-
property: "borderLeftStyle",
|
|
1249
|
-
scale: "borderStyles"
|
|
1250
|
-
};
|
|
1251
|
-
config6.borderRightWidth = {
|
|
1252
|
-
property: "borderRightWidth",
|
|
1253
|
-
scale: "borderWidths"
|
|
1254
|
-
};
|
|
1255
|
-
config6.borderRightColor = {
|
|
1256
|
-
property: "borderRightColor",
|
|
1257
|
-
scale: "colors"
|
|
1258
|
-
};
|
|
1259
|
-
config6.borderRightStyle = {
|
|
1260
|
-
property: "borderRightStyle",
|
|
1261
|
-
scale: "borderStyles"
|
|
1262
|
-
};
|
|
1263
|
-
var border = system(config6);
|
|
1264
|
-
var index_esm_default6 = border;
|
|
1265
|
-
|
|
1266
|
-
// ../../node_modules/@styled-system/background/dist/index.esm.js
|
|
1267
|
-
var config7 = {
|
|
1268
|
-
background: true,
|
|
1269
|
-
backgroundImage: true,
|
|
1270
|
-
backgroundSize: true,
|
|
1271
|
-
backgroundPosition: true,
|
|
1272
|
-
backgroundRepeat: true
|
|
1273
|
-
};
|
|
1274
|
-
config7.bgImage = config7.backgroundImage;
|
|
1275
|
-
config7.bgSize = config7.backgroundSize;
|
|
1276
|
-
config7.bgPosition = config7.backgroundPosition;
|
|
1277
|
-
config7.bgRepeat = config7.backgroundRepeat;
|
|
1278
|
-
var background = system(config7);
|
|
1279
|
-
var index_esm_default7 = background;
|
|
1280
|
-
|
|
1281
|
-
// ../../node_modules/@styled-system/position/dist/index.esm.js
|
|
1282
|
-
var defaults4 = {
|
|
1283
|
-
space: [0, 4, 8, 16, 32, 64, 128, 256, 512]
|
|
1284
|
-
};
|
|
1285
|
-
var config8 = {
|
|
1286
|
-
position: true,
|
|
1287
|
-
zIndex: {
|
|
1288
|
-
property: "zIndex",
|
|
1289
|
-
scale: "zIndices"
|
|
1290
|
-
},
|
|
1291
|
-
top: {
|
|
1292
|
-
property: "top",
|
|
1293
|
-
scale: "space",
|
|
1294
|
-
defaultScale: defaults4.space
|
|
1295
|
-
},
|
|
1296
|
-
right: {
|
|
1297
|
-
property: "right",
|
|
1298
|
-
scale: "space",
|
|
1299
|
-
defaultScale: defaults4.space
|
|
1300
|
-
},
|
|
1301
|
-
bottom: {
|
|
1302
|
-
property: "bottom",
|
|
1303
|
-
scale: "space",
|
|
1304
|
-
defaultScale: defaults4.space
|
|
1305
|
-
},
|
|
1306
|
-
left: {
|
|
1307
|
-
property: "left",
|
|
1308
|
-
scale: "space",
|
|
1309
|
-
defaultScale: defaults4.space
|
|
1310
|
-
}
|
|
1311
|
-
};
|
|
1312
|
-
var position = system(config8);
|
|
1313
|
-
var index_esm_default8 = position;
|
|
1314
|
-
|
|
1315
|
-
// ../../node_modules/@styled-system/space/dist/index.esm.js
|
|
1316
|
-
var defaults5 = {
|
|
1317
|
-
space: [0, 4, 8, 16, 32, 64, 128, 256, 512]
|
|
1318
|
-
};
|
|
1319
|
-
var isNumber3 = function isNumber4(n) {
|
|
1320
|
-
return typeof n === "number" && !isNaN(n);
|
|
1321
|
-
};
|
|
1322
|
-
var getMargin = function getMargin2(n, scale) {
|
|
1323
|
-
if (!isNumber3(n)) {
|
|
1324
|
-
return get(scale, n, n);
|
|
1325
|
-
}
|
|
1326
|
-
var isNegative = n < 0;
|
|
1327
|
-
var absolute = Math.abs(n);
|
|
1328
|
-
var value = get(scale, absolute, absolute);
|
|
1329
|
-
if (!isNumber3(value)) {
|
|
1330
|
-
return isNegative ? "-" + value : value;
|
|
1331
|
-
}
|
|
1332
|
-
return value * (isNegative ? -1 : 1);
|
|
1333
|
-
};
|
|
1334
|
-
var configs = {};
|
|
1335
|
-
configs.margin = {
|
|
1336
|
-
margin: {
|
|
1337
|
-
property: "margin",
|
|
1338
|
-
scale: "space",
|
|
1339
|
-
transform: getMargin,
|
|
1340
|
-
defaultScale: defaults5.space
|
|
1341
|
-
},
|
|
1342
|
-
marginTop: {
|
|
1343
|
-
property: "marginTop",
|
|
1344
|
-
scale: "space",
|
|
1345
|
-
transform: getMargin,
|
|
1346
|
-
defaultScale: defaults5.space
|
|
1347
|
-
},
|
|
1348
|
-
marginRight: {
|
|
1349
|
-
property: "marginRight",
|
|
1350
|
-
scale: "space",
|
|
1351
|
-
transform: getMargin,
|
|
1352
|
-
defaultScale: defaults5.space
|
|
1353
|
-
},
|
|
1354
|
-
marginBottom: {
|
|
1355
|
-
property: "marginBottom",
|
|
1356
|
-
scale: "space",
|
|
1357
|
-
transform: getMargin,
|
|
1358
|
-
defaultScale: defaults5.space
|
|
1359
|
-
},
|
|
1360
|
-
marginLeft: {
|
|
1361
|
-
property: "marginLeft",
|
|
1362
|
-
scale: "space",
|
|
1363
|
-
transform: getMargin,
|
|
1364
|
-
defaultScale: defaults5.space
|
|
1365
|
-
},
|
|
1366
|
-
marginX: {
|
|
1367
|
-
properties: ["marginLeft", "marginRight"],
|
|
1368
|
-
scale: "space",
|
|
1369
|
-
transform: getMargin,
|
|
1370
|
-
defaultScale: defaults5.space
|
|
1371
|
-
},
|
|
1372
|
-
marginY: {
|
|
1373
|
-
properties: ["marginTop", "marginBottom"],
|
|
1374
|
-
scale: "space",
|
|
1375
|
-
transform: getMargin,
|
|
1376
|
-
defaultScale: defaults5.space
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
configs.margin.m = configs.margin.margin;
|
|
1380
|
-
configs.margin.mt = configs.margin.marginTop;
|
|
1381
|
-
configs.margin.mr = configs.margin.marginRight;
|
|
1382
|
-
configs.margin.mb = configs.margin.marginBottom;
|
|
1383
|
-
configs.margin.ml = configs.margin.marginLeft;
|
|
1384
|
-
configs.margin.mx = configs.margin.marginX;
|
|
1385
|
-
configs.margin.my = configs.margin.marginY;
|
|
1386
|
-
configs.padding = {
|
|
1387
|
-
padding: {
|
|
1388
|
-
property: "padding",
|
|
1389
|
-
scale: "space",
|
|
1390
|
-
defaultScale: defaults5.space
|
|
1391
|
-
},
|
|
1392
|
-
paddingTop: {
|
|
1393
|
-
property: "paddingTop",
|
|
1394
|
-
scale: "space",
|
|
1395
|
-
defaultScale: defaults5.space
|
|
1396
|
-
},
|
|
1397
|
-
paddingRight: {
|
|
1398
|
-
property: "paddingRight",
|
|
1399
|
-
scale: "space",
|
|
1400
|
-
defaultScale: defaults5.space
|
|
1401
|
-
},
|
|
1402
|
-
paddingBottom: {
|
|
1403
|
-
property: "paddingBottom",
|
|
1404
|
-
scale: "space",
|
|
1405
|
-
defaultScale: defaults5.space
|
|
1406
|
-
},
|
|
1407
|
-
paddingLeft: {
|
|
1408
|
-
property: "paddingLeft",
|
|
1409
|
-
scale: "space",
|
|
1410
|
-
defaultScale: defaults5.space
|
|
1411
|
-
},
|
|
1412
|
-
paddingX: {
|
|
1413
|
-
properties: ["paddingLeft", "paddingRight"],
|
|
1414
|
-
scale: "space",
|
|
1415
|
-
defaultScale: defaults5.space
|
|
1416
|
-
},
|
|
1417
|
-
paddingY: {
|
|
1418
|
-
properties: ["paddingTop", "paddingBottom"],
|
|
1419
|
-
scale: "space",
|
|
1420
|
-
defaultScale: defaults5.space
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
configs.padding.p = configs.padding.padding;
|
|
1424
|
-
configs.padding.pt = configs.padding.paddingTop;
|
|
1425
|
-
configs.padding.pr = configs.padding.paddingRight;
|
|
1426
|
-
configs.padding.pb = configs.padding.paddingBottom;
|
|
1427
|
-
configs.padding.pl = configs.padding.paddingLeft;
|
|
1428
|
-
configs.padding.px = configs.padding.paddingX;
|
|
1429
|
-
configs.padding.py = configs.padding.paddingY;
|
|
1430
|
-
var margin = system(configs.margin);
|
|
1431
|
-
var padding = system(configs.padding);
|
|
1432
|
-
var space = compose(margin, padding);
|
|
1433
|
-
|
|
1434
|
-
// ../../node_modules/@styled-system/shadow/dist/index.esm.js
|
|
1435
|
-
var shadow = system({
|
|
1436
|
-
boxShadow: {
|
|
1437
|
-
property: "boxShadow",
|
|
1438
|
-
scale: "shadows"
|
|
1439
|
-
},
|
|
1440
|
-
textShadow: {
|
|
1441
|
-
property: "textShadow",
|
|
1442
|
-
scale: "shadows"
|
|
1443
|
-
}
|
|
1444
|
-
});
|
|
1445
|
-
|
|
1446
|
-
// ../../node_modules/@styled-system/css/dist/index.esm.js
|
|
1447
|
-
function _extends2() {
|
|
1448
|
-
_extends2 = Object.assign || function(target) {
|
|
1449
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1450
|
-
var source = arguments[i];
|
|
1451
|
-
for (var key in source) {
|
|
1452
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1453
|
-
target[key] = source[key];
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
return target;
|
|
1458
|
-
};
|
|
1459
|
-
return _extends2.apply(this, arguments);
|
|
1460
|
-
}
|
|
1461
|
-
var get3 = function get4(obj, key, def, p, undef) {
|
|
1462
|
-
key = key && key.split ? key.split(".") : [key];
|
|
1463
|
-
for (p = 0; p < key.length; p++) {
|
|
1464
|
-
obj = obj ? obj[key[p]] : undef;
|
|
1465
|
-
}
|
|
1466
|
-
return obj === undef ? def : obj;
|
|
1467
|
-
};
|
|
1468
|
-
var defaultBreakpoints = [40, 52, 64].map(function(n) {
|
|
1469
|
-
return n + "em";
|
|
1470
|
-
});
|
|
1471
|
-
var defaultTheme = {
|
|
1472
|
-
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
|
|
1473
|
-
fontSizes: [12, 14, 16, 20, 24, 32, 48, 64, 72]
|
|
1474
|
-
};
|
|
1475
|
-
var aliases = {
|
|
1476
|
-
bg: "backgroundColor",
|
|
1477
|
-
m: "margin",
|
|
1478
|
-
mt: "marginTop",
|
|
1479
|
-
mr: "marginRight",
|
|
1480
|
-
mb: "marginBottom",
|
|
1481
|
-
ml: "marginLeft",
|
|
1482
|
-
mx: "marginX",
|
|
1483
|
-
my: "marginY",
|
|
1484
|
-
p: "padding",
|
|
1485
|
-
pt: "paddingTop",
|
|
1486
|
-
pr: "paddingRight",
|
|
1487
|
-
pb: "paddingBottom",
|
|
1488
|
-
pl: "paddingLeft",
|
|
1489
|
-
px: "paddingX",
|
|
1490
|
-
py: "paddingY"
|
|
1491
|
-
};
|
|
1492
|
-
var multiples = {
|
|
1493
|
-
marginX: ["marginLeft", "marginRight"],
|
|
1494
|
-
marginY: ["marginTop", "marginBottom"],
|
|
1495
|
-
paddingX: ["paddingLeft", "paddingRight"],
|
|
1496
|
-
paddingY: ["paddingTop", "paddingBottom"],
|
|
1497
|
-
size: ["width", "height"]
|
|
1498
|
-
};
|
|
1499
|
-
var scales = {
|
|
1500
|
-
color: "colors",
|
|
1501
|
-
backgroundColor: "colors",
|
|
1502
|
-
borderColor: "colors",
|
|
1503
|
-
margin: "space",
|
|
1504
|
-
marginTop: "space",
|
|
1505
|
-
marginRight: "space",
|
|
1506
|
-
marginBottom: "space",
|
|
1507
|
-
marginLeft: "space",
|
|
1508
|
-
marginX: "space",
|
|
1509
|
-
marginY: "space",
|
|
1510
|
-
padding: "space",
|
|
1511
|
-
paddingTop: "space",
|
|
1512
|
-
paddingRight: "space",
|
|
1513
|
-
paddingBottom: "space",
|
|
1514
|
-
paddingLeft: "space",
|
|
1515
|
-
paddingX: "space",
|
|
1516
|
-
paddingY: "space",
|
|
1517
|
-
top: "space",
|
|
1518
|
-
right: "space",
|
|
1519
|
-
bottom: "space",
|
|
1520
|
-
left: "space",
|
|
1521
|
-
gridGap: "space",
|
|
1522
|
-
gridColumnGap: "space",
|
|
1523
|
-
gridRowGap: "space",
|
|
1524
|
-
gap: "space",
|
|
1525
|
-
columnGap: "space",
|
|
1526
|
-
rowGap: "space",
|
|
1527
|
-
fontFamily: "fonts",
|
|
1528
|
-
fontSize: "fontSizes",
|
|
1529
|
-
fontWeight: "fontWeights",
|
|
1530
|
-
lineHeight: "lineHeights",
|
|
1531
|
-
letterSpacing: "letterSpacings",
|
|
1532
|
-
border: "borders",
|
|
1533
|
-
borderTop: "borders",
|
|
1534
|
-
borderRight: "borders",
|
|
1535
|
-
borderBottom: "borders",
|
|
1536
|
-
borderLeft: "borders",
|
|
1537
|
-
borderWidth: "borderWidths",
|
|
1538
|
-
borderStyle: "borderStyles",
|
|
1539
|
-
borderRadius: "radii",
|
|
1540
|
-
borderTopRightRadius: "radii",
|
|
1541
|
-
borderTopLeftRadius: "radii",
|
|
1542
|
-
borderBottomRightRadius: "radii",
|
|
1543
|
-
borderBottomLeftRadius: "radii",
|
|
1544
|
-
borderTopWidth: "borderWidths",
|
|
1545
|
-
borderTopColor: "colors",
|
|
1546
|
-
borderTopStyle: "borderStyles",
|
|
1547
|
-
borderBottomWidth: "borderWidths",
|
|
1548
|
-
borderBottomColor: "colors",
|
|
1549
|
-
borderBottomStyle: "borderStyles",
|
|
1550
|
-
borderLeftWidth: "borderWidths",
|
|
1551
|
-
borderLeftColor: "colors",
|
|
1552
|
-
borderLeftStyle: "borderStyles",
|
|
1553
|
-
borderRightWidth: "borderWidths",
|
|
1554
|
-
borderRightColor: "colors",
|
|
1555
|
-
borderRightStyle: "borderStyles",
|
|
1556
|
-
outlineColor: "colors",
|
|
1557
|
-
boxShadow: "shadows",
|
|
1558
|
-
textShadow: "shadows",
|
|
1559
|
-
zIndex: "zIndices",
|
|
1560
|
-
width: "sizes",
|
|
1561
|
-
minWidth: "sizes",
|
|
1562
|
-
maxWidth: "sizes",
|
|
1563
|
-
height: "sizes",
|
|
1564
|
-
minHeight: "sizes",
|
|
1565
|
-
maxHeight: "sizes",
|
|
1566
|
-
flexBasis: "sizes",
|
|
1567
|
-
size: "sizes",
|
|
1568
|
-
// svg
|
|
1569
|
-
fill: "colors",
|
|
1570
|
-
stroke: "colors"
|
|
1571
|
-
};
|
|
1572
|
-
var positiveOrNegative = function positiveOrNegative2(scale, value) {
|
|
1573
|
-
if (typeof value !== "number" || value >= 0) {
|
|
1574
|
-
return get3(scale, value, value);
|
|
1575
|
-
}
|
|
1576
|
-
var absolute = Math.abs(value);
|
|
1577
|
-
var n = get3(scale, absolute, absolute);
|
|
1578
|
-
if (typeof n === "string") return "-" + n;
|
|
1579
|
-
return n * -1;
|
|
1580
|
-
};
|
|
1581
|
-
var transforms = ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "top", "bottom", "left", "right"].reduce(function(acc, curr) {
|
|
1582
|
-
var _extends22;
|
|
1583
|
-
return _extends2({}, acc, (_extends22 = {}, _extends22[curr] = positiveOrNegative, _extends22));
|
|
1584
|
-
}, {});
|
|
1585
|
-
var responsive = function responsive2(styles) {
|
|
1586
|
-
return function(theme2) {
|
|
1587
|
-
var next = {};
|
|
1588
|
-
var breakpoints = get3(theme2, "breakpoints", defaultBreakpoints);
|
|
1589
|
-
var mediaQueries = [null].concat(breakpoints.map(function(n) {
|
|
1590
|
-
return "@media screen and (min-width: " + n + ")";
|
|
1591
|
-
}));
|
|
1592
|
-
for (var key in styles) {
|
|
1593
|
-
var value = typeof styles[key] === "function" ? styles[key](theme2) : styles[key];
|
|
1594
|
-
if (value == null) continue;
|
|
1595
|
-
if (!Array.isArray(value)) {
|
|
1596
|
-
next[key] = value;
|
|
1597
|
-
continue;
|
|
1598
|
-
}
|
|
1599
|
-
for (var i = 0; i < value.slice(0, mediaQueries.length).length; i++) {
|
|
1600
|
-
var media = mediaQueries[i];
|
|
1601
|
-
if (!media) {
|
|
1602
|
-
next[key] = value[i];
|
|
1603
|
-
continue;
|
|
1604
|
-
}
|
|
1605
|
-
next[media] = next[media] || {};
|
|
1606
|
-
if (value[i] == null) continue;
|
|
1607
|
-
next[media][key] = value[i];
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
return next;
|
|
1611
|
-
};
|
|
1612
|
-
};
|
|
1613
|
-
var css2 = function css3(args) {
|
|
1614
|
-
return function(props) {
|
|
1615
|
-
if (props === void 0) {
|
|
1616
|
-
props = {};
|
|
1617
|
-
}
|
|
1618
|
-
var theme2 = _extends2({}, defaultTheme, {}, props.theme || props);
|
|
1619
|
-
var result = {};
|
|
1620
|
-
var obj = typeof args === "function" ? args(theme2) : args;
|
|
1621
|
-
var styles = responsive(obj)(theme2);
|
|
1622
|
-
for (var key in styles) {
|
|
1623
|
-
var x = styles[key];
|
|
1624
|
-
var val = typeof x === "function" ? x(theme2) : x;
|
|
1625
|
-
if (key === "variant") {
|
|
1626
|
-
var variant3 = css3(get3(theme2, val))(theme2);
|
|
1627
|
-
result = _extends2({}, result, {}, variant3);
|
|
1628
|
-
continue;
|
|
1629
|
-
}
|
|
1630
|
-
if (val && typeof val === "object") {
|
|
1631
|
-
result[key] = css3(val)(theme2);
|
|
1632
|
-
continue;
|
|
1633
|
-
}
|
|
1634
|
-
var prop = get3(aliases, key, key);
|
|
1635
|
-
var scaleName = get3(scales, prop);
|
|
1636
|
-
var scale = get3(theme2, scaleName, get3(theme2, prop, {}));
|
|
1637
|
-
var transform = get3(transforms, prop, get3);
|
|
1638
|
-
var value = transform(scale, val, val);
|
|
1639
|
-
if (multiples[prop]) {
|
|
1640
|
-
var dirs = multiples[prop];
|
|
1641
|
-
for (var i = 0; i < dirs.length; i++) {
|
|
1642
|
-
result[dirs[i]] = value;
|
|
1643
|
-
}
|
|
1644
|
-
} else {
|
|
1645
|
-
result[prop] = value;
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
return result;
|
|
1649
|
-
};
|
|
1650
|
-
};
|
|
1651
|
-
var index_esm_default9 = css2;
|
|
1652
|
-
|
|
1653
|
-
// ../../node_modules/@styled-system/variant/dist/index.esm.js
|
|
1654
|
-
var variant = function variant2(_ref) {
|
|
1655
|
-
var _config;
|
|
1656
|
-
var scale = _ref.scale, _ref$prop = _ref.prop, prop = _ref$prop === void 0 ? "variant" : _ref$prop, _ref$variants = _ref.variants, variants = _ref$variants === void 0 ? {} : _ref$variants, key = _ref.key;
|
|
1657
|
-
var sx;
|
|
1658
|
-
if (Object.keys(variants).length) {
|
|
1659
|
-
sx = function sx2(value, scale2, props) {
|
|
1660
|
-
return index_esm_default9(get(scale2, value, null))(props.theme);
|
|
1661
|
-
};
|
|
1662
|
-
} else {
|
|
1663
|
-
sx = function sx2(value, scale2) {
|
|
1664
|
-
return get(scale2, value, null);
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
sx.scale = scale || key;
|
|
1668
|
-
sx.defaults = variants;
|
|
1669
|
-
var config9 = (_config = {}, _config[prop] = sx, _config);
|
|
1670
|
-
var parser = createParser(config9);
|
|
1671
|
-
return parser;
|
|
1672
|
-
};
|
|
1673
|
-
var buttonStyle = variant({
|
|
1674
|
-
key: "buttons"
|
|
1675
|
-
});
|
|
1676
|
-
var textStyle = variant({
|
|
1677
|
-
key: "textStyles",
|
|
1678
|
-
prop: "textStyle"
|
|
1679
|
-
});
|
|
1680
|
-
var colorStyle = variant({
|
|
1681
|
-
key: "colorStyles",
|
|
1682
|
-
prop: "colors"
|
|
1683
|
-
});
|
|
1684
|
-
|
|
1685
|
-
// ../../node_modules/styled-system/dist/index.esm.js
|
|
1686
|
-
var width = index_esm_default.width;
|
|
1687
|
-
var height = index_esm_default.height;
|
|
1688
|
-
var minWidth = index_esm_default.minWidth;
|
|
1689
|
-
var minHeight = index_esm_default.minHeight;
|
|
1690
|
-
var maxWidth = index_esm_default.maxWidth;
|
|
1691
|
-
var maxHeight = index_esm_default.maxHeight;
|
|
1692
|
-
var size = index_esm_default.size;
|
|
1693
|
-
var verticalAlign = index_esm_default.verticalAlign;
|
|
1694
|
-
var display = index_esm_default.display;
|
|
1695
|
-
var overflow = index_esm_default.overflow;
|
|
1696
|
-
var overflowX = index_esm_default.overflowX;
|
|
1697
|
-
var overflowY = index_esm_default.overflowY;
|
|
1698
|
-
var opacity = index_esm_default2.opacity;
|
|
1699
|
-
var fontSize = index_esm_default3.fontSize;
|
|
1700
|
-
var fontFamily = index_esm_default3.fontFamily;
|
|
1701
|
-
var fontWeight = index_esm_default3.fontWeight;
|
|
1702
|
-
var lineHeight = index_esm_default3.lineHeight;
|
|
1703
|
-
var textAlign = index_esm_default3.textAlign;
|
|
1704
|
-
var fontStyle = index_esm_default3.fontStyle;
|
|
1705
|
-
var letterSpacing = index_esm_default3.letterSpacing;
|
|
1706
|
-
var alignItems = index_esm_default4.alignItems;
|
|
1707
|
-
var alignContent = index_esm_default4.alignContent;
|
|
1708
|
-
var justifyItems = index_esm_default4.justifyItems;
|
|
1709
|
-
var justifyContent = index_esm_default4.justifyContent;
|
|
1710
|
-
var flexWrap = index_esm_default4.flexWrap;
|
|
1711
|
-
var flexDirection = index_esm_default4.flexDirection;
|
|
1712
|
-
var flex = index_esm_default4.flex;
|
|
1713
|
-
var flexGrow = index_esm_default4.flexGrow;
|
|
1714
|
-
var flexShrink = index_esm_default4.flexShrink;
|
|
1715
|
-
var flexBasis = index_esm_default4.flexBasis;
|
|
1716
|
-
var justifySelf = index_esm_default4.justifySelf;
|
|
1717
|
-
var alignSelf = index_esm_default4.alignSelf;
|
|
1718
|
-
var order = index_esm_default4.order;
|
|
1719
|
-
var gridGap = index_esm_default5.gridGap;
|
|
1720
|
-
var gridColumnGap = index_esm_default5.gridColumnGap;
|
|
1721
|
-
var gridRowGap = index_esm_default5.gridRowGap;
|
|
1722
|
-
var gridColumn = index_esm_default5.gridColumn;
|
|
1723
|
-
var gridRow = index_esm_default5.gridRow;
|
|
1724
|
-
var gridAutoFlow = index_esm_default5.gridAutoFlow;
|
|
1725
|
-
var gridAutoColumns = index_esm_default5.gridAutoColumns;
|
|
1726
|
-
var gridAutoRows = index_esm_default5.gridAutoRows;
|
|
1727
|
-
var gridTemplateColumns = index_esm_default5.gridTemplateColumns;
|
|
1728
|
-
var gridTemplateRows = index_esm_default5.gridTemplateRows;
|
|
1729
|
-
var gridTemplateAreas = index_esm_default5.gridTemplateAreas;
|
|
1730
|
-
var gridArea = index_esm_default5.gridArea;
|
|
1731
|
-
var borderWidth = index_esm_default6.borderWidth;
|
|
1732
|
-
var borderStyle = index_esm_default6.borderStyle;
|
|
1733
|
-
var borderColor = index_esm_default6.borderColor;
|
|
1734
|
-
var borderTop = index_esm_default6.borderTop;
|
|
1735
|
-
var borderRight = index_esm_default6.borderRight;
|
|
1736
|
-
var borderBottom = index_esm_default6.borderBottom;
|
|
1737
|
-
var borderLeft = index_esm_default6.borderLeft;
|
|
1738
|
-
var borderRadius = index_esm_default6.borderRadius;
|
|
1739
|
-
var backgroundImage = index_esm_default7.backgroundImage;
|
|
1740
|
-
var backgroundSize = index_esm_default7.backgroundSize;
|
|
1741
|
-
var backgroundPosition = index_esm_default7.backgroundPosition;
|
|
1742
|
-
var backgroundRepeat = index_esm_default7.backgroundRepeat;
|
|
1743
|
-
var zIndex = index_esm_default8.zIndex;
|
|
1744
|
-
var top = index_esm_default8.top;
|
|
1745
|
-
var right = index_esm_default8.right;
|
|
1746
|
-
var bottom = index_esm_default8.bottom;
|
|
1747
|
-
var left = index_esm_default8.left;
|
|
1748
|
-
|
|
1749
|
-
// src/MenuItem/styles.tsx
|
|
1750
1
|
import {
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
var MenuItemContainer = styled.li`
|
|
1772
|
-
box-sizing: border-box;
|
|
1773
|
-
list-style-type: none;
|
|
1774
|
-
margin-left: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1775
|
-
margin-right: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1776
|
-
|
|
1777
|
-
&:first-child {
|
|
1778
|
-
margin-top: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
&:last-child {
|
|
1782
|
-
margin-bottom: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1783
|
-
}
|
|
1784
|
-
`;
|
|
1785
|
-
var StyledMenuItem = styled.button`
|
|
1786
|
-
display: block;
|
|
1787
|
-
box-sizing: border-box;
|
|
1788
|
-
width: 100%;
|
|
1789
|
-
border-radius: ${({ theme: theme2 }) => theme2.radii[500]};
|
|
1790
|
-
background-color: ${({ theme: theme2 }) => theme2.colors.listItem.background.base};
|
|
1791
|
-
border: 1px solid ${({ theme: theme2 }) => theme2.colors.listItem.background.base};
|
|
1792
|
-
color: ${({ theme: theme2 }) => theme2.colors.text.body};
|
|
1793
|
-
font-family: ${({ theme: theme2 }) => theme2.fontFamily};
|
|
1794
|
-
font-weight: ${({ theme: theme2 }) => theme2.fontWeights.normal};
|
|
1795
|
-
text-align: left;
|
|
1796
|
-
text-decoration: none;
|
|
1797
|
-
padding: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1798
|
-
outline: 0;
|
|
1799
|
-
${({ theme: theme2 }) => theme2.typography[200]};
|
|
1800
|
-
transition: all ${({ theme: theme2 }) => theme2.duration["fast"]};
|
|
1801
|
-
|
|
1802
|
-
/* Highlighted */
|
|
1803
|
-
${({ $highlighted }) => $highlighted && highlightedStyles}
|
|
1804
|
-
|
|
1805
|
-
/* Hovered, but not focused */
|
|
1806
|
-
&:hover {
|
|
1807
|
-
${highlightedStyles}
|
|
1808
|
-
${CheckboxContainer} {
|
|
1809
|
-
${checkboxContainerHoverStyles}
|
|
1810
|
-
}
|
|
1811
|
-
${InputWrapper} {
|
|
1812
|
-
${inputWrapperHoverStyles}
|
|
1813
|
-
}
|
|
1814
|
-
${PillInput} {
|
|
1815
|
-
${pillInputHoverStyles}
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
/* focused */
|
|
1820
|
-
&:focus {
|
|
1821
|
-
${focusRing}
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
/* Active */
|
|
1825
|
-
${({ $active }) => $active && activeStyles}
|
|
1826
|
-
|
|
1827
|
-
/* Pressed state*/
|
|
1828
|
-
&:active {
|
|
1829
|
-
${activeStyles}
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
&[aria-disabled="true"] {
|
|
1833
|
-
cursor: not-allowed;
|
|
1834
|
-
${disabled}
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
${border}
|
|
1838
|
-
${color}
|
|
1839
|
-
${flexbox}
|
|
1840
|
-
${grid}
|
|
1841
|
-
${layout}
|
|
1842
|
-
${space}
|
|
1843
|
-
`;
|
|
1844
|
-
var MenuItemRow = styled.div`
|
|
1845
|
-
display: flex;
|
|
1846
|
-
align-items: center;
|
|
1847
|
-
pointer-events: none;
|
|
1848
|
-
`;
|
|
1849
|
-
var MenuItemAction = styled.div`
|
|
1850
|
-
display: flex;
|
|
1851
|
-
align-items: center;
|
|
1852
|
-
justify-content: center;
|
|
1853
|
-
flex-shrink: 0;
|
|
1854
|
-
`;
|
|
1855
|
-
var MenuItemActionLeft = styled(MenuItemAction)`
|
|
1856
|
-
margin-right: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1857
|
-
`;
|
|
1858
|
-
var MenuItemActionRight = styled(MenuItemAction)`
|
|
1859
|
-
margin-left: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1860
|
-
`;
|
|
1861
|
-
var MenuItemText = styled.div`
|
|
1862
|
-
word-break: break-word;
|
|
1863
|
-
flex-grow: 1;
|
|
1864
|
-
min-width: 0;
|
|
1865
|
-
`;
|
|
2
|
+
MenuContentContext,
|
|
3
|
+
MenuContentProvider,
|
|
4
|
+
MenuItemAction,
|
|
5
|
+
MenuItemActionLeft,
|
|
6
|
+
MenuItemActionRight,
|
|
7
|
+
MenuItemContainer,
|
|
8
|
+
MenuItemRow,
|
|
9
|
+
MenuItemText,
|
|
10
|
+
MenuToggleButton,
|
|
11
|
+
MenuToggleContext,
|
|
12
|
+
MenuToggleProvider,
|
|
13
|
+
StyledMenuContent,
|
|
14
|
+
StyledMenuItem,
|
|
15
|
+
checkIfItemSelected,
|
|
16
|
+
defaultMenuContext,
|
|
17
|
+
getSelectedItemIds,
|
|
18
|
+
useMenu,
|
|
19
|
+
useMenuContentContext,
|
|
20
|
+
useMenuToggleContext
|
|
21
|
+
} from "./chunk-ROQATIB7.js";
|
|
1866
22
|
|
|
1867
23
|
// src/MenuItem/useOptionProps.tsx
|
|
1868
|
-
import { useMemo
|
|
24
|
+
import { useMemo } from "react";
|
|
1869
25
|
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
1870
26
|
import { Checkbox } from "@sproutsocial/seeds-react-checkbox";
|
|
1871
27
|
import { Switch } from "@sproutsocial/seeds-react-switch";
|
|
1872
28
|
import { Radio } from "@sproutsocial/seeds-react-radio";
|
|
1873
29
|
import { useTheme } from "styled-components";
|
|
1874
30
|
import { Box } from "@sproutsocial/seeds-react-box";
|
|
1875
|
-
import { jsx
|
|
31
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1876
32
|
var SelectionIndicator = ({
|
|
1877
33
|
id,
|
|
1878
34
|
inputType = "icon",
|
|
1879
35
|
"aria-labelledby": labeledBy,
|
|
1880
36
|
selected
|
|
1881
37
|
}) => {
|
|
1882
|
-
const { space:
|
|
38
|
+
const { space: space3 } = useTheme();
|
|
1883
39
|
const inputStub = (e) => {
|
|
1884
40
|
e.stopPropagation();
|
|
1885
41
|
};
|
|
1886
42
|
switch (inputType) {
|
|
1887
43
|
case "checkbox":
|
|
1888
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
1889
45
|
Checkbox,
|
|
1890
46
|
{
|
|
1891
47
|
tabIndex: -1,
|
|
@@ -1897,7 +53,7 @@ var SelectionIndicator = ({
|
|
|
1897
53
|
}
|
|
1898
54
|
);
|
|
1899
55
|
case "switch":
|
|
1900
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
1901
57
|
Switch,
|
|
1902
58
|
{
|
|
1903
59
|
tabIndex: -1,
|
|
@@ -1908,7 +64,7 @@ var SelectionIndicator = ({
|
|
|
1908
64
|
}
|
|
1909
65
|
);
|
|
1910
66
|
case "radio":
|
|
1911
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
1912
68
|
Radio,
|
|
1913
69
|
{
|
|
1914
70
|
tabIndex: -1,
|
|
@@ -1920,9 +76,9 @@ var SelectionIndicator = ({
|
|
|
1920
76
|
);
|
|
1921
77
|
case "icon":
|
|
1922
78
|
if (selected) {
|
|
1923
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ jsx(Icon, { name: "check-solid", "aria-hidden": true, size: "small" });
|
|
1924
80
|
} else {
|
|
1925
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ jsx(Box, { width: space3["400"] });
|
|
1926
82
|
}
|
|
1927
83
|
default:
|
|
1928
84
|
return null;
|
|
@@ -1936,7 +92,7 @@ var useOptionProps = ({
|
|
|
1936
92
|
...props
|
|
1937
93
|
}) => {
|
|
1938
94
|
const { selectedItem, selectedItemIds, isListbox, isItemSelected } = useMenuContentContext();
|
|
1939
|
-
const selected =
|
|
95
|
+
const selected = useMemo(
|
|
1940
96
|
() => isItemSelected(id),
|
|
1941
97
|
[selectedItem?.id, selectedItemIds]
|
|
1942
98
|
);
|
|
@@ -1945,7 +101,7 @@ var useOptionProps = ({
|
|
|
1945
101
|
active: selected,
|
|
1946
102
|
["aria-selected"]: selected,
|
|
1947
103
|
children: /* @__PURE__ */ jsxs(MenuItemRow, { children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ jsx(MenuItemActionLeft, { children: /* @__PURE__ */ jsx(
|
|
1949
105
|
SelectionIndicator,
|
|
1950
106
|
{
|
|
1951
107
|
id,
|
|
@@ -1954,24 +110,24 @@ var useOptionProps = ({
|
|
|
1954
110
|
selected: !!selected
|
|
1955
111
|
}
|
|
1956
112
|
) }),
|
|
1957
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ jsx(MenuItemText, { id: label, children })
|
|
1958
114
|
] }),
|
|
1959
115
|
...props
|
|
1960
116
|
} : {};
|
|
1961
117
|
};
|
|
1962
118
|
|
|
1963
119
|
// src/MenuItem/MenuItem.tsx
|
|
1964
|
-
import { Fragment, jsx as
|
|
120
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
|
1965
121
|
var MenuItem = ({
|
|
1966
122
|
id,
|
|
1967
123
|
children,
|
|
1968
124
|
onClick,
|
|
1969
125
|
onKeyDown,
|
|
1970
|
-
disabled
|
|
126
|
+
disabled = false,
|
|
1971
127
|
active,
|
|
1972
128
|
innerRef,
|
|
1973
129
|
href,
|
|
1974
|
-
color:
|
|
130
|
+
color: color3,
|
|
1975
131
|
...props
|
|
1976
132
|
}) => {
|
|
1977
133
|
const {
|
|
@@ -1988,7 +144,7 @@ var MenuItem = ({
|
|
|
1988
144
|
});
|
|
1989
145
|
const item = itemsMap[id] || { index: 0, id };
|
|
1990
146
|
const highlighted = highlightedIndex === item?.index;
|
|
1991
|
-
return hiddenItemsMap[item.id] ? /* @__PURE__ */
|
|
147
|
+
return hiddenItemsMap[item.id] ? /* @__PURE__ */ jsx2(Fragment, {}) : /* @__PURE__ */ jsx2(MenuItemContainer, { role: "none", children: /* @__PURE__ */ jsx2(
|
|
1992
148
|
StyledMenuItem,
|
|
1993
149
|
{
|
|
1994
150
|
id,
|
|
@@ -2027,17 +183,26 @@ var INPUT_TYPES = {
|
|
|
2027
183
|
import "react";
|
|
2028
184
|
|
|
2029
185
|
// src/MenuHeader/styles.tsx
|
|
2030
|
-
import
|
|
2031
|
-
|
|
2032
|
-
border
|
|
186
|
+
import styled from "styled-components";
|
|
187
|
+
import {
|
|
188
|
+
border,
|
|
189
|
+
color,
|
|
190
|
+
flexbox,
|
|
191
|
+
grid,
|
|
192
|
+
layout,
|
|
193
|
+
position,
|
|
194
|
+
space
|
|
195
|
+
} from "styled-system";
|
|
196
|
+
var MenuHeaderContainer = styled.div`
|
|
197
|
+
border-color: ${({ theme }) => theme.colors.container.border.base};
|
|
2033
198
|
border-bottom-width: 1px;
|
|
2034
199
|
border-bottom-style: solid;
|
|
2035
200
|
box-sizing: border-box;
|
|
2036
201
|
width: 100%;
|
|
2037
|
-
font-size: ${({ theme
|
|
202
|
+
font-size: ${({ theme }) => theme.typography[200].fontSize};
|
|
2038
203
|
display: flex;
|
|
2039
204
|
flex-direction: column;
|
|
2040
|
-
padding: ${({ theme
|
|
205
|
+
padding: ${({ theme }) => theme.space[350]} ${({ theme }) => theme.space[400]};
|
|
2041
206
|
|
|
2042
207
|
${border}
|
|
2043
208
|
${color}
|
|
@@ -2047,27 +212,27 @@ var MenuHeaderContainer = styled2.div`
|
|
|
2047
212
|
${space}
|
|
2048
213
|
${position}
|
|
2049
214
|
`;
|
|
2050
|
-
var MenuTitleText =
|
|
2051
|
-
color: ${({ theme
|
|
2052
|
-
font-weight: ${({ theme
|
|
215
|
+
var MenuTitleText = styled.h3`
|
|
216
|
+
color: ${({ theme }) => theme.colors.text.headline};
|
|
217
|
+
font-weight: ${({ theme }) => theme.fontWeights.bold};
|
|
2053
218
|
margin: 0px;
|
|
2054
219
|
flex-grow: 1;
|
|
2055
220
|
|
|
2056
|
-
${({ theme
|
|
221
|
+
${({ theme }) => theme.typography[200]}
|
|
2057
222
|
|
|
2058
|
-
${({ $leftAction, theme
|
|
2059
|
-
padding-left: ${
|
|
223
|
+
${({ $leftAction, theme }) => $leftAction && `
|
|
224
|
+
padding-left: ${theme.space[350]};
|
|
2060
225
|
`}
|
|
2061
226
|
`;
|
|
2062
|
-
var MenuChildrenContainer =
|
|
227
|
+
var MenuChildrenContainer = styled.div`
|
|
2063
228
|
grid-column: 1 / -1;
|
|
2064
|
-
margin-top: ${({ theme
|
|
229
|
+
margin-top: ${({ theme }) => theme.space[300]};
|
|
2065
230
|
|
|
2066
231
|
&:first-child {
|
|
2067
232
|
margin-top: 0;
|
|
2068
233
|
}
|
|
2069
234
|
`;
|
|
2070
|
-
var MenuHeaderFeatures =
|
|
235
|
+
var MenuHeaderFeatures = styled.div`
|
|
2071
236
|
display: flex;
|
|
2072
237
|
align-items: center;
|
|
2073
238
|
justify-content: space-between;
|
|
@@ -2091,7 +256,7 @@ var MenuHeaderFeatures = styled2.div`
|
|
|
2091
256
|
`;
|
|
2092
257
|
|
|
2093
258
|
// src/MenuHeader/MenuHeader.tsx
|
|
2094
|
-
import { Fragment as Fragment2, jsx as
|
|
259
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2095
260
|
var MenuHeader = ({
|
|
2096
261
|
children,
|
|
2097
262
|
title,
|
|
@@ -2100,53 +265,32 @@ var MenuHeader = ({
|
|
|
2100
265
|
...rest
|
|
2101
266
|
}) => {
|
|
2102
267
|
const showTopRow = title || leftAction || rightAction;
|
|
2103
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsxs2(MenuHeaderContainer, { $leftAction: !!leftAction, ...rest, children: [
|
|
2104
269
|
showTopRow && /* @__PURE__ */ jsxs2(MenuHeaderFeatures, { $leftAction: !!leftAction, children: [
|
|
2105
270
|
leftAction && leftAction,
|
|
2106
|
-
title && /* @__PURE__ */
|
|
2107
|
-
rightAction && /* @__PURE__ */
|
|
271
|
+
title && /* @__PURE__ */ jsx3(MenuTitleText, { $leftAction: !!leftAction, children: title }),
|
|
272
|
+
rightAction && /* @__PURE__ */ jsx3("div", { className: "right-action", children: rightAction })
|
|
2108
273
|
] }),
|
|
2109
|
-
children && /* @__PURE__ */
|
|
274
|
+
children && /* @__PURE__ */ jsx3(MenuChildrenContainer, { children })
|
|
2110
275
|
] }) });
|
|
2111
276
|
};
|
|
2112
277
|
|
|
2113
|
-
// src/MenuContent/styles.tsx
|
|
2114
|
-
import styled3 from "styled-components";
|
|
2115
|
-
var StyledMenuContent = styled3.ul`
|
|
2116
|
-
margin: 0;
|
|
2117
|
-
padding: 0;
|
|
2118
|
-
overflow: auto;
|
|
2119
|
-
|
|
2120
|
-
&:focus {
|
|
2121
|
-
outline: none;
|
|
2122
|
-
box-shadow: none;
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
${border}
|
|
2126
|
-
${color}
|
|
2127
|
-
${flexbox}
|
|
2128
|
-
${grid}
|
|
2129
|
-
${layout}
|
|
2130
|
-
${space}
|
|
2131
|
-
${position}
|
|
2132
|
-
`;
|
|
2133
|
-
|
|
2134
278
|
// src/hooks/useMenuChildren.tsx
|
|
2135
|
-
import
|
|
2136
|
-
import { Fragment as Fragment3, jsx as
|
|
279
|
+
import React3, { useMemo as useMemo2 } from "react";
|
|
280
|
+
import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
|
|
2137
281
|
var walkAllChildren = (children, callback) => {
|
|
2138
282
|
const walk = (element, parents2) => {
|
|
2139
283
|
if (element === null || element === void 0) return;
|
|
2140
284
|
callback(element, parents2);
|
|
2141
285
|
const newParents = [...parents2, element];
|
|
2142
|
-
if (
|
|
2143
|
-
|
|
286
|
+
if (React3.isValidElement(element) && element.props?.children) {
|
|
287
|
+
React3.Children.toArray(element.props.children).forEach((child) => {
|
|
2144
288
|
walk(child, newParents);
|
|
2145
289
|
});
|
|
2146
290
|
}
|
|
2147
291
|
};
|
|
2148
292
|
const parents = [];
|
|
2149
|
-
|
|
293
|
+
React3.Children.toArray(children).forEach((child) => {
|
|
2150
294
|
walk(child, parents);
|
|
2151
295
|
});
|
|
2152
296
|
};
|
|
@@ -2187,9 +331,9 @@ var addItemsFromGroup = ({
|
|
|
2187
331
|
});
|
|
2188
332
|
});
|
|
2189
333
|
} else if (menuGroup.props.children) {
|
|
2190
|
-
const children =
|
|
334
|
+
const children = React3.Children.toArray(menuGroup.props.children);
|
|
2191
335
|
children.forEach((menuItem) => {
|
|
2192
|
-
if (
|
|
336
|
+
if (React3.isValidElement(menuItem)) {
|
|
2193
337
|
addMenuItem({
|
|
2194
338
|
itemProps: {
|
|
2195
339
|
id: menuItem.props.id,
|
|
@@ -2269,19 +413,19 @@ var mapMenuItems = ({
|
|
|
2269
413
|
menuItems,
|
|
2270
414
|
MenuItemComponent = MenuItem
|
|
2271
415
|
}) => {
|
|
2272
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: menuItems.map((menuItemProps) => /* @__PURE__ */ jsx4(MenuItemComponent, { ...menuItemProps }, menuItemProps.id)) });
|
|
2273
417
|
};
|
|
2274
418
|
var getChildrenFromMenuItems = ({
|
|
2275
419
|
menuItems,
|
|
2276
420
|
MenuItemComponent
|
|
2277
|
-
}) => /* @__PURE__ */
|
|
421
|
+
}) => /* @__PURE__ */ jsx4(MenuContent, { menuItems, MenuItemComponent });
|
|
2278
422
|
var useMenuChildren = ({
|
|
2279
423
|
children: childrenProp,
|
|
2280
424
|
menuItems,
|
|
2281
425
|
MenuItemComponent
|
|
2282
426
|
}) => {
|
|
2283
|
-
const { allMenuItems, menuItemsMap, children } =
|
|
2284
|
-
let children2 = /* @__PURE__ */
|
|
427
|
+
const { allMenuItems, menuItemsMap, children } = useMemo2(() => {
|
|
428
|
+
let children2 = /* @__PURE__ */ jsx4(Fragment3, {});
|
|
2285
429
|
const menuItemsMap2 = {};
|
|
2286
430
|
const allMenuItems2 = [];
|
|
2287
431
|
if (menuItems && menuItems.length) {
|
|
@@ -2306,23 +450,23 @@ var useMenuChildren = ({
|
|
|
2306
450
|
import { useCallback } from "react";
|
|
2307
451
|
|
|
2308
452
|
// src/MenuContent/DefaultMenuEmptyState.tsx
|
|
2309
|
-
import
|
|
453
|
+
import styled2 from "styled-components";
|
|
2310
454
|
import { Box as Box2 } from "@sproutsocial/seeds-react-box";
|
|
2311
|
-
import { jsx as
|
|
2312
|
-
var StyledEmptyState =
|
|
2313
|
-
padding: ${({ theme
|
|
455
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
456
|
+
var StyledEmptyState = styled2(Box2)`
|
|
457
|
+
padding: ${({ theme }) => theme.space[350]};
|
|
2314
458
|
text-align: center;
|
|
2315
|
-
font-size: ${({ theme
|
|
459
|
+
font-size: ${({ theme }) => theme.typography[200].fontSize};
|
|
2316
460
|
`;
|
|
2317
461
|
var DefaultMenuEmptyState = ({
|
|
2318
462
|
children = "No items found",
|
|
2319
463
|
...props
|
|
2320
464
|
}) => {
|
|
2321
|
-
return /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ jsx5(StyledEmptyState, { ...props, children });
|
|
2322
466
|
};
|
|
2323
467
|
|
|
2324
468
|
// src/MenuContent/MenuContent.tsx
|
|
2325
|
-
import { jsx as
|
|
469
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2326
470
|
var MenuContent = ({
|
|
2327
471
|
id = "menu_content",
|
|
2328
472
|
children: childrenProp,
|
|
@@ -2344,7 +488,7 @@ var MenuContent = ({
|
|
|
2344
488
|
const toggleButtonProps = getToggleButtonProps?.();
|
|
2345
489
|
const children = childrenProp || !menuItems || !menuItems.length ? childrenProp : mapMenuItems({ menuItems, MenuItemComponent });
|
|
2346
490
|
if (isInitialized && !hasVisibleItems && !autoCloseOnEmpty) {
|
|
2347
|
-
return emptyStateElement ?? /* @__PURE__ */
|
|
491
|
+
return emptyStateElement ?? /* @__PURE__ */ jsx6(DefaultMenuEmptyState, {});
|
|
2348
492
|
}
|
|
2349
493
|
if (!children) {
|
|
2350
494
|
return null;
|
|
@@ -2356,7 +500,7 @@ var MenuContent = ({
|
|
|
2356
500
|
},
|
|
2357
501
|
[onKeyDown, toggleButtonProps?.["onKeyDown"]]
|
|
2358
502
|
);
|
|
2359
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ jsx6(
|
|
2360
504
|
StyledMenuContent,
|
|
2361
505
|
{
|
|
2362
506
|
autoFocus: true,
|
|
@@ -2382,173 +526,67 @@ MenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
|
2382
526
|
import "react";
|
|
2383
527
|
|
|
2384
528
|
// src/MenuFooter/styles.tsx
|
|
2385
|
-
import
|
|
529
|
+
import styled3 from "styled-components";
|
|
2386
530
|
import { Box as Box3 } from "@sproutsocial/seeds-react-box";
|
|
2387
|
-
var StyledMenuFooterBox =
|
|
2388
|
-
padding: ${({ theme
|
|
531
|
+
var StyledMenuFooterBox = styled3(Box3)`
|
|
532
|
+
padding: ${({ theme }) => theme.space[350]} ${({ theme }) => theme.space[400]};
|
|
2389
533
|
border-top: 1px solid ${(p) => p.theme.colors.container.border.base};
|
|
2390
534
|
`;
|
|
2391
535
|
|
|
2392
536
|
// src/MenuFooter/MenuFooter.tsx
|
|
2393
|
-
import { jsx as
|
|
537
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
2394
538
|
var MenuFooter = ({ children, ...rest }) => {
|
|
2395
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ jsx7(StyledMenuFooterBox, { ...rest, children });
|
|
2396
540
|
};
|
|
2397
541
|
|
|
2398
542
|
// src/MenuGroup/MenuGroup.tsx
|
|
2399
543
|
import "react";
|
|
2400
544
|
|
|
2401
545
|
// src/MenuGroup/styles.tsx
|
|
2402
|
-
import
|
|
2403
|
-
|
|
2404
|
-
// ../seeds-react-text/dist/esm/index.js
|
|
2405
|
-
import "react";
|
|
2406
|
-
import styled22 from "styled-components";
|
|
2407
|
-
import styled6, { css as css5 } from "styled-components";
|
|
546
|
+
import styled4 from "styled-components";
|
|
547
|
+
import Text from "@sproutsocial/seeds-react-text";
|
|
2408
548
|
import {
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
var
|
|
2418
|
-
margin: 0;
|
|
2419
|
-
padding-left: 0;
|
|
2420
|
-
padding-right: 0;
|
|
2421
|
-
font-family: ${(props) => props.theme.fontFamily};
|
|
2422
|
-
font-style: ${(props) => props.isItalicized && "italic"};
|
|
2423
|
-
|
|
2424
|
-
${(props) => props.truncated && css5`
|
|
2425
|
-
display: block;
|
|
2426
|
-
overflow: hidden;
|
|
2427
|
-
white-space: nowrap;
|
|
2428
|
-
text-overflow: ellipsis;
|
|
2429
|
-
`}
|
|
2430
|
-
|
|
2431
|
-
${(props) => props.breakWord && css5`
|
|
2432
|
-
word-break: break-word;
|
|
2433
|
-
hyphens: auto;
|
|
2434
|
-
`}
|
|
2435
|
-
|
|
2436
|
-
${COMMON}
|
|
2437
|
-
${LAYOUT}
|
|
2438
|
-
${FLEXBOX}
|
|
2439
|
-
${GRID}
|
|
2440
|
-
${TYPOGRAPHY}
|
|
2441
|
-
`;
|
|
2442
|
-
var styles_default = Container;
|
|
2443
|
-
var Headline = styled22(styles_default)`
|
|
2444
|
-
color: ${(props) => props.theme.colors.text.headline};
|
|
2445
|
-
font-weight: ${(props) => props.theme.fontWeights.bold};
|
|
2446
|
-
${(props) => props.theme.typography[400]}
|
|
2447
|
-
`;
|
|
2448
|
-
var SubHeadline = styled22(styles_default)`
|
|
2449
|
-
color: ${(props) => props.theme.colors.text.headline};
|
|
2450
|
-
font-weight: ${(props) => props.theme.fontWeights.bold};
|
|
2451
|
-
${(props) => props.theme.typography[300]}
|
|
2452
|
-
`;
|
|
2453
|
-
var SmallSubHeadline = styled22(styles_default)`
|
|
2454
|
-
color: ${(props) => props.theme.colors.text.headline};
|
|
2455
|
-
font-weight: ${(props) => props.theme.fontWeights.bold};
|
|
2456
|
-
${(props) => props.theme.typography[200]}
|
|
2457
|
-
`;
|
|
2458
|
-
var Byline = styled22(styles_default)`
|
|
2459
|
-
color: ${(props) => props.theme.colors.text.subtext};
|
|
2460
|
-
${(props) => props.theme.typography[200]}
|
|
2461
|
-
`;
|
|
2462
|
-
var SmallByline = styled22(styles_default)`
|
|
2463
|
-
color: ${(props) => props.theme.colors.text.subtext};
|
|
2464
|
-
${(props) => props.theme.typography[100]}
|
|
2465
|
-
`;
|
|
2466
|
-
var BodyCopy = styled22(styles_default)`
|
|
2467
|
-
color: ${(props) => props.theme.colors.text.body};
|
|
2468
|
-
${(props) => props.theme.typography[300]}
|
|
2469
|
-
`;
|
|
2470
|
-
var SmallBodyCopy = styled22(styles_default)`
|
|
2471
|
-
color: ${(props) => props.theme.colors.text.body};
|
|
2472
|
-
${(props) => props.theme.typography[200]}
|
|
2473
|
-
`;
|
|
2474
|
-
var Text = ({ fontSize: fontSize2, children, qa, color: color2, ...rest }) => {
|
|
2475
|
-
const qaText = typeof children === "string" ? children : void 0;
|
|
2476
|
-
return /* @__PURE__ */ jsx9(
|
|
2477
|
-
styles_default,
|
|
2478
|
-
{
|
|
2479
|
-
typeScale: fontSize2,
|
|
2480
|
-
"data-qa-text": qaText,
|
|
2481
|
-
color: color2,
|
|
2482
|
-
...qa,
|
|
2483
|
-
...rest,
|
|
2484
|
-
children
|
|
2485
|
-
}
|
|
2486
|
-
);
|
|
2487
|
-
};
|
|
2488
|
-
var withTextLogic = (Component) => {
|
|
2489
|
-
return ({ children, ...props }) => {
|
|
2490
|
-
const qaText = typeof children === "string" ? children : void 0;
|
|
2491
|
-
return /* @__PURE__ */ jsx9(Component, { "data-qa-text": qaText, ...props, children });
|
|
2492
|
-
};
|
|
2493
|
-
};
|
|
2494
|
-
var HeadlineWithLogic = withTextLogic(Headline);
|
|
2495
|
-
HeadlineWithLogic.displayName = "Text.Headline";
|
|
2496
|
-
Text.Headline = HeadlineWithLogic;
|
|
2497
|
-
var SubHeadlineWithLogic = withTextLogic(SubHeadline);
|
|
2498
|
-
SubHeadlineWithLogic.displayName = "Text.SubHeadline";
|
|
2499
|
-
Text.SubHeadline = SubHeadlineWithLogic;
|
|
2500
|
-
var SmallSubHeadlineWithLogic = withTextLogic(SmallSubHeadline);
|
|
2501
|
-
SmallSubHeadlineWithLogic.displayName = "Text.SmallSubHeadline";
|
|
2502
|
-
Text.SmallSubHeadline = SmallSubHeadlineWithLogic;
|
|
2503
|
-
var BylineWithLogic = withTextLogic(Byline);
|
|
2504
|
-
BylineWithLogic.displayName = "Text.Byline";
|
|
2505
|
-
Text.Byline = BylineWithLogic;
|
|
2506
|
-
var SmallBylineWithLogic = withTextLogic(SmallByline);
|
|
2507
|
-
SmallBylineWithLogic.displayName = "Text.SmallByline";
|
|
2508
|
-
Text.SmallByline = SmallBylineWithLogic;
|
|
2509
|
-
var BodyCopyWithLogic = withTextLogic(BodyCopy);
|
|
2510
|
-
BodyCopyWithLogic.displayName = "Text.BodyCopy";
|
|
2511
|
-
Text.BodyCopy = BodyCopyWithLogic;
|
|
2512
|
-
var SmallBodyCopyWithLogic = withTextLogic(SmallBodyCopy);
|
|
2513
|
-
SmallBodyCopyWithLogic.displayName = "Text.SmallBodyCopy";
|
|
2514
|
-
Text.SmallBodyCopy = SmallBodyCopyWithLogic;
|
|
2515
|
-
var Text_default = Text;
|
|
2516
|
-
var index_default = Text_default;
|
|
2517
|
-
|
|
2518
|
-
// src/MenuGroup/styles.tsx
|
|
2519
|
-
var StyledMenuGroup = styled7.li`
|
|
549
|
+
border as border2,
|
|
550
|
+
layout as layout2,
|
|
551
|
+
position as position2,
|
|
552
|
+
flexbox as flexbox2,
|
|
553
|
+
grid as grid2,
|
|
554
|
+
color as color2,
|
|
555
|
+
space as space2
|
|
556
|
+
} from "styled-system";
|
|
557
|
+
var StyledMenuGroup = styled4.li`
|
|
2520
558
|
&:not(:last-child) {
|
|
2521
559
|
border-bottom: 1px solid
|
|
2522
|
-
${({ theme
|
|
560
|
+
${({ theme }) => theme.colors.container.border.base};
|
|
2523
561
|
}
|
|
2524
562
|
list-style: none;
|
|
2525
563
|
margin: 0;
|
|
2526
564
|
|
|
2527
|
-
${
|
|
2528
|
-
${
|
|
2529
|
-
${
|
|
2530
|
-
${
|
|
2531
|
-
${
|
|
2532
|
-
${
|
|
2533
|
-
${
|
|
565
|
+
${border2}
|
|
566
|
+
${position2}
|
|
567
|
+
${color2}
|
|
568
|
+
${flexbox2}
|
|
569
|
+
${grid2}
|
|
570
|
+
${layout2}
|
|
571
|
+
${space2}
|
|
2534
572
|
`;
|
|
2535
|
-
var StyledTitle =
|
|
2536
|
-
font-size: ${({ theme
|
|
2537
|
-
margin: ${({ theme
|
|
2538
|
-
0px ${({ theme
|
|
573
|
+
var StyledTitle = styled4(Text.SmallSubHeadline)`
|
|
574
|
+
font-size: ${({ theme }) => theme.typography[100].fontSize};
|
|
575
|
+
margin: ${({ theme }) => theme.space[400]} ${({ theme }) => theme.space[400]}
|
|
576
|
+
0px ${({ theme }) => theme.space[400]};
|
|
2539
577
|
`;
|
|
2540
|
-
var StyledMenuGroupUl =
|
|
578
|
+
var StyledMenuGroupUl = styled4.ul`
|
|
2541
579
|
margin: 0;
|
|
2542
580
|
padding: 0;
|
|
2543
581
|
`;
|
|
2544
582
|
|
|
2545
583
|
// src/MenuGroup/MenuGroup.tsx
|
|
2546
|
-
import { jsx as
|
|
584
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2547
585
|
var MenuGroup = ({
|
|
2548
586
|
titleAs = "h3",
|
|
2549
587
|
children: childrenProp,
|
|
2550
588
|
title,
|
|
2551
|
-
color:
|
|
589
|
+
color: color3,
|
|
2552
590
|
isSingleSelect,
|
|
2553
591
|
id,
|
|
2554
592
|
menuItems,
|
|
@@ -2567,11 +605,11 @@ var MenuGroup = ({
|
|
|
2567
605
|
id,
|
|
2568
606
|
isSingleSelect,
|
|
2569
607
|
"aria-labelledby": title ? titleId : void 0,
|
|
2570
|
-
color:
|
|
608
|
+
color: color3,
|
|
2571
609
|
...rest,
|
|
2572
610
|
children: [
|
|
2573
|
-
title && /* @__PURE__ */
|
|
2574
|
-
/* @__PURE__ */
|
|
611
|
+
title && /* @__PURE__ */ jsx8(StyledTitle, { role: "heading", as: titleAs, id: titleId, children: title }),
|
|
612
|
+
/* @__PURE__ */ jsx8(StyledMenuGroupUl, { children })
|
|
2575
613
|
]
|
|
2576
614
|
}
|
|
2577
615
|
);
|
|
@@ -2579,23 +617,19 @@ var MenuGroup = ({
|
|
|
2579
617
|
MenuGroup.__MENU_PRIMITIVE_TYPE = "MenuGroup";
|
|
2580
618
|
|
|
2581
619
|
// src/MenuRoot/MenuRoot.tsx
|
|
2582
|
-
import
|
|
620
|
+
import React6, {
|
|
2583
621
|
useCallback as useCallback2,
|
|
2584
622
|
useEffect,
|
|
2585
623
|
useLayoutEffect
|
|
2586
624
|
} from "react";
|
|
2587
|
-
import
|
|
625
|
+
import styled5 from "styled-components";
|
|
2588
626
|
import {
|
|
2589
627
|
Popout
|
|
2590
628
|
} from "@sproutsocial/seeds-react-popout";
|
|
2591
629
|
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
var
|
|
2595
|
-
|
|
2596
|
-
// src/MenuRoot/MenuRoot.tsx
|
|
2597
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2598
|
-
var CustomPopoutContent = styled8(Popout.Content)`
|
|
630
|
+
import { MOTION_DURATION_FAST } from "@sproutsocial/seeds-motion/unitless";
|
|
631
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
632
|
+
var CustomPopoutContent = styled5(Popout.Content)`
|
|
2599
633
|
padding: 0;
|
|
2600
634
|
margin-left: 0;
|
|
2601
635
|
margin-right: 0;
|
|
@@ -2616,7 +650,6 @@ var menuPlacementOrigin = {
|
|
|
2616
650
|
["right-end"]: { originX: 0, originY: 1 }
|
|
2617
651
|
};
|
|
2618
652
|
var menuAnimationConfig = {
|
|
2619
|
-
layout: true,
|
|
2620
653
|
variants: {
|
|
2621
654
|
initial: (custom = { placement: "bottom" }) => ({
|
|
2622
655
|
...menuPlacementOrigin[custom.placement],
|
|
@@ -2649,7 +682,7 @@ var menuAnimationConfig = {
|
|
|
2649
682
|
};
|
|
2650
683
|
var MenuPopout = ({
|
|
2651
684
|
content,
|
|
2652
|
-
width
|
|
685
|
+
width = "300px",
|
|
2653
686
|
isOpen,
|
|
2654
687
|
openMenu,
|
|
2655
688
|
closeMenu,
|
|
@@ -2662,12 +695,12 @@ var MenuPopout = ({
|
|
|
2662
695
|
},
|
|
2663
696
|
[openMenu, closeMenu]
|
|
2664
697
|
);
|
|
2665
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ jsx9(
|
|
2666
699
|
Popout,
|
|
2667
700
|
{
|
|
2668
701
|
isOpen: !!isOpen,
|
|
2669
702
|
setIsOpen,
|
|
2670
|
-
content: (props) => /* @__PURE__ */
|
|
703
|
+
content: (props) => /* @__PURE__ */ jsx9(CustomPopoutContent, { width: popoutProps.fullWidth ? "initial" : width, children: typeof content === "function" ? content(props) : content }),
|
|
2671
704
|
focusLockProps: {
|
|
2672
705
|
// correct jerking motion when scrolling while the Popout is open
|
|
2673
706
|
// returnFocus: false,
|
|
@@ -2684,7 +717,7 @@ var MenuRoot = ({
|
|
|
2684
717
|
children,
|
|
2685
718
|
menuToggleElement,
|
|
2686
719
|
popoutProps: { placement = "bottom", focusLockProps, ...popoutProps } = {},
|
|
2687
|
-
width
|
|
720
|
+
width,
|
|
2688
721
|
...contextProps
|
|
2689
722
|
}) => {
|
|
2690
723
|
const {
|
|
@@ -2695,19 +728,19 @@ var MenuRoot = ({
|
|
|
2695
728
|
getMenuProps,
|
|
2696
729
|
autoCloseOnEmpty = false
|
|
2697
730
|
} = contextProps;
|
|
2698
|
-
const toggleElementRef =
|
|
2699
|
-
const [finalWidth, setFinalWidth] =
|
|
731
|
+
const toggleElementRef = React6.useRef(null);
|
|
732
|
+
const [finalWidth, setFinalWidth] = React6.useState();
|
|
2700
733
|
const min_width = 200;
|
|
2701
734
|
useLayoutEffect(() => {
|
|
2702
|
-
if (
|
|
2703
|
-
setFinalWidth(
|
|
735
|
+
if (width) {
|
|
736
|
+
setFinalWidth(width);
|
|
2704
737
|
} else if (toggleElementRef.current?.offsetWidth) {
|
|
2705
738
|
const toggleWidth = toggleElementRef.current.offsetWidth;
|
|
2706
739
|
setFinalWidth(Math.max(toggleWidth, min_width));
|
|
2707
740
|
} else {
|
|
2708
741
|
setFinalWidth(min_width);
|
|
2709
742
|
}
|
|
2710
|
-
}, [
|
|
743
|
+
}, [width, toggleElementRef.current?.offsetWidth]);
|
|
2711
744
|
const menuContext = useMenu(contextProps);
|
|
2712
745
|
getMenuProps?.({}, { suppressRefError: true });
|
|
2713
746
|
useEffect(() => {
|
|
@@ -2716,17 +749,17 @@ var MenuRoot = ({
|
|
|
2716
749
|
closeMenu?.();
|
|
2717
750
|
}
|
|
2718
751
|
}, [menuContext.hasVisibleItems, isOpen, inputValue, autoCloseOnEmpty]);
|
|
2719
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ jsx9(
|
|
2720
753
|
MenuPopout,
|
|
2721
754
|
{
|
|
2722
755
|
placement,
|
|
2723
756
|
isOpen: !!isOpen,
|
|
2724
757
|
openMenu,
|
|
2725
758
|
closeMenu,
|
|
2726
|
-
content: /* @__PURE__ */
|
|
759
|
+
content: /* @__PURE__ */ jsx9(MenuContentProvider, { menuContext, children }),
|
|
2727
760
|
width: finalWidth,
|
|
2728
761
|
...popoutProps,
|
|
2729
|
-
children: (toggleProps) => /* @__PURE__ */
|
|
762
|
+
children: (toggleProps) => /* @__PURE__ */ jsx9(
|
|
2730
763
|
MenuToggleProvider,
|
|
2731
764
|
{
|
|
2732
765
|
menuContext: {
|
|
@@ -2747,7 +780,7 @@ var MenuRoot = ({
|
|
|
2747
780
|
// src/MenuLabel.tsx
|
|
2748
781
|
import "react";
|
|
2749
782
|
import { Label } from "@sproutsocial/seeds-react-label";
|
|
2750
|
-
import { jsx as
|
|
783
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2751
784
|
var MenuLabel = ({
|
|
2752
785
|
children,
|
|
2753
786
|
required = false,
|
|
@@ -2756,7 +789,7 @@ var MenuLabel = ({
|
|
|
2756
789
|
const { getLabelProps } = useMenuToggleContext();
|
|
2757
790
|
return (
|
|
2758
791
|
// This fallback id should never be used, but it is here to satisfy TypeScript since getLabelProps could be undefined.
|
|
2759
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ jsx10(
|
|
2760
793
|
Label,
|
|
2761
794
|
{
|
|
2762
795
|
htmlFor: "fallback_menu_label",
|
|
@@ -2769,51 +802,12 @@ var MenuLabel = ({
|
|
|
2769
802
|
);
|
|
2770
803
|
};
|
|
2771
804
|
|
|
2772
|
-
// src/MenuToggleButton/MenuToggleButton.tsx
|
|
2773
|
-
import { Button } from "@sproutsocial/seeds-react-button";
|
|
2774
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2775
|
-
var MenuToggleButton = (props) => {
|
|
2776
|
-
const { getToggleButtonProps, isListbox, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
2777
|
-
const {
|
|
2778
|
-
onClick: userOnClick,
|
|
2779
|
-
onKeyDown: userOnKeyDown,
|
|
2780
|
-
onBlur: userOnBlur,
|
|
2781
|
-
...restProps
|
|
2782
|
-
} = props;
|
|
2783
|
-
const defaultDropdownProps = {
|
|
2784
|
-
ref,
|
|
2785
|
-
onClick: userOnClick,
|
|
2786
|
-
onKeyDown: userOnKeyDown,
|
|
2787
|
-
onBlur: userOnBlur
|
|
2788
|
-
};
|
|
2789
|
-
const dropdownProps = getDropdownProps?.({
|
|
2790
|
-
...defaultDropdownProps,
|
|
2791
|
-
preventKeyAction: true
|
|
2792
|
-
}) ?? defaultDropdownProps;
|
|
2793
|
-
const toggleButtonProps = getToggleButtonProps?.({
|
|
2794
|
-
...dropdownProps,
|
|
2795
|
-
refKey: "innerRef",
|
|
2796
|
-
...ariaProps,
|
|
2797
|
-
...isListbox ? {} : { role: "button", "aria-haspopup": "menu" }
|
|
2798
|
-
});
|
|
2799
|
-
if (toggleButtonProps && toggleButtonProps["aria-activedescendant"] === "") {
|
|
2800
|
-
toggleButtonProps["aria-activedescendant"] = void 0;
|
|
2801
|
-
}
|
|
2802
|
-
if (toggleButtonProps && toggleButtonProps["aria-expanded"] === false) {
|
|
2803
|
-
toggleButtonProps["aria-controls"] = void 0;
|
|
2804
|
-
}
|
|
2805
|
-
if (toggleButtonProps) {
|
|
2806
|
-
toggleButtonProps["aria-labelledby"] = void 0;
|
|
2807
|
-
}
|
|
2808
|
-
return /* @__PURE__ */ jsx13(Button, { appearance: "secondary", ...toggleButtonProps, ...restProps });
|
|
2809
|
-
};
|
|
2810
|
-
|
|
2811
805
|
// src/MenuSearchInput/MenuSearchInput.tsx
|
|
2812
|
-
import
|
|
806
|
+
import React9 from "react";
|
|
2813
807
|
import { Input } from "@sproutsocial/seeds-react-input";
|
|
2814
808
|
|
|
2815
809
|
// src/hooks/useItemFiltering.tsx
|
|
2816
|
-
import
|
|
810
|
+
import React8 from "react";
|
|
2817
811
|
|
|
2818
812
|
// src/utils/downshiftDefaults.ts
|
|
2819
813
|
var itemToString = (item) => {
|
|
@@ -2833,8 +827,8 @@ var useItemFiltering = ({
|
|
|
2833
827
|
getShouldFilter = defaultGetShouldFilter,
|
|
2834
828
|
setHiddenItemsMap: setHiddenItemsMapProp
|
|
2835
829
|
}) => {
|
|
2836
|
-
const [hiddenItemsMap, setHiddenItemsMap] =
|
|
2837
|
-
const updateFilteredItems =
|
|
830
|
+
const [hiddenItemsMap, setHiddenItemsMap] = React8.useState({});
|
|
831
|
+
const updateFilteredItems = React8.useCallback(
|
|
2838
832
|
({ inputValue }) => {
|
|
2839
833
|
const newHiddenItems = getShouldFilter({ inputValue }) ? allMenuItems.reduce((map, item) => {
|
|
2840
834
|
const isItemVisible = getIsItemVisible(item, inputValue);
|
|
@@ -2852,7 +846,7 @@ var useItemFiltering = ({
|
|
|
2852
846
|
};
|
|
2853
847
|
|
|
2854
848
|
// src/MenuSearchInput/MenuSearchInput.tsx
|
|
2855
|
-
import { jsx as
|
|
849
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2856
850
|
var MenuSearchInput = ({
|
|
2857
851
|
getIsItemVisible,
|
|
2858
852
|
inputProps,
|
|
@@ -2871,18 +865,18 @@ var MenuSearchInput = ({
|
|
|
2871
865
|
getIsItemVisible,
|
|
2872
866
|
setHiddenItemsMap
|
|
2873
867
|
});
|
|
2874
|
-
|
|
868
|
+
React9.useEffect(() => {
|
|
2875
869
|
updateFilteredItems({ inputValue: restInputProps.value || "" });
|
|
2876
870
|
}, [isOpen, restInputProps.value]);
|
|
2877
871
|
const toggleButtonProps = getToggleButtonProps?.() || {};
|
|
2878
|
-
const handleKeyDown =
|
|
872
|
+
const handleKeyDown = React9.useCallback(
|
|
2879
873
|
(e) => {
|
|
2880
874
|
if (e.key === " ") return;
|
|
2881
875
|
toggleButtonProps.onKeyDown?.(e);
|
|
2882
876
|
},
|
|
2883
877
|
[toggleButtonProps.onKeyDown]
|
|
2884
878
|
);
|
|
2885
|
-
return /* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ jsx11(
|
|
2886
880
|
Input,
|
|
2887
881
|
{
|
|
2888
882
|
onChange: (e, value) => {
|
|
@@ -2902,13 +896,13 @@ var MenuSearchInput = ({
|
|
|
2902
896
|
};
|
|
2903
897
|
|
|
2904
898
|
// src/MenuTokenInput.tsx
|
|
2905
|
-
import
|
|
2906
|
-
import
|
|
899
|
+
import React10 from "react";
|
|
900
|
+
import styled6 from "styled-components";
|
|
2907
901
|
import {
|
|
2908
902
|
TokenInput
|
|
2909
903
|
} from "@sproutsocial/seeds-react-token-input";
|
|
2910
|
-
import { jsx as
|
|
2911
|
-
var StyledTokenInputWrapper =
|
|
904
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
905
|
+
var StyledTokenInputWrapper = styled6.div`
|
|
2912
906
|
> div {
|
|
2913
907
|
padding: 4px;
|
|
2914
908
|
}
|
|
@@ -2937,12 +931,12 @@ var MenuTokenInput = ({
|
|
|
2937
931
|
removeSelectedItem,
|
|
2938
932
|
setActiveIndex,
|
|
2939
933
|
selectedItems = []
|
|
2940
|
-
} =
|
|
934
|
+
} = React10.useContext(MenuContext);
|
|
2941
935
|
const removeToken = (tokenId) => {
|
|
2942
936
|
const tokenToRemove = selectedItems?.find((item) => item.id === tokenId);
|
|
2943
937
|
tokenToRemove && removeSelectedItem?.(tokenToRemove);
|
|
2944
938
|
};
|
|
2945
|
-
return /* @__PURE__ */
|
|
939
|
+
return /* @__PURE__ */ jsx12(StyledTokenInputWrapper, { children: /* @__PURE__ */ jsx12(
|
|
2946
940
|
TokenInput,
|
|
2947
941
|
{
|
|
2948
942
|
onKeyDown: (e, value) => {
|
|
@@ -2991,8 +985,8 @@ var MenuTokenInput = ({
|
|
|
2991
985
|
};
|
|
2992
986
|
|
|
2993
987
|
// src/MenuSearchTokenInput/MenuSearchTokenInput.tsx
|
|
2994
|
-
import
|
|
2995
|
-
import { jsx as
|
|
988
|
+
import React11 from "react";
|
|
989
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2996
990
|
var MenuSearchTokenInput = ({
|
|
2997
991
|
getIsItemVisible,
|
|
2998
992
|
getTokenProps,
|
|
@@ -3015,10 +1009,10 @@ var MenuSearchTokenInput = ({
|
|
|
3015
1009
|
setHiddenItemsMap
|
|
3016
1010
|
});
|
|
3017
1011
|
const controlledValue = value || inputPropsValue !== void 0 ? `${inputPropsValue}` : void 0;
|
|
3018
|
-
const [internalValue, setInternalValue] =
|
|
1012
|
+
const [internalValue, setInternalValue] = React11.useState(
|
|
3019
1013
|
controlledValue || ""
|
|
3020
1014
|
);
|
|
3021
|
-
const updateFilteredState =
|
|
1015
|
+
const updateFilteredState = React11.useCallback(
|
|
3022
1016
|
// defaults to an empty string if no value is passed
|
|
3023
1017
|
(value2 = "") => {
|
|
3024
1018
|
setInternalValue(value2);
|
|
@@ -3026,21 +1020,21 @@ var MenuSearchTokenInput = ({
|
|
|
3026
1020
|
},
|
|
3027
1021
|
[updateFilteredItems]
|
|
3028
1022
|
);
|
|
3029
|
-
|
|
1023
|
+
React11.useEffect(() => {
|
|
3030
1024
|
updateFilteredState(controlledValue);
|
|
3031
1025
|
}, [controlledValue]);
|
|
3032
|
-
|
|
1026
|
+
React11.useEffect(() => {
|
|
3033
1027
|
updateFilteredState(controlledValue);
|
|
3034
1028
|
}, [isOpen]);
|
|
3035
1029
|
const toggleButtonProps = getToggleButtonProps?.() || {};
|
|
3036
|
-
const handleKeyDown =
|
|
1030
|
+
const handleKeyDown = React11.useCallback(
|
|
3037
1031
|
(e) => {
|
|
3038
1032
|
if (e.key === " ") return;
|
|
3039
1033
|
toggleButtonProps.onKeyDown?.(e);
|
|
3040
1034
|
},
|
|
3041
1035
|
[toggleButtonProps.onKeyDown]
|
|
3042
1036
|
);
|
|
3043
|
-
return /* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ jsx13(
|
|
3044
1038
|
MenuTokenInput,
|
|
3045
1039
|
{
|
|
3046
1040
|
onChange: (e, value2) => {
|
|
@@ -3061,11 +1055,11 @@ var MenuSearchTokenInput = ({
|
|
|
3061
1055
|
};
|
|
3062
1056
|
|
|
3063
1057
|
// src/SubmenuItem/SubmenuItem.tsx
|
|
3064
|
-
import
|
|
1058
|
+
import React12 from "react";
|
|
3065
1059
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
3066
1060
|
import { Box as Box4 } from "@sproutsocial/seeds-react-box";
|
|
3067
1061
|
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
|
|
3068
|
-
import { jsx as
|
|
1062
|
+
import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3069
1063
|
var SubmenuItemTrigger = ({
|
|
3070
1064
|
id,
|
|
3071
1065
|
children,
|
|
@@ -3074,7 +1068,7 @@ var SubmenuItemTrigger = ({
|
|
|
3074
1068
|
}) => {
|
|
3075
1069
|
const { getToggleButtonProps, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
3076
1070
|
const toggleRef = ref && innerRef ? mergeRefs2([ref, innerRef].filter(Boolean)) : ref || innerRef;
|
|
3077
|
-
return /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ jsx14(
|
|
3078
1072
|
MenuItem,
|
|
3079
1073
|
{
|
|
3080
1074
|
...rest,
|
|
@@ -3093,7 +1087,7 @@ var SubmenuItemTrigger = ({
|
|
|
3093
1087
|
id,
|
|
3094
1088
|
children: /* @__PURE__ */ jsxs4(Box4, { display: "flex", justifyContent: "space-between", children: [
|
|
3095
1089
|
children,
|
|
3096
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ jsx14(MenuItemActionRight, { children: /* @__PURE__ */ jsx14(Icon2, { name: "chevron-right-outline" }) })
|
|
3097
1091
|
] })
|
|
3098
1092
|
}
|
|
3099
1093
|
);
|
|
@@ -3123,17 +1117,17 @@ var SubmenuItem = ({
|
|
|
3123
1117
|
itemsMap,
|
|
3124
1118
|
isOpen: parentIsOpen
|
|
3125
1119
|
} = useMenuContentContext();
|
|
3126
|
-
const [submenuIsFocused, setSubmenuIsFocused] =
|
|
3127
|
-
const [submenuIsOpen, setSubmenuIsOpen] =
|
|
3128
|
-
const [submenuIsActive, setSubmenuIsActive] =
|
|
3129
|
-
const submenuItemRef =
|
|
3130
|
-
const submenuRef =
|
|
1120
|
+
const [submenuIsFocused, setSubmenuIsFocused] = React12.useState(false);
|
|
1121
|
+
const [submenuIsOpen, setSubmenuIsOpen] = React12.useState(false);
|
|
1122
|
+
const [submenuIsActive, setSubmenuIsActive] = React12.useState(false);
|
|
1123
|
+
const submenuItemRef = React12.useRef(null);
|
|
1124
|
+
const submenuRef = React12.useRef(null);
|
|
3131
1125
|
const menuContent = menuItems ? getChildrenFromMenuItems({ menuItems, MenuItemComponent }) : menuChildren;
|
|
3132
1126
|
const item = itemsMap[id] || {
|
|
3133
1127
|
index: 0,
|
|
3134
1128
|
id
|
|
3135
1129
|
};
|
|
3136
|
-
|
|
1130
|
+
React12.useEffect(() => {
|
|
3137
1131
|
if (highlightedIndex === item.index) {
|
|
3138
1132
|
!submenuIsOpen && setSubmenuIsOpen(true);
|
|
3139
1133
|
} else if (submenuIsOpen && highlightedIndex !== -1) {
|
|
@@ -3141,7 +1135,7 @@ var SubmenuItem = ({
|
|
|
3141
1135
|
setSubmenuIsActive(false);
|
|
3142
1136
|
}
|
|
3143
1137
|
}, [highlightedIndex, item.index, submenuIsOpen, setSubmenuIsOpen]);
|
|
3144
|
-
const onSubmenuStateChange =
|
|
1138
|
+
const onSubmenuStateChange = React12.useCallback(
|
|
3145
1139
|
(state) => {
|
|
3146
1140
|
if (state.isOpen !== void 0) {
|
|
3147
1141
|
setSubmenuIsOpen(state.isOpen);
|
|
@@ -3185,7 +1179,7 @@ var SubmenuItem = ({
|
|
|
3185
1179
|
onMenuItemClick();
|
|
3186
1180
|
}
|
|
3187
1181
|
};
|
|
3188
|
-
|
|
1182
|
+
React12.useEffect(() => {
|
|
3189
1183
|
if (document && document.body) {
|
|
3190
1184
|
document.body.addEventListener("click", onBodyClick, {
|
|
3191
1185
|
capture: true
|
|
@@ -3203,7 +1197,7 @@ var SubmenuItem = ({
|
|
|
3203
1197
|
};
|
|
3204
1198
|
}
|
|
3205
1199
|
}, [document, onSubmenuKeydown]);
|
|
3206
|
-
const subMenuContent = /* @__PURE__ */
|
|
1200
|
+
const subMenuContent = /* @__PURE__ */ jsx14(
|
|
3207
1201
|
"div",
|
|
3208
1202
|
{
|
|
3209
1203
|
ref: submenuRef,
|
|
@@ -3214,13 +1208,13 @@ var SubmenuItem = ({
|
|
|
3214
1208
|
children: menuContent
|
|
3215
1209
|
}
|
|
3216
1210
|
);
|
|
3217
|
-
return /* @__PURE__ */
|
|
1211
|
+
return /* @__PURE__ */ jsx14(
|
|
3218
1212
|
MenuComponent,
|
|
3219
1213
|
{
|
|
3220
1214
|
...{
|
|
3221
1215
|
...menuProps,
|
|
3222
1216
|
children: subMenuContent,
|
|
3223
|
-
menuToggleElement: /* @__PURE__ */
|
|
1217
|
+
menuToggleElement: /* @__PURE__ */ jsx14(
|
|
3224
1218
|
SubmenuItemTrigger,
|
|
3225
1219
|
{
|
|
3226
1220
|
innerRef: submenuItemRef,
|
|
@@ -3252,28 +1246,28 @@ var SubmenuItem = ({
|
|
|
3252
1246
|
SubmenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
3253
1247
|
|
|
3254
1248
|
// src/ListboxToggleButton.tsx
|
|
3255
|
-
import
|
|
1249
|
+
import styled7, { css } from "styled-components";
|
|
3256
1250
|
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
3257
|
-
import { jsx as
|
|
3258
|
-
var StyledListboxToggleButton =
|
|
1251
|
+
import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1252
|
+
var StyledListboxToggleButton = styled7(
|
|
3259
1253
|
MenuToggleButton
|
|
3260
1254
|
)`
|
|
3261
|
-
${(props) => props.invalid &&
|
|
1255
|
+
${(props) => props.invalid && css`
|
|
3262
1256
|
border-color: ${(props2) => props2.theme.colors.form.border.error};
|
|
3263
1257
|
`}
|
|
3264
1258
|
`;
|
|
3265
|
-
var StyledChevron =
|
|
3266
|
-
margin-left: ${({ theme
|
|
1259
|
+
var StyledChevron = styled7.div`
|
|
1260
|
+
margin-left: ${({ theme }) => theme.space[300]};
|
|
3267
1261
|
${({ $isOpen }) => $isOpen && `
|
|
3268
1262
|
transform: rotate(-180deg);
|
|
3269
1263
|
`}
|
|
3270
1264
|
transition: transform 0.15s;
|
|
3271
1265
|
|
|
3272
|
-
${({ invalid }) => invalid &&
|
|
1266
|
+
${({ invalid }) => invalid && css`
|
|
3273
1267
|
color: ${(props) => props.theme.colors.icon.error};
|
|
3274
1268
|
`}
|
|
3275
1269
|
`;
|
|
3276
|
-
var StyledInnerButton =
|
|
1270
|
+
var StyledInnerButton = styled7.div`
|
|
3277
1271
|
display: flex;
|
|
3278
1272
|
justify-content: space-between;
|
|
3279
1273
|
`;
|
|
@@ -3282,20 +1276,20 @@ var ListboxToggleButton = ({
|
|
|
3282
1276
|
...buttonProps
|
|
3283
1277
|
}) => {
|
|
3284
1278
|
const { isOpen } = useMenuToggleContext();
|
|
3285
|
-
return /* @__PURE__ */
|
|
1279
|
+
return /* @__PURE__ */ jsx15(StyledListboxToggleButton, { appearance: "secondary", ...buttonProps, children: /* @__PURE__ */ jsxs5(StyledInnerButton, { children: [
|
|
3286
1280
|
children,
|
|
3287
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsx15(StyledChevron, { $isOpen: isOpen, invalid: buttonProps.invalid, children: /* @__PURE__ */ jsx15(Icon3, { name: "chevron-down-outline", fixedWidth: true, "aria-hidden": true }) })
|
|
3288
1282
|
] }) });
|
|
3289
1283
|
};
|
|
3290
1284
|
|
|
3291
1285
|
// src/ActionMenu/ActionMenu.tsx
|
|
3292
|
-
import
|
|
1286
|
+
import React14, { useEffect as useEffect2 } from "react";
|
|
3293
1287
|
import {
|
|
3294
1288
|
useSelect as useSelect2
|
|
3295
1289
|
} from "downshift";
|
|
3296
1290
|
|
|
3297
1291
|
// src/hooks/useDownshiftDefaults.tsx
|
|
3298
|
-
import
|
|
1292
|
+
import React13 from "react";
|
|
3299
1293
|
|
|
3300
1294
|
// src/reducers/useComboboxStateReducer.tsx
|
|
3301
1295
|
import { useCombobox } from "downshift";
|
|
@@ -3419,12 +1413,12 @@ var useDownshiftDefaults = ({
|
|
|
3419
1413
|
isMulti = false,
|
|
3420
1414
|
multiSelectProps = {}
|
|
3421
1415
|
} = {}) => {
|
|
3422
|
-
const [hiddenItemsMap, setHiddenItemsMap] =
|
|
3423
|
-
const hiddenItemsCount =
|
|
1416
|
+
const [hiddenItemsMap, setHiddenItemsMap] = React13.useState({});
|
|
1417
|
+
const hiddenItemsCount = React13.useMemo(
|
|
3424
1418
|
() => Object.keys(hiddenItemsMap).filter(Boolean).length,
|
|
3425
1419
|
[hiddenItemsMap]
|
|
3426
1420
|
);
|
|
3427
|
-
const isItemDisabled =
|
|
1421
|
+
const isItemDisabled = React13.useCallback(
|
|
3428
1422
|
(item) => Boolean(item.disabled || hiddenItemsMap[item.id]),
|
|
3429
1423
|
[hiddenItemsMap]
|
|
3430
1424
|
);
|
|
@@ -3455,7 +1449,7 @@ var useDownshiftDefaults = ({
|
|
|
3455
1449
|
};
|
|
3456
1450
|
|
|
3457
1451
|
// src/ActionMenu/ActionMenu.tsx
|
|
3458
|
-
import { jsx as
|
|
1452
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3459
1453
|
var handleStateChange = (changes, currentSelectedItem) => {
|
|
3460
1454
|
if (!(changes.type === useSelect2.stateChangeTypes.ToggleButtonKeyDownEnter || changes.type === useSelect2.stateChangeTypes.ToggleButtonKeyDownSpaceButton)) {
|
|
3461
1455
|
return;
|
|
@@ -3503,7 +1497,7 @@ var ActionMenu = ({
|
|
|
3503
1497
|
const { defaultDownshiftProps, ...restDefaults } = useDownshiftDefaults({
|
|
3504
1498
|
isCombobox: false
|
|
3505
1499
|
});
|
|
3506
|
-
const [currentSelectedItem, setCurrentSelectedItem] =
|
|
1500
|
+
const [currentSelectedItem, setCurrentSelectedItem] = React14.useState(null);
|
|
3507
1501
|
const { isOpen, ...useSelectReturnProps } = useSelect2({
|
|
3508
1502
|
...defaultDownshiftProps.select,
|
|
3509
1503
|
items: allMenuItems,
|
|
@@ -3518,7 +1512,7 @@ var ActionMenu = ({
|
|
|
3518
1512
|
useEffect2(() => {
|
|
3519
1513
|
setCurrentSelectedItem(useSelectReturnProps.selectedItem);
|
|
3520
1514
|
}, [useSelectReturnProps.selectedItem]);
|
|
3521
|
-
return /* @__PURE__ */
|
|
1515
|
+
return /* @__PURE__ */ jsx16(
|
|
3522
1516
|
MenuRootComponent,
|
|
3523
1517
|
{
|
|
3524
1518
|
...{
|
|
@@ -3539,7 +1533,7 @@ var ActionMenu = ({
|
|
|
3539
1533
|
// src/SingleSelectMenu/SingleSelectMenu.tsx
|
|
3540
1534
|
import "react";
|
|
3541
1535
|
import { useSelect as useSelect3 } from "downshift";
|
|
3542
|
-
import { jsx as
|
|
1536
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3543
1537
|
var SingleSelectMenu = ({
|
|
3544
1538
|
children: childrenProp,
|
|
3545
1539
|
stateReducer: externalStateReducer,
|
|
@@ -3566,7 +1560,7 @@ var SingleSelectMenu = ({
|
|
|
3566
1560
|
),
|
|
3567
1561
|
...useSelectProps
|
|
3568
1562
|
});
|
|
3569
|
-
return /* @__PURE__ */
|
|
1563
|
+
return /* @__PURE__ */ jsx17(
|
|
3570
1564
|
MenuRootComponent,
|
|
3571
1565
|
{
|
|
3572
1566
|
...{
|
|
@@ -3587,7 +1581,7 @@ var SingleSelectMenu = ({
|
|
|
3587
1581
|
// src/MultiSelectMenu/MultiSelectMenu.tsx
|
|
3588
1582
|
import "react";
|
|
3589
1583
|
import { useSelect as useSelect4, useMultipleSelection } from "downshift";
|
|
3590
|
-
import { jsx as
|
|
1584
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3591
1585
|
var MultiSelectMenu = ({
|
|
3592
1586
|
children: childrenProp,
|
|
3593
1587
|
menuItems,
|
|
@@ -3660,7 +1654,7 @@ var MultiSelectMenu = ({
|
|
|
3660
1654
|
},
|
|
3661
1655
|
...useSelectProps
|
|
3662
1656
|
});
|
|
3663
|
-
return /* @__PURE__ */
|
|
1657
|
+
return /* @__PURE__ */ jsx18(
|
|
3664
1658
|
MenuRootComponent,
|
|
3665
1659
|
{
|
|
3666
1660
|
...{
|
|
@@ -3693,7 +1687,7 @@ import "react";
|
|
|
3693
1687
|
// src/Autocomplete/SingleAutocomplete.tsx
|
|
3694
1688
|
import "react";
|
|
3695
1689
|
import { useCombobox as useCombobox2 } from "downshift";
|
|
3696
|
-
import { jsx as
|
|
1690
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3697
1691
|
var SingleAutocomplete = ({
|
|
3698
1692
|
children: childrenProp,
|
|
3699
1693
|
stateReducer: externalStateReducer,
|
|
@@ -3731,7 +1725,7 @@ var SingleAutocomplete = ({
|
|
|
3731
1725
|
});
|
|
3732
1726
|
const { isOpen, closeMenu, inputValue } = useComboboxReturnProps;
|
|
3733
1727
|
const { popoutProps: userPopoutProps } = useComboboxProps;
|
|
3734
|
-
return /* @__PURE__ */
|
|
1728
|
+
return /* @__PURE__ */ jsx19(
|
|
3735
1729
|
MenuRootComponent,
|
|
3736
1730
|
{
|
|
3737
1731
|
...{
|
|
@@ -3753,9 +1747,9 @@ var SingleAutocomplete = ({
|
|
|
3753
1747
|
};
|
|
3754
1748
|
|
|
3755
1749
|
// src/Autocomplete/MultiAutocomplete.tsx
|
|
3756
|
-
import
|
|
1750
|
+
import React18 from "react";
|
|
3757
1751
|
import { useCombobox as useCombobox3, useMultipleSelection as useMultipleSelection2 } from "downshift";
|
|
3758
|
-
import { jsx as
|
|
1752
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3759
1753
|
var MultiAutocomplete = ({
|
|
3760
1754
|
children: childrenProp,
|
|
3761
1755
|
stateReducer: externalStateReducer,
|
|
@@ -3781,22 +1775,22 @@ var MultiAutocomplete = ({
|
|
|
3781
1775
|
menuItems,
|
|
3782
1776
|
MenuItemComponent
|
|
3783
1777
|
});
|
|
3784
|
-
const [selectedItemsState, setSelectedItemsState] =
|
|
3785
|
-
const selectedItems =
|
|
1778
|
+
const [selectedItemsState, setSelectedItemsState] = React18.useState(initialSelectedItems);
|
|
1779
|
+
const selectedItems = React18.useMemo(
|
|
3786
1780
|
() => selectedItemsProp || selectedItemsState,
|
|
3787
1781
|
[selectedItemsProp, selectedItemsState]
|
|
3788
1782
|
);
|
|
3789
|
-
const selectedItemIds =
|
|
1783
|
+
const selectedItemIds = React18.useMemo(
|
|
3790
1784
|
() => getSelectedItemIds(selectedItems),
|
|
3791
1785
|
[selectedItems]
|
|
3792
1786
|
);
|
|
3793
|
-
const getIsItemVisibleMulti =
|
|
1787
|
+
const getIsItemVisibleMulti = React18.useCallback(
|
|
3794
1788
|
(item, inputValue) => {
|
|
3795
1789
|
return (showSelectedItemsInDropdown || !selectedItemIds[item.id]) && getIsItemVisible(item, inputValue);
|
|
3796
1790
|
},
|
|
3797
1791
|
[selectedItemIds, showSelectedItemsInDropdown, getIsItemVisible]
|
|
3798
1792
|
);
|
|
3799
|
-
const getShouldFilterMulti =
|
|
1793
|
+
const getShouldFilterMulti = React18.useCallback(
|
|
3800
1794
|
(args) => {
|
|
3801
1795
|
return !showSelectedItemsInDropdown && Object.keys(selectedItemIds).length > 0 || defaultGetShouldFilter(args);
|
|
3802
1796
|
},
|
|
@@ -3821,7 +1815,7 @@ var MultiAutocomplete = ({
|
|
|
3821
1815
|
getShouldFilter: getShouldFilterMulti,
|
|
3822
1816
|
setHiddenItemsMap
|
|
3823
1817
|
});
|
|
3824
|
-
|
|
1818
|
+
React18.useEffect(() => {
|
|
3825
1819
|
updateFilteredItems({ inputValue: "" });
|
|
3826
1820
|
}, [selectedItemIds]);
|
|
3827
1821
|
const useMultipleSelectionReturnProps = useMultipleSelection2({
|
|
@@ -3866,7 +1860,7 @@ var MultiAutocomplete = ({
|
|
|
3866
1860
|
...useComboboxProps
|
|
3867
1861
|
});
|
|
3868
1862
|
const { popoutProps: userPopoutProps } = useComboboxProps;
|
|
3869
|
-
return /* @__PURE__ */
|
|
1863
|
+
return /* @__PURE__ */ jsx20(
|
|
3870
1864
|
MenuRootComponent,
|
|
3871
1865
|
{
|
|
3872
1866
|
...{
|
|
@@ -3895,21 +1889,21 @@ var MultiAutocomplete = ({
|
|
|
3895
1889
|
};
|
|
3896
1890
|
|
|
3897
1891
|
// src/Autocomplete/Autocomplete.tsx
|
|
3898
|
-
import { jsx as
|
|
1892
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3899
1893
|
var Autocomplete = ({
|
|
3900
1894
|
multiSelect = false,
|
|
3901
1895
|
...rest
|
|
3902
1896
|
}) => {
|
|
3903
1897
|
if (multiSelect) {
|
|
3904
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx21(MultiAutocomplete, { ...rest });
|
|
3905
1899
|
}
|
|
3906
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ jsx21(SingleAutocomplete, { ...rest });
|
|
3907
1901
|
};
|
|
3908
1902
|
|
|
3909
1903
|
// src/Autocomplete/AutocompleteInput.tsx
|
|
3910
1904
|
import "react";
|
|
3911
1905
|
import { Input as Input2 } from "@sproutsocial/seeds-react-input";
|
|
3912
|
-
import { jsx as
|
|
1906
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3913
1907
|
var AutocompleteInput = ({
|
|
3914
1908
|
onKeyDown,
|
|
3915
1909
|
onChange,
|
|
@@ -3920,7 +1914,7 @@ var AutocompleteInput = ({
|
|
|
3920
1914
|
...rest
|
|
3921
1915
|
}) => {
|
|
3922
1916
|
const { getInputComponentProps, inputValue, ref, ariaProps } = useMenuToggleContext();
|
|
3923
|
-
return /* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ jsx22(
|
|
3924
1918
|
Input2,
|
|
3925
1919
|
{
|
|
3926
1920
|
id: "autocomplete_input",
|
|
@@ -3946,7 +1940,7 @@ var AutocompleteInput = ({
|
|
|
3946
1940
|
|
|
3947
1941
|
// src/Autocomplete/AutocompleteTokenInput.tsx
|
|
3948
1942
|
import "react";
|
|
3949
|
-
import { jsx as
|
|
1943
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3950
1944
|
var AutocompleteTokenInput = ({
|
|
3951
1945
|
onKeyDown,
|
|
3952
1946
|
onChange,
|
|
@@ -3965,7 +1959,7 @@ var AutocompleteTokenInput = ({
|
|
|
3965
1959
|
ref,
|
|
3966
1960
|
ariaProps
|
|
3967
1961
|
} = useMenuToggleContext();
|
|
3968
|
-
return /* @__PURE__ */
|
|
1962
|
+
return /* @__PURE__ */ jsx23(
|
|
3969
1963
|
MenuTokenInput,
|
|
3970
1964
|
{
|
|
3971
1965
|
id: "autocomplete_input",
|
|
@@ -3990,19 +1984,19 @@ var AutocompleteTokenInput = ({
|
|
|
3990
1984
|
// src/Autocomplete/AutocompleteSelect.tsx
|
|
3991
1985
|
import Icon4 from "@sproutsocial/seeds-react-icon";
|
|
3992
1986
|
import "react";
|
|
3993
|
-
import
|
|
1987
|
+
import styled8 from "styled-components";
|
|
3994
1988
|
import { Accessory } from "@sproutsocial/seeds-react-input";
|
|
3995
|
-
import { jsx as
|
|
3996
|
-
var StyledAutocompleteInput =
|
|
1989
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1990
|
+
var StyledAutocompleteInput = styled8(AutocompleteInput)`
|
|
3997
1991
|
${Accessory} {
|
|
3998
1992
|
pointer-events: none;
|
|
3999
1993
|
}
|
|
4000
1994
|
`;
|
|
4001
1995
|
var AutocompleteSelect = (props) => {
|
|
4002
|
-
return /* @__PURE__ */
|
|
1996
|
+
return /* @__PURE__ */ jsx24(
|
|
4003
1997
|
StyledAutocompleteInput,
|
|
4004
1998
|
{
|
|
4005
|
-
elemAfter: /* @__PURE__ */
|
|
1999
|
+
elemAfter: /* @__PURE__ */ jsx24(Icon4, { name: "chevron-down" }),
|
|
4006
2000
|
...props
|
|
4007
2001
|
}
|
|
4008
2002
|
);
|
|
@@ -4039,8 +2033,9 @@ var nestedMenuStateReducer = (_state, actionAndChanges) => {
|
|
|
4039
2033
|
};
|
|
4040
2034
|
|
|
4041
2035
|
// src/NestedMenu/NestedMenuContext.tsx
|
|
4042
|
-
import { createContext
|
|
4043
|
-
import {
|
|
2036
|
+
import { createContext, useContext as useContext4 } from "react";
|
|
2037
|
+
import { MOTION_DURATION_FAST as MOTION_DURATION_FAST2 } from "@sproutsocial/seeds-motion/unitless";
|
|
2038
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4044
2039
|
var defaultNestedMenuContext = {
|
|
4045
2040
|
selectedMenuPath: [],
|
|
4046
2041
|
setSelectedMenuId: () => {
|
|
@@ -4055,19 +2050,19 @@ var defaultNestedMenuContext = {
|
|
|
4055
2050
|
activeMenuContext: defaultMenuContext,
|
|
4056
2051
|
setActiveMenuContext: () => {
|
|
4057
2052
|
},
|
|
4058
|
-
animationSpeed:
|
|
2053
|
+
animationSpeed: MOTION_DURATION_FAST2
|
|
4059
2054
|
};
|
|
4060
|
-
var NestedMenuContext =
|
|
2055
|
+
var NestedMenuContext = createContext(
|
|
4061
2056
|
defaultNestedMenuContext
|
|
4062
2057
|
);
|
|
4063
2058
|
var NestedMenuProvider = ({
|
|
4064
2059
|
children,
|
|
4065
2060
|
...nestedMenuProps
|
|
4066
2061
|
}) => {
|
|
4067
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsx25(NestedMenuContext.Provider, { value: nestedMenuProps, children });
|
|
4068
2063
|
};
|
|
4069
2064
|
var useNestedMenuContext = () => {
|
|
4070
|
-
const nestedMenuContextValue =
|
|
2065
|
+
const nestedMenuContextValue = useContext4(NestedMenuContext);
|
|
4071
2066
|
if (nestedMenuContextValue === null) {
|
|
4072
2067
|
throw new Error(
|
|
4073
2068
|
"useNestedMenuContext must be used within a <NestedMenuContext.Provider />"
|
|
@@ -4083,7 +2078,7 @@ import { mergeRefs as mergeRefs3 } from "@sproutsocial/seeds-react-utilities";
|
|
|
4083
2078
|
// src/NestedMenu/NestedMenuItem.tsx
|
|
4084
2079
|
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
4085
2080
|
import { Box as Box5 } from "@sproutsocial/seeds-react-box";
|
|
4086
|
-
import { jsx as
|
|
2081
|
+
import { jsx as jsx26, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4087
2082
|
var NestedMenuItem = ({
|
|
4088
2083
|
children,
|
|
4089
2084
|
childMenuId,
|
|
@@ -4099,15 +2094,15 @@ var NestedMenuItem = ({
|
|
|
4099
2094
|
}
|
|
4100
2095
|
}
|
|
4101
2096
|
} : {};
|
|
4102
|
-
return /* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ jsx26(MenuItem, { ...onClickProps, ...rest, children: /* @__PURE__ */ jsxs6(Box5, { display: "flex", justifyContent: "space-between", children: [
|
|
4103
2098
|
children,
|
|
4104
|
-
childMenuId && /* @__PURE__ */
|
|
2099
|
+
childMenuId && /* @__PURE__ */ jsx26(MenuItemActionRight, { children: /* @__PURE__ */ jsx26(Icon5, { name: "arrow-right-outline" }) })
|
|
4105
2100
|
] }) });
|
|
4106
2101
|
};
|
|
4107
2102
|
NestedMenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
4108
2103
|
|
|
4109
2104
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
4110
|
-
import { jsx as
|
|
2105
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4111
2106
|
var NestedMenuContent = ({
|
|
4112
2107
|
innerRef: innerRefProp = null,
|
|
4113
2108
|
onKeyDown: onKeyDownProp,
|
|
@@ -4144,7 +2139,7 @@ var NestedMenuContent = ({
|
|
|
4144
2139
|
break;
|
|
4145
2140
|
}
|
|
4146
2141
|
};
|
|
4147
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ jsx27(
|
|
4148
2143
|
MenuContent,
|
|
4149
2144
|
{
|
|
4150
2145
|
onKeyDown,
|
|
@@ -4157,20 +2152,20 @@ var NestedMenuContent = ({
|
|
|
4157
2152
|
NestedMenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
4158
2153
|
|
|
4159
2154
|
// src/NestedMenu/NestedMenuHeader.tsx
|
|
4160
|
-
import { Button
|
|
2155
|
+
import { Button } from "@sproutsocial/seeds-react-button";
|
|
4161
2156
|
import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
|
|
4162
2157
|
import { AnimatePresence, motion } from "motion/react";
|
|
4163
|
-
import { jsx as
|
|
2158
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4164
2159
|
var NestedMenuHeader = ({
|
|
4165
2160
|
backArrowLabel,
|
|
4166
2161
|
...props
|
|
4167
2162
|
}) => {
|
|
4168
2163
|
const { goBack, selectedMenuPath, animationSpeed } = useNestedMenuContext();
|
|
4169
2164
|
const showBackArrow = selectedMenuPath.length > 1;
|
|
4170
|
-
return /* @__PURE__ */
|
|
2165
|
+
return /* @__PURE__ */ jsx28(
|
|
4171
2166
|
MenuHeader,
|
|
4172
2167
|
{
|
|
4173
|
-
leftAction: /* @__PURE__ */
|
|
2168
|
+
leftAction: /* @__PURE__ */ jsx28(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx28(
|
|
4174
2169
|
motion.div,
|
|
4175
2170
|
{
|
|
4176
2171
|
initial: { opacity: 0 },
|
|
@@ -4179,7 +2174,7 @@ var NestedMenuHeader = ({
|
|
|
4179
2174
|
opacity: 0,
|
|
4180
2175
|
transition: { duration: animationSpeed }
|
|
4181
2176
|
},
|
|
4182
|
-
children: showBackArrow ? /* @__PURE__ */
|
|
2177
|
+
children: showBackArrow ? /* @__PURE__ */ jsx28(Button, { onClick: goBack, ariaLabel: backArrowLabel, children: /* @__PURE__ */ jsx28(Icon6, { name: "arrow-left" }) }) : void 0
|
|
4183
2178
|
},
|
|
4184
2179
|
`${selectedMenuPath}-header--button`
|
|
4185
2180
|
) }),
|
|
@@ -4188,9 +2183,12 @@ var NestedMenuHeader = ({
|
|
|
4188
2183
|
);
|
|
4189
2184
|
};
|
|
4190
2185
|
|
|
2186
|
+
// src/NestedMenu/NestedMenu.tsx
|
|
2187
|
+
import { MOTION_DURATION_FAST as MOTION_DURATION_FAST3 } from "@sproutsocial/seeds-motion/unitless";
|
|
2188
|
+
|
|
4191
2189
|
// src/NestedMenu/NestedMenuRoot.tsx
|
|
4192
|
-
import
|
|
4193
|
-
import { jsx as
|
|
2190
|
+
import React23 from "react";
|
|
2191
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4194
2192
|
var NestedMenuRoot = ({
|
|
4195
2193
|
children,
|
|
4196
2194
|
menuToggleElement,
|
|
@@ -4198,32 +2196,32 @@ var NestedMenuRoot = ({
|
|
|
4198
2196
|
}) => {
|
|
4199
2197
|
const menuContext = useMenu(contextProps);
|
|
4200
2198
|
const { setActiveMenuContext, selectedMenuPath } = useNestedMenuContext();
|
|
4201
|
-
|
|
2199
|
+
React23.useEffect(() => {
|
|
4202
2200
|
setActiveMenuContext(menuContext);
|
|
4203
2201
|
}, [
|
|
4204
2202
|
selectedMenuPath[selectedMenuPath.length - 1],
|
|
4205
2203
|
menuContext.selectedItem,
|
|
4206
2204
|
menuContext.selectedItems?.length
|
|
4207
2205
|
]);
|
|
4208
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ jsx29(MenuContentProvider, { menuContext, children });
|
|
4209
2207
|
};
|
|
4210
2208
|
|
|
4211
2209
|
// src/NestedMenu/NestedMenuPopout.tsx
|
|
4212
2210
|
import { motion as motion2 } from "motion/react";
|
|
4213
|
-
import
|
|
4214
|
-
import { jsx as
|
|
4215
|
-
var StyledDiv =
|
|
2211
|
+
import styled9 from "styled-components";
|
|
2212
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2213
|
+
var StyledDiv = styled9(motion2.div)`
|
|
4216
2214
|
overflow: hidden;
|
|
4217
2215
|
`;
|
|
4218
2216
|
var NestedMenuPopout = ({
|
|
4219
2217
|
content,
|
|
4220
2218
|
menuToggleElement,
|
|
4221
|
-
width
|
|
2219
|
+
width,
|
|
4222
2220
|
onClose,
|
|
4223
2221
|
...popoutProps
|
|
4224
2222
|
}) => {
|
|
4225
2223
|
const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
|
|
4226
|
-
return /* @__PURE__ */
|
|
2224
|
+
return /* @__PURE__ */ jsx30(
|
|
4227
2225
|
MenuPopout,
|
|
4228
2226
|
{
|
|
4229
2227
|
lockPlacement: true,
|
|
@@ -4234,10 +2232,10 @@ var NestedMenuPopout = ({
|
|
|
4234
2232
|
isOpen: !!rootMenuContextProps.isOpen,
|
|
4235
2233
|
openMenu: rootMenuContextProps.openMenu,
|
|
4236
2234
|
closeMenu: rootMenuContextProps.closeMenu,
|
|
4237
|
-
width
|
|
4238
|
-
content: (props) => /* @__PURE__ */
|
|
2235
|
+
width,
|
|
2236
|
+
content: (props) => /* @__PURE__ */ jsx30(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
|
|
4239
2237
|
...popoutProps,
|
|
4240
|
-
children: (toggleProps) => /* @__PURE__ */
|
|
2238
|
+
children: (toggleProps) => /* @__PURE__ */ jsx30(
|
|
4241
2239
|
MenuToggleProvider,
|
|
4242
2240
|
{
|
|
4243
2241
|
menuContext: {
|
|
@@ -4253,7 +2251,7 @@ var NestedMenuPopout = ({
|
|
|
4253
2251
|
};
|
|
4254
2252
|
|
|
4255
2253
|
// src/NestedMenu/NestedMenu.tsx
|
|
4256
|
-
import { jsx as
|
|
2254
|
+
import { jsx as jsx31, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4257
2255
|
var useId = () => {
|
|
4258
2256
|
const [id, setId] = useState();
|
|
4259
2257
|
useEffect4(() => {
|
|
@@ -4272,7 +2270,7 @@ var NestedMenu = ({
|
|
|
4272
2270
|
scheduleUpdateRef: externalPopoutUpdateRef,
|
|
4273
2271
|
...restPopoutProps
|
|
4274
2272
|
} = {},
|
|
4275
|
-
width
|
|
2273
|
+
width = "300px",
|
|
4276
2274
|
stateReducer: rootExternalStateReducer,
|
|
4277
2275
|
id: externalNestedMenuId,
|
|
4278
2276
|
...useSelectProps
|
|
@@ -4357,7 +2355,7 @@ var NestedMenu = ({
|
|
|
4357
2355
|
nestedMenuStateReducer,
|
|
4358
2356
|
externalStateReducer
|
|
4359
2357
|
);
|
|
4360
|
-
const animationSpeed =
|
|
2358
|
+
const animationSpeed = MOTION_DURATION_FAST3;
|
|
4361
2359
|
const contentVariants = {
|
|
4362
2360
|
arrive: (custom = { hasLoadedOnce: false, isAdding: false }) => ({
|
|
4363
2361
|
opacity: 0,
|
|
@@ -4419,7 +2417,7 @@ var NestedMenu = ({
|
|
|
4419
2417
|
initialIsOpen: true,
|
|
4420
2418
|
children: (
|
|
4421
2419
|
// Handles the smooth animating of the content
|
|
4422
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsx31(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsxs7(
|
|
4423
2421
|
motion3.div,
|
|
4424
2422
|
{
|
|
4425
2423
|
variants: contentVariants,
|
|
@@ -4428,7 +2426,7 @@ var NestedMenu = ({
|
|
|
4428
2426
|
exit: "leave",
|
|
4429
2427
|
custom: { isAdding, hasLoadedOnce },
|
|
4430
2428
|
children: [
|
|
4431
|
-
MenuHeaderComponent && /* @__PURE__ */
|
|
2429
|
+
MenuHeaderComponent && /* @__PURE__ */ jsx31(
|
|
4432
2430
|
MenuHeaderComponent,
|
|
4433
2431
|
{
|
|
4434
2432
|
backArrowLabel,
|
|
@@ -4436,7 +2434,7 @@ var NestedMenu = ({
|
|
|
4436
2434
|
}
|
|
4437
2435
|
),
|
|
4438
2436
|
children && children,
|
|
4439
|
-
menuItems && !children && /* @__PURE__ */
|
|
2437
|
+
menuItems && !children && /* @__PURE__ */ jsx31(
|
|
4440
2438
|
NestedMenuContent,
|
|
4441
2439
|
{
|
|
4442
2440
|
menuItems,
|
|
@@ -4453,7 +2451,7 @@ var NestedMenu = ({
|
|
|
4453
2451
|
useEffect4(() => {
|
|
4454
2452
|
popoutUpdateRef.current?.();
|
|
4455
2453
|
}, [nestedMenuProps.children]);
|
|
4456
|
-
return /* @__PURE__ */
|
|
2454
|
+
return /* @__PURE__ */ jsx31(
|
|
4457
2455
|
NestedMenuProvider,
|
|
4458
2456
|
{
|
|
4459
2457
|
...{
|
|
@@ -4467,11 +2465,11 @@ var NestedMenu = ({
|
|
|
4467
2465
|
setActiveMenuContext,
|
|
4468
2466
|
animationSpeed
|
|
4469
2467
|
},
|
|
4470
|
-
children: /* @__PURE__ */
|
|
2468
|
+
children: /* @__PURE__ */ jsx31(
|
|
4471
2469
|
NestedMenuPopout,
|
|
4472
2470
|
{
|
|
4473
2471
|
content: MenuComponent && // Handles the rerender of the component
|
|
4474
|
-
/* @__PURE__ */
|
|
2472
|
+
/* @__PURE__ */ jsx31(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx31(
|
|
4475
2473
|
motion3.div,
|
|
4476
2474
|
{
|
|
4477
2475
|
variants: menuVariants,
|
|
@@ -4479,12 +2477,12 @@ var NestedMenu = ({
|
|
|
4479
2477
|
animate: "enter",
|
|
4480
2478
|
exit: "leave",
|
|
4481
2479
|
custom: { isAdding, hasLoadedOnce },
|
|
4482
|
-
children: /* @__PURE__ */
|
|
2480
|
+
children: /* @__PURE__ */ jsx31(MenuComponent, { ...nestedMenuProps })
|
|
4483
2481
|
},
|
|
4484
2482
|
`${currentMenuId}-content`
|
|
4485
2483
|
) }),
|
|
4486
2484
|
menuToggleElement,
|
|
4487
|
-
width
|
|
2485
|
+
width,
|
|
4488
2486
|
scheduleUpdateRef: (callback) => {
|
|
4489
2487
|
popoutUpdateRef.current = callback;
|
|
4490
2488
|
externalPopoutUpdateRef?.(callback);
|
|
@@ -4556,13 +2554,4 @@ export {
|
|
|
4556
2554
|
useSelectStateReducer,
|
|
4557
2555
|
useSelectStateReducerForMulti
|
|
4558
2556
|
};
|
|
4559
|
-
/*! Bundled license information:
|
|
4560
|
-
|
|
4561
|
-
object-assign/index.js:
|
|
4562
|
-
(*
|
|
4563
|
-
object-assign
|
|
4564
|
-
(c) Sindre Sorhus
|
|
4565
|
-
@license MIT
|
|
4566
|
-
*)
|
|
4567
|
-
*/
|
|
4568
2557
|
//# sourceMappingURL=index.js.map
|