@marigold/components 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionGroup/ActionGroup.d.ts +9 -0
- package/dist/ActionGroup/index.d.ts +1 -0
- package/dist/Alert/Alert.d.ts +16 -1
- package/dist/Box/Box.d.ts +2 -1
- package/dist/Button/Button.d.ts +4 -6
- package/dist/Card/Card.d.ts +9 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Checkbox/Checkbox.d.ts +3 -0
- package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
- package/dist/Column/Column.d.ts +3 -1
- package/dist/Dialog/Dialog.d.ts +8 -1
- package/dist/Dialog/ModalDialog.d.ts +5 -0
- package/dist/Field/Field.d.ts +4 -2
- package/dist/Label/Label.d.ts +2 -1
- package/dist/Provider/MarigoldProvider.d.ts +3 -0
- package/dist/Provider/index.d.ts +3 -0
- package/dist/Radio/Radio.d.ts +3 -0
- package/dist/Radio/RadioIcons.d.ts +9 -0
- package/dist/Select/ListBox.d.ts +8 -0
- package/dist/Select/ListBoxSection.d.ts +8 -0
- package/dist/Select/Option.d.ts +8 -0
- package/dist/Select/Popover.d.ts +9 -0
- package/dist/Select/Select.d.ts +11 -4
- package/dist/Stack/Stack.d.ts +1 -3
- package/dist/Textarea/Textarea.d.ts +2 -1
- package/dist/components.cjs.development.js +868 -357
- package/dist/components.cjs.development.js.map +1 -1
- package/dist/components.cjs.production.min.js +1 -1
- package/dist/components.cjs.production.min.js.map +1 -1
- package/dist/components.esm.js +837 -359
- package/dist/components.esm.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/package.json +18 -3
- package/src/ActionGroup/ActionGroup.stories.mdx +62 -0
- package/src/ActionGroup/ActionGroup.test.tsx +83 -0
- package/src/ActionGroup/ActionGroup.tsx +43 -0
- package/src/ActionGroup/index.ts +1 -0
- package/src/Alert/Alert.stories.mdx +28 -38
- package/src/Alert/Alert.test.tsx +1 -1
- package/src/Alert/Alert.tsx +11 -33
- package/src/Badge/Badge.stories.mdx +48 -34
- package/src/Badge/Badge.test.tsx +7 -15
- package/src/Badge/Badge.tsx +1 -2
- package/src/Box/Box.stories.mdx +322 -26
- package/src/Box/Box.tsx +58 -50
- package/src/Button/Button.stories.mdx +54 -166
- package/src/Button/Button.test.tsx +48 -8
- package/src/Button/Button.tsx +47 -18
- package/src/Card/Card.stories.mdx +49 -0
- package/src/Card/Card.test.tsx +66 -0
- package/src/Card/Card.tsx +36 -0
- package/src/Card/index.ts +1 -0
- package/src/Checkbox/Checkbox.stories.mdx +76 -71
- package/src/Checkbox/Checkbox.test.tsx +70 -24
- package/src/Checkbox/Checkbox.tsx +68 -49
- package/src/Checkbox/CheckboxIcons.tsx +49 -0
- package/src/Column/Column.stories.mdx +39 -64
- package/src/Column/Column.test.tsx +8 -0
- package/src/Column/Column.tsx +12 -2
- package/src/Columns/Columns.stories.mdx +58 -240
- package/src/Container/Container.stories.mdx +8 -25
- package/src/Dialog/Dialog.stories.mdx +65 -56
- package/src/Dialog/Dialog.test.tsx +64 -24
- package/src/Dialog/Dialog.tsx +64 -12
- package/src/Dialog/ModalDialog.tsx +47 -0
- package/src/Divider/Divider.stories.mdx +28 -34
- package/src/Field/Field.stories.mdx +88 -48
- package/src/Field/Field.test.tsx +31 -40
- package/src/Field/Field.tsx +26 -21
- package/src/Heading/Heading.stories.mdx +30 -82
- package/src/Hidden/Hidden.stories.mdx +29 -54
- package/src/Image/Image.stories.mdx +26 -30
- package/src/Input/Input.stories.mdx +52 -36
- package/src/Label/Label.stories.mdx +47 -29
- package/src/Label/Label.test.tsx +15 -1
- package/src/Label/Label.tsx +20 -7
- package/src/Link/Link.stories.mdx +36 -29
- package/src/Menu/Menu.stories.mdx +71 -39
- package/src/Menu/Menu.test.tsx +4 -4
- package/src/Menu/Menu.tsx +12 -14
- package/src/MenuItem/MenuItem.stories.mdx +32 -27
- package/src/MenuItem/MenuItem.test.tsx +15 -11
- package/src/MenuItem/MenuItem.tsx +7 -10
- package/src/Message/Message.stories.mdx +35 -35
- package/src/Message/Message.tsx +2 -10
- package/src/Provider/MarigoldProvider.test.tsx +126 -0
- package/src/Provider/MarigoldProvider.tsx +29 -0
- package/src/Provider/index.ts +3 -0
- package/src/Radio/Radio.stories.mdx +78 -92
- package/src/Radio/Radio.test.tsx +57 -15
- package/src/Radio/Radio.tsx +71 -51
- package/src/Radio/RadioIcons.tsx +39 -0
- package/src/Select/ListBox.tsx +39 -0
- package/src/Select/ListBoxSection.tsx +40 -0
- package/src/Select/Option.tsx +48 -0
- package/src/Select/Popover.tsx +50 -0
- package/src/Select/Select.stories.mdx +70 -36
- package/src/Select/Select.test.tsx +279 -35
- package/src/Select/Select.tsx +151 -18
- package/src/Slider/Slider.stories.mdx +22 -49
- package/src/Stack/Stack.stories.mdx +40 -94
- package/src/Stack/Stack.test.tsx +84 -65
- package/src/Stack/Stack.tsx +25 -41
- package/src/Text/Text.stories.mdx +52 -52
- package/src/Text/Text.tsx +13 -14
- package/src/Textarea/Textarea.stories.mdx +65 -56
- package/src/Textarea/Textarea.test.tsx +4 -5
- package/src/Textarea/Textarea.tsx +28 -37
- package/src/ValidationMessage/ValidationMessage.stories.mdx +26 -26
- package/src/ValidationMessage/ValidationMessage.test.tsx +4 -4
- package/src/ValidationMessage/ValidationMessage.tsx +11 -12
- package/src/index.ts +5 -0
|
@@ -4,10 +4,21 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var React__default = _interopDefault(React);
|
|
7
|
-
var icons = require('@marigold/icons');
|
|
8
|
-
var system = require('@marigold/system');
|
|
9
7
|
var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
|
|
8
|
+
var system = require('@marigold/system');
|
|
9
|
+
var icons = require('@marigold/icons');
|
|
10
|
+
var button = require('@react-aria/button');
|
|
11
|
+
var overlays = require('@react-stately/overlays');
|
|
12
|
+
var overlays$1 = require('@react-aria/overlays');
|
|
13
|
+
var dialog = require('@react-aria/dialog');
|
|
14
|
+
var focus = require('@react-aria/focus');
|
|
10
15
|
var link = require('@react-aria/link');
|
|
16
|
+
var ssr = require('@react-aria/ssr');
|
|
17
|
+
var select = require('@react-stately/select');
|
|
18
|
+
var utils = require('@react-aria/utils');
|
|
19
|
+
var select$1 = require('@react-aria/select');
|
|
20
|
+
var listbox = require('@react-aria/listbox');
|
|
21
|
+
var collections = require('@react-stately/collections');
|
|
11
22
|
|
|
12
23
|
function _extends() {
|
|
13
24
|
_extends = Object.assign || function (target) {
|
|
@@ -42,10 +53,50 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
42
53
|
return target;
|
|
43
54
|
}
|
|
44
55
|
|
|
56
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
57
|
+
if (!o) return;
|
|
58
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
59
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
62
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _arrayLikeToArray(arr, len) {
|
|
66
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
67
|
+
|
|
68
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
69
|
+
|
|
70
|
+
return arr2;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
74
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
75
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
76
|
+
|
|
77
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
78
|
+
if (it) o = it;
|
|
79
|
+
var i = 0;
|
|
80
|
+
return function () {
|
|
81
|
+
if (i >= o.length) return {
|
|
82
|
+
done: true
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
done: false,
|
|
86
|
+
value: o[i++]
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var _excluded = ["variant", "as", "css", "children", "className", "display", "height", "width", "minWidth", "maxWidth", "position", "top", "bottom", "right", "left", "zIndex", "p", "px", "py", "pt", "pb", "pl", "pr", "m", "mx", "my", "mt", "mb", "ml", "mr", "flexDirection", "flexWrap", "flexShrink", "flexGrow", "alignItems", "justifyContent", "bg", "border", "borderRadius", "boxShadow", "opacity", "overflow", "transition"];
|
|
45
95
|
var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
46
96
|
var variant = _ref.variant,
|
|
47
97
|
_ref$as = _ref.as,
|
|
48
98
|
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
99
|
+
css = _ref.css,
|
|
49
100
|
children = _ref.children,
|
|
50
101
|
className = _ref.className,
|
|
51
102
|
display = _ref.display,
|
|
@@ -86,13 +137,13 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
86
137
|
opacity = _ref.opacity,
|
|
87
138
|
overflow = _ref.overflow,
|
|
88
139
|
transition = _ref.transition,
|
|
89
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
140
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
90
141
|
|
|
91
|
-
|
|
92
|
-
|
|
142
|
+
return React__default.createElement(system.Element, Object.assign({
|
|
143
|
+
as: as,
|
|
144
|
+
ref: ref,
|
|
93
145
|
variant: variant,
|
|
94
|
-
|
|
95
|
-
css: {
|
|
146
|
+
css: _extends({}, {
|
|
96
147
|
display: display,
|
|
97
148
|
height: height,
|
|
98
149
|
width: width,
|
|
@@ -131,80 +182,73 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
131
182
|
opacity: opacity,
|
|
132
183
|
overflow: overflow,
|
|
133
184
|
transition: transition
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ref: ref,
|
|
138
|
-
className: cn
|
|
139
|
-
}), children);
|
|
185
|
+
}, css),
|
|
186
|
+
className: className
|
|
187
|
+
}, props), children);
|
|
140
188
|
});
|
|
141
189
|
|
|
142
|
-
var
|
|
190
|
+
var _excluded$1 = ["variant", "space", "verticalAlignment", "children", "className"];
|
|
191
|
+
var ActionGroup = function ActionGroup(_ref) {
|
|
143
192
|
var _ref$variant = _ref.variant,
|
|
144
|
-
variant = _ref$variant === void 0 ? '
|
|
193
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
194
|
+
_ref$space = _ref.space,
|
|
195
|
+
space = _ref$space === void 0 ? 'none' : _ref$space,
|
|
196
|
+
_ref$verticalAlignmen = _ref.verticalAlignment,
|
|
197
|
+
verticalAlignment = _ref$verticalAlignmen === void 0 ? false : _ref$verticalAlignmen,
|
|
145
198
|
children = _ref.children,
|
|
146
199
|
className = _ref.className,
|
|
147
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
200
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
148
201
|
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
202
|
+
var childStyle = verticalAlignment ? {
|
|
203
|
+
marginBottom: space
|
|
204
|
+
} : {
|
|
205
|
+
marginRight: space
|
|
206
|
+
};
|
|
207
|
+
return React__default.createElement(Box, Object.assign({
|
|
208
|
+
variant: "actionGroup." + variant,
|
|
155
209
|
className: className
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
var iconClassName = system.useStyles({
|
|
166
|
-
css: {
|
|
167
|
-
bg: bgColor,
|
|
168
|
-
m: '10px'
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
var icon = React__default.createElement(icons.Check, {
|
|
172
|
-
size: 12,
|
|
173
|
-
color: "#ffffff",
|
|
174
|
-
className: iconClassName
|
|
175
|
-
});
|
|
210
|
+
}, props), React.Children.map(flattenChildren(children), function (child, i) {
|
|
211
|
+
return child !== null && child !== undefined && React__default.createElement(Box, {
|
|
212
|
+
as: verticalAlignment ? 'div' : 'span',
|
|
213
|
+
css: i < React.Children.count(children) - 1 ? childStyle : undefined
|
|
214
|
+
}, child);
|
|
215
|
+
}));
|
|
216
|
+
};
|
|
176
217
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
});
|
|
189
|
-
}
|
|
218
|
+
var _excluded$2 = ["variant", "children"];
|
|
219
|
+
var ICON_MAP = {
|
|
220
|
+
success: icons.Check,
|
|
221
|
+
warning: icons.Notification,
|
|
222
|
+
error: icons.Exclamation
|
|
223
|
+
};
|
|
224
|
+
var Alert = function Alert(_ref) {
|
|
225
|
+
var _ref$variant = _ref.variant,
|
|
226
|
+
variant = _ref$variant === void 0 ? 'success' : _ref$variant,
|
|
227
|
+
children = _ref.children,
|
|
228
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
190
229
|
|
|
230
|
+
var Icon = ICON_MAP[variant];
|
|
191
231
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
192
|
-
|
|
232
|
+
display: "flex",
|
|
233
|
+
variant: "alerts." + variant
|
|
193
234
|
}), React__default.createElement(Box, {
|
|
194
235
|
display: "inline-block",
|
|
195
236
|
alignItems: "center",
|
|
196
237
|
width: "32px",
|
|
197
238
|
height: "32px",
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
239
|
+
bg: variant
|
|
240
|
+
}, React__default.createElement(Box, {
|
|
241
|
+
as: Icon,
|
|
242
|
+
size: 12,
|
|
243
|
+
color: "#fff",
|
|
244
|
+
bg: variant,
|
|
245
|
+
m: 10
|
|
246
|
+
})), React__default.createElement(Box, {
|
|
204
247
|
mx: "16px"
|
|
205
248
|
}, children));
|
|
206
249
|
};
|
|
207
250
|
|
|
251
|
+
var _excluded$3 = ["variant", "bgColor", "borderColor", "children"];
|
|
208
252
|
var Badge = function Badge(_ref) {
|
|
209
253
|
var _ref$variant = _ref.variant,
|
|
210
254
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
@@ -213,77 +257,186 @@ var Badge = function Badge(_ref) {
|
|
|
213
257
|
_ref$borderColor = _ref.borderColor,
|
|
214
258
|
borderColor = _ref$borderColor === void 0 ? 'transparent' : _ref$borderColor,
|
|
215
259
|
children = _ref.children,
|
|
216
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
260
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
217
261
|
|
|
218
262
|
return React__default.createElement(Box, Object.assign({
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}),
|
|
263
|
+
css: {
|
|
264
|
+
bg: bgColor,
|
|
265
|
+
borderColor: borderColor
|
|
266
|
+
},
|
|
225
267
|
variant: "badge." + variant
|
|
226
268
|
}, props), children);
|
|
227
269
|
};
|
|
228
270
|
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
271
|
+
var _excluded$4 = ["as", "variant", "size", "disabled", "children", "className"];
|
|
272
|
+
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
273
|
+
var _ref$as = _ref.as,
|
|
274
|
+
as = _ref$as === void 0 ? 'button' : _ref$as,
|
|
275
|
+
_ref$variant = _ref.variant,
|
|
276
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
277
|
+
_ref$size = _ref.size,
|
|
278
|
+
size = _ref$size === void 0 ? 'large' : _ref$size,
|
|
279
|
+
disabled = _ref.disabled,
|
|
232
280
|
children = _ref.children,
|
|
233
|
-
|
|
281
|
+
className = _ref.className,
|
|
282
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
234
283
|
|
|
235
|
-
|
|
236
|
-
as:
|
|
237
|
-
|
|
238
|
-
|
|
284
|
+
var _useButton = button.useButton(_extends({}, props, {
|
|
285
|
+
elementType: typeof as === 'string' ? as : 'span',
|
|
286
|
+
isDisabled: disabled
|
|
287
|
+
}), ref),
|
|
288
|
+
buttonProps = _useButton.buttonProps;
|
|
289
|
+
|
|
290
|
+
return React__default.createElement(Box, Object.assign({}, buttonProps, props, {
|
|
291
|
+
as: as,
|
|
292
|
+
variant: ["button." + variant, "button." + size],
|
|
293
|
+
className: className,
|
|
294
|
+
ref: ref
|
|
239
295
|
}), React__default.createElement(Box, {
|
|
240
296
|
as: "span",
|
|
241
297
|
display: "inline-flex",
|
|
242
298
|
alignItems: "center"
|
|
243
299
|
}, children));
|
|
244
|
-
};
|
|
300
|
+
});
|
|
245
301
|
|
|
246
|
-
var
|
|
302
|
+
var _excluded$5 = ["variant", "title", "width", "className", "children"];
|
|
303
|
+
var Card = function Card(_ref) {
|
|
247
304
|
var _ref$variant = _ref.variant,
|
|
248
305
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
306
|
+
title = _ref.title,
|
|
307
|
+
width = _ref.width,
|
|
308
|
+
className = _ref.className,
|
|
249
309
|
children = _ref.children,
|
|
250
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
310
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
251
311
|
|
|
252
312
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
313
|
+
variant: "card." + variant,
|
|
314
|
+
maxWidth: width,
|
|
315
|
+
className: className
|
|
316
|
+
}), title && React__default.createElement(Box, {
|
|
317
|
+
as: "h2",
|
|
318
|
+
variant: "text.h2",
|
|
319
|
+
pb: "small"
|
|
320
|
+
}, title), children);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
var _excluded$6 = ["disabled"],
|
|
324
|
+
_excluded2 = ["disabled", "error"];
|
|
325
|
+
var CheckboxChecked = function CheckboxChecked(_ref) {
|
|
326
|
+
var _ref$disabled = _ref.disabled,
|
|
327
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
328
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
329
|
+
|
|
330
|
+
return React__default.createElement(icons.SVG, Object.assign({
|
|
331
|
+
width: "16",
|
|
332
|
+
height: "32",
|
|
333
|
+
viewBox: "0 0 16 32",
|
|
334
|
+
fill: "none"
|
|
335
|
+
}, props), React__default.createElement(Box, {
|
|
336
|
+
as: "rect",
|
|
337
|
+
x: "0.5",
|
|
338
|
+
y: "8.5",
|
|
339
|
+
width: "15px",
|
|
340
|
+
height: "15px",
|
|
341
|
+
rx: "1.5",
|
|
342
|
+
variant: disabled ? 'checkbox.checked.disabled' : 'checkbox.checked'
|
|
343
|
+
}), React__default.createElement(Box, {
|
|
344
|
+
as: "path",
|
|
345
|
+
fillRule: "evenodd",
|
|
346
|
+
clipRule: "evenodd",
|
|
347
|
+
d: "M13.9571 12.8338L12.4085 11.2852L6.08699 17.6007L3.59887 15.1126L2.04163 16.6588L6.08682 20.704L13.9571 12.8338Z",
|
|
348
|
+
variant: "checkbox.checked.icon"
|
|
349
|
+
}));
|
|
350
|
+
};
|
|
351
|
+
var CheckboxUnchecked = function CheckboxUnchecked(_ref2) {
|
|
352
|
+
var _ref2$disabled = _ref2.disabled,
|
|
353
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
354
|
+
_ref2$error = _ref2.error,
|
|
355
|
+
error = _ref2$error === void 0 ? false : _ref2$error,
|
|
356
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
357
|
+
|
|
358
|
+
return React__default.createElement(icons.SVG, Object.assign({
|
|
359
|
+
width: "16",
|
|
360
|
+
height: "32",
|
|
361
|
+
viewBox: "0 0 16 32",
|
|
362
|
+
fill: "none"
|
|
363
|
+
}, props), React__default.createElement(Box, {
|
|
364
|
+
as: "rect",
|
|
365
|
+
x: "0.5",
|
|
366
|
+
y: "8.5",
|
|
367
|
+
width: "15px",
|
|
368
|
+
height: "15px",
|
|
369
|
+
rx: "1.5",
|
|
370
|
+
variant: disabled ? 'checkbox.unchecked.disabled' : error ? 'checkbox.unchecked.error' : 'checkbox.unchecked'
|
|
371
|
+
}));
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
var _excluded$7 = ["variant", "required", "children"];
|
|
375
|
+
var Label = function Label(_ref) {
|
|
376
|
+
var _ref$variant = _ref.variant,
|
|
377
|
+
variant = _ref$variant === void 0 ? 'above' : _ref$variant,
|
|
378
|
+
required = _ref.required,
|
|
379
|
+
children = _ref.children,
|
|
380
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
381
|
+
|
|
382
|
+
return required ? React__default.createElement(Box, {
|
|
383
|
+
as: "span",
|
|
384
|
+
display: "inline-flex",
|
|
385
|
+
alignItems: "center"
|
|
386
|
+
}, React__default.createElement(Box, Object.assign({}, props, {
|
|
387
|
+
as: "label",
|
|
388
|
+
variant: "label." + variant
|
|
389
|
+
}), children), required && React__default.createElement(Box, {
|
|
390
|
+
as: icons.Required,
|
|
391
|
+
size: 16,
|
|
392
|
+
css: {
|
|
393
|
+
color: 'red60'
|
|
394
|
+
}
|
|
395
|
+
})) : React__default.createElement(Box, Object.assign({}, props, {
|
|
253
396
|
as: "label",
|
|
254
397
|
variant: "label." + variant
|
|
255
398
|
}), children);
|
|
256
399
|
};
|
|
257
400
|
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
'input:disabled ~ &': {
|
|
272
|
-
color: 'disabled',
|
|
273
|
-
cursor: 'not-allowed'
|
|
274
|
-
}
|
|
275
|
-
},
|
|
401
|
+
var _excluded$8 = ["variant", "children", "className"];
|
|
402
|
+
var ValidationMessage = function ValidationMessage(_ref) {
|
|
403
|
+
var _ref$variant = _ref.variant,
|
|
404
|
+
variant = _ref$variant === void 0 ? 'error' : _ref$variant,
|
|
405
|
+
children = _ref.children,
|
|
406
|
+
className = _ref.className,
|
|
407
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
408
|
+
|
|
409
|
+
return React__default.createElement(Box, Object.assign({
|
|
410
|
+
as: "span",
|
|
411
|
+
display: "flex",
|
|
412
|
+
alignItems: "center",
|
|
413
|
+
variant: "validation." + variant,
|
|
276
414
|
className: className
|
|
277
|
-
});
|
|
415
|
+
}, props), children);
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
var _excluded$9 = ["className", "variant", "error"],
|
|
419
|
+
_excluded2$1 = ["label", "required", "error", "errorMessage"];
|
|
420
|
+
|
|
421
|
+
var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
422
|
+
var variant = _ref.variant,
|
|
423
|
+
checked = _ref.checked,
|
|
424
|
+
disabled = _ref.disabled,
|
|
425
|
+
error = _ref.error;
|
|
278
426
|
|
|
279
427
|
if (checked) {
|
|
280
|
-
return React__default.createElement(
|
|
281
|
-
|
|
428
|
+
return React__default.createElement(Box, {
|
|
429
|
+
as: CheckboxChecked,
|
|
430
|
+
variant: "checkbox." + variant,
|
|
431
|
+
disabled: disabled
|
|
282
432
|
});
|
|
283
433
|
}
|
|
284
434
|
|
|
285
|
-
return React__default.createElement(
|
|
286
|
-
|
|
435
|
+
return React__default.createElement(Box, {
|
|
436
|
+
as: CheckboxUnchecked,
|
|
437
|
+
variant: "checkbox." + variant,
|
|
438
|
+
disabled: disabled,
|
|
439
|
+
error: error
|
|
287
440
|
});
|
|
288
441
|
};
|
|
289
442
|
|
|
@@ -291,9 +444,15 @@ var CheckboxInput = function CheckboxInput(_ref2) {
|
|
|
291
444
|
var className = _ref2.className,
|
|
292
445
|
_ref2$variant = _ref2.variant,
|
|
293
446
|
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
294
|
-
|
|
447
|
+
error = _ref2.error,
|
|
448
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$9);
|
|
295
449
|
|
|
296
|
-
|
|
450
|
+
return React__default.createElement(Box, {
|
|
451
|
+
display: "inline-block",
|
|
452
|
+
className: className
|
|
453
|
+
}, React__default.createElement(Box, Object.assign({
|
|
454
|
+
as: "input",
|
|
455
|
+
type: "checkbox",
|
|
297
456
|
css: {
|
|
298
457
|
position: 'absolute',
|
|
299
458
|
opacity: 0,
|
|
@@ -302,46 +461,62 @@ var CheckboxInput = function CheckboxInput(_ref2) {
|
|
|
302
461
|
height: 1,
|
|
303
462
|
overflow: 'hidden'
|
|
304
463
|
}
|
|
305
|
-
});
|
|
306
|
-
return React__default.createElement(Box, {
|
|
307
|
-
display: "inline-block"
|
|
308
|
-
}, React__default.createElement("input", Object.assign({
|
|
309
|
-
type: "checkbox",
|
|
310
|
-
className: checkboxStyle
|
|
311
464
|
}, props)), React__default.createElement(CheckboxIcon, {
|
|
312
465
|
checked: props.checked,
|
|
313
|
-
|
|
314
|
-
|
|
466
|
+
variant: variant,
|
|
467
|
+
disabled: props.disabled,
|
|
468
|
+
error: error
|
|
315
469
|
}));
|
|
316
470
|
};
|
|
317
471
|
|
|
318
472
|
var Checkbox = function Checkbox(_ref3) {
|
|
319
473
|
var label = _ref3.label,
|
|
320
474
|
required = _ref3.required,
|
|
321
|
-
|
|
475
|
+
error = _ref3.error,
|
|
476
|
+
errorMessage = _ref3.errorMessage,
|
|
477
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
|
|
322
478
|
|
|
323
479
|
if (label) {
|
|
324
|
-
return React__default.createElement(Label, {
|
|
325
|
-
htmlFor: props.id
|
|
326
|
-
|
|
480
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(Label, {
|
|
481
|
+
htmlFor: props.id,
|
|
482
|
+
required: required,
|
|
483
|
+
variant: props.disabled ? 'disabled' : 'inline'
|
|
484
|
+
}, React__default.createElement(Box, Object.assign({
|
|
485
|
+
as: CheckboxInput,
|
|
486
|
+
pr: "8px",
|
|
487
|
+
error: error
|
|
488
|
+
}, props)), label), error && errorMessage && React__default.createElement(ValidationMessage, null, React__default.createElement(icons.Exclamation, {
|
|
327
489
|
size: 16
|
|
328
|
-
}));
|
|
490
|
+
}), errorMessage));
|
|
329
491
|
}
|
|
330
492
|
|
|
331
493
|
return React__default.createElement(CheckboxInput, Object.assign({}, props));
|
|
332
494
|
};
|
|
333
495
|
|
|
496
|
+
var _excluded$a = ["width", "children"];
|
|
497
|
+
|
|
498
|
+
var transform = function transform(width) {
|
|
499
|
+
if (Array.isArray(width)) {
|
|
500
|
+
return width.map(function (v) {
|
|
501
|
+
return v / 12 * 100 + "%";
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return width / 12 * 100 + "%";
|
|
506
|
+
};
|
|
507
|
+
|
|
334
508
|
var Column = function Column(_ref) {
|
|
335
509
|
var _ref$width = _ref.width,
|
|
336
510
|
width = _ref$width === void 0 ? 12 : _ref$width,
|
|
337
511
|
children = _ref.children,
|
|
338
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
512
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
339
513
|
|
|
340
514
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
341
|
-
width: width
|
|
515
|
+
width: transform(width)
|
|
342
516
|
}), children);
|
|
343
517
|
};
|
|
344
518
|
|
|
519
|
+
var _excluded$b = ["space", "horizontalAlign", "verticalAlign", "className", "children"];
|
|
345
520
|
var Columns = function Columns(_ref) {
|
|
346
521
|
var _ref$space = _ref.space,
|
|
347
522
|
space = _ref$space === void 0 ? 0 : _ref$space,
|
|
@@ -351,7 +526,7 @@ var Columns = function Columns(_ref) {
|
|
|
351
526
|
verticalAlign = _ref$verticalAlign === void 0 ? 'top' : _ref$verticalAlign,
|
|
352
527
|
className = _ref.className,
|
|
353
528
|
children = _ref.children,
|
|
354
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
529
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
355
530
|
|
|
356
531
|
var columnItems = flattenChildren(children);
|
|
357
532
|
var childClassNames = system.useStyles({
|
|
@@ -397,36 +572,123 @@ var Columns = function Columns(_ref) {
|
|
|
397
572
|
})));
|
|
398
573
|
};
|
|
399
574
|
|
|
400
|
-
var
|
|
401
|
-
|
|
575
|
+
var _excluded$c = ["as", "variant", "children"];
|
|
576
|
+
var Heading = function Heading(_ref) {
|
|
577
|
+
var _ref$as = _ref.as,
|
|
578
|
+
as = _ref$as === void 0 ? 'h2' : _ref$as,
|
|
579
|
+
_ref$variant = _ref.variant,
|
|
580
|
+
variant = _ref$variant === void 0 ? 'h2' : _ref$variant,
|
|
402
581
|
children = _ref.children,
|
|
582
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
583
|
+
|
|
584
|
+
return React__default.createElement(Box, Object.assign({}, props, {
|
|
585
|
+
as: as,
|
|
586
|
+
variant: "text." + variant
|
|
587
|
+
}), children);
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
var _excluded$d = ["children"];
|
|
591
|
+
var ModalDialog = function ModalDialog(_ref) {
|
|
592
|
+
var children = _ref.children,
|
|
593
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
594
|
+
|
|
595
|
+
// Handle interacting outside the dialog and pressing
|
|
596
|
+
// the Escape key to close the modal.
|
|
597
|
+
var ref = React__default.useRef();
|
|
598
|
+
|
|
599
|
+
var _useOverlay = overlays$1.useOverlay(props, ref),
|
|
600
|
+
overlayProps = _useOverlay.overlayProps,
|
|
601
|
+
underlayProps = _useOverlay.underlayProps; // Prevent scrolling while the modal is open, and hide content
|
|
602
|
+
// outside the modal from screen readers.
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
overlays$1.usePreventScroll();
|
|
606
|
+
|
|
607
|
+
var _useModal = overlays$1.useModal(),
|
|
608
|
+
modalProps = _useModal.modalProps;
|
|
609
|
+
|
|
610
|
+
var _useDialog = dialog.useDialog(props, ref),
|
|
611
|
+
dialogProps = _useDialog.dialogProps;
|
|
612
|
+
|
|
613
|
+
return React__default.createElement(Box, Object.assign({
|
|
614
|
+
variant: "dialog.modalWrapper"
|
|
615
|
+
}, underlayProps), React__default.createElement(focus.FocusScope, {
|
|
616
|
+
contain: true,
|
|
617
|
+
restoreFocus: true,
|
|
618
|
+
autoFocus: true
|
|
619
|
+
}, React__default.createElement(Box, Object.assign({}, overlayProps, dialogProps, modalProps, {
|
|
620
|
+
ref: ref,
|
|
621
|
+
variant: "dialog.modalBody"
|
|
622
|
+
}), children)));
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
var _excluded$e = ["children", "title", "className", "isOpen", "close"];
|
|
626
|
+
var Dialog = function Dialog(_ref) {
|
|
627
|
+
var children = _ref.children,
|
|
628
|
+
title = _ref.title,
|
|
403
629
|
className = _ref.className,
|
|
404
|
-
|
|
630
|
+
isOpen = _ref.isOpen,
|
|
631
|
+
close = _ref.close,
|
|
632
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
405
633
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
634
|
+
var closeButtonRef = React__default.useRef(); // useButton ensures that focus management is handled correctly,
|
|
635
|
+
// across all browsers. Focus is restored to the button once the
|
|
636
|
+
// dialog closes.
|
|
637
|
+
|
|
638
|
+
var _useButton = button.useButton({
|
|
639
|
+
onPress: function onPress() {
|
|
640
|
+
return close();
|
|
641
|
+
}
|
|
642
|
+
}, closeButtonRef),
|
|
643
|
+
closeButtonProps = _useButton.buttonProps;
|
|
644
|
+
|
|
645
|
+
return React__default.createElement(overlays$1.OverlayContainer, null, React__default.createElement(ModalDialog, {
|
|
646
|
+
isOpen: isOpen,
|
|
647
|
+
onClose: close,
|
|
648
|
+
isDismissable: true
|
|
649
|
+
}, React__default.createElement(Box, Object.assign({
|
|
410
650
|
variant: "dialog.wrapper",
|
|
411
651
|
className: className
|
|
412
|
-
}), React__default.createElement(Box, {
|
|
413
|
-
display: "flex"
|
|
414
|
-
}, React__default.createElement(Box, {
|
|
652
|
+
}, props), React__default.createElement(Box, {
|
|
415
653
|
variant: "dialog.body"
|
|
416
|
-
},
|
|
654
|
+
}, title && React__default.createElement(Heading, {
|
|
655
|
+
as: "h4",
|
|
656
|
+
variant: "h4"
|
|
657
|
+
}, title), children), React__default.createElement(Box, {
|
|
417
658
|
variant: "dialog.onClose"
|
|
418
|
-
}, React__default.createElement(Button, {
|
|
419
|
-
variant: "
|
|
420
|
-
|
|
421
|
-
},
|
|
659
|
+
}, React__default.createElement(Button, Object.assign({
|
|
660
|
+
variant: "close",
|
|
661
|
+
size: "xsmall"
|
|
662
|
+
}, closeButtonProps, {
|
|
663
|
+
ref: closeButtonRef
|
|
664
|
+
}), React__default.createElement(icons.Close, {
|
|
422
665
|
size: 16
|
|
423
666
|
}))))));
|
|
667
|
+
}; // use this hook to get the overlayTriggerState and openButton props for using the dialog component
|
|
668
|
+
|
|
669
|
+
var useDialogButtonProps = function useDialogButtonProps() {
|
|
670
|
+
var state = overlays.useOverlayTriggerState({});
|
|
671
|
+
var openButtonRef = React__default.useRef();
|
|
672
|
+
|
|
673
|
+
var _useButton2 = button.useButton({
|
|
674
|
+
onPress: function onPress() {
|
|
675
|
+
return state.open();
|
|
676
|
+
}
|
|
677
|
+
}, openButtonRef),
|
|
678
|
+
openButtonProps = _useButton2.buttonProps;
|
|
679
|
+
|
|
680
|
+
return {
|
|
681
|
+
state: state,
|
|
682
|
+
openButtonProps: openButtonProps,
|
|
683
|
+
openButtonRef: openButtonRef
|
|
684
|
+
};
|
|
424
685
|
};
|
|
425
686
|
|
|
687
|
+
var _excluded$f = ["variant"];
|
|
426
688
|
var Divider = function Divider(_ref) {
|
|
427
689
|
var _ref$variant = _ref.variant,
|
|
428
690
|
variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
|
|
429
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
691
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
430
692
|
|
|
431
693
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
432
694
|
as: "hr",
|
|
@@ -434,12 +696,13 @@ var Divider = function Divider(_ref) {
|
|
|
434
696
|
}));
|
|
435
697
|
};
|
|
436
698
|
|
|
699
|
+
var _excluded$g = ["variant", "type"];
|
|
437
700
|
var Input = function Input(_ref) {
|
|
438
701
|
var _ref$variant = _ref.variant,
|
|
439
702
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
440
703
|
_ref$type = _ref.type,
|
|
441
704
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
442
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
705
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
443
706
|
|
|
444
707
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
445
708
|
as: "input",
|
|
@@ -448,80 +711,40 @@ var Input = function Input(_ref) {
|
|
|
448
711
|
}));
|
|
449
712
|
};
|
|
450
713
|
|
|
451
|
-
var
|
|
452
|
-
var _ref$variant = _ref.variant,
|
|
453
|
-
variant = _ref$variant === void 0 ? 'error' : _ref$variant,
|
|
454
|
-
children = _ref.children,
|
|
455
|
-
className = _ref.className,
|
|
456
|
-
props = _objectWithoutPropertiesLoose(_ref, ["variant", "children", "className"]);
|
|
457
|
-
|
|
458
|
-
var classNames = system.useStyles({
|
|
459
|
-
variant: "validation." + variant,
|
|
460
|
-
css: {
|
|
461
|
-
display: 'flex',
|
|
462
|
-
alignItems: 'center'
|
|
463
|
-
},
|
|
464
|
-
className: className
|
|
465
|
-
});
|
|
466
|
-
return React__default.createElement("span", Object.assign({
|
|
467
|
-
className: classNames
|
|
468
|
-
}, props), children);
|
|
469
|
-
};
|
|
470
|
-
|
|
714
|
+
var _excluded$h = ["type", "className", "htmlFor", "label", "required", "error", "errorMessage", "disabled"];
|
|
471
715
|
var Field = function Field(_ref) {
|
|
472
|
-
var _ref$
|
|
473
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
474
|
-
_ref$type = _ref.type,
|
|
716
|
+
var _ref$type = _ref.type,
|
|
475
717
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
476
|
-
|
|
477
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
718
|
+
className = _ref.className,
|
|
478
719
|
htmlFor = _ref.htmlFor,
|
|
479
720
|
label = _ref.label,
|
|
721
|
+
required = _ref.required,
|
|
480
722
|
error = _ref.error,
|
|
481
|
-
|
|
723
|
+
errorMessage = _ref.errorMessage,
|
|
724
|
+
disabled = _ref.disabled,
|
|
725
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
482
726
|
|
|
483
|
-
|
|
484
|
-
variant:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
css: {
|
|
489
|
-
color: 'red60'
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
return React__default.createElement("div", null, React__default.createElement(Label, {
|
|
493
|
-
className: labelClassName,
|
|
494
|
-
htmlFor: htmlFor
|
|
495
|
-
}, label, error ? React__default.createElement(icons.Required, {
|
|
496
|
-
size: 16,
|
|
497
|
-
className: errorClassName
|
|
498
|
-
}) : ''), React__default.createElement(Input, Object.assign({}, props, {
|
|
727
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(Label, {
|
|
728
|
+
variant: disabled ? 'disabled' : 'above',
|
|
729
|
+
htmlFor: htmlFor,
|
|
730
|
+
required: required
|
|
731
|
+
}, label), React__default.createElement(Input, Object.assign({}, props, {
|
|
499
732
|
type: type,
|
|
500
|
-
id: htmlFor
|
|
501
|
-
|
|
733
|
+
id: htmlFor,
|
|
734
|
+
disabled: disabled,
|
|
735
|
+
variant: error ? 'error' : 'default',
|
|
736
|
+
className: className
|
|
737
|
+
})), error && errorMessage && React__default.createElement(ValidationMessage, null, React__default.createElement(icons.Exclamation, {
|
|
502
738
|
size: 16
|
|
503
|
-
}),
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
var Heading = function Heading(_ref) {
|
|
507
|
-
var _ref$as = _ref.as,
|
|
508
|
-
as = _ref$as === void 0 ? 'h2' : _ref$as,
|
|
509
|
-
_ref$variant = _ref.variant,
|
|
510
|
-
variant = _ref$variant === void 0 ? 'h2' : _ref$variant,
|
|
511
|
-
children = _ref.children,
|
|
512
|
-
props = _objectWithoutPropertiesLoose(_ref, ["as", "variant", "children"]);
|
|
513
|
-
|
|
514
|
-
return React__default.createElement(Box, Object.assign({}, props, {
|
|
515
|
-
as: as,
|
|
516
|
-
variant: "text." + variant
|
|
517
|
-
}), children);
|
|
739
|
+
}), errorMessage));
|
|
518
740
|
};
|
|
519
741
|
|
|
742
|
+
var _excluded$i = ["show", "children"];
|
|
520
743
|
var Hidden = function Hidden(_ref) {
|
|
521
744
|
var _ref$show = _ref.show,
|
|
522
745
|
show = _ref$show === void 0 ? false : _ref$show,
|
|
523
746
|
children = _ref.children,
|
|
524
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
747
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
|
525
748
|
|
|
526
749
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
527
750
|
as: "span",
|
|
@@ -529,10 +752,11 @@ var Hidden = function Hidden(_ref) {
|
|
|
529
752
|
}), children);
|
|
530
753
|
};
|
|
531
754
|
|
|
755
|
+
var _excluded$j = ["variant"];
|
|
532
756
|
var Image = function Image(_ref) {
|
|
533
757
|
var _ref$variant = _ref.variant,
|
|
534
758
|
variant = _ref$variant === void 0 ? 'fullWidth' : _ref$variant,
|
|
535
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
759
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
536
760
|
|
|
537
761
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
538
762
|
as: "img",
|
|
@@ -540,6 +764,7 @@ var Image = function Image(_ref) {
|
|
|
540
764
|
}));
|
|
541
765
|
};
|
|
542
766
|
|
|
767
|
+
var _excluded$k = ["as", "variant", "children", "className", "align", "color", "cursor", "outline", "userSelect"];
|
|
543
768
|
var Text = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
544
769
|
var _ref$as = _ref.as,
|
|
545
770
|
as = _ref$as === void 0 ? 'span' : _ref$as,
|
|
@@ -552,10 +777,10 @@ var Text = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
552
777
|
cursor = _ref.cursor,
|
|
553
778
|
outline = _ref.outline,
|
|
554
779
|
userSelect = _ref.userSelect,
|
|
555
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
780
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
|
556
781
|
|
|
557
|
-
|
|
558
|
-
|
|
782
|
+
return React__default.createElement(Box, Object.assign({}, props, {
|
|
783
|
+
as: as,
|
|
559
784
|
variant: "text." + variant,
|
|
560
785
|
css: {
|
|
561
786
|
textAlign: align,
|
|
@@ -563,15 +788,13 @@ var Text = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
563
788
|
cursor: cursor,
|
|
564
789
|
outline: outline,
|
|
565
790
|
userSelect: userSelect
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return React__default.createElement(Box, Object.assign({}, props, {
|
|
569
|
-
as: as,
|
|
570
|
-
className: cn,
|
|
791
|
+
},
|
|
792
|
+
className: className,
|
|
571
793
|
ref: ref
|
|
572
794
|
}), children);
|
|
573
795
|
});
|
|
574
796
|
|
|
797
|
+
var _excluded$l = ["as", "variant", "children", "disabled"];
|
|
575
798
|
var Link = function Link(_ref) {
|
|
576
799
|
var _ref$as = _ref.as,
|
|
577
800
|
as = _ref$as === void 0 ? 'a' : _ref$as,
|
|
@@ -579,7 +802,7 @@ var Link = function Link(_ref) {
|
|
|
579
802
|
variant = _ref$variant === void 0 ? 'link' : _ref$variant,
|
|
580
803
|
children = _ref.children,
|
|
581
804
|
disabled = _ref.disabled,
|
|
582
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
805
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
583
806
|
|
|
584
807
|
var ref = React.useRef();
|
|
585
808
|
|
|
@@ -596,60 +819,55 @@ var Link = function Link(_ref) {
|
|
|
596
819
|
}), children);
|
|
597
820
|
};
|
|
598
821
|
|
|
822
|
+
var _excluded$m = ["variant", "label", "onClick", "show", "children"];
|
|
599
823
|
var Menu = function Menu(_ref) {
|
|
600
824
|
var _ref$variant = _ref.variant,
|
|
601
|
-
variant = _ref$variant === void 0 ? '
|
|
825
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
602
826
|
_ref$label = _ref.label,
|
|
603
827
|
label = _ref$label === void 0 ? 'Menu' : _ref$label,
|
|
604
828
|
onClick = _ref.onClick,
|
|
605
829
|
_ref$show = _ref.show,
|
|
606
830
|
show = _ref$show === void 0 ? false : _ref$show,
|
|
607
831
|
children = _ref.children,
|
|
608
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
832
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$m);
|
|
609
833
|
|
|
610
|
-
var itemStyles = system.useStyles({
|
|
611
|
-
css: {
|
|
612
|
-
position: 'absolute',
|
|
613
|
-
minWidth: '120px',
|
|
614
|
-
display: 'block',
|
|
615
|
-
textAlign: 'left',
|
|
616
|
-
borderRadius: '2px'
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
834
|
return React__default.createElement(Box, Object.assign({
|
|
620
|
-
variant: "
|
|
835
|
+
variant: "menu." + variant
|
|
621
836
|
}, props), React__default.createElement(Button, {
|
|
622
837
|
onClick: onClick,
|
|
623
838
|
variant: "menu"
|
|
624
|
-
}, label), show ? React__default.createElement(
|
|
625
|
-
|
|
839
|
+
}, label), show ? React__default.createElement(Box, {
|
|
840
|
+
display: "block",
|
|
841
|
+
position: "absolute",
|
|
842
|
+
minWidth: "120px",
|
|
843
|
+
borderRadius: "2px"
|
|
626
844
|
}, children) : null);
|
|
627
845
|
};
|
|
628
846
|
|
|
847
|
+
var _excluded$n = ["variant", "className", "children"];
|
|
629
848
|
var MenuItem = function MenuItem(_ref) {
|
|
630
849
|
var _ref$variant = _ref.variant,
|
|
631
|
-
variant = _ref$variant === void 0 ? '
|
|
850
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
632
851
|
className = _ref.className,
|
|
633
852
|
children = _ref.children,
|
|
634
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
853
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
|
635
854
|
|
|
636
|
-
|
|
637
|
-
variant: "
|
|
855
|
+
return React__default.createElement(Box, {
|
|
856
|
+
variant: "menuItem." + variant,
|
|
638
857
|
className: className
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
className: classNames
|
|
643
|
-
}), children);
|
|
858
|
+
}, React__default.createElement(Link, Object.assign({
|
|
859
|
+
variant: "menuItemLink"
|
|
860
|
+
}, props), children));
|
|
644
861
|
};
|
|
645
862
|
|
|
863
|
+
var _excluded$o = ["messageTitle", "variant", "className", "children"];
|
|
646
864
|
var Message = function Message(_ref) {
|
|
647
865
|
var messageTitle = _ref.messageTitle,
|
|
648
866
|
_ref$variant = _ref.variant,
|
|
649
867
|
variant = _ref$variant === void 0 ? 'info' : _ref$variant,
|
|
650
868
|
className = _ref.className,
|
|
651
869
|
children = _ref.children,
|
|
652
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
870
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
653
871
|
|
|
654
872
|
var icon = React__default.createElement(icons.Info, null);
|
|
655
873
|
|
|
@@ -670,60 +888,119 @@ var Message = function Message(_ref) {
|
|
|
670
888
|
alignItems: "center",
|
|
671
889
|
variant: "messages.title"
|
|
672
890
|
}, icon, React__default.createElement(Heading, {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
css: {
|
|
676
|
-
display: 'inline'
|
|
677
|
-
}
|
|
678
|
-
})
|
|
891
|
+
as: "h4",
|
|
892
|
+
variant: "h4"
|
|
679
893
|
}, messageTitle)), React__default.createElement(Box, {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
})
|
|
894
|
+
css: {
|
|
895
|
+
color: 'black'
|
|
896
|
+
}
|
|
685
897
|
}, children));
|
|
686
898
|
};
|
|
687
899
|
|
|
900
|
+
// import { css } from '@theme-ui/css';
|
|
901
|
+
// const GlobalStyles = () => {
|
|
902
|
+
// const theme = useTheme();
|
|
903
|
+
// const styles = css({
|
|
904
|
+
// body: { variant: 'root.body' },
|
|
905
|
+
// html: { variant: 'root.html' },
|
|
906
|
+
// })(theme);
|
|
907
|
+
// return <Global styles={styles} />;
|
|
908
|
+
// };
|
|
909
|
+
// a merge of the ThemeProvider and the react-aria OverlayProvider
|
|
910
|
+
|
|
911
|
+
var MarigoldProvider = function MarigoldProvider(_ref) {
|
|
912
|
+
var theme = _ref.theme,
|
|
913
|
+
children = _ref.children;
|
|
914
|
+
return React__default.createElement(system.ThemeProvider, {
|
|
915
|
+
theme: theme
|
|
916
|
+
}, React__default.createElement(overlays$1.OverlayProvider, null, children));
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
var _excluded$p = ["disabled"],
|
|
920
|
+
_excluded2$2 = ["disabled", "error"];
|
|
921
|
+
var RadioChecked = function RadioChecked(_ref) {
|
|
922
|
+
var _ref$disabled = _ref.disabled,
|
|
923
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
924
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
925
|
+
|
|
926
|
+
return React__default.createElement(icons.SVG, Object.assign({
|
|
927
|
+
width: "16",
|
|
928
|
+
height: "32",
|
|
929
|
+
viewBox: "0 0 16 32",
|
|
930
|
+
fill: "none"
|
|
931
|
+
}, props), React__default.createElement(Box, {
|
|
932
|
+
as: "circle",
|
|
933
|
+
cx: "8",
|
|
934
|
+
cy: "16",
|
|
935
|
+
r: "7.5",
|
|
936
|
+
variant: disabled ? 'radio.checked.disabled' : 'radio.checked'
|
|
937
|
+
}), React__default.createElement(Box, {
|
|
938
|
+
as: "circle",
|
|
939
|
+
cx: "8",
|
|
940
|
+
cy: "16",
|
|
941
|
+
r: "3",
|
|
942
|
+
variant: "radio.checked.circle"
|
|
943
|
+
}));
|
|
944
|
+
};
|
|
945
|
+
var RadioUnchecked = function RadioUnchecked(_ref2) {
|
|
946
|
+
var _ref2$disabled = _ref2.disabled,
|
|
947
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
948
|
+
_ref2$error = _ref2.error,
|
|
949
|
+
error = _ref2$error === void 0 ? false : _ref2$error,
|
|
950
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
951
|
+
|
|
952
|
+
return React__default.createElement(icons.SVG, Object.assign({
|
|
953
|
+
width: "16",
|
|
954
|
+
height: "32",
|
|
955
|
+
viewBox: "0 0 16 32",
|
|
956
|
+
fill: "none"
|
|
957
|
+
}, props), React__default.createElement(Box, {
|
|
958
|
+
as: "circle",
|
|
959
|
+
cx: "8",
|
|
960
|
+
cy: "16",
|
|
961
|
+
r: "7.5",
|
|
962
|
+
variant: disabled ? 'radio.unchecked.disabled' : error ? 'radio.unchecked.error' : 'radio.unchecked'
|
|
963
|
+
}));
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
var _excluded$q = ["className", "variant", "error"],
|
|
967
|
+
_excluded2$3 = ["label", "required", "error", "errorMessage"];
|
|
968
|
+
|
|
688
969
|
var RadioIcon = function RadioIcon(_ref) {
|
|
689
|
-
var
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
variant: "form." + variant,
|
|
694
|
-
css: {
|
|
695
|
-
ariaHidden: 'true',
|
|
696
|
-
mr: 2,
|
|
697
|
-
verticalAlign: 'middle',
|
|
698
|
-
':hover': {
|
|
699
|
-
cursor: 'pointer'
|
|
700
|
-
},
|
|
701
|
-
'input:disabled ~ &': {
|
|
702
|
-
color: 'muted',
|
|
703
|
-
cursor: 'not-allowed'
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
className: className
|
|
707
|
-
});
|
|
970
|
+
var variant = _ref.variant,
|
|
971
|
+
checked = _ref.checked,
|
|
972
|
+
disabled = _ref.disabled,
|
|
973
|
+
error = _ref.error;
|
|
708
974
|
|
|
709
975
|
if (checked) {
|
|
710
|
-
return React__default.createElement(
|
|
711
|
-
|
|
976
|
+
return React__default.createElement(Box, {
|
|
977
|
+
as: RadioChecked,
|
|
978
|
+
variant: "radio." + variant,
|
|
979
|
+
disabled: disabled
|
|
712
980
|
});
|
|
713
981
|
}
|
|
714
982
|
|
|
715
|
-
return React__default.createElement(
|
|
716
|
-
|
|
983
|
+
return React__default.createElement(Box, {
|
|
984
|
+
as: RadioUnchecked,
|
|
985
|
+
variant: "radio." + variant,
|
|
986
|
+
disabled: disabled,
|
|
987
|
+
error: error
|
|
717
988
|
});
|
|
718
989
|
};
|
|
719
990
|
|
|
720
991
|
var RadioInput = function RadioInput(_ref2) {
|
|
721
992
|
var className = _ref2.className,
|
|
722
993
|
_ref2$variant = _ref2.variant,
|
|
723
|
-
variant = _ref2$variant === void 0 ? '
|
|
724
|
-
|
|
994
|
+
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
995
|
+
error = _ref2.error,
|
|
996
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$q);
|
|
725
997
|
|
|
726
|
-
|
|
998
|
+
return React__default.createElement(Box, {
|
|
999
|
+
display: "inline-block",
|
|
1000
|
+
className: className
|
|
1001
|
+
}, React__default.createElement(Box, Object.assign({
|
|
1002
|
+
as: "input",
|
|
1003
|
+
type: "radio",
|
|
727
1004
|
css: {
|
|
728
1005
|
position: 'absolute',
|
|
729
1006
|
opacity: 0,
|
|
@@ -732,40 +1009,44 @@ var RadioInput = function RadioInput(_ref2) {
|
|
|
732
1009
|
height: 1,
|
|
733
1010
|
overflow: 'hidden'
|
|
734
1011
|
}
|
|
735
|
-
});
|
|
736
|
-
return React__default.createElement(Box, {
|
|
737
|
-
display: "inline-block"
|
|
738
|
-
}, React__default.createElement("input", Object.assign({
|
|
739
|
-
type: "radio",
|
|
740
|
-
className: radioStyle
|
|
741
1012
|
}, props)), React__default.createElement(RadioIcon, {
|
|
742
1013
|
checked: props.checked,
|
|
743
|
-
|
|
744
|
-
|
|
1014
|
+
variant: variant,
|
|
1015
|
+
disabled: props.disabled,
|
|
1016
|
+
error: error
|
|
745
1017
|
}));
|
|
746
1018
|
};
|
|
747
1019
|
|
|
748
1020
|
var Radio = function Radio(_ref3) {
|
|
749
1021
|
var label = _ref3.label,
|
|
750
1022
|
required = _ref3.required,
|
|
751
|
-
|
|
1023
|
+
error = _ref3.error,
|
|
1024
|
+
errorMessage = _ref3.errorMessage,
|
|
1025
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
|
|
752
1026
|
|
|
753
1027
|
if (label) {
|
|
754
|
-
return React__default.createElement(Label, {
|
|
755
|
-
htmlFor: props.id
|
|
756
|
-
|
|
1028
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(Label, {
|
|
1029
|
+
htmlFor: props.id,
|
|
1030
|
+
required: required,
|
|
1031
|
+
variant: props.disabled ? 'disabled' : 'inline'
|
|
1032
|
+
}, React__default.createElement(Box, Object.assign({
|
|
1033
|
+
as: RadioInput,
|
|
1034
|
+
pr: "8px",
|
|
1035
|
+
error: error
|
|
1036
|
+
}, props)), label), error && errorMessage && React__default.createElement(ValidationMessage, null, React__default.createElement(icons.Exclamation, {
|
|
757
1037
|
size: 16
|
|
758
|
-
}));
|
|
1038
|
+
}), errorMessage));
|
|
759
1039
|
}
|
|
760
1040
|
|
|
761
1041
|
return React__default.createElement(RadioInput, Object.assign({}, props));
|
|
762
1042
|
};
|
|
763
1043
|
|
|
1044
|
+
var _excluded$r = ["variant", "className"];
|
|
764
1045
|
var Slider = function Slider(_ref) {
|
|
765
1046
|
var _ref$variant = _ref.variant,
|
|
766
1047
|
variant = _ref$variant === void 0 ? 'slider' : _ref$variant,
|
|
767
1048
|
className = _ref.className,
|
|
768
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
1049
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
769
1050
|
|
|
770
1051
|
var classNames = system.useStyles({
|
|
771
1052
|
variant: "form." + variant,
|
|
@@ -780,127 +1061,355 @@ var Slider = function Slider(_ref) {
|
|
|
780
1061
|
}, props));
|
|
781
1062
|
};
|
|
782
1063
|
|
|
783
|
-
var
|
|
784
|
-
var
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
1064
|
+
var Option = function Option(_ref) {
|
|
1065
|
+
var item = _ref.item,
|
|
1066
|
+
state = _ref.state;
|
|
1067
|
+
var ref = React.useRef(null);
|
|
1068
|
+
|
|
1069
|
+
var _useState = React.useState(false),
|
|
1070
|
+
disabled = _useState[0],
|
|
1071
|
+
setDisabled = _useState[1];
|
|
1072
|
+
|
|
1073
|
+
var _useOption = listbox.useOption({
|
|
1074
|
+
key: item.key
|
|
1075
|
+
}, state, ref),
|
|
1076
|
+
optionProps = _useOption.optionProps,
|
|
1077
|
+
isSelected = _useOption.isSelected;
|
|
1078
|
+
|
|
1079
|
+
React.useEffect(function () {
|
|
1080
|
+
for (var _iterator = _createForOfIteratorHelperLoose(state.disabledKeys.values()), _step; !(_step = _iterator()).done;) {
|
|
1081
|
+
var key = _step.value;
|
|
1082
|
+
|
|
1083
|
+
if (key === item.key) {
|
|
1084
|
+
setDisabled(true);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}, [state.disabledKeys, item.key]);
|
|
1088
|
+
return React__default.createElement(Box, Object.assign({
|
|
1089
|
+
as: "li"
|
|
1090
|
+
}, optionProps, {
|
|
1091
|
+
ref: ref,
|
|
1092
|
+
variant: isSelected ? 'select.option.selected' : disabled ? 'select.option.disabled' : 'select.option'
|
|
1093
|
+
}), item.rendered);
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
var ListBoxSection = function ListBoxSection(_ref) {
|
|
1097
|
+
var section = _ref.section,
|
|
1098
|
+
state = _ref.state;
|
|
788
1099
|
|
|
789
|
-
var
|
|
1100
|
+
var _useListBoxSection = listbox.useListBoxSection({
|
|
1101
|
+
heading: section.rendered,
|
|
1102
|
+
'aria-label': section['aria-label']
|
|
1103
|
+
}),
|
|
1104
|
+
itemProps = _useListBoxSection.itemProps,
|
|
1105
|
+
headingProps = _useListBoxSection.headingProps,
|
|
1106
|
+
groupProps = _useListBoxSection.groupProps;
|
|
1107
|
+
|
|
1108
|
+
return React__default.createElement(Box, Object.assign({
|
|
1109
|
+
as: "li"
|
|
1110
|
+
}, itemProps, {
|
|
790
1111
|
css: {
|
|
791
|
-
|
|
792
|
-
pointerEvents: 'none',
|
|
793
|
-
ml: '-28px'
|
|
1112
|
+
cursor: 'not-allowed'
|
|
794
1113
|
}
|
|
795
|
-
})
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
},
|
|
802
|
-
|
|
1114
|
+
}), section.rendered && React__default.createElement(Box, Object.assign({
|
|
1115
|
+
as: "span"
|
|
1116
|
+
}, headingProps, {
|
|
1117
|
+
variant: 'select.section'
|
|
1118
|
+
}), section.rendered), React__default.createElement(Box, Object.assign({
|
|
1119
|
+
as: "ul"
|
|
1120
|
+
}, groupProps), [].concat(section.childNodes).map(function (node) {
|
|
1121
|
+
return React__default.createElement(Option, {
|
|
1122
|
+
key: node.key,
|
|
1123
|
+
item: node,
|
|
1124
|
+
state: state
|
|
1125
|
+
});
|
|
1126
|
+
})));
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
var ListBox = function ListBox(props) {
|
|
1130
|
+
var ref = React.useRef(null);
|
|
1131
|
+
var state = props.state,
|
|
1132
|
+
error = props.error;
|
|
1133
|
+
|
|
1134
|
+
var _useListBox = listbox.useListBox(props, state, ref),
|
|
1135
|
+
listBoxProps = _useListBox.listBoxProps;
|
|
1136
|
+
|
|
1137
|
+
return React__default.createElement(Box, Object.assign({
|
|
1138
|
+
as: "ul",
|
|
1139
|
+
css: {
|
|
1140
|
+
listStyle: 'none'
|
|
1141
|
+
}
|
|
1142
|
+
}, listBoxProps, {
|
|
1143
|
+
variant: error ? 'select.listbox.error' : 'select.listbox',
|
|
1144
|
+
ref: ref
|
|
1145
|
+
}), [].concat(state.collection).map(function (item) {
|
|
1146
|
+
return item.type === 'section' ? React__default.createElement(ListBoxSection, {
|
|
1147
|
+
key: item.key,
|
|
1148
|
+
section: item,
|
|
1149
|
+
state: state
|
|
1150
|
+
}) : React__default.createElement(Option, {
|
|
1151
|
+
key: item.key,
|
|
1152
|
+
item: item,
|
|
1153
|
+
state: state
|
|
1154
|
+
});
|
|
803
1155
|
}));
|
|
804
1156
|
};
|
|
805
1157
|
|
|
806
|
-
var
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1158
|
+
var _excluded$s = ["children", "className", "isOpen", "onClose"];
|
|
1159
|
+
var Popover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1160
|
+
var children = _ref.children,
|
|
1161
|
+
className = _ref.className,
|
|
1162
|
+
isOpen = _ref.isOpen,
|
|
1163
|
+
onClose = _ref.onClose,
|
|
1164
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
1165
|
+
|
|
1166
|
+
// Handle events that should cause the popup to close,
|
|
1167
|
+
var _useOverlay = overlays$1.useOverlay({
|
|
1168
|
+
isOpen: isOpen,
|
|
1169
|
+
onClose: onClose,
|
|
1170
|
+
shouldCloseOnBlur: true,
|
|
1171
|
+
isDismissable: true
|
|
1172
|
+
}, ref),
|
|
1173
|
+
overlayProps = _useOverlay.overlayProps; // Hide content outside the modal from screen readers.
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
var _useModal = overlays$1.useModal(),
|
|
1177
|
+
modalProps = _useModal.modalProps;
|
|
1178
|
+
|
|
1179
|
+
return React__default.createElement(overlays$1.OverlayContainer, null, React__default.createElement(focus.FocusScope, {
|
|
1180
|
+
restoreFocus: true
|
|
1181
|
+
}, React__default.createElement(Box, Object.assign({}, utils.mergeProps(overlayProps, otherProps, modalProps), {
|
|
1182
|
+
className: className,
|
|
1183
|
+
ref: ref
|
|
1184
|
+
}), children, React__default.createElement(overlays$1.DismissButton, {
|
|
1185
|
+
onDismiss: onClose
|
|
1186
|
+
}))));
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
var _excluded$t = ["placeholder", "disabled", "required", "error", "errorMessage", "width", "className"];
|
|
1190
|
+
var Select = function Select(_ref) {
|
|
1191
|
+
var _ref$placeholder = _ref.placeholder,
|
|
1192
|
+
placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
|
|
1193
|
+
disabled = _ref.disabled,
|
|
1194
|
+
required = _ref.required,
|
|
1195
|
+
error = _ref.error,
|
|
1196
|
+
errorMessage = _ref.errorMessage,
|
|
1197
|
+
width = _ref.width,
|
|
1198
|
+
className = _ref.className,
|
|
1199
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
1200
|
+
|
|
1201
|
+
var state = select.useSelectState(props);
|
|
1202
|
+
var overlayTriggerState = overlays.useOverlayTriggerState({});
|
|
1203
|
+
var triggerRef = React.useRef();
|
|
1204
|
+
var overlayRef = React.useRef(); // Get props for the overlay
|
|
1205
|
+
|
|
1206
|
+
var _useOverlayTrigger = overlays$1.useOverlayTrigger({
|
|
1207
|
+
type: 'listbox'
|
|
1208
|
+
}, overlayTriggerState, triggerRef),
|
|
1209
|
+
overlayProps = _useOverlayTrigger.overlayProps; // Get popover positioning props relative to the trigger
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
var _useOverlayPosition = overlays$1.useOverlayPosition({
|
|
1213
|
+
targetRef: triggerRef,
|
|
1214
|
+
overlayRef: overlayRef,
|
|
1215
|
+
placement: 'bottom',
|
|
1216
|
+
shouldFlip: false,
|
|
1217
|
+
isOpen: state.isOpen,
|
|
1218
|
+
onClose: state.close
|
|
1219
|
+
}),
|
|
1220
|
+
positionProps = _useOverlayPosition.overlayProps; // Get props for child elements from useSelect
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
var _useSelect = select$1.useSelect(props, state, triggerRef),
|
|
1224
|
+
labelProps = _useSelect.labelProps,
|
|
1225
|
+
triggerProps = _useSelect.triggerProps,
|
|
1226
|
+
valueProps = _useSelect.valueProps,
|
|
1227
|
+
menuProps = _useSelect.menuProps; // Get props for the button based on the trigger props from useSelect
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
var _useButton = button.useButton(triggerProps, triggerRef),
|
|
1231
|
+
buttonProps = _useButton.buttonProps;
|
|
1232
|
+
|
|
1233
|
+
var _useFocusRing = focus.useFocusRing(),
|
|
1234
|
+
focusProps = _useFocusRing.focusProps;
|
|
1235
|
+
|
|
1236
|
+
return React__default.createElement(Box, {
|
|
1237
|
+
position: "relative",
|
|
1238
|
+
display: "inline-block",
|
|
1239
|
+
width: width && width
|
|
1240
|
+
}, props.label && React__default.createElement(Box, null, React__default.createElement(Label, Object.assign({}, labelProps, {
|
|
1241
|
+
htmlFor: labelProps.id,
|
|
1242
|
+
variant: disabled ? 'disabled' : 'above'
|
|
1243
|
+
}), required ? React__default.createElement(Box, {
|
|
1244
|
+
as: "span",
|
|
1245
|
+
display: "inline-flex",
|
|
1246
|
+
alignItems: "center"
|
|
1247
|
+
}, props.label, React__default.createElement(Box, {
|
|
1248
|
+
as: icons.Required,
|
|
1249
|
+
size: 16,
|
|
1250
|
+
css: {
|
|
1251
|
+
color: 'error'
|
|
1252
|
+
}
|
|
1253
|
+
})) : props.label)), React__default.createElement(select$1.HiddenSelect, {
|
|
1254
|
+
state: state,
|
|
1255
|
+
triggerRef: triggerRef,
|
|
1256
|
+
label: props.label,
|
|
1257
|
+
name: props.name,
|
|
1258
|
+
isDisabled: disabled
|
|
1259
|
+
}), React__default.createElement(Box, Object.assign({
|
|
1260
|
+
as: "button"
|
|
1261
|
+
}, utils.mergeProps(buttonProps, focusProps), {
|
|
1262
|
+
ref: triggerRef,
|
|
1263
|
+
variant: error && state.isOpen && !disabled ? 'button.select.errorOpened' : error ? 'button.select.error' : state.isOpen && !disabled ? 'button.select.open' : 'button.select',
|
|
1264
|
+
disabled: disabled,
|
|
1265
|
+
className: className
|
|
1266
|
+
}), React__default.createElement(Box, Object.assign({
|
|
1267
|
+
as: "span"
|
|
1268
|
+
}, valueProps, {
|
|
1269
|
+
variant: disabled ? 'select.disabled' : 'select'
|
|
1270
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? React__default.createElement(Box, {
|
|
1271
|
+
as: icons.ArrowUp,
|
|
1272
|
+
size: 16,
|
|
1273
|
+
css: {
|
|
1274
|
+
fill: disabled ? 'disabled' : 'text'
|
|
1275
|
+
}
|
|
1276
|
+
}) : React__default.createElement(Box, {
|
|
1277
|
+
as: icons.ArrowDown,
|
|
1278
|
+
size: 16,
|
|
1279
|
+
css: {
|
|
1280
|
+
fill: disabled ? 'disabled' : 'text'
|
|
1281
|
+
}
|
|
1282
|
+
})), state.isOpen && !disabled && React__default.createElement(Box, Object.assign({
|
|
1283
|
+
as: Popover
|
|
1284
|
+
}, overlayProps, positionProps, {
|
|
1285
|
+
css: {
|
|
1286
|
+
width: width ? width : triggerRef.current && triggerRef.current.offsetWidth + 'px'
|
|
1287
|
+
},
|
|
1288
|
+
ref: overlayRef,
|
|
1289
|
+
isOpen: state.isOpen,
|
|
1290
|
+
onClose: state.close
|
|
1291
|
+
}), React__default.createElement(ListBox, Object.assign({
|
|
1292
|
+
error: error
|
|
1293
|
+
}, menuProps, {
|
|
1294
|
+
state: state
|
|
1295
|
+
}))), error && errorMessage && React__default.createElement(Box, {
|
|
1296
|
+
as: "span",
|
|
1297
|
+
display: "inline-flex",
|
|
1298
|
+
alignItems: "center"
|
|
1299
|
+
}, React__default.createElement(Box, {
|
|
1300
|
+
as: icons.Exclamation,
|
|
1301
|
+
size: 16,
|
|
1302
|
+
css: {
|
|
1303
|
+
color: 'error'
|
|
1304
|
+
}
|
|
1305
|
+
}), React__default.createElement(ValidationMessage, null, errorMessage)));
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
var _excluded$u = ["space", "align", "children"];
|
|
1309
|
+
var ALIGNMENT = {
|
|
1310
|
+
left: 'flex-start',
|
|
1311
|
+
center: 'center',
|
|
1312
|
+
right: 'flex-end'
|
|
822
1313
|
};
|
|
823
1314
|
var Stack = function Stack(_ref) {
|
|
824
1315
|
var _ref$space = _ref.space,
|
|
825
|
-
space = _ref$space === void 0 ?
|
|
1316
|
+
space = _ref$space === void 0 ? 'none' : _ref$space,
|
|
826
1317
|
_ref$align = _ref.align,
|
|
827
1318
|
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
828
1319
|
children = _ref.children,
|
|
829
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
1320
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
830
1321
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
}
|
|
841
|
-
return React__default.createElement(Box, {
|
|
842
|
-
display: display,
|
|
843
|
-
flexDirection: flexDirection,
|
|
844
|
-
alignItems: alignItems,
|
|
845
|
-
pt: space,
|
|
846
|
-
mt: index === 0 ? -space : 0
|
|
847
|
-
}, child);
|
|
1322
|
+
return React__default.createElement(Box, Object.assign({}, props, {
|
|
1323
|
+
display: "flex",
|
|
1324
|
+
flexDirection: "column",
|
|
1325
|
+
alignItems: ALIGNMENT[align],
|
|
1326
|
+
css: {
|
|
1327
|
+
'> * + *': {
|
|
1328
|
+
pt: space
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}), React.Children.map(flattenChildren(children), function (child) {
|
|
1332
|
+
return React__default.createElement(Box, null, React__default.cloneElement(child, {}, child.props.children));
|
|
848
1333
|
}));
|
|
849
1334
|
};
|
|
850
1335
|
|
|
1336
|
+
var _excluded$v = ["variant", "htmlFor", "label", "error", "errorMessage", "required", "className", "children"];
|
|
851
1337
|
var Textarea = function Textarea(_ref) {
|
|
852
1338
|
var _ref$variant = _ref.variant,
|
|
853
1339
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
854
1340
|
_ref$htmlFor = _ref.htmlFor,
|
|
855
1341
|
htmlFor = _ref$htmlFor === void 0 ? 'textarea' : _ref$htmlFor,
|
|
856
1342
|
label = _ref.label,
|
|
1343
|
+
error = _ref.error,
|
|
857
1344
|
errorMessage = _ref.errorMessage,
|
|
858
|
-
|
|
859
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
1345
|
+
required = _ref.required,
|
|
860
1346
|
_ref$className = _ref.className,
|
|
861
1347
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
862
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
1348
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$v);
|
|
863
1349
|
|
|
864
|
-
var errorClassName = system.useStyles({
|
|
865
|
-
css: {
|
|
866
|
-
color: 'error'
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
var textareaClassNames = system.useStyles({
|
|
870
|
-
css: {
|
|
871
|
-
outlineColor: errorMessage && 'error'
|
|
872
|
-
},
|
|
873
|
-
className: className
|
|
874
|
-
});
|
|
875
1350
|
return React__default.createElement(Box, null, label && React__default.createElement(Label, {
|
|
876
|
-
htmlFor: htmlFor
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
className: errorClassName
|
|
880
|
-
})), React__default.createElement(Box, Object.assign({
|
|
1351
|
+
htmlFor: htmlFor,
|
|
1352
|
+
required: required
|
|
1353
|
+
}, label), React__default.createElement(Box, Object.assign({
|
|
881
1354
|
as: "textarea"
|
|
882
1355
|
}, props, {
|
|
883
1356
|
display: "block",
|
|
884
1357
|
variant: "textarea." + variant,
|
|
885
|
-
|
|
886
|
-
|
|
1358
|
+
css: {
|
|
1359
|
+
outlineColor: error && 'error'
|
|
1360
|
+
},
|
|
1361
|
+
className: className
|
|
1362
|
+
})), error && errorMessage && React__default.createElement(ValidationMessage, null, React__default.createElement(icons.Exclamation, {
|
|
887
1363
|
size: 16
|
|
888
1364
|
}), errorMessage));
|
|
889
1365
|
};
|
|
890
1366
|
|
|
1367
|
+
var _excluded$w = ["children"];
|
|
891
1368
|
var Container = function Container(_ref) {
|
|
892
1369
|
var children = _ref.children,
|
|
893
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
1370
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$w);
|
|
894
1371
|
|
|
895
1372
|
return React__default.createElement(Box, Object.assign({}, props, {
|
|
896
1373
|
width: "100%"
|
|
897
1374
|
}), children);
|
|
898
1375
|
};
|
|
899
1376
|
|
|
1377
|
+
Object.defineProperty(exports, 'ThemeProvider', {
|
|
1378
|
+
enumerable: true,
|
|
1379
|
+
get: function () {
|
|
1380
|
+
return system.ThemeProvider;
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
Object.defineProperty(exports, 'useTheme', {
|
|
1384
|
+
enumerable: true,
|
|
1385
|
+
get: function () {
|
|
1386
|
+
return system.useTheme;
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
Object.defineProperty(exports, 'SSRProvider', {
|
|
1390
|
+
enumerable: true,
|
|
1391
|
+
get: function () {
|
|
1392
|
+
return ssr.SSRProvider;
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
Object.defineProperty(exports, 'Item', {
|
|
1396
|
+
enumerable: true,
|
|
1397
|
+
get: function () {
|
|
1398
|
+
return collections.Item;
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
Object.defineProperty(exports, 'Section', {
|
|
1402
|
+
enumerable: true,
|
|
1403
|
+
get: function () {
|
|
1404
|
+
return collections.Section;
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
exports.ActionGroup = ActionGroup;
|
|
900
1408
|
exports.Alert = Alert;
|
|
901
1409
|
exports.Badge = Badge;
|
|
902
1410
|
exports.Box = Box;
|
|
903
1411
|
exports.Button = Button;
|
|
1412
|
+
exports.Card = Card;
|
|
904
1413
|
exports.Checkbox = Checkbox;
|
|
905
1414
|
exports.Column = Column;
|
|
906
1415
|
exports.Columns = Columns;
|
|
@@ -914,6 +1423,7 @@ exports.Image = Image;
|
|
|
914
1423
|
exports.Input = Input;
|
|
915
1424
|
exports.Label = Label;
|
|
916
1425
|
exports.Link = Link;
|
|
1426
|
+
exports.MarigoldProvider = MarigoldProvider;
|
|
917
1427
|
exports.Menu = Menu;
|
|
918
1428
|
exports.MenuItem = MenuItem;
|
|
919
1429
|
exports.Message = Message;
|
|
@@ -924,4 +1434,5 @@ exports.Stack = Stack;
|
|
|
924
1434
|
exports.Text = Text;
|
|
925
1435
|
exports.Textarea = Textarea;
|
|
926
1436
|
exports.ValidationMessage = ValidationMessage;
|
|
1437
|
+
exports.useDialogButtonProps = useDialogButtonProps;
|
|
927
1438
|
//# sourceMappingURL=components.cjs.development.js.map
|