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